wok view glibc/receipt @ rev 10026

gmp, mpc-library, mpfr: fix build system wirh --build and --host from CONFIGURE_ARGS
author Christophe Lincoln <pankso@slitaz.org>
date Thu May 19 21:14:41 2011 +0200 (2011-05-19)
parents c8fb53e181a8
children fcc533f679e7
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 # If i686 ???
31 case $ARCH in
32 i?86) echo "CFLAGS += -march=i486 -mtune=native" > configparms ;;
33 esac
35 { $src/configure \
36 --host=$BUILD_HOST \
37 --build=$($src/scripts/config.guess) \
38 --disable-profile --enable-add-ons \
39 --enable-kernel=2.6.22.5 --with-headers=/tools/include \
40 libc_cv_forced_unwind=yes libc_cv_c_cleanup=yes &&
41 make &&
42 make install
43 } || return 1
45 # Link compiler to this new glibc.
46 SPECS=`dirname $($BUILD_HOST-gcc -print-libgcc-file-name)`/specs
47 $BUILD_HOST-gcc -dumpspecs | sed \
48 -e 's@/lib\(64\)\?/ld@/tools&@g' \
49 -e "/^\*cpp:$/{n;s,$, -isystem /tools/include,}" > $SPECS
50 unset SPECS
51 }
53 # Rules to configure and make the package.
54 compile_rules()
55 {
56 # Some patch are needed to make things work correctly.
57 # Following patches and sed fixes comes from LFS development book :
58 # http://www.linuxfromscratch.org/lfs/view/development/chapter06/glibc.html
59 cd $src
60 DL=$(readelf -l /bin/sh | sed -n 's@.*interpret.*/tools\(.*\)]$@\1@p')
61 sed -i "s|libs -o|libs -L/usr/lib -Wl,-dynamic-linker=$DL -o|" \
62 scripts/test-installation.pl
63 unset DL
64 sed -i -e 's/"db1"/& \&\& $name ne "nss_test1"/' scripts/test-installation.pl
65 sed -i 's|@BASH@|/bin/bash|' elf/ldd.bash.in
67 # Fix a bug that prevents Glibc from building with GCC-4.5.2:
68 patch -Np1 -i $stuff/glibc-2.13-gcc_fix-1.patch
70 # Fix a stack imbalance that occurs under some conditions:
71 sed -i '195,213 s/PRIVATE_FUTEX/FUTEX_CLOCK_REALTIME/' \
72 nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedrdlock.S \
73 nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedwrlock.S
75 mkdir ../glibc-build
76 cd ../glibc-build
78 # Install in the build tree and then move all files
79 # to the source tree to keep $src and $_pkg for genpkg.
80 mkdir -p $WOK/$PACKAGE/install/etc
81 touch $WOK/$PACKAGE/install/etc/ld.so.conf
82 # Use -march=i486 for better compatibility. Also Glibc dont build with -Os.
83 unset CFLAGS
84 case $ARCH in
85 i386|i486)
86 echo "CFLAGS += -O2 -march=i486 -pipe -fomit-frame-pointer" > \
87 configparms ;;
88 *)
89 echo "CFLAGS += -O2 -march=$ARCH -pipe -fomit-frame-pointer" > \
90 configparms ;;
91 esac
92 { $src/configure \
93 --disable-profile \
94 --enable-add-ons \
95 --enable-kernel=2.6.22.5 \
96 --libexecdir=/usr/lib/glibc \
97 $CONFIGURE_ARGS &&
98 make &&
99 make install_root=$DESTDIR install
100 } || return 1
102 # If temporary toolchain was previously used, switch to
103 # regular toolchain.
104 [ -d /tools ] || return
105 mv /tools/bin/ld /tools/bin/ld-old
106 mv /tools/$(gcc -dumpmachine)/bin/ld /tools/$(gcc -dumpmachine)/bin/ld-old
107 mv /tools/bin/ld-new /tools/bin/ld
108 ln -s /tools/bin/ld /tools/$(gcc -dumpmachine)/bin/ld
109 gcc -dumpspecs | sed -e 's@/tools@@g' \
110 -e '/\*startfile_prefix_spec:/{n;s@.*@/usr/lib/ @}' \
111 -e '/\*cpp:/{n;s@$@ -isystem /usr/include@}' > \
112 `dirname $(gcc --print-libgcc-file-name)`/specs
113 }
115 # Rules to gen a SliTaz package suitable for Tazpkg.
116 genpkg_rules()
117 {
118 LOCALE=""
119 mkdir -p $fs/var
121 # Remove build directory.
122 rm -rf $WOK/$PACKAGE/source/$PACKAGE-build
123 rm -rf $WOK/$PACKAGE/$PACKAGE-build
124 }