X-Git-Url: http://gitweb.hugovil.com/?a=blobdiff_plain;f=stage0%2Fpkg%2Fgcc;h=fab1a514723f2f6a6531a8d5930c2dfe86fd93b2;hb=d381f8e6ab376aa1a90da946c1bde740214fc866;hp=5746dab59250130431e79768f954f976322d0896;hpb=69ac3e7cf686f8e95e47a7ab89bc38796aace488;p=hvlinux.git diff --git a/stage0/pkg/gcc b/stage0/pkg/gcc index 5746dab..fab1a51 100644 --- a/stage0/pkg/gcc +++ b/stage0/pkg/gcc @@ -1,39 +1,50 @@ #!/bin/bash -hvpatch() +hvconfig_pre() { - # Manually applying patches if specified - if [ -n "${GCC_PATCHES}" ]; then - for p in ${GCC_PATCHES}; do - apply_patch ${PACKAGE}-${p}.patch ${PACKAGE} - done - fi - - case "${HVL_TARGET}" in - "x86") - apply_patch ${PACKAGE}-specs-1.patch ${PACKAGE} - ;; - "x86_64") - apply_patch ${PACKAGE}-pure64_specs-1.patch ${PACKAGE} - ;; - esac -} + export AR=ar + export LDFLAGS="-Wl,-rpath,${CROSS_TOOLS_DIR}/lib" -configure_pre() -{ # Common options for passes 1 & 2 - CONFIGURE_OPTS="${CONFIGURE_OPTS} \ + # --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 \ + --with-local-prefix=${TOOLS_DIR} \ + --with-native-system-header-dir=/tools/include \ --disable-nls \ - --with-mpfr=/cross-tools \ - --with-gmp=/cross-tools" + --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 [ -n "${GCC_PASS1}" ]; then - CONFIGURE_OPTS="${CONFIGURE_OPTS} \ + 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 \ @@ -41,54 +52,57 @@ configure_pre() --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="${CONFIGURE_OPTS} \ + CONFIGURE_OPTS+=" \ --enable-shared \ + --disable-static \ --enable-languages=c,c++ \ --enable-__cxa_atexit \ --enable-c99 \ --enable-long-long \ + --enable-libstdcxx-time \ --enable-threads=posix" - fi - case "${HVL_TARGET}" in - *) - CONFIGURE_OPTS="${CONFIGURE_OPTS} --with-ppl=/cross-tools \ - --with-cloog=/cross-tools \ - --disable-multilib" - ;; - esac + cd ${SRC_DIR} - cd ${LFS_TMP}/${PACKAGE} - - # 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: - sed -e "s@\(^CROSS_SYSTEM_HEADER_DIR =\).*@\1 /tools/include@g" \ - -i gcc/Makefile.in - - if [ -n "${GCC_PASS1}" ]; then - # 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 + # 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 [ -n "${GCC_PASS1}" ]; then + if [ "x${HVLABEL}" = "x${GCC}-pass1" ]; then ${HVMAKE} all-gcc all-target-libgcc - ${HVMAKE} install-gcc install-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} install + ${HVMAKE} DESTDIR=${LFS} install fi }