wok view glibc/receipt @ rev 9714

glibc: like GCC also need gawk
author Christophe Lincoln <pankso@slitaz.org>
date Sun May 08 23:33:17 2011 +0200 (2011-05-08)
parents cefe5a63f9c0
children 0fc448aca6fe
line source
1 # SliTaz package receipt.
3 PACKAGE="glibc"
4 VERSION="2.13"
5 CATEGORY="meta"
6 SHORT_DESC="The GNU C libraries. This package is used to compile the libc."
7 MAINTAINER="pankso@slitaz.org"
8 TARBALL="$PACKAGE-$VERSION.tar.gz"
9 WEB_SITE="http://www.gnu.org/software/libc/"
10 WGET_URL="$GNU_MIRROR/$PACKAGE/$TARBALL"
12 DEPENDS="glibc-base glibc-locale glibc-dev"
13 BUILD_DEPENDS="linux-api-headers gawk"
15 # Genpkg order for tazwok.
16 COOK_OPT="genpkg=glibc-base:glibc-extra-samba:glib-locale:glibc-dev"
18 # Rules to compile & install the temporary toolchain.
19 cook_tmp_toolchain()
20 {
21 cd $src
23 # Fix a bug that prevents Glibc from building with GCC-4.5.2:
24 patch -Np1 -i $stuff/glibc-2.13-gcc_fix-1.patch
26 # Build in a separate directory.
27 mkdir ../glibc-build && cd ../glibc-build
29 # glibc no longer support i386, so use -march=i486 for better compatibility.
30 case $ARCH in
31 i?86) echo "CFLAGS += -march=i486 -mtune=native" > configparms ;;
32 esac
34 { $src/configure \
35 --host=$BUILD_HOST \
36 --build=$($src/scripts/config.guess) \
37 --disable-profile --enable-add-ons \
38 --enable-kernel=2.6.22.5 --with-headers=/tools/include \
39 libc_cv_forced_unwind=yes libc_cv_c_cleanup=yes &&
40 make &&
41 make install
42 } || return 1
44 # Link compiler to this new glibc.
45 SPECS=`dirname $($BUILD_HOST-gcc -print-libgcc-file-name)`/specs
46 $BUILD_HOST-gcc -dumpspecs | sed \
47 -e 's@/lib\(64\)\?/ld@/tools&@g' \
48 -e "/^\*cpp:$/{n;s,$, -isystem /tools/include,}" > $SPECS
49 unset SPECS
50 }
52 # Rules to configure and make the package.
53 compile_rules()
54 {
55 # Some patch are needed to make things work correctly.
56 # Following patches and sed fixes comes from LFS development book :
57 # http://www.linuxfromscratch.org/lfs/view/development/chapter06/glibc.html
58 cd $src
59 DL=$(readelf -l /bin/sh | sed -n 's@.*interpret.*/tools\(.*\)]$@\1@p')
60 sed -i "s|libs -o|libs -L/usr/lib -Wl,-dynamic-linker=$DL -o|" \
61 scripts/test-installation.pl
62 unset DL
63 sed -i -e 's/"db1"/& \&\& $name ne "nss_test1"/' scripts/test-installation.pl
64 sed -i 's|@BASH@|/bin/bash|' elf/ldd.bash.in
66 # Fix a bug that prevents Glibc from building with GCC-4.5.2:
67 patch -Np1 -i $stuff/glibc-2.13-gcc_fix-1.patch
69 # Fix a stack imbalance that occurs under some conditions:
70 sed -i '195,213 s/PRIVATE_FUTEX/FUTEX_CLOCK_REALTIME/' \
71 nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedrdlock.S \
72 nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedwrlock.S
74 mkdir ../glibc-build
75 cd ../glibc-build
77 # Install in the build tree and then move all files
78 # to the source tree to keep $src and $_pkg for genpkg.
79 mkdir -p $WOK/$PACKAGE/install/etc
80 touch $WOK/$PACKAGE/install/etc/ld.so.conf
81 echo "CFLAGS += $CFLAGS" > configparms
82 { $src/configure \
83 --disable-profile \
84 --enable-add-ons \
85 --enable-kernel=2.6.22.5 \
86 --libexecdir=/usr/lib/glibc &&
87 make &&
88 make install_root=$DESTDIR install
89 } || return 1
91 # If temporary toolchain was previously used, switch to
92 # regular toolchain.
93 [ -d /tools ] || return
94 mv /tools/bin/ld /tools/bin/ld-old
95 mv /tools/$(gcc -dumpmachine)/bin/ld /tools/$(gcc -dumpmachine)/bin/ld-old
96 mv /tools/bin/ld-new /tools/bin/ld
97 ln -s /tools/bin/ld /tools/$(gcc -dumpmachine)/bin/ld
98 gcc -dumpspecs | sed -e 's@/tools@@g' \
99 -e '/\*startfile_prefix_spec:/{n;s@.*@/usr/lib/ @}' \
100 -e '/\*cpp:/{n;s@$@ -isystem /usr/include@}' > \
101 `dirname $(gcc --print-libgcc-file-name)`/specs
102 }
104 # Rules to gen a SliTaz package suitable for Tazpkg.
105 genpkg_rules()
106 {
107 LOCALE=""
108 mkdir -p $fs/var
110 # Remove build directory.
111 rm -rf $WOK/$PACKAGE/source/$PACKAGE-build
112 rm -rf $WOK/$PACKAGE/$PACKAGE-build
113 }