Contents of /trunk/core/glibc/glibc-2.30-r1.smage2
Parent Directory | Revision Log
Revision 32916 -
(show annotations)
(download)
Fri Oct 4 07:35:35 2019 UTC (4 years, 11 months ago) by niro
File size: 13485 byte(s)
Fri Oct 4 07:35:35 2019 UTC (4 years, 11 months ago) by niro
File size: 13485 byte(s)
-added glibc-2.30
1 | # $Id$ |
2 | |
3 | PNAME="glibc" |
4 | PVER="2.30" |
5 | PBUILD="r1" |
6 | |
7 | PCAT="sys-libs" |
8 | |
9 | DESCRIPTION="GNU libc6 (also called glibc2) C library with NPTL Threads." |
10 | HOMEPAGE="http://www.gnu.org/software/libc/libc.html" |
11 | |
12 | DEPEND=">= sys-apps/base-files-0.7 |
13 | >= sys-libs/tzdata-2019" |
14 | |
15 | # we force headers to one specific version |
16 | SDEPEND="== sys-kernel/linux-libc-headers-5.2.1" |
17 | PROVIDE="virtual/glibc" |
18 | |
19 | # functions to include in the mage file |
20 | SPECIAL_FUNCTIONS="fix_db_files" |
21 | |
22 | SRCFILE="glibc-${PVER}.tar.xz" |
23 | SRCDIR="${BUILDDIR}/glibc-${PVER}" |
24 | |
25 | ENVD_REV="1.2" |
26 | |
27 | sminclude mtools |
28 | |
29 | SRC_URI=( |
30 | ftp://sources.redhat.com/pub/glibc/releases/${SRCFILE} |
31 | ftp://sources.redhat.com/pub/glibc/snapshots/${SRCFILE} |
32 | gnu://${PNAME}/${SRCFILE} |
33 | mirror://${PNAME}/${SRCFILE} |
34 | mirror://${PNAME}/glibc.envd-${ENVD_REV} |
35 | mirror://${PNAME}/locale.gen-header |
36 | mirror://${PNAME}/locale-gen |
37 | mirror://${PNAME}/${PNAME}-2.17-syscalld-infinite-loop.patch |
38 | ) |
39 | |
40 | # sed line: on 2 digits add an zero: 2.7 -> 2.7.0 |
41 | UP2DATE="updatecmd_gnu ${PNAME/-nptl/} | sed 's/^\([0-9]\.[0-9]\$\)/\1.0/'" |
42 | |
43 | # glibc don't like strong CFLAGS |
44 | #export CFLAGS="${CFLAGS//-O?} -O2" |
45 | # glibc -> nptl thread don't like striping |
46 | # keep static libs to honor -static-pie or nptl/pthreads segfault may occur |
47 | msetfeature "!strip static !ccache !distcc" |
48 | |
49 | # hack to fix NPTL issues with xen, only required on 32bit arches |
50 | if [[ ${ARCH} = i*86 ]] |
51 | then |
52 | export CFLAGS="${CFLAGS} -mno-tls-direct-seg-refs" |
53 | fi |
54 | |
55 | ## glibc-2.6.1 and above needs march CFLAGS: -march=${ARCH} -mtune=generic |
56 | ## first filter -mtune and -march from flags |
57 | #for flag in ${CFLAGS} |
58 | #do |
59 | # case ${flag} in |
60 | # -mtune=*) continue ;; |
61 | # -march=*) continue ;; |
62 | # esac |
63 | # newflags="${newflags} ${flag}" |
64 | #done |
65 | #export CFLAGS="${newflags}" |
66 | # |
67 | ## than add our defaults for glibc |
68 | #[[ ${ARCH} = i*86 ]] && export CFLAGS="${CFLAGS} -march=${ARCH}" # only i*86 |
69 | #export CFLAGS="${CFLAGS} -mtune=generic" # all arches |
70 | #export CXXFLAGS="${CFLAGS}" |
71 | |
72 | # use other linux-headers |
73 | [[ -z ${ALT_HEADERS} ]] && export ALT_HEADERS="/usr/include" |
74 | |
75 | # kernel support |
76 | export ENABLE_KERNEL=3.2.0 |
77 | |
78 | #unset CPPFLAGS LDFLAGS |
79 | |
80 | src_prepare() |
81 | { |
82 | munpack ${SRCFILE} || die |
83 | cd ${SRCDIR} |
84 | |
85 | # fix a test case that fails when built using gcc-5.x |
86 | sed -i '/tst-audit2-ENV/i CFLAGS-tst-audit2.c += -fno-builtin' elf/Makefile || die |
87 | |
88 | # fixes an infinite loop while syscall.d creation |
89 | # see: http://sourceware.org/bugzilla/show_bug.cgi?id=15711 |
90 | mpatch ${PNAME}-2.17-syscalld-infinite-loop.patch || die |
91 | # use 1.0 second instead of 0.5 (required by arch i686 builds on 64bit machines) |
92 | sed -i 's:0.5 seconds ago:1.0 seconds ago:' ${SRCDIR}/Makerules || die |
93 | |
94 | # scripts/test-installation.pl sometime fails |
95 | # |
96 | # CC="gcc" /usr/bin/perl scripts/test-installation.pl |
97 | # /usr/src/glibc-2.16.0.bld/ |
98 | # Unmatched ( in regex; marked by <-- HERE in m/$( <-- HERE if $(abi-32-ld-soname),$(abi-32-ld-soname),ld/ at scripts/test-installation.pl line 172, <LDD> |
99 | # line 1 |
100 | sed -i 's:CC="$(CC)" $(PERL) scripts/test-installation.pl $(common-objpfx)::' Makefile || die |
101 | |
102 | # binutils patch needs reconf |
103 | # autoconf --force || die |
104 | |
105 | # fix permissions on some of the scripts |
106 | chmod u+x ${SRCDIR}/scripts/*.sh || die |
107 | |
108 | install -d ${SRCDIR}/build || die |
109 | cd ${SRCDIR}/build |
110 | |
111 | if [ ! -f /etc/ld.so.conf ] |
112 | then |
113 | touch /etc/ld.so.conf || die |
114 | fi |
115 | } |
116 | |
117 | src_compile() |
118 | { |
119 | local myopts |
120 | |
121 | # generic pathes |
122 | myopts="--prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info" |
123 | myopts+=" --with-headers=/usr/include" |
124 | # bugurl |
125 | myopts+=" --with-bugurl=http://bugs.magellan-linux.de/" |
126 | # disable profiling |
127 | myopts+=" --disable-profile" |
128 | # enable addons |
129 | myopts+=" --enable-add-ons" |
130 | # supported kernel-release |
131 | myopts+=" --enable-kernel=${ENABLE_KERNEL}" |
132 | # disable cvs and gd support |
133 | myopts+=" --without-cvs --without-gd" |
134 | # enable bindnow |
135 | myopts+=" --enable-bind-now" |
136 | # enable lock elision |
137 | # myopts+=" --enable-lock-elision" |
138 | myopts+=" --disable-lock-elision" |
139 | # disable -werror |
140 | myopts+=" --disable-werror" |
141 | # enable multi-arch |
142 | myopts+=" --enable-multi-arch" |
143 | # enable stackguard randomization |
144 | myopts+=" --enable-stackguard-randomization" |
145 | # enable stack protector |
146 | myopts+=" --enable-stack-protector=strong" |
147 | # enable static pie |
148 | myopts+=" --enable-static-pie" |
149 | # enable intel cet + branch tracking (IBT) and shadow stack (SHSTK) |
150 | myopts+=" --enable-cet" |
151 | |
152 | # fortify_source not supported |
153 | export CPPFLAGS=${CPPFLAGS/-D_FORTIFY_SOURCE=2/} |
154 | |
155 | # support multilib lib64 dir (x86_64 only) |
156 | if [[ ${ARCH} = x86_64 ]] |
157 | then |
158 | # first build a -m32 version |
159 | install -d ${SRCDIR}/build-m32 |
160 | cd ${SRCDIR}/build-m32 |
161 | |
162 | # honor /usr move |
163 | echo "rootsbindir=/usr/sbin" >> ${SRCDIR}/build-m32/configparms || die |
164 | # make sure the -m32 libs goes really to /usr/lib |
165 | echo "slibdir=/usr/lib" >> ${SRCDIR}/build-m32/configparms || die |
166 | echo "rtlddir=/usr/lib" >> ${SRCDIR}/build-m32/configparms || die |
167 | |
168 | CC="gcc -m32" CXX="g++ -m32" \ |
169 | CFLAGS="${CFLAGS//-march=${ARCH}} -march=i686" \ |
170 | CXXFLAGS="${CXXFLAGS//-march=${ARCH}} -march=i686" \ |
171 | ../configure \ |
172 | --build=${CHOST} \ |
173 | --host=i686-pc-linux-gnu \ |
174 | --libdir=/usr/lib \ |
175 | --libexecdir=/usr/lib/glibc \ |
176 | ${myopts} \ |
177 | || die |
178 | |
179 | make PARALLELMFLAGS="${MAKEOPTS}" || die |
180 | fi |
181 | |
182 | cd ${SRCDIR}/build |
183 | |
184 | # honor /usr move |
185 | echo "rootsbindir=/usr/sbin" >> ${SRCDIR}/build/configparms || die |
186 | # make sure the -m64 libs goes really to /lib64 |
187 | echo "slibdir=/usr/$(mlibdir)" >> ${SRCDIR}/build/configparms || die |
188 | echo "rtlddir=/usr/$(mlibdir)" >> ${SRCDIR}/build/configparms || die |
189 | |
190 | ../configure \ |
191 | --build=${CHOST} \ |
192 | --host=${CHOST} \ |
193 | --libdir=/usr/$(mlibdir) \ |
194 | --libexecdir=/usr/$(mlibdir)/glibc \ |
195 | ${myopts} \ |
196 | || die |
197 | |
198 | make PARALLELMFLAGS="${MAKEOPTS}" || die |
199 | } |
200 | |
201 | src_install() |
202 | { |
203 | if [[ ${ARCH} = x86_64 ]] |
204 | then |
205 | # install -m32 libs |
206 | cd ${SRCDIR}/build-m32 |
207 | make PARALLELMFLAGS="${MAKEOPTS}" install_root=${BINDIR} install || die |
208 | fi |
209 | |
210 | cd ${SRCDIR}/build |
211 | make PARALLELMFLAGS="${MAKEOPTS}" install_root=${BINDIR} install || die |
212 | |
213 | # do not generate the locales here, let it the user do with the locale-gen tool |
214 | # make PARALLELMFLAGS="${MAKEOPTS}" install_root=${BINDIR} localedata/install-locales || die |
215 | |
216 | # install locales list and generate tools |
217 | # generate locale.gen file from localedata/SUPPORTED file |
218 | minstalletc locale.gen-header locale.gen || die |
219 | sed \ |
220 | -e 's:/: :g' \ |
221 | -e 's:\\: :g' \ |
222 | -e 's:SUPPORTED-LOCALES=::' \ |
223 | -e 's:\ \ $::g' \ |
224 | -e '/^#/d' \ |
225 | -e 's:^:#:g' \ |
226 | ${SRCDIR}/localedata/SUPPORTED \ |
227 | >> ${BINDIR}/etc/locale.gen || die |
228 | minstalldir /usr/sbin || die |
229 | minstallexec -s locale-gen /usr/sbin || die |
230 | |
231 | # nsswitch configuration file |
232 | minstalletc ${SRCDIR}/nss/nsswitch.conf || die |
233 | |
234 | # nscd configuration file |
235 | minstalletc ${SRCDIR}/nscd/nscd.conf || die |
236 | # systemd services, but do not include systemd.sminc to have a hard depend on systemd |
237 | minstalldir /usr/lib/systemd/system || die |
238 | minstallfile ${SRCDIR}/nscd/nscd.service /usr/lib/systemd/system || die |
239 | minstalldir /etc/tmpfiles.d || die |
240 | minstallfile ${SRCDIR}/nscd/nscd.tmpfiles /etc/tmpfiles.d/nscd.conf || die |
241 | |
242 | # gai configuration file |
243 | minstalletc ${SRCDIR}/posix/gai.conf || die |
244 | |
245 | # now in tzdata |
246 | ## we use Berlin as default |
247 | ## busybox compat |
248 | #local args |
249 | #if need_busybox_support /bin/cp |
250 | #then |
251 | # args="-f" |
252 | #else |
253 | # args="--remove-destination" |
254 | #fi |
255 | #cp ${args} ${BINDIR}/usr/share/zoneinfo/Europe/Berlin ${BINDIR}/etc/localtime || die |
256 | [ -f ${BINDIR}/etc/ld.so.conf ] && { rm -f ${BINDIR}/etc/ld.so.conf || die; } |
257 | [ -e ${BINDIR}/etc/ld.so.cache ] && { rm -rf ${BINDIR}/etc/ld.so.cache || die; } |
258 | |
259 | # base environment |
260 | minstallenv glibc.envd-${ENVD_REV} 00glibc || die |
261 | if [[ ${ARCH} = x86_64 ]] |
262 | then |
263 | MCONFIG="/etc/env.d/00glibc" |
264 | maddconfig "LDPATH=\"/$(mlibdir)\"" || die |
265 | maddconfig "LDPATH=\"/usr/$(mlibdir)\"" || die |
266 | maddconfig "LDPATH=\"/usr/local/$(mlibdir)\"" || die |
267 | maddconfig "LDPATH=\"/opt/$(mlibdir)\"" || die |
268 | fi |
269 | |
270 | # strip all binaries |
271 | find ${BINDIR} ! -type d | xargs --no-run-if-empty file | grep -v "pie executable" | grep "executable" | grep ELF | cut -f 1 -d : | xargs --no-run-if-empty strip --strip-unneeded || die |
272 | |
273 | # strip all libraries |
274 | # want to be safe here; --strip-unneeded seems to cause pthread problems |
275 | # strip all but libpthread, libc and ld |
276 | install -d ${BUILDDIR}/thread-backup/$(mlibdir) || die |
277 | mv ${BINDIR}/usr/$(mlibdir)/lib{pthread,thread_db,c-}* ${BUILDDIR}/thread-backup/$(mlibdir)/ || die |
278 | mv ${BINDIR}/usr/$(mlibdir)/ld-* ${BUILDDIR}/thread-backup/$(mlibdir)/ || die |
279 | if [[ ${ARCH} = x86_64 ]] |
280 | then |
281 | install -d ${BUILDDIR}/thread-backup/lib || die |
282 | mv ${BINDIR}/usr/lib/lib{pthread,thread_db,c-}* ${BUILDDIR}/thread-backup/lib/ || die |
283 | mv ${BINDIR}/usr/lib/ld-* ${BUILDDIR}/thread-backup/lib/ || die |
284 | fi |
285 | |
286 | # now strip but only debuging symbols |
287 | find ${BINDIR} ! -type d | xargs --no-run-if-empty file | grep "[shared object|pie executable]" | grep ELF | cut -f 1 -d : | xargs --no-run-if-empty strip --strip-debug || die |
288 | find ${BINDIR} ! -type d | xargs --no-run-if-empty file | grep "ar archive" | cut -f 1 -d : | xargs --no-run-if-empty strip --strip-debug || die |
289 | mv -f ${BUILDDIR}/thread-backup/$(mlibdir)/* ${BINDIR}/usr/$(mlibdir)/ || die |
290 | if [[ ${ARCH} = x86_64 ]] |
291 | then |
292 | mv -f ${BUILDDIR}/thread-backup/lib/* ${BINDIR}/usr/lib/ || die |
293 | fi |
294 | # remove stale directory |
295 | rm -rf ${BUILDDIR}/thread-backup || die |
296 | |
297 | # prepare glibc for installation; slackware method |
298 | minstalldir /incoming || die |
299 | mv ${BINDIR}/usr/$(mlibdir)/*.so ${BINDIR}/incoming || die |
300 | mv ${BINDIR}/usr/$(mlibdir)/*.so.* ${BINDIR}/incoming || die |
301 | mv ${BINDIR}/incoming ${BINDIR}/usr/$(mlibdir)/incoming || die |
302 | mv ${BINDIR}/usr/$(mlibdir)/incoming/libSegFault.so ${BINDIR}/usr/$(mlibdir) || die |
303 | } |
304 | |
305 | fix_db_files() |
306 | { |
307 | local i |
308 | local DB_ENTRY="${BUILDDIR}/${PKGNAME}" |
309 | |
310 | for i in .files .symlinks .dirs |
311 | do |
312 | [ ! -f ${DB_ENTRY}/${i} ] && continue |
313 | [[ -z $(< ${DB_ENTRY}/${i}) ]] && continue |
314 | |
315 | echo " fixing /usr/$(mlibdir)/incoming from db-entry '${i}' ..." |
316 | |
317 | # /usr/lib/incoming -> empty line; sed2 removes all empty lines |
318 | #sed -i -e "s:/$(mlibdir)/incoming.*::g" -e '/^$/d' ${DB_ENTRY}/${i} |
319 | # do not simply emtpy the line, but change it the the correct path, |
320 | # so no stale libs are around if the package gets updated! |
321 | sed -i \ |
322 | -e "s:/usr/$(mlibdir)/incoming:/usr/$(mlibdir):g" \ |
323 | -e "s:/usr/$(mlibdir)/incoming.*::g" \ |
324 | -e '/^$/d' ${DB_ENTRY}/${i} |
325 | done |
326 | } |
327 | |
328 | postinstall() |
329 | { |
330 | # first save the old libpthread.so.0; |
331 | # it will later used to determinate that there are no stale |
332 | # libpthreads that breaks ldconfig |
333 | local OLD_PTHREAD |
334 | OLD_PTHREAD="$(readlink ${MROOT}/usr/$(mlibdir)/libpthread.so.0)" |
335 | |
336 | # slackware install method |
337 | |
338 | # we cannot easily install the glibc libs, |
339 | # because our tools for cp etc needs them to run |
340 | |
341 | local file |
342 | |
343 | echo " Switching to new glibc ..." |
344 | # swap libraries on the fly: |
345 | if [ -x /usr/sbin/ldconfig -a -d /usr/$(mlibdir)/incoming ] && [[ -z ${MROOT} ]] |
346 | then |
347 | # first create copies of the incoming libraries: |
348 | cd /usr/$(mlibdir)/incoming |
349 | for file in $(find /usr/$(mlibdir)/incoming -type f) |
350 | do |
351 | if [ ! -r "../$(basename ${file}).incoming" ] |
352 | then |
353 | cp -a ${file} ../$(basename ${file}).incoming |
354 | fi |
355 | done |
356 | |
357 | # then switch to them all at once: |
358 | /usr/sbin/ldconfig -l /usr/$(mlibdir)/*.incoming 2> /dev/null |
359 | |
360 | # finally, rename them and clean up: |
361 | cd /usr/$(mlibdir) |
362 | for file in *.incoming |
363 | do |
364 | rm -f $(basename ${file} .incoming) |
365 | cp -a ${file} $(basename ${file} .incoming) |
366 | /usr/sbin/ldconfig -l $(basename ${file} .incoming) |
367 | rm -f ${file} |
368 | done |
369 | |
370 | # no ldconfig? |
371 | # good, it's safe to just jam it on home (and make links below): |
372 | else |
373 | ( |
374 | cd ${MROOT}/usr/$(mlibdir)/incoming |
375 | for file in * |
376 | do |
377 | cp -a ${file} .. |
378 | done |
379 | |
380 | local my_sym |
381 | local my_dest |
382 | |
383 | # rebuild symlinks |
384 | echo " Recreating Symlinks:" |
385 | for i in $(find ${MROOT}/usr/$(mlibdir)/incoming -type l) |
386 | do |
387 | my_sym="$(readlink ${i})" |
388 | my_dest="$(basename ${i})" |
389 | |
390 | echo " ${my_dest} -> ${my_dest}" |
391 | |
392 | # assure to remove the old ones; |
393 | [ -L ${MROOT}/usr/$(mlibdir)/"${my_dest}" ] && \ |
394 | rm ${MROOT}/usr/$(mlibdir)/"${my_dest}" |
395 | |
396 | ln -snf "${my_sym}" ${MROOT}/usr/$(mlibdir)/"${my_dest}" |
397 | done |
398 | ) |
399 | fi |
400 | |
401 | # now, get rid of the temporary directory: |
402 | rm -rf ${MROOT}/usr/$(mlibdir)/incoming |
403 | |
404 | # remove stale nptl libpthread-2.?.?.so, |
405 | # fix only needed for glibc with linuxthreads; |
406 | # prevent reloc errors such as: |
407 | # ls: error while loading shared libraries: libpthread.so.0: cannot open shared object file: No such file or directory |
408 | |
409 | # get our new libpthread.so.0 |
410 | local NEW_PTHREAD |
411 | NEW_PTHREAD="$(readlink ${MROOT}/usr/$(mlibdir)/libpthread.so.0)" |
412 | |
413 | if [ "${NEW_PTHREAD}" != "${OLD_PTHREAD}" ] |
414 | then |
415 | echo " Removing stale libpthread libraries ..." |
416 | for file in ${MROOT}/usr/$(mlibdir)/libpthread-* |
417 | do |
418 | if [ "$(basename ${file})" != "${NEW_PTHREAD}" ] |
419 | then |
420 | rm -f ${file} |
421 | fi |
422 | done |
423 | |
424 | #rm -f /lib/${OLD_PTHREAD} |
425 | |
426 | ln -snf ${NEW_PTHREAD} ${MROOT}/usr/$(mlibdir)/libpthread.so.0 |
427 | fi |
428 | |
429 | if [ -x /usr/sbin/iconvconfig ] |
430 | then |
431 | # generate fastloading iconv module configuration file. |
432 | echo " Generate iconv module config ..." |
433 | /usr/sbin/iconvconfig --prefix=${MROOT}/ |
434 | fi |
435 | |
436 | # not working with busybox |
437 | if ! need_busybox_support /sbin/telinit |
438 | then |
439 | # reloading init |
440 | echo " Reloading init ..." |
441 | [[ -z ${MROOT} ]] && /sbin/telinit U &> /dev/null |
442 | fi |
443 | |
444 | # generating user def locales |
445 | echo " Generating user defined locales ..." |
446 | [[ -z ${MROOT} ]] && /usr/sbin/locale-gen |
447 | |
448 | # now we must fix the mage db files |
449 | # to stop the annoying errors messages |
450 | fix_db_files |
451 | } |