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
This commit is contained in:
Ludovic Courtès 2010-12-14 17:08:43 +00:00
parent e930a7385b
commit fff4a6c8b4
1 changed files with 15 additions and 0 deletions

View File

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