#!/bin/sh # Reading system configuration informations, functions and package versions. source ../sysinfos source ../functions source ../packages-list # Saves CFLAGS and CXXFLAGS, and clears them. save_flags_no_optimizations && # Applying patches (if any) apply_patches ${1} && cd ${LFS_TMP}/${1} && # Suppressing the running of the fixincludes script. */ cp -v gcc/Makefile.in{,.orig} && sed 's@\./fixinc\.sh@-c true@' gcc/Makefile.in.orig > gcc/Makefile.in && # The bootstrap build performed in pass1 built GCC with the -fomit-frame-pointer # compiler flag. Non-bootstrap builds omit this flag by default, so the following sed # command is used in order to ensure consistent compiler builds. cp -v gcc/Makefile.in{,.tmp} && sed 's/^XCFLAGS =$/& -fomit-frame-pointer/' gcc/Makefile.in.tmp > gcc/Makefile.in && # The following command will change the location of GCC's default dynamic # linker to use the one we installed in /tools. It also removes # /usr/include from GCC's include search path for file in $(find gcc/config -name linux64.h -o -name linux.h); do cp -uv $file{,.orig} sed -e 's@/lib\(64\)\?\(32\)\?/ld@/tools&@g' \ -e 's@/usr@/tools@g' $file.orig > $file echo "" >> $file echo "#undef STANDARD_INCLUDE_DIR" >> $file echo "#define STANDARD_INCLUDE_DIR 0" >> $file touch $file.orig done cd ${LFS_TMP}/${1}-build && ../${1}/configure \ --prefix=/tools \ --with-local-prefix=/tools \ --enable-clocale=gnu \ --enable-shared \ --enable-threads=posix \ --enable-__cxa_atexit \ --enable-languages=c,c++ \ --disable-libstdcxx-pch \ --disable-bootstrap && make -j ${MAKEJOBS} && make install && gcc_toolchain_test_stage1 && # Restore original CFLAGS and CXXFLAGS values. restore_flags # Return last error exit $?