wok-undigest rev 1133

add again glibc
author Xander Ziiryanoff <psychomaniak@xakep.ru>
date Wed Jul 23 22:03:59 2014 +0000 (2014-07-23)
parents 60e3e78f0d90
children d5bd6719c58b
files glibc-base/receipt glibc-base/stuff/arm-files.list glibc-base/stuff/i486-files.list glibc-base/stuff/mkdir.list glibc-base/stuff/wanted-files.list glibc-dev/receipt glibc-extra-samba/receipt glibc-locale/receipt glibc/receipt glibc/stuff/glibc-2.13-gcc_fix-1.patch glibc/stuff/glibc-2.14-reexport-rpc-interface.patch glibc/stuff/glibc-2.14-reinstall-nis-rpc-headers.patch glibc/stuff/glibc-2.14-revert-4768ae77.patch glibc/stuff/glibc-2.14.1-fixes-1.patch glibc/stuff/glibc-2.14.1-gcc_fix-1.patch glibc/stuff/glibc-2.14.1-sort-1.patch
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/glibc-base/receipt	Wed Jul 23 22:03:59 2014 +0000
     1.3 @@ -0,0 +1,136 @@
     1.4 +# SliTaz package receipt.
     1.5 +
     1.6 +PACKAGE="glibc-base"
     1.7 +VERSION="2.14.1"
     1.8 +CATEGORY="base-system"
     1.9 +SHORT_DESC="GNU libc minimal libraries and UTF-8 support for SliTaz."
    1.10 +WEB_SITE="http://www.gnu.org/software/libc/"
    1.11 +MAINTAINER="pankso@slitaz.org"
    1.12 +LICENSE="GPL2"
    1.13 +WANTED="glibc"
    1.14 +HOST_ARCH="i486 arm x86_64"
    1.15 +
    1.16 +# Locales include by default, other locales are in: locale-** and glibc-locale
    1.17 +DEFAULT_LOCALE="en_US en_GB"
    1.18 +
    1.19 +# Handle multiarch compilation.
    1.20 +case "$ARCH" in
    1.21 +	arm*|x86_64) VERSION="2.13" WANTED="" ;;
    1.22 +esac
    1.23 +
    1.24 +# Handle multiarch installation.
    1.25 +case "$SLITAZ_ARCH" in
    1.26 +	arm*|x86_64) VERSION="2.13" WANTED="" ;;
    1.27 +esac
    1.28 +
    1.29 +# Rules to gen a SliTaz package suitable for Tazpkg.
    1.30 +#
    1.31 +# Full glibc is very long to compile (see package glibc for more
    1.32 +# informations). You can use the precompiled package available on
    1.33 +# SliTaz mirror to build a distro without recompiling glibc.
    1.34 +#
    1.35 +
    1.36 +# i18n
    1.37 +get_locales()
    1.38 +{
    1.39 +	local path=$1
    1.40 +	for i in $DEFAULT_LOCALE
    1.41 +	do
    1.42 +		cp $install/$path/i18n/locales/$i $fs/usr/share/i18n/locales
    1.43 +	done
    1.44 +}
    1.45 +
    1.46 +genpkg_rules()
    1.47 +{
    1.48 +	# Mkdir's.
    1.49 +	for dir in $(cat $stuff/mkdir.list)
    1.50 +	do
    1.51 +		mkdir -p ${fs}$dir
    1.52 +	done
    1.53 +
    1.54 +	case "$ARCH" in
    1.55 +		arm*)
    1.56 +			# Eglibc is cross compiled by cross to have a toolchain so we can
    1.57 +			# use these files instead of recooking it. ARM use Eglibc
    1.58 +			echo "Using cross compiled Eglibc..."
    1.59 +			install=/cross/$ARCH/sysroot
    1.60 +
    1.61 +			# /usr/{bin,share} /usr/lib/gconv
    1.62 +			for file in $(cat $stuff/arm-files.list)
    1.63 +			do
    1.64 +				cp -a ${install}$file ${fs}$file
    1.65 +			done
    1.66 +
    1.67 +			# libs
    1.68 +			for lib in libcrypt libm libc libresolv librt libutil libpthread \
    1.69 +				libnss_* libnsl libanl libdl
    1.70 +			do
    1.71 +				cp -a $install/lib/${lib}-*.so $fs/lib
    1.72 +				cp -a $install/lib/${lib}.so* $fs/lib
    1.73 +				cp -a $install/usr/lib/${lib}.so $fs/usr/lib
    1.74 +			done
    1.75 +			cp -a $install/lib/ld-*.so* $fs/lib
    1.76 +			cp -a $install/usr/lib/libc_nonshared.a $fs/usr/lib
    1.77 +			cp -a $install/usr/lib/libpthread_nonshared.a $fs/usr/lib
    1.78 +			cp $install/etc/rpc $fs/etc
    1.79 +			touch $fs/etc/ld.so.conf
    1.80 +			touch $fs/etc/ld.so.cache
    1.81 +			get_locales "usr/share" ;;
    1.82 +		x86_64)
    1.83 +			# EXPERIMENTAL: Glibc is cross compiled by cross to have a
    1.84 +			# toolchain so we can use these files instead of recooking it.
    1.85 +			echo "Using cross compiled Glibc..."
    1.86 +			install=/usr/cross/$ARCH
    1.87 +
    1.88 +			# /usr/{bin,share} /usr/lib/gconv
    1.89 +			for file in $(cat $stuff/arm-files.list)
    1.90 +			do
    1.91 +				cp -a ${install}$file ${fs}/usr/$file
    1.92 +			done
    1.93 +
    1.94 +			# /lib
    1.95 +			for lib in libcrypt libm libc libresolv librt libutil libpthread \
    1.96 +				libnss_* libnsl libanl libdl
    1.97 +			do
    1.98 +				cp -a $install/lib/${lib}-*.so $fs/lib
    1.99 +				cp -a $install/lib/${lib}.so* $fs/lib
   1.100 +			done
   1.101 +			cp -a $install/lib/ld-*.so* $fs/lib
   1.102 +			cp -a $install/lib/libc_nonshared.a $fs/lib
   1.103 +			cp -a $install/lib/libpthread_nonshared.a $fs/lib
   1.104 +			cp $install/etc/rpc $fs/etc
   1.105 +			touch $fs/etc/ld.so.conf
   1.106 +			get_locales "share"
   1.107 +			# Fix libraries search path
   1.108 +			sed -i s"|/usr/cross/$ARCH||"g $fs/lib/libc.so
   1.109 +			sed -i s"|/usr/cross/$ARCH||"g $fs/lib/libpthread.so ;;
   1.110 +		*)
   1.111 +			# Copy all files specified in stuff/files.list. We get the files
   1.112 +			# from glibc package.
   1.113 +			for file in $(cat $stuff/wanted-files.list)
   1.114 +			do
   1.115 +				cp -a ${install}$file ${fs}$file
   1.116 +			done
   1.117 +			get_locales "usr/share"
   1.118 +	esac
   1.119 +}
   1.120 +
   1.121 +# Remove an eventual locale-archive since we use directories.
   1.122 +pre_install()
   1.123 +{
   1.124 +	rm -f $root/usr/lib/locale/locale-archive
   1.125 +}
   1.126 +
   1.127 +# Glibc-base is auto-updated in chroot but when cross-compiling we need
   1.128 +# to have /usr/cross/$ARCH search path in libc.so
   1.129 +post_install()
   1.130 +{
   1.131 +	# x86_64
   1.132 +	if echo $root | grep -q /usr/cross/x86_64; then
   1.133 +		echo "Fixing x86_64: $root/lib/libc.so"
   1.134 +		cat > $root/lib/libc.so << EOT
   1.135 +OUTPUT_FORMAT(elf64-x86-64)
   1.136 +GROUP ( $root/lib/libc.so.6 $root/lib/libc_nonshared.a AS_NEEDED ( $root/lib/ld-linux-x86-64.so.2 ) )
   1.137 +EOT
   1.138 +	fi
   1.139 +}
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/glibc-base/stuff/arm-files.list	Wed Jul 23 22:03:59 2014 +0000
     2.3 @@ -0,0 +1,31 @@
     2.4 +/usr/lib/gconv/UNICODE.so
     2.5 +/usr/lib/gconv/gconv-modules
     2.6 +/usr/lib/gconv/ANSI_X3.110.so
     2.7 +/usr/lib/gconv/ISO8859-1.so
     2.8 +/usr/lib/gconv/ISO8859-15.so
     2.9 +/usr/lib/gconv/UTF-16.so
    2.10 +/usr/lib/gconv/CP1252.so
    2.11 +/usr/lib/gconv/IBM437.so
    2.12 +/usr/lib/gconv/IBM850.so
    2.13 +
    2.14 +/usr/bin/locale
    2.15 +/usr/bin/localedef
    2.16 +
    2.17 +/usr/share/locale/locale.alias
    2.18 +/usr/share/i18n/charmaps/UTF-8.gz
    2.19 +
    2.20 +/usr/share/i18n/locales/i18n
    2.21 +/usr/share/i18n/locales/iso14651_t1
    2.22 +/usr/share/i18n/locales/iso14651_t1_common
    2.23 +/usr/share/i18n/locales/translit_neutral
    2.24 +/usr/share/i18n/locales/translit_combining
    2.25 +/usr/share/i18n/locales/translit_circle
    2.26 +/usr/share/i18n/locales/translit_cjk_compat
    2.27 +/usr/share/i18n/locales/translit_compat
    2.28 +/usr/share/i18n/locales/translit_font
    2.29 +/usr/share/i18n/locales/translit_fraction
    2.30 +/usr/share/i18n/locales/translit_narrow
    2.31 +/usr/share/i18n/locales/translit_small
    2.32 +/usr/share/i18n/locales/translit_wide
    2.33 +
    2.34 +/usr/share/zoneinfo/UTC
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/glibc-base/stuff/i486-files.list	Wed Jul 23 22:03:59 2014 +0000
     3.3 @@ -0,0 +1,80 @@
     3.4 +/lib/libutil-2.14.1.so
     3.5 +/lib/libnss_dns-2.14.1.so
     3.6 +/lib/libnsl-2.14.1.so
     3.7 +/lib/libanl-2.14.1.so
     3.8 +/lib/libm-2.14.1.so
     3.9 +/lib/libpthread-2.14.1.so
    3.10 +/lib/libthread_db-1.0.so
    3.11 +/lib/libnss_compat-2.14.1.so
    3.12 +/lib/libc-2.14.1.so
    3.13 +/lib/librt-2.14.1.so
    3.14 +/lib/libcrypt-2.14.1.so
    3.15 +/lib/ld-2.14.1.so
    3.16 +/lib/libresolv-2.14.1.so
    3.17 +/lib/libnss_files-2.14.1.so
    3.18 +/lib/libdl-2.14.1.so
    3.19 +
    3.20 +/usr/lib/gconv/UNICODE.so
    3.21 +/usr/lib/gconv/gconv-modules
    3.22 +/usr/lib/gconv/ANSI_X3.110.so
    3.23 +/usr/lib/gconv/ISO8859-1.so
    3.24 +/usr/lib/gconv/ISO8859-15.so
    3.25 +/usr/lib/gconv/UTF-16.so
    3.26 +/usr/lib/gconv/CP1252.so
    3.27 +/usr/lib/gconv/IBM437.so
    3.28 +/usr/lib/gconv/IBM850.so
    3.29 +
    3.30 +/usr/bin/locale
    3.31 +/usr/bin/localedef
    3.32 +
    3.33 +/usr/share/locale/locale.alias
    3.34 +/usr/share/i18n/charmaps/UTF-8.gz
    3.35 +
    3.36 +/usr/share/i18n/locales/i18n
    3.37 +/usr/share/i18n/locales/iso14651_t1 
    3.38 +/usr/share/i18n/locales/iso14651_t1_common 
    3.39 +/usr/share/i18n/locales/translit_neutral 
    3.40 +/usr/share/i18n/locales/translit_combining
    3.41 +/usr/share/i18n/locales/translit_circle 
    3.42 +/usr/share/i18n/locales/translit_cjk_compat 
    3.43 +/usr/share/i18n/locales/translit_compat 
    3.44 +/usr/share/i18n/locales/translit_font 
    3.45 +/usr/share/i18n/locales/translit_fraction
    3.46 +/usr/share/i18n/locales/translit_narrow
    3.47 +/usr/share/i18n/locales/translit_small
    3.48 +/usr/share/i18n/locales/translit_wide
    3.49 +
    3.50 +/usr/share/zoneinfo/UTC
    3.51 +
    3.52 +/etc/rpc
    3.53 +/etc/ld.so.conf
    3.54 +/etc/ld.so.cache
    3.55 +
    3.56 +/lib/libc.so.6
    3.57 +/lib/librt.so.1
    3.58 +/lib/libdl.so.2
    3.59 +/lib/libanl.so.1
    3.60 +/lib/libutil.so.1
    3.61 +/lib/libnss_dns.so.2
    3.62 +/lib/libnss_compat.so.2
    3.63 +/lib/libcrypt.so.1
    3.64 +/lib/libpthread.so.0
    3.65 +/lib/libthread_db.so.1
    3.66 +/lib/libm.so.6
    3.67 +/lib/ld-linux.so.2
    3.68 +/lib/libresolv.so.2
    3.69 +/lib/libnsl.so.1
    3.70 +/lib/libnss_files.so.2
    3.71 +
    3.72 +/usr/lib/libnss_dns.so
    3.73 +/usr/lib/libnss_files.so
    3.74 +/usr/lib/libcrypt.so
    3.75 +/usr/lib/libnss_compat.so
    3.76 +/usr/lib/libdl.so
    3.77 +/usr/lib/libm.so
    3.78 +/usr/lib/librt.so
    3.79 +/usr/lib/libresolv.so
    3.80 +/usr/lib/libnsl.so
    3.81 +/usr/lib/libutil.so
    3.82 +/usr/lib/libanl.so
    3.83 +/usr/lib/libthread_db.so
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/glibc-base/stuff/mkdir.list	Wed Jul 23 22:03:59 2014 +0000
     4.3 @@ -0,0 +1,10 @@
     4.4 +/etc
     4.5 +/lib
     4.6 +/usr/bin
     4.7 +/usr/lib/gconv
     4.8 +/usr/lib/locale
     4.9 +/usr/share/zoneinfo/America
    4.10 +/usr/share/zoneinfo/Europe
    4.11 +/usr/share/i18n/locales
    4.12 +/usr/share/i18n/charmaps
    4.13 +/usr/share/locale
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/glibc-base/stuff/wanted-files.list	Wed Jul 23 22:03:59 2014 +0000
     5.3 @@ -0,0 +1,80 @@
     5.4 +/lib/libutil-2.14.1.so
     5.5 +/lib/libnss_dns-2.14.1.so
     5.6 +/lib/libnsl-2.14.1.so
     5.7 +/lib/libanl-2.14.1.so
     5.8 +/lib/libm-2.14.1.so
     5.9 +/lib/libpthread-2.14.1.so
    5.10 +/lib/libthread_db-1.0.so
    5.11 +/lib/libnss_compat-2.14.1.so
    5.12 +/lib/libc-2.14.1.so
    5.13 +/lib/librt-2.14.1.so
    5.14 +/lib/libcrypt-2.14.1.so
    5.15 +/lib/ld-2.14.1.so
    5.16 +/lib/libresolv-2.14.1.so
    5.17 +/lib/libnss_files-2.14.1.so
    5.18 +/lib/libdl-2.14.1.so
    5.19 +
    5.20 +/usr/lib/gconv/UNICODE.so
    5.21 +/usr/lib/gconv/gconv-modules
    5.22 +/usr/lib/gconv/ANSI_X3.110.so
    5.23 +/usr/lib/gconv/ISO8859-1.so
    5.24 +/usr/lib/gconv/ISO8859-15.so
    5.25 +/usr/lib/gconv/UTF-16.so
    5.26 +/usr/lib/gconv/CP1252.so
    5.27 +/usr/lib/gconv/IBM437.so
    5.28 +/usr/lib/gconv/IBM850.so
    5.29 +
    5.30 +/usr/bin/locale
    5.31 +/usr/bin/localedef
    5.32 +
    5.33 +/usr/share/locale/locale.alias
    5.34 +/usr/share/i18n/charmaps/UTF-8.gz
    5.35 +
    5.36 +/usr/share/i18n/locales/i18n
    5.37 +/usr/share/i18n/locales/iso14651_t1 
    5.38 +/usr/share/i18n/locales/iso14651_t1_common 
    5.39 +/usr/share/i18n/locales/translit_neutral 
    5.40 +/usr/share/i18n/locales/translit_combining
    5.41 +/usr/share/i18n/locales/translit_circle 
    5.42 +/usr/share/i18n/locales/translit_cjk_compat 
    5.43 +/usr/share/i18n/locales/translit_compat 
    5.44 +/usr/share/i18n/locales/translit_font 
    5.45 +/usr/share/i18n/locales/translit_fraction
    5.46 +/usr/share/i18n/locales/translit_narrow
    5.47 +/usr/share/i18n/locales/translit_small
    5.48 +/usr/share/i18n/locales/translit_wide
    5.49 +
    5.50 +/usr/share/zoneinfo/UTC
    5.51 +
    5.52 +/etc/rpc
    5.53 +/etc/ld.so.conf
    5.54 +/etc/ld.so.cache
    5.55 +
    5.56 +/lib/libc.so.6
    5.57 +/lib/librt.so.1
    5.58 +/lib/libdl.so.2
    5.59 +/lib/libanl.so.1
    5.60 +/lib/libutil.so.1
    5.61 +/lib/libnss_dns.so.2
    5.62 +/lib/libnss_compat.so.2
    5.63 +/lib/libcrypt.so.1
    5.64 +/lib/libpthread.so.0
    5.65 +/lib/libthread_db.so.1
    5.66 +/lib/libm.so.6
    5.67 +/lib/ld-linux.so.2
    5.68 +/lib/libresolv.so.2
    5.69 +/lib/libnsl.so.1
    5.70 +/lib/libnss_files.so.2
    5.71 +
    5.72 +/usr/lib/libnss_dns.so
    5.73 +/usr/lib/libnss_files.so
    5.74 +/usr/lib/libcrypt.so
    5.75 +/usr/lib/libnss_compat.so
    5.76 +/usr/lib/libdl.so
    5.77 +/usr/lib/libm.so
    5.78 +/usr/lib/librt.so
    5.79 +/usr/lib/libresolv.so
    5.80 +/usr/lib/libnsl.so
    5.81 +/usr/lib/libutil.so
    5.82 +/usr/lib/libanl.so
    5.83 +/usr/lib/libthread_db.so
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/glibc-dev/receipt	Wed Jul 23 22:03:59 2014 +0000
     6.3 @@ -0,0 +1,42 @@
     6.4 +# SliTaz package receipt.
     6.5 +
     6.6 +PACKAGE="glibc-dev"
     6.7 +VERSION="2.14.1"
     6.8 +CATEGORY="development"
     6.9 +SHORT_DESC="The GNU C libraries devel files (Part of SliTaz toolchain)."
    6.10 +MAINTAINER="pankso@slitaz.org"
    6.11 +LICENSE="GPL2"
    6.12 +WANTED="glibc"
    6.13 +WEB_SITE="http://www.gnu.org/software/libc/"
    6.14 +
    6.15 +DEPENDS="glibc-base"
    6.16 +
    6.17 +# Rules to gen a SliTaz package suitable for Tazpkg.
    6.18 +#
    6.19 +# This package is part of the toolchain. We use list to mkdir and cp files.
    6.20 +#
    6.21 +genpkg_rules()
    6.22 +{
    6.23 +    # Mass copy and then remove all files specified in stuff/base-files.list.
    6.24 +    # We get the files from glibc-base. Locale files are in: glibc-locale.
    6.25 +    cp -a $install/* $fs
    6.26 +    
    6.27 +    # Rm base files.
    6.28 +    echo -n "Removing all base files..."
    6.29 +    for file in `cat $WOK/glibc-base/taz/glibc-base-$VERSION/files.list`
    6.30 +    do
    6.31 +    	rm -f ${fs}$file
    6.32 +    done
    6.33 +    rm -rf $fs/etc
    6.34 +    rm -rf $fs/usr/share
    6.35 +    status
    6.36 +    
    6.37 +    # Rm locale.
    6.38 +    echo -n "Removing all locale files..."
    6.39 +    for file in `cat $WOK/glibc-locale/taz/glibc-locale-$VERSION/files.list`
    6.40 +    do
    6.41 +    	rm -f ${fs}$file
    6.42 +    done
    6.43 +    rm -rf $fs/usr/lib/gconv
    6.44 +    status
    6.45 +}
     7.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.2 +++ b/glibc-extra-samba/receipt	Wed Jul 23 22:03:59 2014 +0000
     7.3 @@ -0,0 +1,20 @@
     7.4 +# SliTaz package receipt.
     7.5 +
     7.6 +PACKAGE="glibc-extra-samba"
     7.7 +VERSION="2.14.1"
     7.8 +CATEGORY="base-system"
     7.9 +SHORT_DESC="GNU libc extra gconv modules for samba."
    7.10 +WEB_SITE="http://gcc.gnu.org/"
    7.11 +WANTED="glibc"
    7.12 +MAINTAINER="pascal.bellard@slitaz.org"
    7.13 +LICENSE="GPL2"
    7.14 +
    7.15 +# Rules to gen a SliTaz package suitable for Tazpkg.
    7.16 +#
    7.17 +genpkg_rules()
    7.18 +{
    7.19 +	mkdir -p $fs/usr/lib/gconv
    7.20 +	for i in IBM850.so IBM437.so; do
    7.21 +		cp $install/usr/lib/gconv/$i $fs/usr/lib/gconv/$i
    7.22 +	done
    7.23 +}
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/glibc-locale/receipt	Wed Jul 23 22:03:59 2014 +0000
     8.3 @@ -0,0 +1,53 @@
     8.4 +# SliTaz package receipt.
     8.5 +
     8.6 +PACKAGE="glibc-locale"
     8.7 +VERSION="2.14.1"
     8.8 +CATEGORY="system-tools"
     8.9 +SHORT_DESC="The GNU C libraries locale files and utilities (see also locale-*)."
    8.10 +MAINTAINER="pankso@slitaz.org"
    8.11 +LICENSE="GPL2"
    8.12 +WANTED="glibc"
    8.13 +WEB_SITE="http://www.gnu.org/software/libc/"
    8.14 +
    8.15 +DEPENDS="glibc-base glibc-extra-samba"
    8.16 +
    8.17 +LOCALE_PACK="cs de es fr hu id it pt ru sl zh_CN zh_TW"
    8.18 +
    8.19 +# Rules to gen a SliTaz package suitable for Tazpkg.
    8.20 +genpkg_rules()
    8.21 +{
    8.22 +	mkdir -p $fs/usr/share $fs/usr/lib $fs/usr/bin
    8.23 +
    8.24 +	cp -a $install/usr/lib/gconv $fs/usr/lib
    8.25 +	cp -a $install/usr/share/locale $fs/usr/share
    8.26 +	cp -a $install/usr/share/i18n $fs/usr/share
    8.27 +	cp -a $install/usr/share/zoneinfo $fs/usr/share
    8.28 +
    8.29 +	# Utilities and tools
    8.30 +	cp -a $install/usr/bin/iconv $fs/usr/bin
    8.31 +	cp -a $install/usr/bin/tzselect $fs/usr/bin
    8.32 +
    8.33 +	# Rm base files.
    8.34 +	echo -n "* Removing all base files..."
    8.35 +	for file in `cat $WOK/glibc-base/taz/glibc-base-$VERSION/files.list`
    8.36 +	do
    8.37 +		rm -f ${fs}$file
    8.38 +	done
    8.39 +	status
    8.40 +	
    8.41 +	# Rm glibc-extra-samba files.
    8.42 +	echo -n "* Removing extra samba files..."
    8.43 +	for file in `cat $WOK/glibc-extra-samba/taz/glibc-extra-samba-$VERSION/files.list`
    8.44 +	do
    8.45 +		rm -f ${fs}$file
    8.46 +	done
    8.47 +	status
    8.48 +
    8.49 +	# Rm files provided by locale-pack.
    8.50 +	for i in $LOCALE_PACK
    8.51 +	do
    8.52 +		echo -n "* Removing locale: $i"
    8.53 +		rm -rf $fs/usr/share/locale/$i
    8.54 +		status
    8.55 +	done
    8.56 +}
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/glibc/receipt	Wed Jul 23 22:03:59 2014 +0000
     9.3 @@ -0,0 +1,149 @@
     9.4 +# SliTaz package receipt.
     9.5 +
     9.6 +PACKAGE="glibc"
     9.7 +VERSION="2.14.1"
     9.8 +CATEGORY="meta"
     9.9 +SHORT_DESC="The GNU C libraries. This package is used to compile the libc."
    9.10 +MAINTAINER="pankso@slitaz.org"
    9.11 +LICENSE="GPL2"
    9.12 +TARBALL="$PACKAGE-$VERSION.tar.gz"
    9.13 +WEB_SITE="http://www.gnu.org/software/libc/"
    9.14 +WGET_URL="$GNU_MIRROR/$PACKAGE/$TARBALL"
    9.15 +
    9.16 +DEPENDS="glibc-base glibc-locale glibc-dev"
    9.17 +BUILD_DEPENDS="linux-api-headers autoconf bash"
    9.18 +
    9.19 +# Genpkg order for tazwok.
    9.20 +COOK_OPT="genpkg=glibc-base:glibc-extra-samba:glib-locale:glibc-dev"
    9.21 +	
    9.22 +# Rules to compile & install the temporary toolchain.
    9.23 +cook_tmp_toolchain()
    9.24 +{
    9.25 +	cd $src
    9.26 +	
    9.27 +	# Glibc Bug Fixes Patch from LFS
    9.28 +	patch -Np1 -i $stuff/glibc-2.14.1-fixes-1.patch
    9.29 +	# Glibc Bug Sort Relocatable Objects Patch
    9.30 +	patch -Np1 -i $stuff/glibc-2.14.1-sort-1.patch
    9.31 +	# Fix a bug that prevents Glibc from building with GCC-4.6.2
    9.32 +	patch -Np1 -i stuff/glibc-2.14.1-gcc_fix-1.patch
    9.33 +
    9.34 +	# Build in a separate directory.
    9.35 +	mkdir ../glibc-build && cd ../glibc-build
    9.36 +
    9.37 +	# glibc no longer support i386, so use -march=i486 for better compatibility.
    9.38 +	# If i686 ???
    9.39 +	unset CFLAGS CXXFLAGS
    9.40 +	case $ARCH in
    9.41 +		i386|i486)
    9.42 +			echo "CFLAGS += -O2 -march=i486 -mtune=i486" > configparms ;;
    9.43 +		*)
    9.44 +			echo "CFLAGS += -O2 -march=$ARCH -mtune=$ARCH" > configparms ;;
    9.45 +	esac
    9.46 +
    9.47 +	{ $src/configure \
    9.48 +		--host=$HOST_SYSTEM \
    9.49 +		--build=$($src/scripts/config.guess) \
    9.50 +		--disable-profile --enable-add-ons \
    9.51 +		--enable-kernel=2.6.30 --with-headers=/tools/include \
    9.52 +		libc_cv_forced_unwind=yes libc_cv_c_cleanup=yes &&
    9.53 +	make &&
    9.54 +	make install
    9.55 +	} || return 1
    9.56 +
    9.57 +	# Link compiler to this new glibc.
    9.58 +	SPECS=`dirname $($HOST_SYSTEM-gcc -print-libgcc-file-name)`/specs
    9.59 +	$HOST_SYSTEM-gcc -dumpspecs | sed \
    9.60 +		-e 's@/lib\(64\)\?/ld@/tools&@g' \
    9.61 +		-e "/^\*cpp:$/{n;s,$, -isystem /tools/include,}" > $SPECS 
    9.62 +	unset SPECS
    9.63 +}
    9.64 +
    9.65 +# Rules to configure and make the package.
    9.66 +compile_rules()
    9.67 +{
    9.68 +	cd $src
    9.69 +
    9.70 +	# SliTaz is a Busybox based OS, why we so small and fast. Using gawk by
    9.71 +	# default to build package will not ensure package work with Busybox awk
    9.72 +	# and so should NOT be use to cook.
    9.73 +	if [ -x /usr/bin/cook ]; then
    9.74 +		[ -d "/var/lib/tazpkg/installed/gawk" ] || tazpkg get-install gawk
    9.75 +	fi
    9.76 +
    9.77 +	# Fixes and patches from LFS, Redhat
    9.78 +	sed -i -e 's/"db1"/& \&\& $name ne "nss_test1"/' scripts/test-installation.pl
    9.79 +	sed -i 's|@BASH@|/bin/bash|' elf/ldd.bash.in
    9.80 +
    9.81 +	# Glibc misc Bug Fixes
    9.82 +	patch -Np1 -i $stuff/glibc-2.14.1-fixes-1.patch
    9.83 +	
    9.84 +	# Glibc Bug Sort Relocatable Objects Patch
    9.85 +	#patch -Np1 -i $stuff/glibc-2.14.1-sort-1.patch
    9.86 +	
    9.87 +	# Fix a bug that prevents Glibc from building with GCC-4.6.2
    9.88 +	patch -Np1 -i $stuff/glibc-2.14.1-gcc_fix-1.patch
    9.89 +	
    9.90 +	# Revert commit causing issues with crappy DNS servers
    9.91 +	patch -Np1 -i $stuff/glibc-2.14-revert-4768ae77.patch
    9.92 +	
    9.93 +	# re-export RPC interface until libtirpc is ready as a replacement
    9.94 +	# http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=acee4873 (only fedora branch...)
    9.95 +	patch -Np1 -i $stuff/glibc-2.14-reexport-rpc-interface.patch
    9.96 +	# http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=bdd816a3 (only fedora branch...)
    9.97 +	patch -Np1 -i $stuff/glibc-2.14-reinstall-nis-rpc-headers.patch
    9.98 +
    9.99 +	# Fix a stack imbalance that occurs under some conditions:
   9.100 +	sed -i '195,213 s/PRIVATE_FUTEX/FUTEX_CLOCK_REALTIME/' \
   9.101 +		nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedrdlock.S \
   9.102 +		nptl/sysdeps/unix/sysv/linux/x86_64/pthread_rwlock_timedwrlock.S
   9.103 +
   9.104 +	# Glibc needs ld.so.conf in the install destdir.
   9.105 +	mkdir -p $WOK/$PACKAGE/install/etc
   9.106 +	touch $WOK/$PACKAGE/install/etc/ld.so.conf
   9.107 +	mkdir ../glibc-build && cd ../glibc-build
   9.108 +	
   9.109 +	# Read the INSTALL file in glibc. Also Glibc dont build with -Os flag.
   9.110 +	# --enale-kernel use latest SliTaz Kernel version. From Glibc INSTALL:
   9.111 +	# "The higher the VERSION number is, the less compatibility code is
   9.112 +	# added, and the faster the code gets."
   9.113 +	unset CFLAGS CXXFLAGS
   9.114 +	case "$ARCH" in
   9.115 +		i386|i486)
   9.116 +			echo "CFLAGS += -O2 -march=i486 -mtune=i486" > configparms ;;
   9.117 +		*)
   9.118 +			echo "CFLAGS += -O2 -march=$ARCH -mtune=$ARCH" > configparms ;;
   9.119 +	esac
   9.120 +	{ $src/configure \
   9.121 +		--disable-profile \
   9.122 +		--enable-add-ons \
   9.123 +		--enable-kernel=2.6.30 \
   9.124 +		--libexecdir=/usr/lib/glibc \
   9.125 +		--build=$HOST_SYSTEM \
   9.126 +		--host=$HOST_SYSTEM \
   9.127 +		--target=$BUILD_SYSTEM &&
   9.128 +	make && make install_root=$DESTDIR install
   9.129 +	} || return 1
   9.130 +
   9.131 +	# If temporary toolchain was previously used, switch to regular toolchain.
   9.132 +	[ -d /tools ] || return
   9.133 +	mv /tools/bin/ld /tools/bin/ld-old
   9.134 +	mv /tools/$(gcc -dumpmachine)/bin/ld /tools/$(gcc -dumpmachine)/bin/ld-old
   9.135 +	mv /tools/bin/ld-new /tools/bin/ld
   9.136 +	ln -s /tools/bin/ld /tools/$(gcc -dumpmachine)/bin/ld
   9.137 +	gcc -dumpspecs | sed -e 's@/tools@@g' \
   9.138 +		-e '/\*startfile_prefix_spec:/{n;s@.*@/usr/lib/ @}' \
   9.139 +		-e '/\*cpp:/{n;s@$@ -isystem /usr/include@}' > \
   9.140 +		`dirname $(gcc --print-libgcc-file-name)`/specs
   9.141 +}
   9.142 +
   9.143 +# Rules to gen a SliTaz package suitable for Tazpkg.
   9.144 +genpkg_rules()
   9.145 +{
   9.146 +	LOCALE=""
   9.147 +	mkdir -p $fs/var
   9.148 +
   9.149 +	# Remove build directory.
   9.150 +	rm -rf $WOK/$PACKAGE/source/$PACKAGE-build
   9.151 +	rm -rf $WOK/$PACKAGE/$PACKAGE-build
   9.152 +}
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/glibc/stuff/glibc-2.13-gcc_fix-1.patch	Wed Jul 23 22:03:59 2014 +0000
    10.3 @@ -0,0 +1,49 @@
    10.4 +Submitted By:            Matt Burgess <matthew_at_linuxfromscratch_dot_org>
    10.5 +Date:                    2010-04-18
    10.6 +Initial Package Version: 2.11.1
    10.7 +Upstream Status:         Not Submitted
    10.8 +Origin:                  http://www.eglibc.org/archives/patches/msg00073.html
    10.9 +Description:             Fixes the following build problem with GCC-4.5.0:
   10.10 +
   10.11 +/mnt/lfs/sources/libc-build/math/s_frexp.os.dt -MT /mnt/lfs/sources/libc-build/math/s_frexp.os
   10.12 +./sysdeps/i386/fpu/s_frexp.S: Assembler messages:
   10.13 +./sysdeps/i386/fpu/s_frexp.S:66: Error: invalid identifier for ".ifdef"
   10.14 +./sysdeps/i386/fpu/s_frexp.S:66: Error: junk at end of line, first unrecognized character is `1'
   10.15 +./sysdeps/i386/fpu/s_frexp.S:66: Error: junk at end of line, first unrecognized character is `1'
   10.16 +./sysdeps/i386/fpu/s_frexp.S:66: Error: junk at end of line, first unrecognized character is `1'
   10.17 +./sysdeps/i386/fpu/s_frexp.S:66: Error: junk at end of line, first unrecognized character is `.'
   10.18 +./sysdeps/i386/fpu/s_frexp.S:66: Error: junk at end of line, first unrecognized character is `1'
   10.19 +./sysdeps/i386/fpu/s_frexp.S:66: Error: expected comma after name `' in .size directive
   10.20 +./sysdeps/i386/fpu/s_frexp.S:66: Error: ".endif" without ".if"
   10.21 +./sysdeps/i386/fpu/s_frexp.S:66: Error: junk `.get_pc_thunk.dx' after expression
   10.22 +make[2]: *** [/mnt/lfs/sources/libc-build/math/s_frexp.os] Error 1
   10.23 +
   10.24 +diff -Naur glibc-2.11.1.orig/nptl/sysdeps/pthread/pt-initfini.c glibc-2.11.1/nptl/sysdeps/pthread/pt-initfini.c
   10.25 +--- glibc-2.11.1.orig/nptl/sysdeps/pthread/pt-initfini.c	2009-12-08 20:10:20.000000000 +0000
   10.26 ++++ glibc-2.11.1/nptl/sysdeps/pthread/pt-initfini.c	2010-04-17 11:34:06.882681001 +0000
   10.27 +@@ -45,6 +45,11 @@
   10.28 + /* Embed an #include to pull in the alignment and .end directives. */
   10.29 + asm ("\n#include \"defs.h\"");
   10.30 + 
   10.31 ++asm ("\n#if defined __i686 && defined __ASSEMBLER__");
   10.32 ++asm ("\n#undef __i686");
   10.33 ++asm ("\n#define __i686 __i686");
   10.34 ++asm ("\n#endif");
   10.35 ++
   10.36 + /* The initial common code ends here. */
   10.37 + asm ("\n/*@HEADER_ENDS*/");
   10.38 + 
   10.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
   10.40 +--- glibc-2.11.1.orig/sysdeps/unix/sysv/linux/i386/sysdep.h	2009-12-08 20:10:20.000000000 +0000
   10.41 ++++ glibc-2.11.1/sysdeps/unix/sysv/linux/i386/sysdep.h	2010-04-17 11:34:06.882681001 +0000
   10.42 +@@ -29,6 +29,10 @@
   10.43 + #include <dl-sysdep.h>
   10.44 + #include <tls.h>
   10.45 + 
   10.46 ++#if defined __i686 && defined __ASSEMBLER__
   10.47 ++#undef __i686
   10.48 ++#define __i686 __i686
   10.49 ++#endif
   10.50 + 
   10.51 + /* For Linux we can use the system call table in the header file
   10.52 + 	/usr/include/asm/unistd.h
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/glibc/stuff/glibc-2.14-reexport-rpc-interface.patch	Wed Jul 23 22:03:59 2014 +0000
    11.3 @@ -0,0 +1,26 @@
    11.4 +diff --git a/include/libc-symbols.h b/include/libc-symbols.h
    11.5 +index 67e1ca2..5e7cca5 100644
    11.6 +--- a/include/libc-symbols.h
    11.7 ++++ b/include/libc-symbols.h
    11.8 +@@ -635,7 +635,7 @@ for linking")
    11.9 + # define libc_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
   11.10 + # define libc_hidden_def(name) hidden_def (name)
   11.11 + # define libc_hidden_weak(name) hidden_weak (name)
   11.12 +-# define libc_hidden_nolink(name, version) hidden_nolink (name, libc, version)
   11.13 ++# define libc_hidden_nolink(name, version) hidden_def (name)
   11.14 + # define libc_hidden_ver(local, name) hidden_ver (local, name)
   11.15 + # define libc_hidden_data_def(name) hidden_data_def (name)
   11.16 + # define libc_hidden_data_weak(name) hidden_data_weak (name)
   11.17 +diff --git a/sunrpc/Makefile b/sunrpc/Makefile
   11.18 +index 5134ce9..40c73d1 100644
   11.19 +--- a/sunrpc/Makefile
   11.20 ++++ b/sunrpc/Makefile
   11.21 +@@ -53,7 +53,7 @@ headers-in-tirpc = $(addprefix rpc/,auth.h auth_unix.h clnt.h pmap_clnt.h \
   11.22 + 				    des_crypt.h)
   11.23 + headers-not-in-tirpc = $(addprefix rpc/,key_prot.h rpc_des.h) \
   11.24 + 		       $(rpcsvc:%=rpcsvc/%) rpcsvc/bootparam.h
   11.25 +-headers = rpc/netdb.h
   11.26 ++headers = rpc/netdb.h $(headers-in-tirpc) $(headers-not-in-tirpc)
   11.27 + install-others = $(inst_sysconfdir)/rpc
   11.28 + generated = $(rpcsvc:%.x=rpcsvc/%.h) $(rpcsvc:%.x=x%.c) $(rpcsvc:%.x=x%.stmp) \
   11.29 + 	    $(rpcsvc:%.x=rpcsvc/%.stmp) rpcgen
    12.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.2 +++ b/glibc/stuff/glibc-2.14-reinstall-nis-rpc-headers.patch	Wed Jul 23 22:03:59 2014 +0000
    12.3 @@ -0,0 +1,28 @@
    12.4 +From bdd816a366c4e5bba5de7157d948e0c0737fb4fb Mon Sep 17 00:00:00 2001
    12.5 +From: Andreas Schwab <schwab@redhat.com>
    12.6 +Date: Tue, 17 May 2011 17:42:30 +0200
    12.7 +Subject: [PATCH] Reinstall NIS RPC headers
    12.8 +
    12.9 +---
   12.10 + nis/Makefile |    4 ++--
   12.11 + 1 files changed, 2 insertions(+), 2 deletions(-)
   12.12 +
   12.13 +diff --git a/nis/Makefile b/nis/Makefile
   12.14 +index b5c9609..d2934d9 100644
   12.15 +--- a/nis/Makefile
   12.16 ++++ b/nis/Makefile
   12.17 +@@ -23,9 +23,9 @@ subdir	:= nis
   12.18 + 
   12.19 + aux			:= nis_hash
   12.20 + 
   12.21 ++headers			:= $(wildcard rpcsvc/*.[hx])
   12.22 + distribute		:= nss-nis.h nss-nisplus.h nis_intern.h Banner \
   12.23 +-			   nisplus-parser.h nis_xdr.h nss \
   12.24 +-			   $(wildcard rpcsvc/*.[hx])
   12.25 ++			   nisplus-parser.h nis_xdr.h nss
   12.26 + 
   12.27 + # These are the databases available for the nis (and perhaps later nisplus)
   12.28 + # service.  This must be a superset of the services in nss.
   12.29 +-- 
   12.30 +1.7.5.4
   12.31 +
    13.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.2 +++ b/glibc/stuff/glibc-2.14-revert-4768ae77.patch	Wed Jul 23 22:03:59 2014 +0000
    13.3 @@ -0,0 +1,37 @@
    13.4 +diff -Naur glibc-orig//resolv/res_send.c glibc/resolv/res_send.c
    13.5 +--- glibc-orig//resolv/res_send.c	2011-06-10 18:59:03.041436996 +1000
    13.6 ++++ glibc/resolv/res_send.c	2011-06-10 19:08:09.379309323 +1000
    13.7 +@@ -549,7 +549,7 @@
    13.8 +				    ns, ansp, ansp2, nansp2, resplen2);
    13.9 +			if (n < 0)
   13.10 +				return (-1);
   13.11 +-			if (n == 0 && (buf2 == NULL || *resplen2 == 0))
   13.12 ++			if (n == 0)
   13.13 +				goto next_ns;
   13.14 +		} else {
   13.15 +			/* Use datagrams. */
   13.16 +@@ -559,7 +559,7 @@
   13.17 +				    ansp2, nansp2, resplen2);
   13.18 +			if (n < 0)
   13.19 +				return (-1);
   13.20 +-			if (n == 0 && (buf2 == NULL || *resplen2 == 0))
   13.21 ++			if (n == 0)
   13.22 +				goto next_ns;
   13.23 +			if (v_circuit)
   13.24 +			  // XXX Check whether both requests failed or
   13.25 +@@ -1275,14 +1275,10 @@
   13.26 +				(*thisresplenp > *thisanssizp)
   13.27 +				? *thisanssizp : *thisresplenp);
   13.28 +
   13.29 +-			if (recvresp1 || (buf2 != NULL && recvresp2)) {
   13.30 +-			  *resplen2 = 0;
   13.31 ++			if (recvresp1 || (buf2 != NULL && recvresp2))
   13.32 +			  return resplen;
   13.33 +-			}
   13.34 +			if (buf2 != NULL)
   13.35 +			  {
   13.36 +-			    /* No data from the first reply.  */
   13.37 +-			    resplen = 0;
   13.38 +			    /* We are waiting for a possible second reply.  */
   13.39 +			    if (hp->id == anhp->id)
   13.40 +			      recvresp1 = 1;
    14.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.2 +++ b/glibc/stuff/glibc-2.14.1-fixes-1.patch	Wed Jul 23 22:03:59 2014 +0000
    14.3 @@ -0,0 +1,159 @@
    14.4 +Submitted By:            Matt Burgess <matthew_at_linuxfromscratch_dot_org>
    14.5 +Date:                    2011-10-07
    14.6 +Initial Package Version: 2.14.1
    14.7 +Upstream Status:         From upstream
    14.8 +Origin:                  Matt Burgess
    14.9 +Description:             Fixes Firefox crashes and a bug when programs link to
   14.10 +                         SDL.
   14.11 +
   14.12 +diff -Naur glibc-2.14.1.orig/elf/dl-close.c glibc-2.14.1/elf/dl-close.c
   14.13 +--- glibc-2.14.1.orig/elf/dl-close.c	2011-10-07 09:48:55.000000000 +0000
   14.14 ++++ glibc-2.14.1/elf/dl-close.c	2011-10-07 19:43:10.346411120 +0000
   14.15 +@@ -119,17 +119,8 @@
   14.16 +   if (map->l_direct_opencount > 0 || map->l_type != lt_loaded
   14.17 +       || dl_close_state != not_pending)
   14.18 +     {
   14.19 +-      if (map->l_direct_opencount == 0)
   14.20 +-	{
   14.21 +-	  if (map->l_type == lt_loaded)
   14.22 +-	    dl_close_state = rerun;
   14.23 +-	  else if (map->l_type == lt_library)
   14.24 +-	    {
   14.25 +-	      struct link_map **oldp = map->l_initfini;
   14.26 +-	      map->l_initfini = map->l_orig_initfini;
   14.27 +-	      _dl_scope_free (oldp);
   14.28 +-	    }
   14.29 +-	}
   14.30 ++      if (map->l_direct_opencount == 0 && map->l_type == lt_loaded)
   14.31 ++	dl_close_state = rerun;
   14.32 + 
   14.33 +       /* There are still references to this object.  Do nothing more.  */
   14.34 +       if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_FILES, 0))
   14.35 +diff -Naur glibc-2.14.1.orig/elf/dl-deps.c glibc-2.14.1/elf/dl-deps.c
   14.36 +--- glibc-2.14.1.orig/elf/dl-deps.c	2011-10-07 09:48:55.000000000 +0000
   14.37 ++++ glibc-2.14.1/elf/dl-deps.c	2011-10-07 19:43:10.348432639 +0000
   14.38 +@@ -478,6 +478,7 @@
   14.39 + 		  nneeded * sizeof needed[0]);
   14.40 + 	  atomic_write_barrier ();
   14.41 + 	  l->l_initfini = l_initfini;
   14.42 ++	  l->l_free_initfini = 1;
   14.43 + 	}
   14.44 + 
   14.45 +       /* If we have no auxiliary objects just go on to the next map.  */
   14.46 +@@ -678,6 +679,7 @@
   14.47 +   l_initfini[nlist] = NULL;
   14.48 +   atomic_write_barrier ();
   14.49 +   map->l_initfini = l_initfini;
   14.50 ++  map->l_free_initfini = 1;
   14.51 +   if (l_reldeps != NULL)
   14.52 +     {
   14.53 +       atomic_write_barrier ();
   14.54 +@@ -686,7 +688,7 @@
   14.55 +       _dl_scope_free (old_l_reldeps);
   14.56 +     }
   14.57 +   if (old_l_initfini != NULL)
   14.58 +-      map->l_orig_initfini = old_l_initfini;
   14.59 ++    _dl_scope_free (old_l_initfini);
   14.60 + 
   14.61 +   if (errno_reason)
   14.62 +     _dl_signal_error (errno_reason == -1 ? 0 : errno_reason, objname,
   14.63 +diff -Naur glibc-2.14.1.orig/elf/dl-libc.c glibc-2.14.1/elf/dl-libc.c
   14.64 +--- glibc-2.14.1.orig/elf/dl-libc.c	2011-10-07 09:48:55.000000000 +0000
   14.65 ++++ glibc-2.14.1/elf/dl-libc.c	2011-10-07 19:43:10.352411141 +0000
   14.66 +@@ -279,6 +279,10 @@
   14.67 + 	      if (! old->dont_free)
   14.68 + 		free (old);
   14.69 + 	    }
   14.70 ++
   14.71 ++	  /* Free the initfini dependency list.  */
   14.72 ++	  if (l->l_free_initfini)
   14.73 ++	    free (l->l_initfini);
   14.74 + 	}
   14.75 + 
   14.76 +       if (__builtin_expect (GL(dl_ns)[ns]._ns_global_scope_alloc, 0) != 0
   14.77 +diff -Naur glibc-2.14.1.orig/elf/rtld.c glibc-2.14.1/elf/rtld.c
   14.78 +--- glibc-2.14.1.orig/elf/rtld.c	2011-10-07 09:48:55.000000000 +0000
   14.79 ++++ glibc-2.14.1/elf/rtld.c	2011-10-07 19:43:10.355406263 +0000
   14.80 +@@ -2263,6 +2263,7 @@
   14.81 + 	      lnp->dont_free = 1;
   14.82 + 	      lnp = lnp->next;
   14.83 + 	    }
   14.84 ++	  l->l_free_initfini = 0;
   14.85 + 
   14.86 + 	  if (l != &GL(dl_rtld_map))
   14.87 + 	    _dl_relocate_object (l, l->l_scope, GLRO(dl_lazy) ? RTLD_LAZY : 0,
   14.88 +diff -Naur glibc-2.14.1.orig/include/link.h glibc-2.14.1/include/link.h
   14.89 +--- glibc-2.14.1.orig/include/link.h	2011-10-07 09:48:55.000000000 +0000
   14.90 ++++ glibc-2.14.1/include/link.h	2011-10-07 19:43:10.357462703 +0000
   14.91 +@@ -192,6 +192,9 @@
   14.92 + 						 during LD_TRACE_PRELINKING=1
   14.93 + 						 contains any DT_SYMBOLIC
   14.94 + 						 libraries.  */
   14.95 ++    unsigned int l_free_initfini:1; /* Nonzero if l_initfini can be
   14.96 ++				       freed, ie. not allocated with
   14.97 ++				       the dummy malloc in ld.so.  */
   14.98 + 
   14.99 +     /* Collected information about own RPATH directories.  */
  14.100 +     struct r_search_path_struct l_rpath_dirs;
  14.101 +@@ -240,9 +243,6 @@
  14.102 + 
  14.103 +     /* List of object in order of the init and fini calls.  */
  14.104 +     struct link_map **l_initfini;
  14.105 +-    /* The init and fini list generated at startup, saved when the
  14.106 +-       object is also loaded dynamically.  */
  14.107 +-    struct link_map **l_orig_initfini;
  14.108 + 
  14.109 +     /* List of the dependencies introduced through symbol binding.  */
  14.110 +     struct link_map_reldeps
  14.111 +diff -Naur glibc-2.14.1.orig/resolv/res_query.c glibc-2.14.1/resolv/res_query.c
  14.112 +--- glibc-2.14.1.orig/resolv/res_query.c	2011-10-07 09:48:55.000000000 +0000
  14.113 ++++ glibc-2.14.1/resolv/res_query.c	2011-10-07 19:43:10.361412711 +0000
  14.114 +@@ -122,6 +122,7 @@
  14.115 + 		  int *resplen2)
  14.116 + {
  14.117 + 	HEADER *hp = (HEADER *) answer;
  14.118 ++	HEADER *hp2;
  14.119 + 	int n, use_malloc = 0;
  14.120 + 	u_int oflags = statp->_flags;
  14.121 + 
  14.122 +@@ -239,26 +240,25 @@
  14.123 + 	  /* __libc_res_nsend might have reallocated the buffer.  */
  14.124 + 	  hp = (HEADER *) *answerp;
  14.125 + 
  14.126 +-	/* We simplify the following tests by assigning HP to HP2.  It
  14.127 +-	   is easy to verify that this is the same as ignoring all
  14.128 +-	   tests of HP2.  */
  14.129 +-	HEADER *hp2 = answerp2 ? (HEADER *) *answerp2 : hp;
  14.130 +-
  14.131 +-	if (n < (int) sizeof (HEADER) && answerp2 != NULL
  14.132 +-	    && *resplen2 > (int) sizeof (HEADER))
  14.133 ++	/* We simplify the following tests by assigning HP to HP2 or
  14.134 ++	   vice versa.  It is easy to verify that this is the same as
  14.135 ++	   ignoring all tests of HP or HP2.  */
  14.136 ++	if (answerp2 == NULL || *resplen2 < (int) sizeof (HEADER))
  14.137 + 	  {
  14.138 +-	    /* Special case of partial answer.  */
  14.139 +-	    assert (hp != hp2);
  14.140 +-	    hp = hp2;
  14.141 ++	    hp2 = hp;
  14.142 + 	  }
  14.143 +-	else if (answerp2 != NULL && *resplen2 < (int) sizeof (HEADER)
  14.144 +-		 && n > (int) sizeof (HEADER))
  14.145 ++	else
  14.146 + 	  {
  14.147 +-	    /* Special case of partial answer.  */
  14.148 +-	    assert (hp != hp2);
  14.149 +-	    hp2 = hp;
  14.150 ++	    hp2 = (HEADER *) *answerp2;
  14.151 ++	    if (n < (int) sizeof (HEADER))
  14.152 ++	      {
  14.153 ++	        hp = hp2;
  14.154 ++	      }
  14.155 + 	  }
  14.156 + 
  14.157 ++	/* Make sure both hp and hp2 are defined */
  14.158 ++	assert((hp != NULL) && (hp2 != NULL));
  14.159 ++
  14.160 + 	if ((hp->rcode != NOERROR || ntohs(hp->ancount) == 0)
  14.161 + 	    && (hp2->rcode != NOERROR || ntohs(hp2->ancount) == 0)) {
  14.162 + #ifdef DEBUG
    15.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.2 +++ b/glibc/stuff/glibc-2.14.1-gcc_fix-1.patch	Wed Jul 23 22:03:59 2014 +0000
    15.3 @@ -0,0 +1,49 @@
    15.4 +Submitted By:            Matt Burgess <matthew_at_linuxfromscratch_dot_org>
    15.5 +Date:                    2010-04-18
    15.6 +Initial Package Version: 2.11.1
    15.7 +Upstream Status:         Not Submitted
    15.8 +Origin:                  http://www.eglibc.org/archives/patches/msg00073.html
    15.9 +Description:             Fixes the following build problem with GCC-4.5.0:
   15.10 +
   15.11 +/mnt/lfs/sources/libc-build/math/s_frexp.os.dt -MT /mnt/lfs/sources/libc-build/math/s_frexp.os
   15.12 +./sysdeps/i386/fpu/s_frexp.S: Assembler messages:
   15.13 +./sysdeps/i386/fpu/s_frexp.S:66: Error: invalid identifier for ".ifdef"
   15.14 +./sysdeps/i386/fpu/s_frexp.S:66: Error: junk at end of line, first unrecognized character is `1'
   15.15 +./sysdeps/i386/fpu/s_frexp.S:66: Error: junk at end of line, first unrecognized character is `1'
   15.16 +./sysdeps/i386/fpu/s_frexp.S:66: Error: junk at end of line, first unrecognized character is `1'
   15.17 +./sysdeps/i386/fpu/s_frexp.S:66: Error: junk at end of line, first unrecognized character is `.'
   15.18 +./sysdeps/i386/fpu/s_frexp.S:66: Error: junk at end of line, first unrecognized character is `1'
   15.19 +./sysdeps/i386/fpu/s_frexp.S:66: Error: expected comma after name `' in .size directive
   15.20 +./sysdeps/i386/fpu/s_frexp.S:66: Error: ".endif" without ".if"
   15.21 +./sysdeps/i386/fpu/s_frexp.S:66: Error: junk `.get_pc_thunk.dx' after expression
   15.22 +make[2]: *** [/mnt/lfs/sources/libc-build/math/s_frexp.os] Error 1
   15.23 +
   15.24 +diff -Naur glibc-2.11.1.orig/nptl/sysdeps/pthread/pt-initfini.c glibc-2.11.1/nptl/sysdeps/pthread/pt-initfini.c
   15.25 +--- glibc-2.11.1.orig/nptl/sysdeps/pthread/pt-initfini.c	2009-12-08 20:10:20.000000000 +0000
   15.26 ++++ glibc-2.11.1/nptl/sysdeps/pthread/pt-initfini.c	2010-04-17 11:34:06.882681001 +0000
   15.27 +@@ -45,6 +45,11 @@
   15.28 + /* Embed an #include to pull in the alignment and .end directives. */
   15.29 + asm ("\n#include \"defs.h\"");
   15.30 + 
   15.31 ++asm ("\n#if defined __i686 && defined __ASSEMBLER__");
   15.32 ++asm ("\n#undef __i686");
   15.33 ++asm ("\n#define __i686 __i686");
   15.34 ++asm ("\n#endif");
   15.35 ++
   15.36 + /* The initial common code ends here. */
   15.37 + asm ("\n/*@HEADER_ENDS*/");
   15.38 + 
   15.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
   15.40 +--- glibc-2.11.1.orig/sysdeps/unix/sysv/linux/i386/sysdep.h	2009-12-08 20:10:20.000000000 +0000
   15.41 ++++ glibc-2.11.1/sysdeps/unix/sysv/linux/i386/sysdep.h	2010-04-17 11:34:06.882681001 +0000
   15.42 +@@ -29,6 +29,10 @@
   15.43 + #include <dl-sysdep.h>
   15.44 + #include <tls.h>
   15.45 + 
   15.46 ++#if defined __i686 && defined __ASSEMBLER__
   15.47 ++#undef __i686
   15.48 ++#define __i686 __i686
   15.49 ++#endif
   15.50 + 
   15.51 + /* For Linux we can use the system call table in the header file
   15.52 + 	/usr/include/asm/unistd.h
    16.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.2 +++ b/glibc/stuff/glibc-2.14.1-sort-1.patch	Wed Jul 23 22:03:59 2014 +0000
    16.3 @@ -0,0 +1,273 @@
    16.4 +Submitted By:            Bruce Dubbs <bdubbs_at_linuxfromscratch_dot_org>
    16.5 +Date:                    2012-02-24
    16.6 +Initial Package Version: 2.14.1
    16.7 +Upstream Status:         From upstream
    16.8 +Origin:                  Upstream
    16.9 +Description:             Sort objects by dependency before relocation.
   16.10 +                         Fixes segfault in dlopen for several programs.
   16.11 +
   16.12 +diff --git a/Makeconfig b/Makeconfig
   16.13 +index 2db2821..68547b2 100644
   16.14 +--- a/Makeconfig
   16.15 ++++ b/Makeconfig
   16.16 +@@ -938,6 +938,12 @@ libdl =
   16.17 + endif
   16.18 + endif
   16.19 + 
   16.20 ++ifeq ($(build-shared),yes)
   16.21 ++libm = $(common-objpfx)math/libm.so$(libm.so-version)
   16.22 ++else
   16.23 ++libm = $(common-objpfx)math/libm.a
   16.24 ++endif
   16.25 ++
   16.26 + # These are the subdirectories containing the library source.  The order
   16.27 + # is more or less arbitrary.  The sorting step will take care of the
   16.28 + # dependencies.
   16.29 +diff --git a/elf/Makefile b/elf/Makefile
   16.30 +index 052e763..3f1772a 100644
   16.31 +--- a/elf/Makefile
   16.32 ++++ b/elf/Makefile
   16.33 +@@ -124,7 +124,8 @@ distribute	:= rtld-Rules \
   16.34 + 		   tst-initordera1.c tst-initordera2.c tst-initorderb1.c \
   16.35 + 		   tst-initorderb2.c tst-initordera3.c tst-initordera4.c \
   16.36 + 		   tst-initorder.c \
   16.37 +-		   tst-initorder2.c
   16.38 ++		   tst-initorder2.c \
   16.39 ++		   tst-relsort1.c tst-relsort1mod1.c tst-relsort1mod2.c
   16.40 + 
   16.41 + CFLAGS-dl-runtime.c = -fexceptions -fasynchronous-unwind-tables
   16.42 + CFLAGS-dl-lookup.c = -fexceptions -fasynchronous-unwind-tables
   16.43 +@@ -227,7 +228,7 @@ tests += loadtest restest1 preloadtest loadfail multiload origtest resolvfail \
   16.44 + 	 tst-audit1 tst-audit2 \
   16.45 + 	 tst-stackguard1 tst-addr1 tst-thrlock \
   16.46 + 	 tst-unique1 tst-unique2 tst-unique3 tst-unique4 \
   16.47 +-	 tst-initorder tst-initorder2
   16.48 ++	 tst-initorder tst-initorder2 tst-relsort1
   16.49 + #	 reldep9
   16.50 + test-srcs = tst-pathopt
   16.51 + selinux-enabled := $(shell cat /selinux/enforce 2> /dev/null)
   16.52 +@@ -290,7 +291,9 @@ modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \
   16.53 + 		tst-initordera1 tst-initorderb1 \
   16.54 + 		tst-initordera2 tst-initorderb2 \
   16.55 + 		tst-initordera3 tst-initordera4 \
   16.56 +-		tst-initorder2a tst-initorder2b tst-initorder2c tst-initorder2d
   16.57 ++		tst-initorder2a tst-initorder2b tst-initorder2c \
   16.58 ++		tst-initorder2d \
   16.59 ++		tst-relsort1mod1 tst-relsort1mod2
   16.60 + ifeq (yes,$(have-initfini-array))
   16.61 + modules-names += tst-array2dep tst-array5dep
   16.62 + endif
   16.63 +@@ -1195,3 +1198,9 @@ CFLAGS-tst-auditmod6b.c += $(AVX-CFLAGS)
   16.64 + CFLAGS-tst-auditmod6c.c += $(AVX-CFLAGS)
   16.65 + CFLAGS-tst-auditmod7b.c += $(AVX-CFLAGS)
   16.66 + endif
   16.67 ++
   16.68 ++$(objpfx)tst-relsort1: $(libdl)
   16.69 ++$(objpfx)tst-relsort1mod1.so: $(libm) $(objpfx)tst-relsort1mod2.so
   16.70 ++$(objpfx)tst-relsort1mod2.so: $(libm)
   16.71 ++$(objpfx)tst-relsort1.out: $(objpfx)tst-relsort1mod1.so \
   16.72 ++			   $(objpfx)tst-relsort1mod2.so
   16.73 +diff --git a/elf/dl-open.c b/elf/dl-open.c
   16.74 +index a0b5c50..a56bdc1 100644
   16.75 +--- a/elf/dl-open.c
   16.76 ++++ b/elf/dl-open.c
   16.77 +@@ -1,5 +1,5 @@
   16.78 + /* Load a shared object at runtime, relocate it, and run its initializer.
   16.79 +-   Copyright (C) 1996-2007, 2009, 2010, 2011 Free Software Foundation, Inc.
   16.80 ++   Copyright (C) 1996-2007, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
   16.81 +    This file is part of the GNU C Library.
   16.82 + 
   16.83 +    The GNU C Library is free software; you can redistribute it and/or
   16.84 +@@ -303,45 +303,109 @@ dl_open_worker (void *a)
   16.85 +   if (GLRO(dl_lazy))
   16.86 +     reloc_mode |= mode & RTLD_LAZY;
   16.87 + 
   16.88 +-  /* Relocate the objects loaded.  We do this in reverse order so that copy
   16.89 +-     relocs of earlier objects overwrite the data written by later objects.  */
   16.90 +-
   16.91 ++  /* Sort the objects by dependency for the relocation process.  This
   16.92 ++     allows IFUNC relocations to work and it also means copy
   16.93 ++     relocation of dependencies are if necessary overwritten.  */
   16.94 ++  size_t nmaps = 0;
   16.95 +   struct link_map *l = new;
   16.96 +-  while (l->l_next)
   16.97 +-    l = l->l_next;
   16.98 +-  while (1)
   16.99 ++  do
  16.100 ++    {
  16.101 ++      if (! l->l_real->l_relocated)
  16.102 ++	++nmaps;
  16.103 ++      l = l->l_next;
  16.104 ++    }
  16.105 ++  while (l != NULL);
  16.106 ++  struct link_map *maps[nmaps];
  16.107 ++  nmaps = 0;
  16.108 ++  l = new;
  16.109 ++  do
  16.110 +     {
  16.111 +       if (! l->l_real->l_relocated)
  16.112 ++	maps[nmaps++] = l;
  16.113 ++      l = l->l_next;
  16.114 ++    }
  16.115 ++  while (l != NULL);
  16.116 ++  if (nmaps > 1)
  16.117 ++    {
  16.118 ++      char seen[nmaps];
  16.119 ++      memset (seen, '\0', nmaps);
  16.120 ++      size_t i = 0;
  16.121 ++      while (1)
  16.122 + 	{
  16.123 +-#ifdef SHARED
  16.124 +-	  if (__builtin_expect (GLRO(dl_profile) != NULL, 0))
  16.125 ++	  ++seen[i];
  16.126 ++	  struct link_map *thisp = maps[i];
  16.127 ++
  16.128 ++	  /* Find the last object in the list for which the current one is
  16.129 ++	     a dependency and move the current object behind the object
  16.130 ++	     with the dependency.  */
  16.131 ++	  size_t k = nmaps - 1;
  16.132 ++	  while (k > i)
  16.133 + 	    {
  16.134 +-	      /* If this here is the shared object which we want to profile
  16.135 +-		 make sure the profile is started.  We can find out whether
  16.136 +-		 this is necessary or not by observing the `_dl_profile_map'
  16.137 +-		 variable.  If was NULL but is not NULL afterwars we must
  16.138 +-		 start the profiling.  */
  16.139 +-	      struct link_map *old_profile_map = GL(dl_profile_map);
  16.140 ++	      struct link_map **runp = maps[k]->l_initfini;
  16.141 ++	      if (runp != NULL)
  16.142 ++		/* Look through the dependencies of the object.  */
  16.143 ++		while (*runp != NULL)
  16.144 ++		  if (__builtin_expect (*runp++ == thisp, 0))
  16.145 ++		    {
  16.146 ++		      /* Move the current object to the back past the last
  16.147 ++			 object with it as the dependency.  */
  16.148 ++		      memmove (&maps[i], &maps[i + 1],
  16.149 ++			       (k - i) * sizeof (maps[0]));
  16.150 ++		      maps[k] = thisp;
  16.151 ++
  16.152 ++		      if (seen[i + 1] > 1)
  16.153 ++			{
  16.154 ++			  ++i;
  16.155 ++			  goto next_clear;
  16.156 ++			}
  16.157 ++
  16.158 ++		      char this_seen = seen[i];
  16.159 ++		      memmove (&seen[i], &seen[i + 1],
  16.160 ++			       (k - i) * sizeof (seen[0]));
  16.161 ++		      seen[k] = this_seen;
  16.162 ++
  16.163 ++		      goto next;
  16.164 ++		    }
  16.165 ++
  16.166 ++	      --k;
  16.167 ++	    }
  16.168 + 
  16.169 +-	      _dl_relocate_object (l, l->l_scope, reloc_mode | RTLD_LAZY, 1);
  16.170 ++	  if (++i == nmaps)
  16.171 ++	    break;
  16.172 ++	next_clear:
  16.173 ++	  memset (&seen[i], 0, (nmaps - i) * sizeof (seen[0]));
  16.174 ++	next:;
  16.175 ++	}
  16.176 ++    }
  16.177 + 
  16.178 +-	      if (old_profile_map == NULL && GL(dl_profile_map) != NULL)
  16.179 +-		{
  16.180 +-		  /* We must prepare the profiling.  */
  16.181 +-		  _dl_start_profile ();
  16.182 ++  for (size_t i = nmaps; i-- > 0; )
  16.183 ++    {
  16.184 ++      l = maps[i];
  16.185 + 
  16.186 +-		  /* Prevent unloading the object.  */
  16.187 +-		  GL(dl_profile_map)->l_flags_1 |= DF_1_NODELETE;
  16.188 +-		}
  16.189 ++#ifdef SHARED
  16.190 ++      if (__builtin_expect (GLRO(dl_profile) != NULL, 0))
  16.191 ++	{
  16.192 ++	  /* If this here is the shared object which we want to profile
  16.193 ++	     make sure the profile is started.  We can find out whether
  16.194 ++	     this is necessary or not by observing the `_dl_profile_map'
  16.195 ++	     variable.  If it was NULL but is not NULL afterwars we must
  16.196 ++	     start the profiling.  */
  16.197 ++	  struct link_map *old_profile_map = GL(dl_profile_map);
  16.198 ++
  16.199 ++	  _dl_relocate_object (l, l->l_scope, reloc_mode | RTLD_LAZY, 1);
  16.200 ++
  16.201 ++	  if (old_profile_map == NULL && GL(dl_profile_map) != NULL)
  16.202 ++	    {
  16.203 ++	      /* We must prepare the profiling.  */
  16.204 ++	      _dl_start_profile ();
  16.205 ++
  16.206 ++	      /* Prevent unloading the object.  */
  16.207 ++	      GL(dl_profile_map)->l_flags_1 |= DF_1_NODELETE;
  16.208 + 	    }
  16.209 +-	  else
  16.210 +-#endif
  16.211 +-	    _dl_relocate_object (l, l->l_scope, reloc_mode, 0);
  16.212 + 	}
  16.213 +-
  16.214 +-      if (l == new)
  16.215 +-	break;
  16.216 +-      l = l->l_prev;
  16.217 ++      else
  16.218 ++#endif
  16.219 ++	_dl_relocate_object (l, l->l_scope, reloc_mode, 0);
  16.220 +     }
  16.221 + 
  16.222 +   /* If the file is not loaded now as a dependency, add the search
  16.223 +diff --git a/elf/tst-relsort1.c b/elf/tst-relsort1.c
  16.224 +new file mode 100644
  16.225 +index 0000000..972100c
  16.226 +--- /dev/null
  16.227 ++++ b/elf/tst-relsort1.c
  16.228 +@@ -0,0 +1,19 @@
  16.229 ++#include <dlfcn.h>
  16.230 ++#include <stdio.h>
  16.231 ++
  16.232 ++
  16.233 ++static int
  16.234 ++do_test ()
  16.235 ++{
  16.236 ++  const char lib[] = "$ORIGIN/tst-relsort1mod1.so";
  16.237 ++  void *h = dlopen (lib, RTLD_NOW);
  16.238 ++  if (h == NULL)
  16.239 ++    {
  16.240 ++      puts (dlerror ());
  16.241 ++      return 1;
  16.242 ++    }
  16.243 ++  return 0;
  16.244 ++}
  16.245 ++
  16.246 ++#define TEST_FUNCTION do_test ()
  16.247 ++#include "../test-skeleton.c"
  16.248 +diff --git a/elf/tst-relsort1mod1.c b/elf/tst-relsort1mod1.c
  16.249 +new file mode 100644
  16.250 +index 0000000..9e4a943
  16.251 +--- /dev/null
  16.252 ++++ b/elf/tst-relsort1mod1.c
  16.253 +@@ -0,0 +1,7 @@
  16.254 ++extern int foo (double);
  16.255 ++
  16.256 ++int
  16.257 ++bar (void)
  16.258 ++{
  16.259 ++  return foo (1.2);
  16.260 ++}
  16.261 +diff --git a/elf/tst-relsort1mod2.c b/elf/tst-relsort1mod2.c
  16.262 +new file mode 100644
  16.263 +index 0000000..a2c3e55
  16.264 +--- /dev/null
  16.265 ++++ b/elf/tst-relsort1mod2.c
  16.266 +@@ -0,0 +1,7 @@
  16.267 ++#include <math.h>
  16.268 ++
  16.269 ++int
  16.270 ++foo (double d)
  16.271 ++{
  16.272 ++  return floor (d) != 0.0;
  16.273 ++}
  16.274 +-- 
  16.275 +1.7.3.4
  16.276 +