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