Skip to content

Commit

Permalink
Merge pull request #250498 from amjoseph-nixpkgs/gcc/deduplicate/simp…
Browse files Browse the repository at this point in the history
…lify2
  • Loading branch information
Artturin authored Sep 19, 2023
2 parents 983c998 + af319af commit 2e705d0
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions pkgs/development/compilers/gcc/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -309,27 +309,23 @@ lib.pipe ((callFile ./common/builder.nix {}) ({
libc = if libcCross != null then libcCross else stdenv.cc.libc;
in
(
'' echo "fixing the \`GLIBC_DYNAMIC_LINKER'${lib.optionalString atLeast6 ", \\`UCLIBC_DYNAMIC_LINKER',"} and \`${if atLeast6 then "MUSL" else "UCLIBC"}_DYNAMIC_LINKER' macros..."
'' echo "fixing the {GLIBC,UCLIBC,MUSL}_DYNAMIC_LINKER macros..."
for header in "gcc/config/"*-gnu.h "gcc/config/"*"/"*.h
do
grep -q ${lib.optionalString (!atLeast6) "LIBC"}_DYNAMIC_LINKER "$header" || continue
echo " fixing \`$header'..."
echo " fixing $header..."
sed -i "$header" \
-e 's|define[[:blank:]]*\([UCG]\+\)LIBC_DYNAMIC_LINKER\([0-9]*\)[[:blank:]]"\([^\"]\+\)"$|define \1LIBC_DYNAMIC_LINKER\2 "${libc.out}\3"|g'${lib.optionalString atLeast6 " \\"}
'' + lib.optionalString atLeast6 ''
${""} -e 's|define[[:blank:]]*MUSL_DYNAMIC_LINKER\([0-9]*\)[[:blank:]]"\([^\"]\+\)"$|define MUSL_DYNAMIC_LINKER\1 "${libc.out}\2"|g'
'' + ''
${""} done
-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'
done
'' + lib.optionalString (atLeast6 && targetPlatform.libc == "musl") ''
sed -i gcc/config/linux.h -e '1i#undef LOCAL_INCLUDE_DIR'
''
)
))
+ lib.optionalString (atLeast7 && targetPlatform.isAvr) (''
makeFlagsArray+=(
'' + (lib.optionalString atLeast10 ''
'-s' # workaround for hitting hydra log limit
'') + ''
'LIMITS_H_TEST=false'
)
'');
Expand Down

0 comments on commit 2e705d0

Please sign in to comment.