Annotation of /smage/trunk/core/glibc/glibc-2.36-r1.smage2
Parent Directory | Revision Log
Revision 15654 -
(hide annotations)
(download)
Mon Dec 19 08:45:57 2022 UTC (17 months, 3 weeks ago) by niro
File size: 18445 byte(s)
Mon Dec 19 08:45:57 2022 UTC (17 months, 3 weeks ago) by niro
File size: 18445 byte(s)
auto added: ver bump to 2.36-r1
1 | niro | 15650 | # $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 | niro | 15654 | mv ${BINDIR}/usr/$(mlibdir)/lib{pthread,thread_db,c.}* ${BUILDDIR}/thread-backup/$(mlibdir)/ || die |
296 | niro | 15650 | 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 | niro | 15654 | mv ${BINDIR}/usr/lib/lib{pthread,thread_db,c.}* ${BUILDDIR}/thread-backup/lib/ || die |
301 | niro | 15650 | 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 | niro | 15654 | #locale/localedef |
421 | localedef \ | ||
422 | niro | 15650 | --prefix=${BINDIR} \ |
423 | --inputfile=../localedata/locales/de_DE \ | ||
424 | --charmap=../localedata/charmaps/UTF-8 \ | ||
425 | --alias-file=../intl/locale.alias \ | ||
426 | --force \ | ||
427 | de_DE.UTF-8 \ | ||
428 | || die | ||
429 | |||
430 | # test locale-archive | ||
431 | niro | 15654 | #[[ $(locale/localedef --prefix=${BINDIR} --list-archive) = de_DE.utf8 ]] || die |
432 | [[ $(localedef --prefix=${BINDIR} --list-archive) = de_DE.utf8 ]] || die | ||
433 | niro | 15650 | } |
434 | |||
435 | src_install_glibc-locale-us() | ||
436 | { | ||
437 | cd ${SRCDIR}/build | ||
438 | |||
439 | # create locale-archive | ||
440 | minstalldir /usr/$(mlibdir)/locale || die | ||
441 | niro | 15654 | #locale/localedef |
442 | localedef \ | ||
443 | niro | 15650 | --prefix=${BINDIR} \ |
444 | --inputfile=../localedata/locales/en_US \ | ||
445 | --charmap=../localedata/charmaps/UTF-8 \ | ||
446 | --alias-file=../intl/locale.alias \ | ||
447 | --force \ | ||
448 | en_US.UTF-8 \ | ||
449 | || die | ||
450 | |||
451 | # test locale-archive | ||
452 | niro | 15654 | #[[ $(locale/localedef --prefix=${BINDIR} --list-archive) = en_US.utf8 ]] || die |
453 | [[ $(localedef --prefix=${BINDIR} --list-archive) = en_US.utf8 ]] || die | ||
454 | niro | 15650 | } |
455 | |||
456 | fix_db_files() | ||
457 | { | ||
458 | local i | ||
459 | local DB_ENTRY="${BUILDDIR}/${PKGNAME}" | ||
460 | |||
461 | for i in .files .symlinks .dirs | ||
462 | do | ||
463 | [ ! -f ${DB_ENTRY}/${i} ] && continue | ||
464 | [[ -z $(< ${DB_ENTRY}/${i}) ]] && continue | ||
465 | |||
466 | echo " fixing /usr/$(mlibdir)/incoming from db-entry '${i}' ..." | ||
467 | |||
468 | # /usr/lib/incoming -> empty line; sed2 removes all empty lines | ||
469 | #sed -i -e "s:/$(mlibdir)/incoming.*::g" -e '/^$/d' ${DB_ENTRY}/${i} | ||
470 | # do not simply emtpy the line, but change it the the correct path, | ||
471 | # so no stale libs are around if the package gets updated! | ||
472 | sed -i \ | ||
473 | -e "s:/usr/$(mlibdir)/incoming:/usr/$(mlibdir):g" \ | ||
474 | -e "s:/usr/$(mlibdir)/incoming.*::g" \ | ||
475 | -e '/^$/d' ${DB_ENTRY}/${i} | ||
476 | done | ||
477 | } | ||
478 | |||
479 | preinstall_glibc() | ||
480 | { | ||
481 | add_conf_prot_mask /etc/env.d /etc/nsswitch.conf | ||
482 | } | ||
483 | |||
484 | postinstall_glibc() | ||
485 | { | ||
486 | # first save the old libpthread.so.0; | ||
487 | # it will later used to determinate that there are no stale | ||
488 | # libpthreads that breaks ldconfig | ||
489 | local OLD_PTHREAD | ||
490 | OLD_PTHREAD="$(readlink ${MROOT}/usr/$(mlibdir)/libpthread.so.0)" | ||
491 | |||
492 | # # slackware install method | ||
493 | # | ||
494 | # # we cannot easily install the glibc libs, | ||
495 | # # because our tools for cp etc needs them to run | ||
496 | # | ||
497 | # local file | ||
498 | # | ||
499 | # echo " Switching to new glibc ..." | ||
500 | # # swap libraries on the fly: | ||
501 | # if [ -x /usr/sbin/ldconfig -a -d /usr/$(mlibdir)/incoming ] && [[ -z ${MROOT} ]] | ||
502 | # then | ||
503 | # # first create copies of the incoming libraries: | ||
504 | # cd /usr/$(mlibdir)/incoming | ||
505 | # for file in $(find /usr/$(mlibdir)/incoming -type f) | ||
506 | # do | ||
507 | # if [ ! -r "../$(basename ${file}).incoming" ] | ||
508 | # then | ||
509 | # cp -a ${file} ../$(basename ${file}).incoming | ||
510 | # fi | ||
511 | # done | ||
512 | # | ||
513 | # # then switch to them all at once: | ||
514 | # /usr/sbin/ldconfig -l /usr/$(mlibdir)/*.incoming 2> /dev/null | ||
515 | # | ||
516 | # # finally, rename them and clean up: | ||
517 | # cd /usr/$(mlibdir) | ||
518 | # for file in *.incoming | ||
519 | # do | ||
520 | # rm -f $(basename ${file} .incoming) | ||
521 | # cp -a ${file} $(basename ${file} .incoming) | ||
522 | # /usr/sbin/ldconfig -l $(basename ${file} .incoming) | ||
523 | # rm -f ${file} | ||
524 | # done | ||
525 | # | ||
526 | # # no ldconfig? | ||
527 | # # good, it's safe to just jam it on home (and make links below): | ||
528 | # else | ||
529 | # ( | ||
530 | # cd ${MROOT}/usr/$(mlibdir)/incoming | ||
531 | # for file in * | ||
532 | # do | ||
533 | # cp -a ${file} .. | ||
534 | # done | ||
535 | # | ||
536 | # local my_sym | ||
537 | # local my_dest | ||
538 | # | ||
539 | # # rebuild symlinks | ||
540 | # echo " Recreating Symlinks:" | ||
541 | # for i in $(find ${MROOT}/usr/$(mlibdir)/incoming -type l) | ||
542 | # do | ||
543 | # my_sym="$(readlink ${i})" | ||
544 | # my_dest="$(basename ${i})" | ||
545 | # | ||
546 | # echo " ${my_dest} -> ${my_dest}" | ||
547 | # | ||
548 | # # assure to remove the old ones; | ||
549 | # [ -L ${MROOT}/usr/$(mlibdir)/"${my_dest}" ] && \ | ||
550 | # rm ${MROOT}/usr/$(mlibdir)/"${my_dest}" | ||
551 | # | ||
552 | # ln -snf "${my_sym}" ${MROOT}/usr/$(mlibdir)/"${my_dest}" | ||
553 | # done | ||
554 | # ) | ||
555 | # fi | ||
556 | # | ||
557 | # # now, get rid of the temporary directory: | ||
558 | # rm -rf ${MROOT}/usr/$(mlibdir)/incoming | ||
559 | |||
560 | # remove stale nptl libpthread-2.?.?.so, | ||
561 | # fix only needed for glibc with linuxthreads; | ||
562 | # prevent reloc errors such as: | ||
563 | # ls: error while loading shared libraries: libpthread.so.0: cannot open shared object file: No such file or directory | ||
564 | |||
565 | # get our new libpthread.so.0 | ||
566 | local NEW_PTHREAD | ||
567 | NEW_PTHREAD="$(readlink ${MROOT}/usr/$(mlibdir)/libpthread.so.0)" | ||
568 | |||
569 | if [ "${NEW_PTHREAD}" != "${OLD_PTHREAD}" ] | ||
570 | then | ||
571 | echo " Removing stale libpthread libraries ..." | ||
572 | for file in ${MROOT}/usr/$(mlibdir)/libpthread-* | ||
573 | do | ||
574 | if [ "$(basename ${file})" != "${NEW_PTHREAD}" ] | ||
575 | then | ||
576 | rm -f ${file} | ||
577 | fi | ||
578 | done | ||
579 | |||
580 | #rm -f /lib/${OLD_PTHREAD} | ||
581 | |||
582 | ln -snf ${NEW_PTHREAD} ${MROOT}/usr/$(mlibdir)/libpthread.so.0 | ||
583 | fi | ||
584 | |||
585 | # # now we must fix the mage db files | ||
586 | # # to stop the annoying errors messages | ||
587 | # fix_db_files | ||
588 | } | ||
589 | |||
590 | postinstall_glibc-dev() | ||
591 | { | ||
592 | if [ -x /usr/sbin/iconvconfig ] | ||
593 | then | ||
594 | # generate fastloading iconv module configuration file. | ||
595 | echo " Generate iconv module config ..." | ||
596 | /usr/sbin/iconvconfig --prefix=${MROOT}/ | ||
597 | fi | ||
598 | |||
599 | # not working with busybox | ||
600 | if ! need_busybox_support /sbin/init | ||
601 | then | ||
602 | # reloading init | ||
603 | echo " Reloading init ..." | ||
604 | [[ -z ${MROOT} ]] && /sbin/init U &> /dev/null | ||
605 | fi | ||
606 | |||
607 | # generating user def locales | ||
608 | echo " Generating user defined locales ..." | ||
609 | [[ -z ${MROOT} ]] && /usr/sbin/locale-gen | ||
610 | } |