From 040cf4248dc1c6329cf08f73a46af13e140d4eb6 Mon Sep 17 00:00:00 2001 From: Adam Joseph Date: Sun, 20 Aug 2023 23:32:51 -0700 Subject: [PATCH] gcc: simplify expression by applying workarounds more broadly This commit simplifies our gcc expression by applying various workarounds unconditionally, rather than only to exactly the versions which applied them prior to the deduplication cleanup. Unlike its predecessors https://github.com/NixOS/nixpkgs/pull/249707 and https://github.com/NixOS/nixpkgs/pull/250489 this commit *does* affect eval. --- pkgs/development/compilers/gcc/default.nix | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/pkgs/development/compilers/gcc/default.nix b/pkgs/development/compilers/gcc/default.nix index f467aa32f7d1..9105067fbc59 100644 --- a/pkgs/development/compilers/gcc/default.nix +++ b/pkgs/development/compilers/gcc/default.nix @@ -309,17 +309,15 @@ 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'..." 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' '' @@ -327,9 +325,7 @@ ${""} done )) + lib.optionalString (atLeast7 && targetPlatform.isAvr) ('' makeFlagsArray+=( - '' + (lib.optionalString atLeast10 '' '-s' # workaround for hitting hydra log limit - '') + '' 'LIMITS_H_TEST=false' ) '');