wok 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 85505c8dd53a
children 79a8dffadd9f
files glibc/receipt glibc/stuff/glibc-2.12.2-gcc_fix-1.patch
line diff
     1.1 --- a/glibc/receipt	Thu Jan 27 00:20:50 2011 +0100
     1.2 +++ b/glibc/receipt	Thu Jan 27 00:20:50 2011 +0100
     1.3 @@ -1,39 +1,96 @@
     1.4  # SliTaz package receipt.
     1.5  
     1.6  PACKAGE="glibc"
     1.7 -VERSION="2.11.2"
     1.8 +VERSION="2.12.2"
     1.9  CATEGORY="meta"
    1.10  SHORT_DESC="The GNU C libraries. This package is used to compile the libc."
    1.11  MAINTAINER="pankso@slitaz.org"
    1.12  DEPENDS="glibc-base glibc-locale glibc-dev"
    1.13 -BUILD_DEPENDS="slitaz-toolchain gawk perl"
    1.14 +BUILD_DEPENDS="linux-api-headers"
    1.15  TARBALL="$PACKAGE-$VERSION.tar.gz"
    1.16  WEB_SITE="http://www.gnu.org/software/libc/"
    1.17  WGET_URL="$GNU_MIRROR/$PACKAGE/$TARBALL"
    1.18 +# Genpkg order: glibc-base, glibc-locale, glibc-dev.
    1.19 +COOK_OPT="genpkg=glibc-base:glib-locale:glibc-dev"
    1.20 +	
    1.21 +# Rules to compile & install the temporary toolchain.
    1.22 +cook_tmp_toolchain()
    1.23 +{
    1.24 +	cd $src
    1.25 +
    1.26 +	# Fix a bug that prevents Glibc from building with GCC-4.5.2:
    1.27 +	patch -Np1 -i ../stuff/glibc-2.12.2-gcc_fix-1.patch
    1.28 +
    1.29 +	# Build in a separate directory.
    1.30 +	mkdir ../glibc-build && cd ../glibc-build
    1.31 +
    1.32 +	# glibc no longer support i386, so use -march=i486 for better compatibility.
    1.33 +	case $ARCH in
    1.34 +		i?86) echo "CFLAGS += -march=i486 -mtune=native" > configparms ;;
    1.35 +	esac
    1.36 +
    1.37 +	{ $src/configure \
    1.38 +		--host=$BUILD_HOST \
    1.39 +		--build=$($src/scripts/config.guess) \
    1.40 +		--disable-profile --enable-add-ons \
    1.41 +		--enable-kernel=2.6.22.5 --with-headers=/tools/include \
    1.42 +		libc_cv_forced_unwind=yes libc_cv_c_cleanup=yes &&
    1.43 +	make &&
    1.44 +	make install
    1.45 +	} || return 1
    1.46 +
    1.47 +	# Link compiler to this new glibc.
    1.48 +	SPECS=`dirname $($BUILD_HOST-gcc -print-libgcc-file-name)`/specs
    1.49 +	$BUILD_HOST-gcc -dumpspecs | sed \
    1.50 +		-e 's@/lib\(64\)\?/ld@/tools&@g' \
    1.51 +		-e "/^\*cpp:$/{n;s,$, -isystem /tools/include,}" > $SPECS 
    1.52 +	unset SPECS
    1.53 +}
    1.54  
    1.55  # Rules to configure and make the package.
    1.56 -#
    1.57 -# Build order: glibc, glibc-base, glibc-locale, glibc-dev.
    1.58 -#
    1.59  compile_rules()
    1.60  {
    1.61 -	mkdir glibc-build
    1.62 -	cd glibc-build
    1.63 +	# Some patch are needed to make things work correctly.
    1.64 +	# Following patches and sed fixes comes from LFS development book :
    1.65 +	# http://www.linuxfromscratch.org/lfs/view/development/chapter06/glibc.html
    1.66 +	cd $src
    1.67 +	DL=$(readelf -l /bin/sh | sed -n 's@.*interpret.*/tools\(.*\)]$@\1@p')
    1.68 +	sed -i "s|libs -o|libs -L/usr/lib -Wl,-dynamic-linker=$DL -o|" \
    1.69 +		scripts/test-installation.pl
    1.70 +	unset DL
    1.71 +	sed -i 's|@BASH@|/bin/bash|' elf/ldd.bash.in
    1.72 +
    1.73 +	# Fix a bug that prevents Glibc from building with GCC-4.5.2:
    1.74 +	patch -Np1 -i ../stuff/glibc-2.12.2-gcc_fix-1.patch
    1.75 +
    1.76 +	mkdir ../glibc-build
    1.77 +	cd ../glibc-build
    1.78 +
    1.79  	# Install in the build tree and then move all files
    1.80  	# to the source tree to keep $src and $_pkg for genpkg.
    1.81 -	mkdir -p ../$PACKAGE-$VERSION/_pkg/etc
    1.82 -	touch ../$PACKAGE-$VERSION/_pkg/etc/ld.so.conf
    1.83 -	#echo "CFLAGS += -march=i486 -mtune=native -O3 -pipe" > configparms
    1.84 -	../$PACKAGE-$VERSION/configure \
    1.85 -		--prefix=/usr \
    1.86 -		--infodir=/usr/share/info \
    1.87 +	mkdir -p $WOK/$PACKAGE/install/etc
    1.88 +	touch $WOK/$PACKAGE/install/etc/ld.so.conf
    1.89 +	echo "CFLAGS += $CFLAGS" > configparms
    1.90 +	{ $src/configure \
    1.91  		--disable-profile \
    1.92  		--enable-add-ons \
    1.93 -		--enable-kernel=2.6.18 \
    1.94 -		--libexecdir=/usr/lib/glibc \
    1.95 -		$CONFIGURE_ARGS &&
    1.96 -	make -j 4 &&
    1.97 -	make install_root=$(cd ../$PACKAGE-$VERSION ; pwd)/_pkg install
    1.98 +		--enable-kernel=2.6.22.5 \
    1.99 +		--libexecdir=/usr/lib/glibc &&
   1.100 +	make &&
   1.101 +	make install_root=$DESTDIR install
   1.102 +	} || return 1
   1.103 +
   1.104 +	# If temporary toolchain was previously used, switch to
   1.105 +	# regular toolchain.
   1.106 +	[ -d /tools ] || return
   1.107 +	mv /tools/bin/ld /tools/bin/ld-old
   1.108 +	mv /tools/$(gcc -dumpmachine)/bin/ld /tools/$(gcc -dumpmachine)/bin/ld-old
   1.109 +	mv /tools/bin/ld-new /tools/bin/ld
   1.110 +	ln -s /tools/bin/ld /tools/$(gcc -dumpmachine)/bin/ld
   1.111 +	gcc -dumpspecs | sed -e 's@/tools@@g' \
   1.112 +		-e '/\*startfile_prefix_spec:/{n;s@.*@/usr/lib/ @}' \
   1.113 +		-e '/\*cpp:/{n;s@$@ -isystem /usr/include@}' > \
   1.114 +		`dirname $(gcc --print-libgcc-file-name)`/specs
   1.115  }
   1.116  
   1.117  # Rules to gen a SliTaz package suitable for Tazpkg.
   1.118 @@ -41,10 +98,7 @@
   1.119  {
   1.120  	LOCALE=""
   1.121  	mkdir -p $fs/var
   1.122 -	for i in $(grep -l '^WANTED="glibc"' $WOK/*/receipt); do
   1.123 -		tazwok genpkg $(basename $(dirname $i))
   1.124 -	done
   1.125 -	echo ""
   1.126 -	echo "--> Install glibc-base, glibc-dev and cook busybox"
   1.127 -	echo ""
   1.128 +
   1.129 +	# Remove build directory.
   1.130 +	rm -r $WOK/$PACKAGE/$PACKAGE-build
   1.131  }
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/glibc/stuff/glibc-2.12.2-gcc_fix-1.patch	Thu Jan 27 00:20:50 2011 +0100
     2.3 @@ -0,0 +1,49 @@
     2.4 +Submitted By:            Matt Burgess <matthew_at_linuxfromscratch_dot_org>
     2.5 +Date:                    2010-04-18
     2.6 +Initial Package Version: 2.11.1
     2.7 +Upstream Status:         Not Submitted
     2.8 +Origin:                  http://www.eglibc.org/archives/patches/msg00073.html
     2.9 +Description:             Fixes the following build problem with GCC-4.5.0:
    2.10 +
    2.11 +/mnt/lfs/sources/libc-build/math/s_frexp.os.dt -MT /mnt/lfs/sources/libc-build/math/s_frexp.os
    2.12 +./sysdeps/i386/fpu/s_frexp.S: Assembler messages:
    2.13 +./sysdeps/i386/fpu/s_frexp.S:66: Error: invalid identifier for ".ifdef"
    2.14 +./sysdeps/i386/fpu/s_frexp.S:66: Error: junk at end of line, first unrecognized character is `1'
    2.15 +./sysdeps/i386/fpu/s_frexp.S:66: Error: junk at end of line, first unrecognized character is `1'
    2.16 +./sysdeps/i386/fpu/s_frexp.S:66: Error: junk at end of line, first unrecognized character is `1'
    2.17 +./sysdeps/i386/fpu/s_frexp.S:66: Error: junk at end of line, first unrecognized character is `.'
    2.18 +./sysdeps/i386/fpu/s_frexp.S:66: Error: junk at end of line, first unrecognized character is `1'
    2.19 +./sysdeps/i386/fpu/s_frexp.S:66: Error: expected comma after name `' in .size directive
    2.20 +./sysdeps/i386/fpu/s_frexp.S:66: Error: ".endif" without ".if"
    2.21 +./sysdeps/i386/fpu/s_frexp.S:66: Error: junk `.get_pc_thunk.dx' after expression
    2.22 +make[2]: *** [/mnt/lfs/sources/libc-build/math/s_frexp.os] Error 1
    2.23 +
    2.24 +diff -Naur glibc-2.11.1.orig/nptl/sysdeps/pthread/pt-initfini.c glibc-2.11.1/nptl/sysdeps/pthread/pt-initfini.c
    2.25 +--- glibc-2.11.1.orig/nptl/sysdeps/pthread/pt-initfini.c	2009-12-08 20:10:20.000000000 +0000
    2.26 ++++ glibc-2.11.1/nptl/sysdeps/pthread/pt-initfini.c	2010-04-17 11:34:06.882681001 +0000
    2.27 +@@ -45,6 +45,11 @@
    2.28 + /* Embed an #include to pull in the alignment and .end directives. */
    2.29 + asm ("\n#include \"defs.h\"");
    2.30 + 
    2.31 ++asm ("\n#if defined __i686 && defined __ASSEMBLER__");
    2.32 ++asm ("\n#undef __i686");
    2.33 ++asm ("\n#define __i686 __i686");
    2.34 ++asm ("\n#endif");
    2.35 ++
    2.36 + /* The initial common code ends here. */
    2.37 + asm ("\n/*@HEADER_ENDS*/");
    2.38 + 
    2.39 +diff -Naur glibc-2.11.1.orig/sysdeps/unix/sysv/linux/i386/sysdep.h glibc-2.11.1/sysdeps/unix/sysv/linux/i386/sysdep.h
    2.40 +--- glibc-2.11.1.orig/sysdeps/unix/sysv/linux/i386/sysdep.h	2009-12-08 20:10:20.000000000 +0000
    2.41 ++++ glibc-2.11.1/sysdeps/unix/sysv/linux/i386/sysdep.h	2010-04-17 11:34:06.882681001 +0000
    2.42 +@@ -29,6 +29,10 @@
    2.43 + #include <dl-sysdep.h>
    2.44 + #include <tls.h>
    2.45 + 
    2.46 ++#if defined __i686 && defined __ASSEMBLER__
    2.47 ++#undef __i686
    2.48 ++#define __i686 __i686
    2.49 ++#endif
    2.50 + 
    2.51 + /* For Linux we can use the system call table in the header file
    2.52 + 	/usr/include/asm/unistd.h