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