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