#!/bin/sh # First argument of this script is the package name # 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 a sed substitution that will suppress the installation of # libiberty.a. We want to use the Binutils version of libiberty.a cd ${LFS_TMP}/${1} && sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/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. sed -i 's/^XCFLAGS =$/& -fomit-frame-pointer/' gcc/Makefile.in && # Suppressing the running of the fixincludes script. */ sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in && # GCC provides a gccbug script which detects at compile time whether # mktemp is present, and hardcodes the result in a test. This will # cause the script to fall back to using less random names for temporary # files. We will be installing mktemp later, so the following sed will # simulate its presence: sed -i 's/@have_mktemp_command@/yes/' gcc/gccbug.in && cd ${LFS_TMP}/${1}-build && ../${1}/configure \ --prefix=/usr \ --libexecdir=/usr/lib \ --enable-shared \ --enable-threads=posix \ --enable-__cxa_atexit \ --enable-clocale=gnu \ --enable-languages=c,c++ \ --disable-bootstrap && make -j ${MAKEJOBS} && make install && ln -v -sf ../usr/bin/cpp /lib && ln -v -sf gcc /usr/bin/cc && # Performing compilation test... echo 'main(){}' > dummy.c && cc dummy.c && readelf -l a.out | grep ': /lib' 1> /dev/null 2>&1 && rm dummy.c a.out && # Restore original CFLAGS and CXXFLAGS values. restore_flags # Return last error exit $?