Magellan Linux

Contents of /smage/trunk/core/glibc/glibc-2.36-r2.smage2

Parent Directory Parent Directory | Revision Log Revision Log


Revision 15657 - (show annotations) (download)
Tue Dec 20 16:05:49 2022 UTC (16 months, 1 week ago) by niro
File size: 20058 byte(s)
auto added: ver bump to 2.36-r2
1 # $Id$
2
3 PNAME="glibc"
4 PVER="2.36"
5 PBUILD="r2"
6
7 SPLIT_PACKAGES="glibc glibc-dev glibc-locale-de glibc-locale-us"
8
9 PCAT="sys-libs"
10 HOMEPAGE="http://www.gnu.org/software/libc/libc.html"
11
12 GLIBC_DEPEND=">= sys-apps/base-files-0.7
13 >= sys-libs/tzdata-2022"
14
15 # we force headers to one specific version
16 SDEPEND="== sys-kernel/linux-libc-headers-5.15.83
17 >= dev-lang/python3-3
18 ${GLIBC_DEPEND}"
19
20 # functions to include in the mage file
21 SPECIAL_FUNCTIONS="fix_db_files"
22
23 SRCFILE="glibc-${PVER}.tar.xz"
24 SRCDIR="${BUILDDIR}/glibc-${PVER}"
25
26 ENVD_REV="1.2"
27
28 sminclude mtools cleanutils alx
29
30 SRC_URI=(
31 #ftp://sources.redhat.com/pub/glibc/releases/${SRCFILE}
32 #ftp://sources.redhat.com/pub/glibc/snapshots/${SRCFILE}
33 gnu://${PNAME}/${SRCFILE}
34 mirror://${PNAME}/${SRCFILE}
35 mirror://${PNAME}/glibc.envd-${ENVD_REV}
36 mirror://${PNAME}/locale.gen-header
37 mirror://${PNAME}/locale-gen
38 # mirror://${PNAME}/${PNAME}-2.17-syscalld-infinite-loop.patch
39 )
40
41 # sed line: on 2 digits add an zero: 2.7 -> 2.7.0
42 UP2DATE="updatecmd_gnu ${PNAME/-nptl/} | sed 's/^\([0-9]\.[0-9]\$\)/\1.0/'"
43
44 # glibc don't like strong CFLAGS
45 #export CFLAGS="${CFLAGS//-O?} -O2"
46 # glibc -> nptl thread don't like striping
47 msetfeature "!strip static"
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
77
78 split_info_glibc()
79 {
80 DESCRIPTION="GNU libc6 (also called glibc2) C library with NPTL Threads."
81 DEPEND="${GLIBC_DEPEND}"
82 PROVIDE="virtual/glibc"
83 }
84
85 split_info_glibc-dev()
86 {
87 DESCRIPTION="Development files for sys-libs/glibc-${PVER}."
88 DEPEND="== sys-libs/glibc-${PVER}"
89 PROVIDE="virtual/glibc-dev"
90 }
91
92 split_info_glibc-locale-de()
93 {
94 DESCRIPTION="Provide german locales for sys-libs/glibc-${PVER}."
95 DEPEND="== sys-libs/glibc-${PVER}"
96 }
97
98 split_info_glibc-locale-us()
99 {
100 DESCRIPTION="Provide english US locales for sys-libs/glibc-${PVER}."
101 DEPEND="== sys-libs/glibc-${PVER}"
102 }
103
104 src_prepare()
105 {
106 munpack ${SRCFILE} || die
107 cd ${SRCDIR}
108
109 # fix a test case that fails when built using gcc-5.x
110 #sed -i '/tst-audit2-ENV/i CFLAGS-tst-audit2.c += -fno-builtin' elf/Makefile || die
111
112 # fixes an infinite loop while syscall.d creation
113 # see: http://sourceware.org/bugzilla/show_bug.cgi?id=15711
114 # mpatch ${PNAME}-2.17-syscalld-infinite-loop.patch || die
115 # use 1.0 second instead of 0.5 (required by arch i686 builds on 64bit machines)
116 # sed -i 's:0.5 seconds ago:1.0 seconds ago:' ${SRCDIR}/Makerules || die
117
118 # scripts/test-installation.pl sometime fails
119 #
120 # CC="gcc" /usr/bin/perl scripts/test-installation.pl
121 # /usr/src/glibc-2.16.0.bld/
122 # 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>
123 # line 1
124 #sed -i 's:CC="$(CC)" $(PERL) scripts/test-installation.pl $(common-objpfx)::' Makefile || die
125
126 # binutils patch needs reconf
127 # autoconf --force || die
128
129 # fix permissions on some of the scripts
130 # chmod u+x ${SRCDIR}/scripts/*.sh || die
131
132 install -d ${SRCDIR}/build || die
133 cd ${SRCDIR}/build
134
135 if [ ! -f /etc/ld.so.conf ]
136 then
137 touch /etc/ld.so.conf || die
138 fi
139 }
140
141 src_compile()
142 {
143 local myopts
144
145 # generic pathes
146 myopts="--prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info"
147 myopts+=" --with-headers=/usr/include"
148 # bugurl
149 myopts+=" --with-bugurl=http://bugs.magellan-linux.de/"
150 # disable profiling
151 myopts+=" --disable-profile"
152 # # enable addons
153 # myopts+=" --enable-add-ons"
154 # supported kernel-release
155 myopts+=" --enable-kernel=${ENABLE_KERNEL}"
156 # # disable cvs and gd support
157 # myopts+=" --without-cvs --without-gd"
158 # disable gd support
159 myopts+=" --without-gd"
160 # enable bindnow
161 myopts+=" --enable-bind-now"
162 # # enable obsolete rpc implementation
163 # myopts+=" --enable-obsolete-rpc"
164 # # enable obsolete nsl implementation
165 # myopts+=" --enable-obsolete-nsl"
166 # # enable lock elision
167 # myopts+=" --enable-lock-elision"
168 # disable -werror
169 myopts+=" --disable-werror"
170 # enable multi-arch
171 myopts+=" --enable-multi-arch"
172 # # enable stackguard randomization
173 # myopts+=" --enable-stackguard-randomization"
174 # enable stack protector
175 myopts+=" --enable-stack-protector=strong"
176 # enable static pie
177 myopts+=" --enable-static-pie"
178 # enable intel cet + branch tracking (IBT) and shadow stack (SHSTK)
179 myopts+=" --enable-cet"
180 # # disable crypt, use libxcrypt instead
181 # myopts+=" --disable-crypt"
182
183 # remove fortify for building libraries
184 export CPPFLAGS=${CPPFLAGS/-D_FORTIFY_SOURCE=2/}
185 export CFLAGS=${CFLAGS/-Wp,-D_FORTIFY_SOURCE=2/}
186
187 # support multilib lib64 dir (x86_64 only)
188 if [[ ${ARCH} = x86_64 ]]
189 then
190 # first build a -m32 version
191 install -d ${SRCDIR}/build-m32
192 cd ${SRCDIR}/build-m32
193
194 # honor /usr move
195 echo "rootsbindir=/usr/sbin" >> ${SRCDIR}/build-m32/configparms || die
196 # make sure the -m32 libs goes really to /usr/lib
197 echo "slibdir=/usr/lib" >> ${SRCDIR}/build-m32/configparms || die
198 echo "rtlddir=/usr/lib" >> ${SRCDIR}/build-m32/configparms || die
199
200 CC="gcc -m32" CXX="g++ -m32" \
201 CFLAGS="${CFLAGS//-march=${ARCH}} -march=i686 -mtune=generic" \
202 CXXFLAGS="${CXXFLAGS//-march=${ARCH}} -march=i686 -mtune=generic" \
203 ../configure \
204 --build=${CHOST} \
205 --host=i686-pc-linux-gnu \
206 --libdir=/usr/lib \
207 --libexecdir=/usr/lib/glibc \
208 ${myopts} \
209 || die
210
211 make || die
212 fi
213
214 cd ${SRCDIR}/build
215
216 # honor /usr move
217 echo "rootsbindir=/usr/sbin" >> ${SRCDIR}/build/configparms || die
218 # make sure the -m64 libs goes really to /lib64
219 echo "slibdir=/usr/$(mlibdir)" >> ${SRCDIR}/build/configparms || die
220 echo "rtlddir=/usr/$(mlibdir)" >> ${SRCDIR}/build/configparms || die
221
222 ../configure \
223 --build=${CHOST} \
224 --host=${CHOST} \
225 --libdir=/usr/$(mlibdir) \
226 --libexecdir=/usr/$(mlibdir)/glibc \
227 ${myopts} \
228 || die
229
230 make || die
231 }
232
233 src_install_glibc()
234 {
235 if [[ ${ARCH} = x86_64 ]]
236 then
237 # install -m32 libs
238 cd ${SRCDIR}/build-m32
239 make install_root=${BINDIR} install || die
240 fi
241
242 cd ${SRCDIR}/build
243 make install_root=${BINDIR} install || die
244
245 # cleanup
246 # utf-16 is needed by wfica >= 12.1
247 # utf-32 is needed by wfica >= 13.1
248 zapmost ${BINDIR} usr/$(mlibdir)/\*.so \
249 usr/$(mlibdir)/\*.so.\* \
250 $([[ ${ARCH} = x86_64 ]] && echo 'usr/lib/*.so usr/lib/*.so.*') \
251 usr/sbin/ldconfig \
252 usr/bin/iconv \
253 usr/bin/locale \
254 usr/bin/ldd \
255 usr/bin/getent \
256 usr/$(mlibdir)/gconv/CP1252.so \
257 usr/$(mlibdir)/gconv/IBM850.so \
258 usr/$(mlibdir)/gconv/ISO8859-1.so \
259 usr/$(mlibdir)/gconv/ISO8859-15.so \
260 usr/$(mlibdir)/gconv/UNICODE.so \
261 usr/$(mlibdir)/gconv/UTF-16.so \
262 usr/$(mlibdir)/gconv/UTF-32.so \
263 usr/$(mlibdir)/gconv/gconv-modules \
264 $([[ ${ARCH} = x86_64 ]] && echo 'usr/lib/gconv/CP1252.so') \
265 $([[ ${ARCH} = x86_64 ]] && echo 'usr/lib/gconv/IBM850.so') \
266 $([[ ${ARCH} = x86_64 ]] && echo 'usr/lib/gconv/ISO8859-1.so') \
267 $([[ ${ARCH} = x86_64 ]] && echo 'usr/lib/gconv/ISO8859-15.so') \
268 $([[ ${ARCH} = x86_64 ]] && echo 'usr/lib/gconv/UNICODE.so') \
269 $([[ ${ARCH} = x86_64 ]] && echo 'usr/lib/gconv/UTF-16.so') \
270 $([[ ${ARCH} = x86_64 ]] && echo 'usr/lib/gconv/UTF-32.so') \
271 $([[ ${ARCH} = x86_64 ]] && echo 'usr/lib/gconv/gconv-modules') \
272 || die
273
274 # nsswitch configuration file
275 minstalletc ${SRCDIR}/nss/nsswitch.conf || die
276
277 # base environment
278 minstallenv glibc.envd-${ENVD_REV} 00glibc || die
279 if [[ ${ARCH} = x86_64 ]]
280 then
281 MCONFIG="/etc/env.d/00glibc"
282 maddconfig "LDPATH=\"/$(mlibdir)\"" || die
283 maddconfig "LDPATH=\"/usr/$(mlibdir)\"" || die
284 maddconfig "LDPATH=\"/usr/local/$(mlibdir)\"" || die
285 maddconfig "LDPATH=\"/opt/$(mlibdir)\"" || die
286 fi
287
288 # strip all binaries
289 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
290
291 # strip all libraries
292 # want to be safe here; --strip-unneeded seems to cause pthread problems
293 # strip all but libpthread, libc and ld
294 install -d ${BUILDDIR}/thread-backup/$(mlibdir) || die
295 mv ${BINDIR}/usr/$(mlibdir)/lib{pthread,thread_db,c.}* ${BUILDDIR}/thread-backup/$(mlibdir)/ || die
296 mv ${BINDIR}/usr/$(mlibdir)/ld-* ${BUILDDIR}/thread-backup/$(mlibdir)/ || die
297 if [[ ${ARCH} = x86_64 ]]
298 then
299 install -d ${BUILDDIR}/thread-backup/lib || die
300 mv ${BINDIR}/usr/lib/lib{pthread,thread_db,c.}* ${BUILDDIR}/thread-backup/lib/ || die
301 mv ${BINDIR}/usr/lib/ld-* ${BUILDDIR}/thread-backup/lib/ || die
302 fi
303
304 # now strip but only debuging symbols
305 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
306 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
307 mv -f ${BUILDDIR}/thread-backup/$(mlibdir)/* ${BINDIR}/usr/$(mlibdir)/ || die
308 if [[ ${ARCH} = x86_64 ]]
309 then
310 mv -f ${BUILDDIR}/thread-backup/lib/* ${BINDIR}/usr/lib/ || die
311 fi
312 # remove stale directory
313 rm -rf ${BUILDDIR}/thread-backup || die
314
315 # prepare glibc for installation; slackware method
316 minstalldir /incoming || die
317 mv ${BINDIR}/usr/$(mlibdir)/*.so ${BINDIR}/incoming || die
318 mv ${BINDIR}/usr/$(mlibdir)/*.so.* ${BINDIR}/incoming || die
319 mv ${BINDIR}/incoming ${BINDIR}/usr/$(mlibdir)/incoming || die
320 mv ${BINDIR}/usr/$(mlibdir)/incoming/libmemusage.so ${BINDIR}/usr/$(mlibdir) || die
321
322 # Beginning with glibc-2.34, shared objects are using their ABI sonames
323 # directly, which is frankly, a terrible idea. It might help other package
324 # managers, but doesn't do us any favors where we already had a system for
325 # dealing with upgrades (and downgrades!). We'll change these libraries to
326 # use the versioned naming system of glibc-2.33 and earlier so that we don't
327 # have to handle these files differently and so that it's easy to see what
328 # version of glibc is in use at a glance.
329 pushd ${BINDIR}/usr/$(mlibdir)/incoming
330 local library
331 for library in *.so.*
332 do
333 mv ${library} $(echo ${library} | cut -f 1 -d .)-${PVER}.so || die
334 done
335 # This one is a special case. We don't want an $ARCH embedded in the
336 # filename. It prevents using the same install scripts on all $ARCH
337 # and does no good since we'll never have multiple $ARCH libraries
338 # installed in the same directory anyway. So give it the previous name
339 # format:
340 mv ld-linux*-${PVER}.so ld-${PVER}.so
341 popd
342 }
343
344 src_install_glibc-dev()
345 {
346 if [[ ${ARCH} = x86_64 ]]
347 then
348 # install -m32 libs
349 cd ${SRCDIR}/build-m32
350 make install_root=${BINDIR} install || die
351 fi
352
353 cd ${SRCDIR}/build
354 make install_root=${BINDIR} install || die
355
356 # cleanup -> in glibc
357 rm ${BINDIR}/usr/$(mlibdir)/*.so || die
358 rm ${BINDIR}/usr/$(mlibdir)/*.so.* || die
359 rm ${BINDIR}/usr/$(mlibdir)/gconv/CP1252.so || die
360 rm ${BINDIR}/usr/$(mlibdir)/gconv/IBM850.so || die
361 rm ${BINDIR}/usr/$(mlibdir)/gconv/ISO8859-1.so || die
362 rm ${BINDIR}/usr/$(mlibdir)/gconv/ISO8859-15.so || die
363 rm ${BINDIR}/usr/$(mlibdir)/gconv/UNICODE.so || die
364 rm ${BINDIR}/usr/$(mlibdir)/gconv/UTF-16.so || die
365 rm ${BINDIR}/usr/$(mlibdir)/gconv/gconv-modules || die
366 if [[ ${ARCH} = x86_64 ]]
367 then
368 rm ${BINDIR}/usr/lib/*.so || die
369 rm ${BINDIR}/usr/lib/*.so.* || die
370 rm ${BINDIR}/usr/lib/gconv/CP1252.so || die
371 rm ${BINDIR}/usr/lib/gconv/IBM850.so || die
372 rm ${BINDIR}/usr/lib/gconv/ISO8859-1.so || die
373 rm ${BINDIR}/usr/lib/gconv/ISO8859-15.so || die
374 rm ${BINDIR}/usr/lib/gconv/UNICODE.so || die
375 rm ${BINDIR}/usr/lib/gconv/UTF-16.so || die
376 rm ${BINDIR}/usr/lib/gconv/gconv-modules || die
377 fi
378 rm ${BINDIR}/usr/sbin/ldconfig || die
379 rm ${BINDIR}/usr/bin/iconv || die
380 rm ${BINDIR}/usr/bin/locale || die
381 rm ${BINDIR}/usr/bin/ldd || die
382 rm ${BINDIR}/usr/bin/getent || die
383
384 # do not generate the locales here, let it the user do with the locale-gen tool
385 # make PARALLELMFLAGS="${MAKEOPTS}" install_root=${BINDIR} localedata/install-locales || die
386
387 # install locales list and generate tools
388 # generate locale.gen file from localedata/SUPPORTED file
389 minstalletc locale.gen-header locale.gen || die
390 sed \
391 -e 's:/: :g' \
392 -e 's:\\: :g' \
393 -e 's:SUPPORTED-LOCALES=::' \
394 -e 's:\ \ $::g' \
395 -e '/^#/d' \
396 -e 's:^:#:g' \
397 ${SRCDIR}/localedata/SUPPORTED \
398 >> ${BINDIR}/etc/locale.gen || die
399 minstalldir /usr/sbin || die
400 minstallexec -s locale-gen /usr/sbin || die
401
402 # nscd configuration file
403 minstalletc ${SRCDIR}/nscd/nscd.conf || die
404 # systemd services, but do not include systemd.sminc to have a hard depend on systemd
405 minstalldir /usr/lib/systemd/system || die
406 minstallfile ${SRCDIR}/nscd/nscd.service /usr/lib/systemd/system || die
407 minstalldir /etc/tmpfiles.d || die
408 minstallfile ${SRCDIR}/nscd/nscd.tmpfiles /etc/tmpfiles.d/nscd.conf || die
409
410 # gai configuration file
411 minstalletc ${SRCDIR}/posix/gai.conf || die
412
413 # now in tzdata
414 ## we use Berlin as default
415 ## busybox compat
416 #local args
417 #if need_busybox_support /bin/cp
418 #then
419 # args="-f"
420 #else
421 # args="--remove-destination"
422 #fi
423 #cp ${args} ${BINDIR}/usr/share/zoneinfo/Europe/Berlin ${BINDIR}/etc/localtime || die
424 [ -f ${BINDIR}/etc/ld.so.conf ] && { rm -f ${BINDIR}/etc/ld.so.conf || die; }
425 [ -e ${BINDIR}/etc/ld.so.cache ] && { rm -rf ${BINDIR}/etc/ld.so.cache || die; }
426
427 # strip all binaries
428 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
429
430 # now strip but only debuging symbols
431 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
432 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
433 }
434
435 src_install_glibc-locale-de()
436 {
437 cd ${SRCDIR}/build
438
439 # create locale-archive
440 minstalldir /usr/$(mlibdir)/locale || die
441 #locale/localedef
442 localedef \
443 --prefix=${BINDIR} \
444 --inputfile=../localedata/locales/de_DE \
445 --charmap=../localedata/charmaps/UTF-8 \
446 --alias-file=../intl/locale.alias \
447 --force \
448 de_DE.UTF-8 \
449 || die
450
451 # test locale-archive
452 #[[ $(locale/localedef --prefix=${BINDIR} --list-archive) = de_DE.utf8 ]] || die
453 [[ $(localedef --prefix=${BINDIR} --list-archive) = de_DE.utf8 ]] || die
454 }
455
456 src_install_glibc-locale-us()
457 {
458 cd ${SRCDIR}/build
459
460 # create locale-archive
461 minstalldir /usr/$(mlibdir)/locale || die
462 #locale/localedef
463 localedef \
464 --prefix=${BINDIR} \
465 --inputfile=../localedata/locales/en_US \
466 --charmap=../localedata/charmaps/UTF-8 \
467 --alias-file=../intl/locale.alias \
468 --force \
469 en_US.UTF-8 \
470 || die
471
472 # test locale-archive
473 #[[ $(locale/localedef --prefix=${BINDIR} --list-archive) = en_US.utf8 ]] || die
474 [[ $(localedef --prefix=${BINDIR} --list-archive) = en_US.utf8 ]] || die
475 }
476
477 fix_db_files()
478 {
479 local i
480 local DB_ENTRY="${BUILDDIR}/${PKGNAME}"
481
482 for i in .files .symlinks .dirs
483 do
484 [ ! -f ${DB_ENTRY}/${i} ] && continue
485 [[ -z $(< ${DB_ENTRY}/${i}) ]] && continue
486
487 echo " fixing /usr/$(mlibdir)/incoming from db-entry '${i}' ..."
488
489 # /usr/lib/incoming -> empty line; sed2 removes all empty lines
490 #sed -i -e "s:/$(mlibdir)/incoming.*::g" -e '/^$/d' ${DB_ENTRY}/${i}
491 # do not simply emtpy the line, but change it the the correct path,
492 # so no stale libs are around if the package gets updated!
493 sed -i \
494 -e "s:/usr/$(mlibdir)/incoming:/usr/$(mlibdir):g" \
495 -e "s:/usr/$(mlibdir)/incoming.*::g" \
496 -e '/^$/d' ${DB_ENTRY}/${i}
497 done
498 }
499
500 preinstall_glibc()
501 {
502 add_conf_prot_mask /etc/env.d /etc/nsswitch.conf
503 }
504
505 postinstall_glibc()
506 {
507 # first save the old libpthread.so.0;
508 # it will later used to determinate that there are no stale
509 # libpthreads that breaks ldconfig
510 local OLD_PTHREAD
511 OLD_PTHREAD="$(readlink ${MROOT}/usr/$(mlibdir)/libpthread.so.0)"
512
513 # slackware install method
514
515 # we cannot easily install the glibc libs,
516 # because our tools for cp etc needs them to run
517
518 local file
519
520 echo " Switching to new glibc ..."
521 # swap libraries on the fly:
522 if [ -x /usr/sbin/ldconfig -a -d /usr/$(mlibdir)/incoming ] && [[ -z ${MROOT} ]]
523 then
524 # first create copies of the incoming libraries:
525 cd /usr/$(mlibdir)/incoming
526 for file in $(find /usr/$(mlibdir)/incoming -type f)
527 do
528 if [ ! -r "../$(basename ${file}).incoming" ]
529 then
530 cp -a ${file} ../$(basename ${file}).incoming
531 fi
532 done
533
534 # then switch to them all at once:
535 /usr/sbin/ldconfig -l /usr/$(mlibdir)/*.incoming 2> /dev/null
536
537 # Remove old versions of the glibc libraries. If you really don't want to
538 # do this for some reason, create a file /etc/glibc-nowipe.
539 if [ ! -r ${MROOT}/etc/glibc-nowipe ]
540 then
541 local INCOMING LIBRARY LIBPREFIX
542
543 cd /usr/$(mlibdir)
544 for INCOMING in incoming/*-*
545 do
546 LIBPREFIX=$(basename $INCOMING | cut -f 1 -d -)
547 for LIBRARY in ${LIBPREFIX}-*
548 do
549 # Don't remove the library if it ends in .incoming:
550 if [ "$(echo $LIBRARY | rev | cut -f 1 -d .)" = "gnimocni" ]
551 then
552 continue
553 fi
554 # Don't remove symlinks:
555 if [ -L $LIBRARY ]
556 then
557 continue
558 fi
559 rm -f $LIBRARY
560 done
561 done
562 fi
563
564 # finally, rename them and clean up:
565 cd /usr/$(mlibdir)
566 for file in *.incoming
567 do
568 rm -f $(basename ${file} .incoming)
569 cp -a ${file} $(basename ${file} .incoming)
570 /usr/sbin/ldconfig -l $(basename ${file} .incoming)
571 rm -f ${file}
572 done
573
574 # no ldconfig?
575 # good, it's safe to just jam it on home (and make links below):
576 else
577 (
578 cd ${MROOT}/usr/$(mlibdir)/incoming
579 for file in *
580 do
581 cp -a ${file} ..
582 done
583
584 local my_sym
585 local my_dest
586
587 # rebuild symlinks
588 echo " Recreating Symlinks:"
589 for i in $(find ${MROOT}/usr/$(mlibdir)/incoming -type l)
590 do
591 my_sym="$(readlink ${i})"
592 my_dest="$(basename ${i})"
593
594 echo " ${my_dest} -> ${my_dest}"
595
596 # assure to remove the old ones;
597 [ -L ${MROOT}/usr/$(mlibdir)/"${my_dest}" ] && \
598 rm ${MROOT}/usr/$(mlibdir)/"${my_dest}"
599
600 ln -snf "${my_sym}" ${MROOT}/usr/$(mlibdir)/"${my_dest}"
601 done
602 )
603 fi
604
605 # now, get rid of the temporary directory:
606 rm -rf ${MROOT}/usr/$(mlibdir)/incoming
607
608 # remove stale nptl libpthread-2.?.?.so,
609 # fix only needed for glibc with linuxthreads;
610 # prevent reloc errors such as:
611 # ls: error while loading shared libraries: libpthread.so.0: cannot open shared object file: No such file or directory
612
613 # get our new libpthread.so.0
614 local NEW_PTHREAD
615 NEW_PTHREAD="$(readlink ${MROOT}/usr/$(mlibdir)/libpthread.so.0)"
616
617 if [ "${NEW_PTHREAD}" != "${OLD_PTHREAD}" ]
618 then
619 echo " Removing stale libpthread libraries ..."
620 for file in ${MROOT}/usr/$(mlibdir)/libpthread-*
621 do
622 if [ "$(basename ${file})" != "${NEW_PTHREAD}" ]
623 then
624 rm -f ${file}
625 fi
626 done
627
628 #rm -f /lib/${OLD_PTHREAD}
629
630 ln -snf ${NEW_PTHREAD} ${MROOT}/usr/$(mlibdir)/libpthread.so.0
631 fi
632
633 # now we must fix the mage db files
634 # to stop the annoying errors messages
635 fix_db_files
636 }
637
638 postinstall_glibc-dev()
639 {
640 if [ -x /usr/sbin/iconvconfig ]
641 then
642 # generate fastloading iconv module configuration file.
643 echo " Generate iconv module config ..."
644 /usr/sbin/iconvconfig --prefix=${MROOT}/
645 fi
646
647 # not working with busybox
648 if ! need_busybox_support /sbin/init
649 then
650 # reloading init
651 echo " Reloading init ..."
652 [[ -z ${MROOT} ]] && /sbin/init U &> /dev/null
653 fi
654
655 # generating user def locales
656 echo " Generating user defined locales ..."
657 [[ -z ${MROOT} ]] && /usr/sbin/locale-gen
658 }