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