wok view glibc/receipt @ rev 11540

up: asunder (2.1)
author Eric Joseph-Alexandre <erjo@slitaz.org>
date Sun Dec 25 13:28:57 2011 +0100 (2011-12-25)
parents 53b83e72d907
children 05dc6adaa091
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"
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 unset CFLAGS CXXFLAGS
32 case $ARCH in
33 i386|i486)
34 echo "CFLAGS += -O2 -march=i486 -mtune=native" > configparms ;;
35 *)
36 echo "CFLAGS += -O2 -march=$ARCH -mtune=native" > configparms ;;
37 esac
39 { $src/configure \
40 --host=$HOST_SYSTEM \
41 --build=$($src/scripts/config.guess) \
42 --disable-profile --enable-add-ons \
43 --enable-kernel=2.6.30 --with-headers=/tools/include \
44 libc_cv_forced_unwind=yes libc_cv_c_cleanup=yes &&
45 make &&
46 make install
47 } || return 1
49 # Link compiler to this new glibc.
50 SPECS=`dirname $($HOST_SYSTEM-gcc -print-libgcc-file-name)`/specs
51 $HOST_SYSTEM-gcc -dumpspecs | sed \
52 -e 's@/lib\(64\)\?/ld@/tools&@g' \
53 -e "/^\*cpp:$/{n;s,$, -isystem /tools/include,}" > $SPECS
54 unset SPECS
55 }
57 # Rules to configure and make the package.
58 compile_rules()
59 {
60 cd $src
62 # SliTaz is a Busybox based OS, why we so small and fast. Using gawk by
63 # default to build package will not ensure package work with Busybox awk
64 # and so should NOT be use to cook.
65 if [ -x /usr/bin/cook ]; then
66 [ -d "/var/lib/tazpkg/installed/gawk" ] || tazpkg get-install gawk
67 fi
69 # Following patches and sed fixes comes from LFS development book:
70 # http://www.linuxfromscratch.org/lfs/view/development/chapter06/glibc.html
71 DL=$(readelf -l /bin/sh | sed -n 's@.*interpret.*/tools\(.*\)]$@\1@p')
72 sed -i "s|libs -o|libs -L/usr/lib -Wl,-dynamic-linker=$DL -o|" \
73 scripts/test-installation.pl
74 unset DL
75 sed -i -e 's/"db1"/& \&\& $name ne "nss_test1"/' scripts/test-installation.pl
76 sed -i 's|@BASH@|/bin/bash|' elf/ldd.bash.in
78 # Fix a bug that prevents Glibc from building with GCC-4.5.2:
79 patch -Np1 -i $stuff/glibc-2.13-gcc_fix-1.patch
81 # Fix a stack imbalance that occurs under some conditions:
82 sed -i '195,213 s/PRIVATE_FUTEX/FUTEX_CLOCK_REALTIME/' \
83 nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedrdlock.S \
84 nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedwrlock.S
86 # Glibc needs ld.so.conf in the install destdir.
87 mkdir -p $WOK/$PACKAGE/install/etc
88 touch $WOK/$PACKAGE/install/etc/ld.so.conf
89 mkdir ../glibc-build && cd ../glibc-build
91 # Read the INSTALL file in glibc. Also Glibc dont build with -Os flag.
92 # --enale-kernel use latest SliTaz Kernel version. From Glibc INSTALL:
93 # "The higher the VERSION number is, the less compatibility code is
94 # added, and the faster the code gets."
95 unset CFLAGS CXXFLAGS
96 case "$ARCH" in
97 i386|i486)
98 echo "CFLAGS += -O2 -march=i486 -mtune=native" > configparms ;;
99 *)
100 echo "CFLAGS += -O2 -march=$ARCH -mtune=native" > configparms ;;
101 esac
102 { $src/configure \
103 --disable-profile \
104 --enable-add-ons \
105 --enable-kernel=2.6.30 \
106 --libexecdir=/usr/lib/glibc \
107 --build=$HOST_SYSTEM \
108 --host=$HOST_SYSTEM &&
109 make && make install_root=$DESTDIR install
110 } || return 1
112 # If temporary toolchain was previously used, switch to regular toolchain.
113 [ -d /tools ] || return
114 mv /tools/bin/ld /tools/bin/ld-old
115 mv /tools/$(gcc -dumpmachine)/bin/ld /tools/$(gcc -dumpmachine)/bin/ld-old
116 mv /tools/bin/ld-new /tools/bin/ld
117 ln -s /tools/bin/ld /tools/$(gcc -dumpmachine)/bin/ld
118 gcc -dumpspecs | sed -e 's@/tools@@g' \
119 -e '/\*startfile_prefix_spec:/{n;s@.*@/usr/lib/ @}' \
120 -e '/\*cpp:/{n;s@$@ -isystem /usr/include@}' > \
121 `dirname $(gcc --print-libgcc-file-name)`/specs
122 }
124 # Rules to gen a SliTaz package suitable for Tazpkg.
125 genpkg_rules()
126 {
127 LOCALE=""
128 mkdir -p $fs/var
130 # Remove build directory.
131 rm -rf $WOK/$PACKAGE/source/$PACKAGE-build
132 rm -rf $WOK/$PACKAGE/$PACKAGE-build
133 }