#!/bin/bash set -o errexit # Reading system configuration informations, functions and package versions. source ../sysinfos source ../functions source ../packages-list # Manually applying patches apply_patch ${1}-branch_update-1.patch ${1} case "${HVL_TARGET}" in *) TARGET_CONFIGURE_OPTS="--with-ppl=/cross-tools \ --with-cloog=/cross-tools \ --disable-multilib" ;; esac case "${HVL_TARGET}" in "x86") apply_patch ${1}-specs-1.patch ${1} ;; "x86_64") apply_patch ${1}-pure64_specs-1.patch ${1} ;; esac cd ${LFS_TMP}/${1} # Change the StartFile Spec to point to the correct library location: echo -en '#undef STANDARD_INCLUDE_DIR\n#define STANDARD_INCLUDE_DIR "/tools/include/"\n\n' >> gcc/config/linux.h echo -en '\n#undef STANDARD_STARTFILE_PREFIX_1\n#define STANDARD_STARTFILE_PREFIX_1 "/tools/lib/"\n' >> gcc/config/linux.h echo -en '\n#undef STANDARD_STARTFILE_PREFIX_2\n#define STANDARD_STARTFILE_PREFIX_2 ""\n' >> gcc/config/linux.h # Alter gcc's C preprocessor's default include search path to use /tools only: cp -v gcc/Makefile.in{,.orig} sed -e "s@\(^CROSS_SYSTEM_HEADER_DIR =\).*@\1 /tools/include@g" \ gcc/Makefile.in.orig > gcc/Makefile.in # Configure options: # --enable-languages=c,c++ # This option ensures that only the C and C++ compilers are built. # --enable-__cxa_atexit # This option allows use of __cxa_atexit, rather than atexit, to register # C++ destructors for local # statics and global objects and is essential for fully standards-compliant # handling of destructors. It also affects the C++ ABI and therefore results # in C++ shared libraries and C++ programs that are interoperable with other # Linux distributions. # --enable-c99 # Enable C99 support for C programs. # --enable-long-long # Enables long long support in the compiler. # --enable-threads=posix # This enables C++ exception handling for multi-threaded code. cd ${LFS_TMP}/${1}-build AR=ar LDFLAGS="-Wl,-rpath,/cross-tools/lib" \ ../${1}/configure \ --prefix=/cross-tools \ --build=${CLFS_HOST} \ --host=${CLFS_HOST} \ --target=${CLFS_TARGET} \ --with-sysroot=${CLFS} \ --with-local-prefix=/tools \ --disable-nls \ --enable-shared \ --enable-languages=c,c++ \ --enable-__cxa_atexit \ --with-mpfr=/cross-tools \ --with-gmp=/cross-tools \ --enable-c99 \ --enable-long-long \ --enable-threads=posix \ ${TARGET_CONFIGURE_OPTS} ${HVMAKE} \ AS_FOR_TARGET="${CLFS_TARGET}-as" \ LD_FOR_TARGET="${CLFS_TARGET}-ld" ${HVMAKE} install exit $?