-#!/bin/bash
-set -o errexit
-
-# First argument of this script is the package name.
-# Remaining arguments are additional configure options.
-
-# Reading system configuration informations, functions and package versions.
-source ../sysinfos
-source ../functions
-source ../packages-list
-
-PACKAGE=${1}
-shift
-CONFIGURE_OPTS=${*}
-
-EGLIBC_VER=$(echo ${PACKAGE} | sed "s!eglibc-\([0-9]*\.[0-9]*\.[0-9]*\)-.*!\1!g")
-
-case "${HVL_TARGET}" in
- "x86" | "x86_64")
- # Manually apply patch
- apply_patch ${PACKAGE}-rpath.patch ${PACKAGE}
- ;;
-esac
-
-TMP_CFLAGS="-mtune=generic -g -O2"
-
-case "${HVL_TARGET}" in
- "x86")
- TMP_CFLAGS="-march=$(cut -d- -f1 <<< ${CLFS_TARGET}) ${TMP_CFLAGS}"
- ;;
-esac
-
-# When running make install, a script called test-installation.pl
-# performs a small sanity test on our newly installed Glibc. However,
-# because our toolchain still points to the /tools directory, the
-# sanity test would be carried out against the wrong Glibc. We can
-# force the script to check the Glibc we have just installed with:
-cd ${LFS_TMP}/${PACKAGE}
-LINKER=$(readelf -l $(file /tools/lib/libc-* | cut -f1 -d:) | sed -n 's@.*interpret.*/tools\(.*\)]$@\1@p')
-sed -i "s|libs -o|libs -L/usr/lib -Wl,-dynamic-linker=${LINKER} -o|" \
- scripts/test-installation.pl
-unset LINKER
-
-cd ${LFS_TMP}/${PACKAGE}-build
-
-case "${HVL_TARGET}" in
- "x86_64")
- # Tell EGLIBC to install its libraries into /lib:
- echo "slibdir=/lib" >> configparms
- CONFIGURE_OPTS="${CONFIGURE_OPTS} --libdir=/usr/lib"
- ;;
-esac
-
-# Configure options:
-# --libexecdir=/usr/lib/eglibc
-# Changes the location of the pt_chown program from its default of /usr/libexec to /usr/lib/eglibc.
-CFLAGS=${TMP_CFLAGS} \
- ../${PACKAGE}/configure \
- --prefix=/usr \
- --disable-profile \
- --enable-add-ons \
- --enable-kernel=$(get_pkg_ver ${KERNEL}) \
- --libexecdir=/usr/lib/eglibc \
- ${CONFIGURE_OPTS}
-make
-touch /etc/ld.so.conf
-
-case "${HVL_TARGET}" in
- "x86_64")
- # The install will finish by checking that everything is correctly
- # installed. Unfortunately, it will test for a multilib installation.
- # On x86_64 Pure64 this means it will try to test the non-existent
- # 32-bit loader which has a different name from the 64-bit loader
- # (unlike on other 64-bit architectures). We fool it by creating a
- # symlink to the real loader.
- ln -svfT ld-${EGLIBC_VER}.so /lib/ld-linux.so.2
- make install
-
- # Now we can remove this symlink.
- rm -v /lib/ld-linux.so.2
-
- # We also need to correct the /usr/bin/ldd script - if you look at this,
- # you will see it references not only the 32-bit linker, but also /lib64
- # where it thinks the 64-bit linker is.
- cp -v /usr/bin/ldd{,.bak}
- sed '/RTLDLIST/s%/ld-linux.so.2 /lib64%%' /usr/bin/ldd.bak >/usr/bin/ldd
- rm -v /usr/bin/ldd.bak
- ;;
- *)
- make install
- ;;
-esac
-
-# The following instructions, instead of the install-locales target
-# above, will install the minimum set of locales necessary for the
-# tests to run successfully:
-mkdir -pv /usr/lib/locale
-localedef -i cs_CZ -f UTF-8 cs_CZ.UTF-8
-localedef -i de_DE -f ISO-8859-1 de_DE
-localedef -i de_DE@euro -f ISO-8859-15 de_DE@euro
-localedef -i de_DE -f UTF-8 de_DE.UTF-8
-localedef -i en_HK -f ISO-8859-1 en_HK
-localedef -i en_PH -f ISO-8859-1 en_PH
-localedef -i en_US -f ISO-8859-1 en_US
-localedef -i en_US -f UTF-8 en_US.UTF-8
-localedef -i es_MX -f ISO-8859-1 es_MX
-localedef -i fa_IR -f UTF-8 fa_IR
-localedef -i fr_FR -f ISO-8859-1 fr_FR
-localedef -i fr_FR@euro -f ISO-8859-15 fr_FR@euro
-localedef -i fr_FR -f UTF-8 fr_FR.UTF-8
-localedef -i it_IT -f ISO-8859-1 it_IT
-localedef -i ja_JP -f EUC-JP ja_JP
-localedef -i tr_TR -f UTF-8 tr_TR.UTF-8
-localedef -i zh_CN -f GB18030 zh_CN.GB18030
-
-# French canadian locales:
-localedef -i ca_FR -f UTF-8 ca_FR.UTF-8
-localedef -i ca_FR -f ISO-8859-1 ca_FR
-localedef -i fr_CA -f UTF-8 fr_CA.UTF-8
-localedef -i fr_CA -f ISO-8859-1 fr_CA
-
-cat > /etc/nsswitch.conf << "EOF"
-# /etc/nsswitch.conf
-
-passwd: files
-group: files
-shadow: files
-
-hosts: files dns
-networks: files
-
-protocols: files
-services: files
-ethers: files
-rpc: files
-EOF
-
-ln -svfT ${TIMEZONE} /usr/share/zoneinfo/localtime
-cp --remove-destination /usr/share/zoneinfo/${TIMEZONE} /etc/localtime
-
-cat > /etc/ld.so.conf << "EOF"
-# /etc/ld.so.conf
-/usr/local/lib
-/opt/lib
-EOF
-
-exit $?