From fff4a6c8b40ec08b0921948976aa4bf7f02e69de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Tue, 14 Dec 2010 17:08:43 +0000 Subject: [PATCH] GCC 4.5: Fix the `GLIBC_DYNAMIC_LINKER' macro on NixOS and in cross builds. Among others, this should fix the dynamic linker path reported by "gcc --help --verbose". svn path=/nixpkgs/branches/stdenv-updates/; revision=25131 --- pkgs/development/compilers/gcc-4.5/default.nix | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pkgs/development/compilers/gcc-4.5/default.nix b/pkgs/development/compilers/gcc-4.5/default.nix index 91fbc666008..77e3cbfa3ed 100644 --- a/pkgs/development/compilers/gcc-4.5/default.nix +++ b/pkgs/development/compilers/gcc-4.5/default.nix @@ -176,6 +176,21 @@ stdenv.mkDerivation ({ sed -i "${gnu_h}" \ -es'|LIB_SPEC *"\(.*\)$|LIB_SPEC "${extraLibSpec} \1|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 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 + do + grep -q LIBC_DYNAMIC_LINKER "$header" || continue + echo " fixing \`$header'..." + sed -i "$header" \ + -e 's|define[[:blank:]]*\([UCG]\+\)LIBC_DYNAMIC_LINKER\([0-9]*\)[[:blank:]]"\([^\"]\+\)"$|define \1LIBC_DYNAMIC_LINKER\2 "${libc}\3"|g' + done + '' else null; inherit noSysDirs profiledCompiler staticCompiler langJava crossStageStatic