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