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