Magellan Linux

Contents of /smage/trunk/core/glibc/glibc-2.25-r4.smage2

Parent Directory Parent Directory | Revision Log Revision Log


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