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