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