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