wok annotate glibc/receipt @ rev 8189

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