#!/bin/sh 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 "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 # We will create a dummy limits.h so the build will not use the one provided by the host distro: touch /tools/include/limits.h # --with-local-prefix=/tools # The purpose of this switch is to remove /usr/local/include from gcc's include search path. # This is not absolutely essential, however, it helps to minimize the influence of the host system. # --disable-shared # Disables the creation of the shared libraries. # --disable-threads # This will prevent GCC from looking for the multi-thread include files, since they haven't been # created for this architecture yet. GCC will be able to find the multi-thread information after # the Glibc headers are created. # --enable-languages=c # This option ensures that only the C compiler is built. 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 \ --disable-shared \ --with-mpfr=/cross-tools \ --with-gmp=/cross-tools \ --with-ppl=/cross-tools \ --with-cloog=/cross-tools \ --without-headers \ --with-newlib \ --disable-decimal-float \ --disable-libgomp \ --disable-libmudflap \ --disable-libssp \ --disable-threads \ --enable-languages=c \ --disable-multilib ${HVMAKE} all-gcc all-target-libgcc ${HVMAKE} install-gcc install-target-libgcc exit $?