GCC 4.6: Incorporate changes made in 4.5 to support cross-builds to GNU.

svn path=/nixpkgs/trunk/; revision=30628
This commit is contained in:
Ludovic Courtès 2011-11-29 22:54:12 +00:00
parent 46d3cd449f
commit 8404afcfe4
2 changed files with 12 additions and 7 deletions

View file

@ -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

View file

@ -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