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