diff --git a/pkgs/development/compilers/gcc-4.6/builder.sh b/pkgs/development/compilers/gcc-4.6/builder.sh index 8e1b3c8e4079..6cd64bc58f20 100644 --- a/pkgs/development/compilers/gcc-4.6/builder.sh +++ b/pkgs/development/compilers/gcc-4.6/builder.sh @@ -5,11 +5,6 @@ export NIX_FIXINC_DUMMY=$NIX_BUILD_TOP/dummy mkdir $NIX_FIXINC_DUMMY -# libstdc++ needs this; otherwise it will use /lib/cpp, which is a Bad -# Thing. -export CPP="gcc -E" -export CXXCPP="g++ -E" - if test "$staticCompiler" = "1"; then EXTRA_LDFLAGS="-static" else diff --git a/pkgs/development/compilers/gcc-4.6/default.nix b/pkgs/development/compilers/gcc-4.6/default.nix index 71ca99b3c13a..03d3b235f109 100644 --- a/pkgs/development/compilers/gcc-4.6/default.nix +++ b/pkgs/development/compilers/gcc-4.6/default.nix @@ -153,13 +153,17 @@ stdenv.mkDerivation ({ postPatch = if (stdenv.system == "i586-pc-gnu" + || (libcCross != null # e.g., building `gcc.hostDrv' + && libcCross ? crossConfig + && libcCross.crossConfig == "i586-pc-gnu") || (cross != null && cross.config == "i586-pc-gnu" && libcCross != null)) then # On GNU/Hurd glibc refers to Hurd & Mach headers and libpthread is not # in glibc, so add the right `-I' flags to the default spec string. + assert libcCross != null -> libpthreadCross != null; let - libc = if cross != null then libcCross else stdenv.glibc; + libc = if libcCross != null then libcCross else stdenv.glibc; gnu_h = "gcc/config/gnu.h"; i386_gnu_h = "gcc/config/i386/gnu.h"; extraCPPDeps = @@ -181,12 +185,18 @@ stdenv.mkDerivation ({ echo "augmenting \`LIB_SPEC' in \`${gnu_h}' with \`${extraLibSpec}'..." sed -i "${gnu_h}" \ -es'|LIB_SPEC *"\(.*\)$|LIB_SPEC "${extraLibSpec} \1|g' + + echo "setting \`NATIVE_SYSTEM_HEADER_DIR' and \`STANDARD_INCLUDE_DIR' to \`${libc}/include'..." + sed -i "${gnu_h}" \ + -es'|#define STANDARD_INCLUDE_DIR.*$|#define STANDARD_INCLUDE_DIR "${libc}/include"|g' + sed -i gcc/config/t-gnu \ + -es'|NATIVE_SYSTEM_HEADER_DIR.*$|NATIVE_SYSTEM_HEADER_DIR = ${libc}/include|g' '' else if cross != null || stdenv.gcc.libc != null then # On NixOS, use the right path to the dynamic linker instead of # `/lib/ld*.so'. let - libc = if (cross != null && libcCross != null) then libcCross else stdenv.gcc.libc; + libc = if (libcCross != null) then libcCross else stdenv.gcc.libc; in '' echo "fixing the \`GLIBC_DYNAMIC_LINKER' and \`UCLIBC_DYNAMIC_LINKER' macros..." for header in "gcc/config/"*-gnu.h "gcc/config/"*"/"*.h