Contents of /smage/trunk/core/glibc/glibc-2.30-r1.smage2
Parent Directory | Revision Log
Revision 13740 -
(show annotations)
(download)
Mon Aug 5 11:18:22 2019 UTC (4 years, 9 months ago) by niro
File size: 17774 byte(s)
Mon Aug 5 11:18:22 2019 UTC (4 years, 9 months ago) by niro
File size: 17774 byte(s)
-linux-libc-headers-4.19.64, binutils-2.32, glibc-2.30, gcc-9.1.0 toolchain - stage1
1 | # $Id$ |
2 | |
3 | PNAME="glibc" |
4 | PVER="2.30" |
5 | PBUILD="r1" |
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.64 |
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 | # enable intel cet + branch tracking (IBT) and shadow stack (SHSTK) |
176 | myopts+=" --enable-cet" |
177 | |
178 | # remove fortify for building libraries |
179 | export CPPFLAGS=${CPPFLAGS/-D_FORTIFY_SOURCE=2/} |
180 | |
181 | # support multilib lib64 dir (x86_64 only) |
182 | if [[ ${ARCH} = x86_64 ]] |
183 | then |
184 | # first build a -m32 version |
185 | install -d ${SRCDIR}/build-m32 |
186 | cd ${SRCDIR}/build-m32 |
187 | |
188 | # honor /usr move |
189 | echo "rootsbindir=/usr/sbin" >> ${SRCDIR}/build-m32/configparms || die |
190 | # make sure the -m32 libs goes really to /usr/lib |
191 | echo "slibdir=/usr/lib" >> ${SRCDIR}/build-m32/configparms || die |
192 | echo "rtlddir=/usr/lib" >> ${SRCDIR}/build-m32/configparms || die |
193 | |
194 | CC="gcc -m32" CXX="g++ -m32" \ |
195 | CFLAGS="${CFLAGS//-march=${ARCH}} -march=i686" \ |
196 | CXXFLAGS="${CXXFLAGS//-march=${ARCH}} -march=i686" \ |
197 | ../configure \ |
198 | --build=${CHOST} \ |
199 | --host=i686-pc-linux-gnu \ |
200 | --libdir=/usr/lib \ |
201 | --libexecdir=/usr/lib/glibc \ |
202 | ${myopts} \ |
203 | || die |
204 | |
205 | make PARALLELMFLAGS="${MAKEOPTS}" || die |
206 | fi |
207 | |
208 | cd ${SRCDIR}/build |
209 | |
210 | # honor /usr move |
211 | echo "rootsbindir=/usr/sbin" >> ${SRCDIR}/build/configparms || die |
212 | # make sure the -m64 libs goes really to /lib64 |
213 | echo "slibdir=/usr/$(mlibdir)" >> ${SRCDIR}/build/configparms || die |
214 | echo "rtlddir=/usr/$(mlibdir)" >> ${SRCDIR}/build/configparms || die |
215 | |
216 | ../configure \ |
217 | --build=${CHOST} \ |
218 | --host=${CHOST} \ |
219 | --libdir=/usr/$(mlibdir) \ |
220 | --libexecdir=/usr/$(mlibdir)/glibc \ |
221 | ${myopts} \ |
222 | || die |
223 | |
224 | make PARALLELMFLAGS="${MAKEOPTS}" || die |
225 | } |
226 | |
227 | src_install_glibc() |
228 | { |
229 | if [[ ${ARCH} = x86_64 ]] |
230 | then |
231 | # install -m32 libs |
232 | cd ${SRCDIR}/build-m32 |
233 | make PARALLELMFLAGS="${MAKEOPTS}" install_root=${BINDIR} install || die |
234 | fi |
235 | |
236 | cd ${SRCDIR}/build |
237 | make PARALLELMFLAGS="${MAKEOPTS}" install_root=${BINDIR} install || die |
238 | |
239 | # cleanup |
240 | # utf-16 is needed by wfica >= 12.1 |
241 | # utf-32 is needed by wfica >= 13.1 |
242 | zapmost ${BINDIR} usr/$(mlibdir)/\*.so \ |
243 | usr/$(mlibdir)/\*.so.\* \ |
244 | $([[ ${ARCH} = x86_64 ]] && echo 'usr/lib/*.so usr/lib/*.so.*') \ |
245 | usr/sbin/ldconfig \ |
246 | usr/bin/iconv \ |
247 | usr/bin/locale \ |
248 | usr/bin/ldd \ |
249 | usr/bin/getent \ |
250 | usr/$(mlibdir)/gconv/CP1252.so \ |
251 | usr/$(mlibdir)/gconv/IBM850.so \ |
252 | usr/$(mlibdir)/gconv/ISO8859-1.so \ |
253 | usr/$(mlibdir)/gconv/ISO8859-15.so \ |
254 | usr/$(mlibdir)/gconv/UNICODE.so \ |
255 | usr/$(mlibdir)/gconv/UTF-16.so \ |
256 | usr/$(mlibdir)/gconv/UTF-32.so \ |
257 | usr/$(mlibdir)/gconv/gconv-modules \ |
258 | $([[ ${ARCH} = x86_64 ]] && echo 'usr/lib/gconv/CP1252.so') \ |
259 | $([[ ${ARCH} = x86_64 ]] && echo 'usr/lib/gconv/IBM850.so') \ |
260 | $([[ ${ARCH} = x86_64 ]] && echo 'usr/lib/gconv/ISO8859-1.so') \ |
261 | $([[ ${ARCH} = x86_64 ]] && echo 'usr/lib/gconv/ISO8859-15.so') \ |
262 | $([[ ${ARCH} = x86_64 ]] && echo 'usr/lib/gconv/UNICODE.so') \ |
263 | $([[ ${ARCH} = x86_64 ]] && echo 'usr/lib/gconv/UTF-16.so') \ |
264 | $([[ ${ARCH} = x86_64 ]] && echo 'usr/lib/gconv/UTF-32.so') \ |
265 | $([[ ${ARCH} = x86_64 ]] && echo 'usr/lib/gconv/gconv-modules') \ |
266 | || die |
267 | |
268 | # nsswitch configuration file |
269 | minstalletc ${SRCDIR}/nss/nsswitch.conf || die |
270 | |
271 | # base environment |
272 | minstallenv glibc.envd-${ENVD_REV} 00glibc || die |
273 | if [[ ${ARCH} = x86_64 ]] |
274 | then |
275 | MCONFIG="/etc/env.d/00glibc" |
276 | maddconfig "LDPATH=\"/$(mlibdir)\"" || die |
277 | maddconfig "LDPATH=\"/usr/$(mlibdir)\"" || die |
278 | maddconfig "LDPATH=\"/usr/local/$(mlibdir)\"" || die |
279 | maddconfig "LDPATH=\"/opt/$(mlibdir)\"" || die |
280 | fi |
281 | |
282 | # strip all binaries |
283 | 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 |
284 | |
285 | # strip all libraries |
286 | # want to be safe here; --strip-unneeded seems to cause pthread problems |
287 | # strip all but libpthread, libc and ld |
288 | install -d ${BUILDDIR}/thread-backup/$(mlibdir) || die |
289 | mv ${BINDIR}/usr/$(mlibdir)/lib{pthread,thread_db,c-}* ${BUILDDIR}/thread-backup/$(mlibdir)/ || die |
290 | mv ${BINDIR}/usr/$(mlibdir)/ld-* ${BUILDDIR}/thread-backup/$(mlibdir)/ || die |
291 | |
292 | # now strip |
293 | 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 |
294 | 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 |
295 | mv -f ${BUILDDIR}/thread-backup/* ${BINDIR}/usr/$(mlibdir)/ || die |
296 | # remove stale directory |
297 | rm -rf ${BUILDDIR}/thread-backup || die |
298 | |
299 | # prepare glibc for installation; slackware method |
300 | minstalldir /incoming || die |
301 | mv ${BINDIR}/usr/$(mlibdir)/*.so ${BINDIR}/incoming || die |
302 | mv ${BINDIR}/usr/$(mlibdir)/*.so.* ${BINDIR}/incoming || die |
303 | mv ${BINDIR}/incoming ${BINDIR}/usr/$(mlibdir)/incoming || die |
304 | mv ${BINDIR}/usr/$(mlibdir)/incoming/libSegFault.so ${BINDIR}/usr/$(mlibdir) || die |
305 | } |
306 | |
307 | src_install_glibc-dev() |
308 | { |
309 | if [[ ${ARCH} = x86_64 ]] |
310 | then |
311 | # install -m32 libs |
312 | cd ${SRCDIR}/build-m32 |
313 | make PARALLELMFLAGS="${MAKEOPTS}" install_root=${BINDIR} install || die |
314 | fi |
315 | |
316 | cd ${SRCDIR}/build |
317 | make PARALLELMFLAGS="${MAKEOPTS}" install_root=${BINDIR} install || die |
318 | |
319 | # cleanup -> in glibc |
320 | rm ${BINDIR}/usr/$(mlibdir)/*.so || die |
321 | rm ${BINDIR}/usr/$(mlibdir)/*.so.* || die |
322 | rm ${BINDIR}/usr/$(mlibdir)/gconv/CP1252.so || die |
323 | rm ${BINDIR}/usr/$(mlibdir)/gconv/IBM850.so || die |
324 | rm ${BINDIR}/usr/$(mlibdir)/gconv/ISO8859-1.so || die |
325 | rm ${BINDIR}/usr/$(mlibdir)/gconv/ISO8859-15.so || die |
326 | rm ${BINDIR}/usr/$(mlibdir)/gconv/UNICODE.so || die |
327 | rm ${BINDIR}/usr/$(mlibdir)/gconv/UTF-16.so || die |
328 | rm ${BINDIR}/usr/$(mlibdir)/gconv/gconv-modules || die |
329 | if [[ ${ARCH} = x86_64 ]] |
330 | then |
331 | rm ${BINDIR}/usr/lib/*.so || die |
332 | rm ${BINDIR}/usr/lib/*.so.* || die |
333 | rm ${BINDIR}/usr/lib/gconv/CP1252.so || die |
334 | rm ${BINDIR}/usr/lib/gconv/IBM850.so || die |
335 | rm ${BINDIR}/usr/lib/gconv/ISO8859-1.so || die |
336 | rm ${BINDIR}/usr/lib/gconv/ISO8859-15.so || die |
337 | rm ${BINDIR}/usr/lib/gconv/UNICODE.so || die |
338 | rm ${BINDIR}/usr/lib/gconv/UTF-16.so || die |
339 | rm ${BINDIR}/usr/lib/gconv/gconv-modules || die |
340 | fi |
341 | rm ${BINDIR}/usr/sbin/ldconfig || die |
342 | rm ${BINDIR}/usr/bin/iconv || die |
343 | rm ${BINDIR}/usr/bin/locale || die |
344 | rm ${BINDIR}/usr/bin/ldd || die |
345 | rm ${BINDIR}/usr/bin/getent || die |
346 | |
347 | # do not generate the locales here, let it the user do with the locale-gen tool |
348 | # make PARALLELMFLAGS="${MAKEOPTS}" install_root=${BINDIR} localedata/install-locales || die |
349 | |
350 | # install locales list and generate tools |
351 | # generate locale.gen file from localedata/SUPPORTED file |
352 | minstalletc locale.gen-header locale.gen || die |
353 | sed \ |
354 | -e 's:/: :g' \ |
355 | -e 's:\\: :g' \ |
356 | -e 's:SUPPORTED-LOCALES=::' \ |
357 | -e 's:\ \ $::g' \ |
358 | -e '/^#/d' \ |
359 | -e 's:^:#:g' \ |
360 | ${SRCDIR}/localedata/SUPPORTED \ |
361 | >> ${BINDIR}/etc/locale.gen || die |
362 | minstalldir /usr/sbin || die |
363 | minstallexec -s locale-gen /usr/sbin || die |
364 | |
365 | # nscd configuration file |
366 | minstalletc ${SRCDIR}/nscd/nscd.conf || die |
367 | # systemd services, but do not include systemd.sminc to have a hard depend on systemd |
368 | minstalldir /usr/lib/systemd/system || die |
369 | minstallfile ${SRCDIR}/nscd/nscd.service /usr/lib/systemd/system || die |
370 | minstalldir /etc/tmpfiles.d || die |
371 | minstallfile ${SRCDIR}/nscd/nscd.tmpfiles /etc/tmpfiles.d/nscd.conf || die |
372 | |
373 | # gai configuration file |
374 | minstalletc ${SRCDIR}/posix/gai.conf || die |
375 | |
376 | # now in tzdata |
377 | ## we use Berlin as default |
378 | ## busybox compat |
379 | #local args |
380 | #if need_busybox_support /bin/cp |
381 | #then |
382 | # args="-f" |
383 | #else |
384 | # args="--remove-destination" |
385 | #fi |
386 | #cp ${args} ${BINDIR}/usr/share/zoneinfo/Europe/Berlin ${BINDIR}/etc/localtime || die |
387 | [ -f ${BINDIR}/etc/ld.so.conf ] && { rm -f ${BINDIR}/etc/ld.so.conf || die; } |
388 | [ -e ${BINDIR}/etc/ld.so.cache ] && { rm -rf ${BINDIR}/etc/ld.so.cache || die; } |
389 | |
390 | # strip all binaries |
391 | 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 |
392 | |
393 | # now strip but only debuging symbols |
394 | 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 |
395 | 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 |
396 | } |
397 | |
398 | src_install_glibc-locale-de() |
399 | { |
400 | cd ${SRCDIR}/build |
401 | |
402 | # create locale-archive |
403 | minstalldir /usr/$(mlibdir)/locale || die |
404 | locale/localedef \ |
405 | --prefix=${BINDIR} \ |
406 | --inputfile=../localedata/locales/de_DE \ |
407 | --charmap=../localedata/charmaps/UTF-8 \ |
408 | --alias-file=../intl/locale.alias \ |
409 | --force \ |
410 | de_DE.UTF-8 \ |
411 | || die |
412 | |
413 | # test locale-archive |
414 | [[ $(locale/localedef --prefix=${BINDIR} --list-archive) = de_DE.utf8 ]] || die |
415 | } |
416 | |
417 | src_install_glibc-locale-us() |
418 | { |
419 | cd ${SRCDIR}/build |
420 | |
421 | # create locale-archive |
422 | minstalldir /usr/$(mlibdir)/locale || die |
423 | locale/localedef \ |
424 | --prefix=${BINDIR} \ |
425 | --inputfile=../localedata/locales/en_US \ |
426 | --charmap=../localedata/charmaps/UTF-8 \ |
427 | --alias-file=../intl/locale.alias \ |
428 | --force \ |
429 | en_US.UTF-8 \ |
430 | || die |
431 | |
432 | # test locale-archive |
433 | [[ $(locale/localedef --prefix=${BINDIR} --list-archive) = en_US.utf8 ]] || die |
434 | } |
435 | |
436 | fix_db_files() |
437 | { |
438 | local i |
439 | local DB_ENTRY="${BUILDDIR}/${PKGNAME}" |
440 | |
441 | for i in .files .symlinks .dirs |
442 | do |
443 | [ ! -f ${DB_ENTRY}/${i} ] && continue |
444 | [[ -z $(< ${DB_ENTRY}/${i}) ]] && continue |
445 | |
446 | echo " fixing /usr/$(mlibdir)/incoming from db-entry '${i}' ..." |
447 | |
448 | # /usr/lib/incoming -> empty line; sed2 removes all empty lines |
449 | #sed -i -e "s:/$(mlibdir)/incoming.*::g" -e '/^$/d' ${DB_ENTRY}/${i} |
450 | # do not simply emtpy the line, but change it the the correct path, |
451 | # so no stale libs are around if the package gets updated! |
452 | sed -i \ |
453 | -e "s:/usr/$(mlibdir)/incoming:/usr/$(mlibdir):g" \ |
454 | -e "s:/usr/$(mlibdir)/incoming.*::g" \ |
455 | -e '/^$/d' ${DB_ENTRY}/${i} |
456 | done |
457 | } |
458 | |
459 | preinstall_glibc() |
460 | { |
461 | add_conf_prot_mask /etc/env.d /etc/nsswitch.conf |
462 | } |
463 | |
464 | postinstall_glibc() |
465 | { |
466 | # first save the old libpthread.so.0; |
467 | # it will later used to determinate that there are no stale |
468 | # libpthreads that breaks ldconfig |
469 | local OLD_PTHREAD |
470 | OLD_PTHREAD="$(readlink ${MROOT}/usr/$(mlibdir)/libpthread.so.0)" |
471 | |
472 | # slackware install method |
473 | |
474 | # we cannot easily install the glibc libs, |
475 | # because our tools for cp etc needs them to run |
476 | |
477 | local file |
478 | |
479 | echo " Switching to new glibc ..." |
480 | # swap libraries on the fly: |
481 | if [ -x /usr/sbin/ldconfig -a -d /usr/$(mlibdir)/incoming ] && [[ -z ${MROOT} ]] |
482 | then |
483 | # first create copies of the incoming libraries: |
484 | cd /usr/$(mlibdir)/incoming |
485 | for file in $(find /usr/$(mlibdir)/incoming -type f) |
486 | do |
487 | if [ ! -r "../$(basename ${file}).incoming" ] |
488 | then |
489 | cp -a ${file} ../$(basename ${file}).incoming |
490 | fi |
491 | done |
492 | |
493 | # then switch to them all at once: |
494 | /usr/sbin/ldconfig -l /usr/$(mlibdir)/*.incoming 2> /dev/null |
495 | |
496 | # finally, rename them and clean up: |
497 | cd /usr/$(mlibdir) |
498 | for file in *.incoming |
499 | do |
500 | rm -f $(basename ${file} .incoming) |
501 | cp -a ${file} $(basename ${file} .incoming) |
502 | /usr/sbin/ldconfig -l $(basename ${file} .incoming) |
503 | rm -f ${file} |
504 | done |
505 | |
506 | # no ldconfig? |
507 | # good, it's safe to just jam it on home (and make links below): |
508 | else |
509 | ( |
510 | cd ${MROOT}/usr/$(mlibdir)/incoming |
511 | for file in * |
512 | do |
513 | cp -a ${file} .. |
514 | done |
515 | |
516 | local my_sym |
517 | local my_dest |
518 | |
519 | # rebuild symlinks |
520 | echo " Recreating Symlinks:" |
521 | for i in $(find ${MROOT}/usr/$(mlibdir)/incoming -type l) |
522 | do |
523 | my_sym="$(readlink ${i})" |
524 | my_dest="$(basename ${i})" |
525 | |
526 | echo " ${my_dest} -> ${my_dest}" |
527 | |
528 | # assure to remove the old ones; |
529 | [ -L ${MROOT}/usr/$(mlibdir)/"${my_dest}" ] && \ |
530 | rm ${MROOT}/usr/$(mlibdir)/"${my_dest}" |
531 | |
532 | ln -snf "${my_sym}" ${MROOT}/usr/$(mlibdir)/"${my_dest}" |
533 | done |
534 | ) |
535 | fi |
536 | |
537 | # now, get rid of the temporary directory: |
538 | rm -rf ${MROOT}/usr/$(mlibdir)/incoming |
539 | |
540 | # remove stale nptl libpthread-2.?.?.so, |
541 | # fix only needed for glibc with linuxthreads; |
542 | # prevent reloc errors such as: |
543 | # ls: error while loading shared libraries: libpthread.so.0: cannot open shared object file: No such file or directory |
544 | |
545 | # get our new libpthread.so.0 |
546 | local NEW_PTHREAD |
547 | NEW_PTHREAD="$(readlink ${MROOT}/usr/$(mlibdir)/libpthread.so.0)" |
548 | |
549 | if [ "${NEW_PTHREAD}" != "${OLD_PTHREAD}" ] |
550 | then |
551 | echo " Removing stale libpthread libraries ..." |
552 | for file in ${MROOT}/usr/$(mlibdir)/libpthread-* |
553 | do |
554 | if [ "$(basename ${file})" != "${NEW_PTHREAD}" ] |
555 | then |
556 | rm -f ${file} |
557 | fi |
558 | done |
559 | |
560 | #rm -f /lib/${OLD_PTHREAD} |
561 | |
562 | ln -snf ${NEW_PTHREAD} ${MROOT}/usr/$(mlibdir)/libpthread.so.0 |
563 | fi |
564 | |
565 | # now we must fix the mage db files |
566 | # to stop the annoying errors messages |
567 | fix_db_files |
568 | } |
569 | |
570 | postinstall_glibc-dev() |
571 | { |
572 | if [ -x /usr/sbin/iconvconfig ] |
573 | then |
574 | # generate fastloading iconv module configuration file. |
575 | echo " Generate iconv module config ..." |
576 | /usr/sbin/iconvconfig --prefix=${MROOT}/ |
577 | fi |
578 | |
579 | # not working with busybox |
580 | if ! need_busybox_support /sbin/init |
581 | then |
582 | # reloading init |
583 | echo " Reloading init ..." |
584 | [[ -z ${MROOT} ]] && /sbin/init U &> /dev/null |
585 | fi |
586 | |
587 | # generating user def locales |
588 | echo " Generating user defined locales ..." |
589 | [[ -z ${MROOT} ]] && /usr/sbin/locale-gen |
590 | } |