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