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