]> git.ipfire.org Git - people/stevee/ipfire-3.x.git/blame - glibc/glibc.nm
glibc: Fix runtime linker path chaos
[people/stevee/ipfire-3.x.git] / glibc / glibc.nm
CommitLineData
166a6c21 1###############################################################################
802ea3af
MT
2# IPFire.org - An Open Source Firewall Solution #
3# Copyright (C) - IPFire Development Team <info@ipfire.org> #
166a6c21
MT
4###############################################################################
5
802ea3af 6name = glibc
21c695c7 7version = 2.37
c2ee3456 8release = 6
802ea3af
MT
9
10maintainer = Michael Tremer <michael.tremer@ipfire.org>
11groups = System/Base
c8f56dcc 12url = http://www.gnu.org/software/libc/libc.html
802ea3af
MT
13license = GPLv2+ LGPLv2+
14summary = The GNU libc libraries.
15
16description
17 The glibc package contains standard libraries which are used by
18 multiple programs on the system. In order to save disk space and
19 memory, as well as to make upgrading easier, common system code is
20 kept in one place and shared between programs. This particular package
21 contains the most important sets of shared libraries: the standard C
22 library and the standard math library. Without these two libraries, a
166a6c21 23 Linux system will not function.
802ea3af
MT
24end
25
8c00dee0 26source_dl = https://ftp.gnu.org/gnu/glibc/
3994dee1 27sources = %{thisapp}.tar.xz
802ea3af
MT
28
29build
bf86a0e1
MT
30 # Build in a separate directory
31 DIR_BUILD = %{DIR_SRC}/glibc-build
32
16cbb54b 33 # Optimize glibc for kernel
0d7e30ee 34 OPTIMIZED_KERNEL = 5.10
16cbb54b 35
802ea3af 36 requires
7f98fc96
MT
37 autoconf
38 automake
6cb5e9ba 39 binutils >= 2.35
24e9b8ad 40 bison
6cb5e9ba 41 gcc >= 11
eec2ad4c 42 gettext
3994dee1 43 kernel-headers >= %{OPTIMIZED_KERNEL}
802ea3af 44 libcap-devel
ee62c3f9 45 libstdc++-static
8c00dee0 46 make >= 4.0
7ed3355c 47 patchelf
8c00dee0 48 python3 >= 3.4
7f98fc96 49 texinfo
802ea3af
MT
50 end
51
bf86a0e1
MT
52 # Disable LTO
53 LTO_CFLAGS =
802ea3af 54
c2ee3456
MT
55 # Path to put the runtime linker
56 rtlddir = %{libdir}
57
e4c5e530
MT
58 configure_options = \
59 --build=%{DISTRO_BUILDTARGET} \
e4c5e530 60 --prefix=/usr \
bf86a0e1 61 --libdir=%{libdir} \
706fb4da 62 --libexecdir=%{libdir}/glibc \
bf86a0e1
MT
63 --sbindir=%{sbindir} \
64 --enable-multi-arch \
e4c5e530 65 --enable-kernel=%{OPTIMIZED_KERNEL} \
bf86a0e1 66 --enable-add-ons \
e4c5e530 67 --disable-werror \
bf86a0e1 68 --disable-profile \
8feada5b 69 --disable-crypt \
bf86a0e1 70 --enable-stack-protector=all \
eec2ad4c 71 --enable-bind-now \
6cb5e9ba 72 --with-bugurl=https://bugtracker.ipfire.org \
2784768a
MT
73 --disable-build-nscd \
74 --disable-nscd
e4c5e530 75
bf86a0e1
MT
76 if "%{DISTRO_ARCH}" == "aarch64"
77 configure_options += \
78 --enable-memory-tagging
c2ee3456
MT
79
80 # The runtime linker on aarch64 for whatever braindead reason is in /usr/lib
81 rtlddir = %{prefix}/lib
82
83 # Runtime Linker
84 rtld = /lib/ld-linux-aarch64.so.1
bf86a0e1 85 end
70b63715 86
bf86a0e1
MT
87 if "%{DISTRO_ARCH}" == "x86_64"
88 configure_options += \
89 --enable-cet
c2ee3456
MT
90
91 # Runtime Linker
92 rtld = /lib64/ld-linux-x86-64.so.2
802ea3af
MT
93 end
94
802ea3af 95 install
bf86a0e1
MT
96 # Install everything
97 make install install_root=%{BUILDROOT} \
c2ee3456 98 rtlddir=%{rtlddir} rootsbindir=%{sbindir} slibdir=%{libdir}
802ea3af
MT
99
100 # Locales
101 mkdir -pv %{BUILDROOT}/usr/lib/locale
102 # This would install all locales that are supported
103 make localedata/install-locales install_root=%{BUILDROOT}
104
bf86a0e1
MT
105 # Install runtime linker configuration
106 install -v -m 644 %{DIR_SOURCE}/ld.so.conf %{BUILDROOT}%{sysconfdir}
107 mkdir -pv %{BUILDROOT}%{sysconfdir}/ld.so.conf.d
802ea3af
MT
108
109 # Don't distribute linker cache
bf86a0e1
MT
110 rm -vf %{BUILDROOT}%{sysconfdir}/ld.so.cache
111
112 # Install nsswitch.conf
113 install -v -m 644 %{DIR_SOURCE}/nsswitch.conf %{BUILDROOT}%{sysconfdir}
114
115 # Remove unused statically linked binaries
116 rm -vf %{BUILDROOT}%{sbindir}/sln
802ea3af
MT
117
118 # Include /usr/lib/gconv/gconv-modules.cache
706fb4da
MT
119 > %{BUILDROOT}%{libdir}/gconv/gconv-modules.cache
120 chmod 644 %{BUILDROOT}%{libdir}/gconv/gconv-modules.cache
802ea3af 121
bf86a0e1
MT
122 # Strip any object files
123 strip --strip-debug %{BUILDROOT}%{libdir}/*.o
7ed3355c
SS
124
125 # Some gconv libraries requires other libraries and contain $ORIGIN
126 # as RUNPATH because they are all located in the same directory.
127 # We do not support $ORIGIN as RUNPATH so change this to the directory
128 # where the modules are located.
129 find %{BUILDROOT}%{libdir}/gconv -type f -name "*.so" -exec sh -c '
130 for file do
131 # Obtain the RUNPATH of the module in case it has one set.
132 runpath=$(patchelf --print-rpath ${file} | tr -d '\n')
133
134 # Check if the RUNPATH is $ORIGIN
135 if [ "${runpath}" == "\$ORIGIN" ]; then
136 # Use patchelf to change the RUNPATH
137 patchelf --set-rpath %{libdir}/gconv ${file}
138 fi
139 done ' sh {} +
8a3a777f 140 end
802ea3af
MT
141end
142
143packages
144 package glibc
c2ee3456
MT
145 # Export the path to the runtime linker which is actually
146 # installed into /usr, but is being searched for elsewhere
147 provides += %{rtld}
bf86a0e1 148
1262a291 149 requires
1262a291
MT
150 tzdata
151 end
b0f38bbb 152
9ec02175
MT
153 conflicts
154 kernel < %{OPTIMIZED_KERNEL}
155 end
156
157 obsoletes
158 glibc-common < %{thisver}
802ea3af
MT
159 end
160 end
161
162 package glibc-devel
9ec02175 163 template DEVEL
802ea3af 164
1262a291
MT
165 requires
166 glibc = %{thisver}
167 glibc-headers = %{thisver}
9ec02175 168 kernel-headers >= %{OPTIMIZED_KERNEL}
1262a291 169 end
802ea3af 170
9ec02175
MT
171 provides
172 glibc-headers = %{thisver}
802ea3af
MT
173 end
174
9ec02175
MT
175 obsoletes
176 glibc-headers < %{thisver}
1262a291 177 end
802ea3af 178
9ec02175 179 files += %{libdir}/*.[ao]
802ea3af
MT
180 end
181
802ea3af 182 package %{name}-utils
bf86a0e1 183 summary = Development utilities from GNU C library
802ea3af
MT
184 description
185 The glibc-utils package contains memusage, a memory usage profiler,
186 mtrace, a memory leak tracer and xtrace, a function call tracer
187 which can be helpful during program debugging.
188 end
802ea3af
MT
189
190 files
bf86a0e1
MT
191 %{bindir}/memusage
192 %{bindir}/memusagestat
193 %{bindir}/mtrace
194 %{bindir}/pcprofiledump
195 %{bindir}/xtrace
706fb4da
MT
196 %{libdir}/libmemusage.so
197 %{libdir}/libpcprofile.so
802ea3af
MT
198 end
199 end
1f9bc2f0
MT
200
201 package %{name}-debuginfo
202 template DEBUGINFO
203 end
802ea3af 204end