Contents of /smage/trunk/core/glibc/glibc-2.31-r1.smage2
Parent Directory | Revision Log
Revision 14390 -
(show annotations)
(download)
Thu Jul 9 13:48:04 2020 UTC (4 years, 2 months ago) by niro
File size: 18208 byte(s)
Thu Jul 9 13:48:04 2020 UTC (4 years, 2 months ago) by niro
File size: 18208 byte(s)
-disabled
1 | # $Id$ |
2 | |
3 | PNAME="glibc" |
4 | PVER="2.31" |
5 | PBUILD="r1" |
6 | |
7 | STATE="disabled" |
8 | |
9 | SPLIT_PACKAGES="glibc glibc-dev glibc-locale-de glibc-locale-us" |
10 | |
11 | PCAT="sys-libs" |
12 | HOMEPAGE="http://www.gnu.org/software/libc/libc.html" |
13 | |
14 | GLIBC_DEPEND=">= sys-apps/base-files-0.7 |
15 | >= sys-libs/tzdata-2019" |
16 | |
17 | # we force headers to one specific version |
18 | SDEPEND="== sys-kernel/linux-libc-headers-4.19.64 |
19 | >= dev-lang/python3-3 |
20 | ${GLIBC_DEPEND}" |
21 | |
22 | # functions to include in the mage file |
23 | SPECIAL_FUNCTIONS="fix_db_files" |
24 | |
25 | SRCFILE="glibc-${PVER}.tar.xz" |
26 | SRCDIR="${BUILDDIR}/glibc-${PVER}" |
27 | |
28 | ENVD_REV="1.2" |
29 | |
30 | sminclude mtools cleanutils alx |
31 | |
32 | SRC_URI=( |
33 | ftp://sources.redhat.com/pub/glibc/releases/${SRCFILE} |
34 | ftp://sources.redhat.com/pub/glibc/snapshots/${SRCFILE} |
35 | gnu://${PNAME}/${SRCFILE} |
36 | mirror://${PNAME}/${SRCFILE} |
37 | mirror://${PNAME}/glibc.envd-${ENVD_REV} |
38 | mirror://${PNAME}/locale.gen-header |
39 | mirror://${PNAME}/locale-gen |
40 | mirror://${PNAME}/${PNAME}-2.17-syscalld-infinite-loop.patch |
41 | ) |
42 | |
43 | # sed line: on 2 digits add an zero: 2.7 -> 2.7.0 |
44 | UP2DATE="updatecmd_gnu ${PNAME/-nptl/} | sed 's/^\([0-9]\.[0-9]\$\)/\1.0/'" |
45 | |
46 | # glibc don't like strong CFLAGS |
47 | #export CFLAGS="${CFLAGS//-O?} -O2" |
48 | # glibc -> nptl thread don't like striping |
49 | msetfeature "!strip static" |
50 | |
51 | # hack to fix NPTL issues with xen, only required on 32bit arches |
52 | if [[ ${ARCH} = i*86 ]] |
53 | then |
54 | export CFLAGS="${CFLAGS} -mno-tls-direct-seg-refs" |
55 | fi |
56 | |
57 | ## glibc-2.6.1 and above needs march CFLAGS: -march=${ARCH} -mtune=generic |
58 | ## first filter -mtune and -march from flags |
59 | #for flag in ${CFLAGS} |
60 | #do |
61 | # case ${flag} in |
62 | # -mtune=*) continue ;; |
63 | # -march=*) continue ;; |
64 | # esac |
65 | # newflags="${newflags} ${flag}" |
66 | #done |
67 | #export CFLAGS="${newflags}" |
68 | # |
69 | ## than add our defaults for glibc |
70 | #[[ ${ARCH} = i*86 ]] && export CFLAGS="${CFLAGS} -march=${ARCH}" # only i*86 |
71 | #export CFLAGS="${CFLAGS} -mtune=generic" # all arches |
72 | #export CXXFLAGS="${CFLAGS}" |
73 | |
74 | # use other linux-headers |
75 | [[ -z ${ALT_HEADERS} ]] && export ALT_HEADERS="/usr/include" |
76 | |
77 | # kernel support |
78 | #export ENABLE_KERNEL=3.2.0 |
79 | |
80 | split_info_glibc() |
81 | { |
82 | DESCRIPTION="GNU libc6 (also called glibc2) C library with NPTL Threads." |
83 | DEPEND="${GLIBC_DEPEND}" |
84 | PROVIDE="virtual/glibc" |
85 | } |
86 | |
87 | split_info_glibc-dev() |
88 | { |
89 | DESCRIPTION="Development files for sys-libs/glibc-${PVER}." |
90 | DEPEND="== sys-libs/glibc-${PVER}" |
91 | PROVIDE="virtual/glibc-dev" |
92 | } |
93 | |
94 | split_info_glibc-locale-de() |
95 | { |
96 | DESCRIPTION="Provide german locales for sys-libs/glibc-${PVER}." |
97 | DEPEND="== sys-libs/glibc-${PVER}" |
98 | } |
99 | |
100 | split_info_glibc-locale-us() |
101 | { |
102 | DESCRIPTION="Provide english US locales for sys-libs/glibc-${PVER}." |
103 | DEPEND="== sys-libs/glibc-${PVER}" |
104 | } |
105 | |
106 | src_prepare() |
107 | { |
108 | munpack ${SRCFILE} || die |
109 | cd ${SRCDIR} |
110 | |
111 | # fix a test case that fails when built using gcc-5.x |
112 | #sed -i '/tst-audit2-ENV/i CFLAGS-tst-audit2.c += -fno-builtin' elf/Makefile || die |
113 | |
114 | # fixes an infinite loop while syscall.d creation |
115 | # see: http://sourceware.org/bugzilla/show_bug.cgi?id=15711 |
116 | # mpatch ${PNAME}-2.17-syscalld-infinite-loop.patch || die |
117 | # use 1.0 second instead of 0.5 (required by arch i686 builds on 64bit machines) |
118 | # sed -i 's:0.5 seconds ago:1.0 seconds ago:' ${SRCDIR}/Makerules || die |
119 | |
120 | # scripts/test-installation.pl sometime fails |
121 | # |
122 | # CC="gcc" /usr/bin/perl scripts/test-installation.pl |
123 | # /usr/src/glibc-2.16.0.bld/ |
124 | # 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> |
125 | # line 1 |
126 | #sed -i 's:CC="$(CC)" $(PERL) scripts/test-installation.pl $(common-objpfx)::' Makefile || die |
127 | |
128 | # binutils patch needs reconf |
129 | # autoconf --force || die |
130 | |
131 | # fix permissions on some of the scripts |
132 | # chmod u+x ${SRCDIR}/scripts/*.sh || die |
133 | |
134 | install -d ${SRCDIR}/build || die |
135 | cd ${SRCDIR}/build |
136 | |
137 | # if [ ! -f /etc/ld.so.conf ] |
138 | # then |
139 | # touch /etc/ld.so.conf || die |
140 | # fi |
141 | } |
142 | |
143 | src_compile() |
144 | { |
145 | local myopts |
146 | |
147 | # generic pathes |
148 | myopts="--prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info" |
149 | myopts+=" --with-headers=/usr/include" |
150 | # bugurl |
151 | myopts+=" --with-bugurl=http://bugs.magellan-linux.de/" |
152 | # disable profiling |
153 | myopts+=" --disable-profile" |
154 | # enable addons |
155 | myopts+=" --enable-add-ons" |
156 | # supported kernel-release |
157 | #myopts+=" --enable-kernel=${ENABLE_KERNEL}" |
158 | # disable cvs and gd support |
159 | # myopts+=" --without-cvs --without-gd" |
160 | # enable bindnow |
161 | myopts+=" --enable-bind-now" |
162 | # # enable obsolete rpc implementation |
163 | # myopts+=" --enable-obsolete-rpc" |
164 | # # enable obsolete nsl implementation |
165 | # myopts+=" --enable-obsolete-nsl" |
166 | # enable lock elision |
167 | myopts+=" --enable-lock-elision" |
168 | # disable -werror |
169 | myopts+=" --disable-werror" |
170 | # enable multi-arch |
171 | myopts+=" --enable-multi-arch" |
172 | # enable stackguard randomization |
173 | myopts+=" --enable-stackguard-randomization" |
174 | # enable stack protector |
175 | myopts+=" --enable-stack-protector=strong" |
176 | # enable static pie |
177 | myopts+=" --enable-static-pie" |
178 | # enable intel cet + branch tracking (IBT) and shadow stack (SHSTK) |
179 | myopts+=" --enable-cet" |
180 | |
181 | # remove fortify for building libraries |
182 | export CPPFLAGS=${CPPFLAGS/-D_FORTIFY_SOURCE=2/} |
183 | |
184 | # support multilib lib64 dir (x86_64 only) |
185 | if [[ ${ARCH} = x86_64 ]] |
186 | then |
187 | # first build a -m32 version |
188 | install -d ${SRCDIR}/build-m32 |
189 | cd ${SRCDIR}/build-m32 |
190 | |
191 | # honor /usr move |
192 | echo "rootsbindir=/usr/sbin" >> ${SRCDIR}/build-m32/configparms || die |
193 | # make sure the -m32 libs goes really to /usr/lib |
194 | echo "slibdir=/usr/lib" >> ${SRCDIR}/build-m32/configparms || die |
195 | echo "rtlddir=/usr/lib" >> ${SRCDIR}/build-m32/configparms || die |
196 | |
197 | CC="gcc -m32" CXX="g++ -m32" \ |
198 | CFLAGS="${CFLAGS//-march=${ARCH}} -march=i686" \ |
199 | CXXFLAGS="${CXXFLAGS//-march=${ARCH}} -march=i686" \ |
200 | ../configure \ |
201 | --build=${CHOST} \ |
202 | --host=i686-pc-linux-gnu \ |
203 | --libdir=/usr/lib \ |
204 | --libexecdir=/usr/lib/glibc \ |
205 | ${myopts} \ |
206 | || die |
207 | |
208 | make PARALLELMFLAGS="${MAKEOPTS}" || die |
209 | fi |
210 | |
211 | cd ${SRCDIR}/build |
212 | |
213 | # honor /usr move |
214 | echo "rootsbindir=/usr/sbin" >> ${SRCDIR}/build/configparms || die |
215 | # make sure the -m64 libs goes really to /lib64 |
216 | echo "slibdir=/usr/$(mlibdir)" >> ${SRCDIR}/build/configparms || die |
217 | echo "rtlddir=/usr/$(mlibdir)" >> ${SRCDIR}/build/configparms || die |
218 | |
219 | ../configure \ |
220 | --build=${CHOST} \ |
221 | --host=${CHOST} \ |
222 | --libdir=/usr/$(mlibdir) \ |
223 | --libexecdir=/usr/$(mlibdir)/glibc \ |
224 | ${myopts} \ |
225 | || die |
226 | |
227 | make PARALLELMFLAGS="${MAKEOPTS}" || die |
228 | } |
229 | |
230 | src_install_glibc() |
231 | { |
232 | if [[ ${ARCH} = x86_64 ]] |
233 | then |
234 | # install -m32 libs |
235 | cd ${SRCDIR}/build-m32 |
236 | make PARALLELMFLAGS="${MAKEOPTS}" install_root=${BINDIR} install || die |
237 | fi |
238 | |
239 | cd ${SRCDIR}/build |
240 | make PARALLELMFLAGS="${MAKEOPTS}" install_root=${BINDIR} install || die |
241 | |
242 | # cleanup |
243 | # utf-16 is needed by wfica >= 12.1 |
244 | # utf-32 is needed by wfica >= 13.1 |
245 | zapmost ${BINDIR} usr/$(mlibdir)/\*.so \ |
246 | usr/$(mlibdir)/\*.so.\* \ |
247 | $([[ ${ARCH} = x86_64 ]] && echo 'usr/lib/*.so usr/lib/*.so.*') \ |
248 | usr/sbin/ldconfig \ |
249 | usr/bin/iconv \ |
250 | usr/bin/locale \ |
251 | usr/bin/ldd \ |
252 | usr/bin/getent \ |
253 | usr/$(mlibdir)/gconv/CP1252.so \ |
254 | usr/$(mlibdir)/gconv/IBM850.so \ |
255 | usr/$(mlibdir)/gconv/ISO8859-1.so \ |
256 | usr/$(mlibdir)/gconv/ISO8859-15.so \ |
257 | usr/$(mlibdir)/gconv/UNICODE.so \ |
258 | usr/$(mlibdir)/gconv/UTF-16.so \ |
259 | usr/$(mlibdir)/gconv/UTF-32.so \ |
260 | usr/$(mlibdir)/gconv/gconv-modules \ |
261 | $([[ ${ARCH} = x86_64 ]] && echo 'usr/lib/gconv/CP1252.so') \ |
262 | $([[ ${ARCH} = x86_64 ]] && echo 'usr/lib/gconv/IBM850.so') \ |
263 | $([[ ${ARCH} = x86_64 ]] && echo 'usr/lib/gconv/ISO8859-1.so') \ |
264 | $([[ ${ARCH} = x86_64 ]] && echo 'usr/lib/gconv/ISO8859-15.so') \ |
265 | $([[ ${ARCH} = x86_64 ]] && echo 'usr/lib/gconv/UNICODE.so') \ |
266 | $([[ ${ARCH} = x86_64 ]] && echo 'usr/lib/gconv/UTF-16.so') \ |
267 | $([[ ${ARCH} = x86_64 ]] && echo 'usr/lib/gconv/UTF-32.so') \ |
268 | $([[ ${ARCH} = x86_64 ]] && echo 'usr/lib/gconv/gconv-modules') \ |
269 | || die |
270 | |
271 | # nsswitch configuration file |
272 | minstalletc ${SRCDIR}/nss/nsswitch.conf || die |
273 | |
274 | # base environment |
275 | minstallenv glibc.envd-${ENVD_REV} 00glibc || die |
276 | if [[ ${ARCH} = x86_64 ]] |
277 | then |
278 | MCONFIG="/etc/env.d/00glibc" |
279 | maddconfig "LDPATH=\"/$(mlibdir)\"" || die |
280 | maddconfig "LDPATH=\"/usr/$(mlibdir)\"" || die |
281 | maddconfig "LDPATH=\"/usr/local/$(mlibdir)\"" || die |
282 | maddconfig "LDPATH=\"/opt/$(mlibdir)\"" || die |
283 | fi |
284 | |
285 | # strip all binaries |
286 | 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 |
287 | |
288 | # strip all libraries |
289 | # want to be safe here; --strip-unneeded seems to cause pthread problems |
290 | # strip all but libpthread, libc and ld |
291 | install -d ${BUILDDIR}/thread-backup/$(mlibdir) || die |
292 | mv ${BINDIR}/usr/$(mlibdir)/lib{pthread,thread_db,c-}* ${BUILDDIR}/thread-backup/$(mlibdir)/ || die |
293 | mv ${BINDIR}/usr/$(mlibdir)/ld-* ${BUILDDIR}/thread-backup/$(mlibdir)/ || die |
294 | if [[ ${ARCH} = x86_64 ]] |
295 | then |
296 | install -d ${BUILDDIR}/thread-backup/lib || die |
297 | mv ${BINDIR}/usr/lib/lib{pthread,thread_db,c-}* ${BUILDDIR}/thread-backup/lib/ || die |
298 | mv ${BINDIR}/usr/lib/ld-* ${BUILDDIR}/thread-backup/lib/ || die |
299 | fi |
300 | |
301 | # now strip but only debuging symbols |
302 | 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 |
303 | 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 |
304 | mv -f ${BUILDDIR}/thread-backup/$(mlibdir)/* ${BINDIR}/usr/$(mlibdir)/ || die |
305 | if [[ ${ARCH} = x86_64 ]] |
306 | then |
307 | mv -f ${BUILDDIR}/thread-backup/lib/* ${BINDIR}/usr/lib/ || die |
308 | fi |
309 | # remove stale directory |
310 | rm -rf ${BUILDDIR}/thread-backup || die |
311 | |
312 | # prepare glibc for installation; slackware method |
313 | minstalldir /incoming || die |
314 | mv ${BINDIR}/usr/$(mlibdir)/*.so ${BINDIR}/incoming || die |
315 | mv ${BINDIR}/usr/$(mlibdir)/*.so.* ${BINDIR}/incoming || die |
316 | mv ${BINDIR}/incoming ${BINDIR}/usr/$(mlibdir)/incoming || die |
317 | mv ${BINDIR}/usr/$(mlibdir)/incoming/libSegFault.so ${BINDIR}/usr/$(mlibdir) || die |
318 | } |
319 | |
320 | src_install_glibc-dev() |
321 | { |
322 | if [[ ${ARCH} = x86_64 ]] |
323 | then |
324 | # install -m32 libs |
325 | cd ${SRCDIR}/build-m32 |
326 | make PARALLELMFLAGS="${MAKEOPTS}" install_root=${BINDIR} install || die |
327 | fi |
328 | |
329 | cd ${SRCDIR}/build |
330 | make PARALLELMFLAGS="${MAKEOPTS}" install_root=${BINDIR} install || die |
331 | |
332 | # cleanup -> in glibc |
333 | rm ${BINDIR}/usr/$(mlibdir)/*.so || die |
334 | rm ${BINDIR}/usr/$(mlibdir)/*.so.* || die |
335 | rm ${BINDIR}/usr/$(mlibdir)/gconv/CP1252.so || die |
336 | rm ${BINDIR}/usr/$(mlibdir)/gconv/IBM850.so || die |
337 | rm ${BINDIR}/usr/$(mlibdir)/gconv/ISO8859-1.so || die |
338 | rm ${BINDIR}/usr/$(mlibdir)/gconv/ISO8859-15.so || die |
339 | rm ${BINDIR}/usr/$(mlibdir)/gconv/UNICODE.so || die |
340 | rm ${BINDIR}/usr/$(mlibdir)/gconv/UTF-16.so || die |
341 | rm ${BINDIR}/usr/$(mlibdir)/gconv/gconv-modules || die |
342 | if [[ ${ARCH} = x86_64 ]] |
343 | then |
344 | rm ${BINDIR}/usr/lib/*.so || die |
345 | rm ${BINDIR}/usr/lib/*.so.* || die |
346 | rm ${BINDIR}/usr/lib/gconv/CP1252.so || die |
347 | rm ${BINDIR}/usr/lib/gconv/IBM850.so || die |
348 | rm ${BINDIR}/usr/lib/gconv/ISO8859-1.so || die |
349 | rm ${BINDIR}/usr/lib/gconv/ISO8859-15.so || die |
350 | rm ${BINDIR}/usr/lib/gconv/UNICODE.so || die |
351 | rm ${BINDIR}/usr/lib/gconv/UTF-16.so || die |
352 | rm ${BINDIR}/usr/lib/gconv/gconv-modules || die |
353 | fi |
354 | rm ${BINDIR}/usr/sbin/ldconfig || die |
355 | rm ${BINDIR}/usr/bin/iconv || die |
356 | rm ${BINDIR}/usr/bin/locale || die |
357 | rm ${BINDIR}/usr/bin/ldd || die |
358 | rm ${BINDIR}/usr/bin/getent || die |
359 | |
360 | # do not generate the locales here, let it the user do with the locale-gen tool |
361 | # make PARALLELMFLAGS="${MAKEOPTS}" install_root=${BINDIR} localedata/install-locales || die |
362 | |
363 | # install locales list and generate tools |
364 | # generate locale.gen file from localedata/SUPPORTED file |
365 | minstalletc locale.gen-header locale.gen || die |
366 | sed \ |
367 | -e 's:/: :g' \ |
368 | -e 's:\\: :g' \ |
369 | -e 's:SUPPORTED-LOCALES=::' \ |
370 | -e 's:\ \ $::g' \ |
371 | -e '/^#/d' \ |
372 | -e 's:^:#:g' \ |
373 | ${SRCDIR}/localedata/SUPPORTED \ |
374 | >> ${BINDIR}/etc/locale.gen || die |
375 | minstalldir /usr/sbin || die |
376 | minstallexec -s locale-gen /usr/sbin || die |
377 | |
378 | # nscd configuration file |
379 | minstalletc ${SRCDIR}/nscd/nscd.conf || die |
380 | # systemd services, but do not include systemd.sminc to have a hard depend on systemd |
381 | minstalldir /usr/lib/systemd/system || die |
382 | minstallfile ${SRCDIR}/nscd/nscd.service /usr/lib/systemd/system || die |
383 | minstalldir /etc/tmpfiles.d || die |
384 | minstallfile ${SRCDIR}/nscd/nscd.tmpfiles /etc/tmpfiles.d/nscd.conf || die |
385 | |
386 | # gai configuration file |
387 | minstalletc ${SRCDIR}/posix/gai.conf || die |
388 | |
389 | # now in tzdata |
390 | ## we use Berlin as default |
391 | ## busybox compat |
392 | #local args |
393 | #if need_busybox_support /bin/cp |
394 | #then |
395 | # args="-f" |
396 | #else |
397 | # args="--remove-destination" |
398 | #fi |
399 | #cp ${args} ${BINDIR}/usr/share/zoneinfo/Europe/Berlin ${BINDIR}/etc/localtime || die |
400 | [ -f ${BINDIR}/etc/ld.so.conf ] && { rm -f ${BINDIR}/etc/ld.so.conf || die; } |
401 | [ -e ${BINDIR}/etc/ld.so.cache ] && { rm -rf ${BINDIR}/etc/ld.so.cache || die; } |
402 | |
403 | # strip all binaries |
404 | 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 |
405 | |
406 | # now strip but only debuging symbols |
407 | 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 |
408 | 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 |
409 | } |
410 | |
411 | src_install_glibc-locale-de() |
412 | { |
413 | cd ${SRCDIR}/build |
414 | |
415 | # create locale-archive |
416 | minstalldir /usr/$(mlibdir)/locale || die |
417 | locale/localedef \ |
418 | --prefix=${BINDIR} \ |
419 | --inputfile=../localedata/locales/de_DE \ |
420 | --charmap=../localedata/charmaps/UTF-8 \ |
421 | --alias-file=../intl/locale.alias \ |
422 | --force \ |
423 | de_DE.UTF-8 \ |
424 | || die |
425 | |
426 | # test locale-archive |
427 | [[ $(locale/localedef --prefix=${BINDIR} --list-archive) = de_DE.utf8 ]] || die |
428 | } |
429 | |
430 | src_install_glibc-locale-us() |
431 | { |
432 | cd ${SRCDIR}/build |
433 | |
434 | # create locale-archive |
435 | minstalldir /usr/$(mlibdir)/locale || die |
436 | locale/localedef \ |
437 | --prefix=${BINDIR} \ |
438 | --inputfile=../localedata/locales/en_US \ |
439 | --charmap=../localedata/charmaps/UTF-8 \ |
440 | --alias-file=../intl/locale.alias \ |
441 | --force \ |
442 | en_US.UTF-8 \ |
443 | || die |
444 | |
445 | # test locale-archive |
446 | [[ $(locale/localedef --prefix=${BINDIR} --list-archive) = en_US.utf8 ]] || die |
447 | } |
448 | |
449 | fix_db_files() |
450 | { |
451 | local i |
452 | local DB_ENTRY="${BUILDDIR}/${PKGNAME}" |
453 | |
454 | for i in .files .symlinks .dirs |
455 | do |
456 | [ ! -f ${DB_ENTRY}/${i} ] && continue |
457 | [[ -z $(< ${DB_ENTRY}/${i}) ]] && continue |
458 | |
459 | echo " fixing /usr/$(mlibdir)/incoming from db-entry '${i}' ..." |
460 | |
461 | # /usr/lib/incoming -> empty line; sed2 removes all empty lines |
462 | #sed -i -e "s:/$(mlibdir)/incoming.*::g" -e '/^$/d' ${DB_ENTRY}/${i} |
463 | # do not simply emtpy the line, but change it the the correct path, |
464 | # so no stale libs are around if the package gets updated! |
465 | sed -i \ |
466 | -e "s:/usr/$(mlibdir)/incoming:/usr/$(mlibdir):g" \ |
467 | -e "s:/usr/$(mlibdir)/incoming.*::g" \ |
468 | -e '/^$/d' ${DB_ENTRY}/${i} |
469 | done |
470 | } |
471 | |
472 | preinstall_glibc() |
473 | { |
474 | add_conf_prot_mask /etc/env.d /etc/nsswitch.conf |
475 | } |
476 | |
477 | postinstall_glibc() |
478 | { |
479 | # first save the old libpthread.so.0; |
480 | # it will later used to determinate that there are no stale |
481 | # libpthreads that breaks ldconfig |
482 | local OLD_PTHREAD |
483 | OLD_PTHREAD="$(readlink ${MROOT}/usr/$(mlibdir)/libpthread.so.0)" |
484 | |
485 | # slackware install method |
486 | |
487 | # we cannot easily install the glibc libs, |
488 | # because our tools for cp etc needs them to run |
489 | |
490 | local file |
491 | |
492 | echo " Switching to new glibc ..." |
493 | # swap libraries on the fly: |
494 | if [ -x /usr/sbin/ldconfig -a -d /usr/$(mlibdir)/incoming ] && [[ -z ${MROOT} ]] |
495 | then |
496 | # first create copies of the incoming libraries: |
497 | cd /usr/$(mlibdir)/incoming |
498 | for file in $(find /usr/$(mlibdir)/incoming -type f) |
499 | do |
500 | if [ ! -r "../$(basename ${file}).incoming" ] |
501 | then |
502 | cp -a ${file} ../$(basename ${file}).incoming |
503 | fi |
504 | done |
505 | |
506 | # then switch to them all at once: |
507 | /usr/sbin/ldconfig -l /usr/$(mlibdir)/*.incoming 2> /dev/null |
508 | |
509 | # finally, rename them and clean up: |
510 | cd /usr/$(mlibdir) |
511 | for file in *.incoming |
512 | do |
513 | rm -f $(basename ${file} .incoming) |
514 | cp -a ${file} $(basename ${file} .incoming) |
515 | /usr/sbin/ldconfig -l $(basename ${file} .incoming) |
516 | rm -f ${file} |
517 | done |
518 | |
519 | # no ldconfig? |
520 | # good, it's safe to just jam it on home (and make links below): |
521 | else |
522 | ( |
523 | cd ${MROOT}/usr/$(mlibdir)/incoming |
524 | for file in * |
525 | do |
526 | cp -a ${file} .. |
527 | done |
528 | |
529 | local my_sym |
530 | local my_dest |
531 | |
532 | # rebuild symlinks |
533 | echo " Recreating Symlinks:" |
534 | for i in $(find ${MROOT}/usr/$(mlibdir)/incoming -type l) |
535 | do |
536 | my_sym="$(readlink ${i})" |
537 | my_dest="$(basename ${i})" |
538 | |
539 | echo " ${my_dest} -> ${my_dest}" |
540 | |
541 | # assure to remove the old ones; |
542 | [ -L ${MROOT}/usr/$(mlibdir)/"${my_dest}" ] && \ |
543 | rm ${MROOT}/usr/$(mlibdir)/"${my_dest}" |
544 | |
545 | ln -snf "${my_sym}" ${MROOT}/usr/$(mlibdir)/"${my_dest}" |
546 | done |
547 | ) |
548 | fi |
549 | |
550 | # now, get rid of the temporary directory: |
551 | rm -rf ${MROOT}/usr/$(mlibdir)/incoming |
552 | |
553 | # remove stale nptl libpthread-2.?.?.so, |
554 | # fix only needed for glibc with linuxthreads; |
555 | # prevent reloc errors such as: |
556 | # ls: error while loading shared libraries: libpthread.so.0: cannot open shared object file: No such file or directory |
557 | |
558 | # get our new libpthread.so.0 |
559 | local NEW_PTHREAD |
560 | NEW_PTHREAD="$(readlink ${MROOT}/usr/$(mlibdir)/libpthread.so.0)" |
561 | |
562 | if [ "${NEW_PTHREAD}" != "${OLD_PTHREAD}" ] |
563 | then |
564 | echo " Removing stale libpthread libraries ..." |
565 | for file in ${MROOT}/usr/$(mlibdir)/libpthread-* |
566 | do |
567 | if [ "$(basename ${file})" != "${NEW_PTHREAD}" ] |
568 | then |
569 | rm -f ${file} |
570 | fi |
571 | done |
572 | |
573 | #rm -f /lib/${OLD_PTHREAD} |
574 | |
575 | ln -snf ${NEW_PTHREAD} ${MROOT}/usr/$(mlibdir)/libpthread.so.0 |
576 | fi |
577 | |
578 | # now we must fix the mage db files |
579 | # to stop the annoying errors messages |
580 | fix_db_files |
581 | } |
582 | |
583 | postinstall_glibc-dev() |
584 | { |
585 | if [ -x /usr/sbin/iconvconfig ] |
586 | then |
587 | # generate fastloading iconv module configuration file. |
588 | echo " Generate iconv module config ..." |
589 | /usr/sbin/iconvconfig --prefix=${MROOT}/ |
590 | fi |
591 | |
592 | # not working with busybox |
593 | if ! need_busybox_support /sbin/init |
594 | then |
595 | # reloading init |
596 | echo " Reloading init ..." |
597 | [[ -z ${MROOT} ]] && /sbin/init U &> /dev/null |
598 | fi |
599 | |
600 | # generating user def locales |
601 | echo " Generating user defined locales ..." |
602 | [[ -z ${MROOT} ]] && /usr/sbin/locale-gen |
603 | } |