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