Magellan Linux

Contents of /smage/trunk/core/glibc/glibc-2.26-r1.smage2

Parent Directory Parent Directory | Revision Log Revision Log


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