gcc5, 7: same fixes as gcc6

This commit is contained in:
Will Dietz 2018-01-07 18:02:57 -06:00
parent fbf41b9ee2
commit f146a3c316
2 changed files with 14 additions and 2 deletions

View File

@ -258,16 +258,22 @@ stdenv.mkDerivation ({
let let
libc = if libcCross != null then libcCross else stdenv.cc.libc; libc = if libcCross != null then libcCross else stdenv.cc.libc;
in in
(
'' echo "fixing the \`GLIBC_DYNAMIC_LINKER', \`UCLIBC_DYNAMIC_LINKER', and \`MUSL_DYNAMIC_LINKER' macros..." '' echo "fixing the \`GLIBC_DYNAMIC_LINKER', \`UCLIBC_DYNAMIC_LINKER', and \`MUSL_DYNAMIC_LINKER' macros..."
for header in "gcc/config/"*-gnu.h "gcc/config/"*"/"*.h for header in "gcc/config/"*-gnu.h "gcc/config/"*"/"*.h
do do
grep -q LIBC_DYNAMIC_LINKER "$header" || continue grep -q _DYNAMIC_LINKER "$header" || continue
echo " fixing \`$header'..." echo " fixing \`$header'..."
sed -i "$header" \ sed -i "$header" \
-e 's|define[[:blank:]]*\([UCG]\+\)LIBC_DYNAMIC_LINKER\([0-9]*\)[[:blank:]]"\([^\"]\+\)"$|define \1LIBC_DYNAMIC_LINKER\2 "${libc.out}\3"|g' \ -e 's|define[[:blank:]]*\([UCG]\+\)LIBC_DYNAMIC_LINKER\([0-9]*\)[[:blank:]]"\([^\"]\+\)"$|define \1LIBC_DYNAMIC_LINKER\2 "${libc.out}\3"|g' \
-e 's|define[[:blank:]]*MUSL_DYNAMIC_LINKER\([0-9]*\)[[:blank:]]"\([^\"]\+\)"$|define MUSL_DYNAMIC_LINKER\1 "${libc.out}\2"|g' -e 's|define[[:blank:]]*MUSL_DYNAMIC_LINKER\([0-9]*\)[[:blank:]]"\([^\"]\+\)"$|define MUSL_DYNAMIC_LINKER\1 "${libc.out}\2"|g'
done done
'' ''
+ stdenv.lib.optionalString (targetPlatform.libc == "musl")
''
sed -i gcc/config/linux.h -e '1i#undef LOCAL_INCLUDE_DIR'
''
)
else null; else null;
# TODO(@Ericson2314): Make passthru instead. Weird to avoid mass rebuild, # TODO(@Ericson2314): Make passthru instead. Weird to avoid mass rebuild,

View File

@ -254,16 +254,22 @@ stdenv.mkDerivation ({
let let
libc = if libcCross != null then libcCross else stdenv.cc.libc; libc = if libcCross != null then libcCross else stdenv.cc.libc;
in in
(
'' echo "fixing the \`GLIBC_DYNAMIC_LINKER', \`UCLIBC_DYNAMIC_LINKER', and \`MUSL_DYNAMIC_LINKER' macros..." '' echo "fixing the \`GLIBC_DYNAMIC_LINKER', \`UCLIBC_DYNAMIC_LINKER', and \`MUSL_DYNAMIC_LINKER' macros..."
for header in "gcc/config/"*-gnu.h "gcc/config/"*"/"*.h for header in "gcc/config/"*-gnu.h "gcc/config/"*"/"*.h
do do
grep -q LIBC_DYNAMIC_LINKER "$header" || continue grep -q _DYNAMIC_LINKER "$header" || continue
echo " fixing \`$header'..." echo " fixing \`$header'..."
sed -i "$header" \ sed -i "$header" \
-e 's|define[[:blank:]]*\([UCG]\+\)LIBC_DYNAMIC_LINKER\([0-9]*\)[[:blank:]]"\([^\"]\+\)"$|define \1LIBC_DYNAMIC_LINKER\2 "${libc.out}\3"|g' \ -e 's|define[[:blank:]]*\([UCG]\+\)LIBC_DYNAMIC_LINKER\([0-9]*\)[[:blank:]]"\([^\"]\+\)"$|define \1LIBC_DYNAMIC_LINKER\2 "${libc.out}\3"|g' \
-e 's|define[[:blank:]]*MUSL_DYNAMIC_LINKER\([0-9]*\)[[:blank:]]"\([^\"]\+\)"$|define MUSL_DYNAMIC_LINKER\1 "${libc.out}\2"|g' -e 's|define[[:blank:]]*MUSL_DYNAMIC_LINKER\([0-9]*\)[[:blank:]]"\([^\"]\+\)"$|define MUSL_DYNAMIC_LINKER\1 "${libc.out}\2"|g'
done done
'' ''
+ stdenv.lib.optionalString (targetPlatform.libc == "musl")
''
sed -i gcc/config/linux.h -e '1i#undef LOCAL_INCLUDE_DIR'
''
)
else null; else null;
# TODO(@Ericson2314): Make passthru instead. Weird to avoid mass rebuild, # TODO(@Ericson2314): Make passthru instead. Weird to avoid mass rebuild,