#!/bin/bash hvconfig_pre() { export AR=ar export LDFLAGS="-Wl,-rpath,${CROSS_TOOLS_DIR}/lib" # Common options for passes 1 & 2 # --with-local-prefix: # Remove /usr/local/include (default value) from gcc's include search # path. This is not absolutely essential, however, it helps to minimize # the influence of the host system. # --with-native-system-header-dir=dirname # Must be an absolute directory (from within sysroot). # The compiler will search the sysroot directory within dirname for # native system headers rather than the default /usr/include. # For example, with: # --with-sysroot=/opt/toolchain # --with-native-system-header-dir=/tools/include # then GCC will search for system headers in: # /opt/toolchain/tools/include CONFIGURE_OPTS=" \ --prefix=/cross-tools \ --build=${CLFS_HOST} \ --host=${CLFS_HOST} \ --target=${CLFS_TARGET} \ --with-sysroot=${CLFS} \ --with-local-prefix=${TOOLS_DIR} \ --with-native-system-header-dir=/tools/include \ --disable-nls \ --with-mpfr=${CROSS_TOOLS_DIR} \ --with-gmp=${CROSS_TOOLS_DIR} \ --with-isl=${CROSS_TOOLS_DIR} \ --with-cloog=${CROSS_TOOLS_DIR} \ --with-mpc=${CROSS_TOOLS_DIR} --with-system-zlib \ --enable-checking=release \ --disable-multilib" if [ "x${HVLABEL}" = "x${GCC}-pass1" ]; then # --without-headers: # When building a cross-compiler and there are no system headers # for the target yet (they will be available once glibc is built). # --with-newlib: # Tell the configuration utility not to use glibc, since it has not # yet been compiled for the target. CONFIGURE_OPTS+=" \ --disable-shared \ --without-headers \ --with-newlib \ --disable-decimal-float \ --disable-libgomp \ --disable-libmudflap \ --disable-libssp \ --disable-libatomic \ --disable-libitm \ --disable-libsanitizer \ --disable-libquadmath \ --disable-threads \ --disable-target-zlib \ --enable-languages=c" # We will create a dummy limits.h so the build will not use the one # provided by the host distro: mkdir -p ${TOOLS_DIR}/include touch ${TOOLS_DIR}/include/limits.h else CONFIGURE_OPTS+=" \ --enable-shared \ --disable-static \ --enable-languages=c,c++ \ --enable-__cxa_atexit \ --enable-c99 \ --enable-long-long \ --enable-libstdcxx-time \ --enable-threads=posix" cd ${SRC_DIR} # Change the StartFile Spec to point to the correct library location: echo -en '\n' >> gcc/config/linux.h echo -en '#undef STANDARD_STARTFILE_PREFIX_1\n' >> gcc/config/linux.h echo -en '#define STANDARD_STARTFILE_PREFIX_1 "/tools/lib/"\n' >> \ gcc/config/linux.h echo -en '#undef STANDARD_STARTFILE_PREFIX_2\n' >> gcc/config/linux.h echo -en '#define STANDARD_STARTFILE_PREFIX_2 ""\n' >> \ gcc/config/linux.h fi } hvconfig_post() { unset AR unset LDFLAGS } hvbuild() { if [ "x${HVLABEL}" = "x${GCC}-pass1" ]; then ${HVMAKE} all-gcc all-target-libgcc ${HVMAKE} DESTDIR=${LFS} install-gcc install-target-libgcc else ${HVMAKE} \ AS_FOR_TARGET="${CLFS_TARGET}-as" \ LD_FOR_TARGET="${CLFS_TARGET}-ld" ${HVMAKE} DESTDIR=${LFS} install fi }