diff --git a/pkgs/development/compilers/gcc/common/dependencies.nix b/pkgs/development/compilers/gcc/common/dependencies.nix index a38cdcb9e20f5..57d87d29d649d 100644 --- a/pkgs/development/compilers/gcc/common/dependencies.nix +++ b/pkgs/development/compilers/gcc/common/dependencies.nix @@ -50,7 +50,7 @@ in ] ++ optionals (perl != null) [ perl ] ++ optionals javaAwtGtk [ pkg-config ] - ++ optionals (with stdenv.targetPlatform; isVc4 || isRedox && flex != null) [ flex ] + ++ optionals (lib.versionAtLeast version "14" || (with stdenv.targetPlatform; isVc4 || isRedox && flex != null)) [ flex ] ++ optionals langAda [ gnat-bootstrap ] # The builder relies on GNU sed (for instance, Darwin's `sed' fails with # "-i may not be used with stdin"), and `stdenvNative' doesn't provide it. diff --git a/pkgs/development/compilers/gcc/default.nix b/pkgs/development/compilers/gcc/default.nix index 0144ab4cfff9b..cad5006ccff2d 100644 --- a/pkgs/development/compilers/gcc/default.nix +++ b/pkgs/development/compilers/gcc/default.nix @@ -52,6 +52,7 @@ let version = versions.fromMajorMinor majorMinorVersion; majorVersion = lib.versions.major version; + atLeast14 = lib.versionAtLeast version "14"; atLeast13 = lib.versionAtLeast version "13"; atLeast12 = lib.versionAtLeast version "12"; atLeast11 = lib.versionAtLeast version "11"; @@ -61,6 +62,7 @@ let atLeast7 = lib.versionAtLeast version "7"; atLeast6 = lib.versionAtLeast version "6"; atLeast49 = lib.versionAtLeast version "4.9"; + is14 = majorVersion == "14"; is13 = majorVersion == "13"; is12 = majorVersion == "12"; is11 = majorVersion == "11"; @@ -221,6 +223,8 @@ let inherit version; url = "https://www.antlr.org/download/antlr-4.4-complete.jar"; sha256 = "02lda2imivsvsis8rnzmbrbp8rh1kb8vmq4i67pqhkwz7lf8y6dz"; }; + } // lib.optionalAttrs atLeast14 { + inherit flex; }); in diff --git a/pkgs/development/compilers/gcc/patches/default.nix b/pkgs/development/compilers/gcc/patches/default.nix index 8f0c8f6d288c8..9d260cb81e9b6 100644 --- a/pkgs/development/compilers/gcc/patches/default.nix +++ b/pkgs/development/compilers/gcc/patches/default.nix @@ -63,6 +63,7 @@ in ++ optionals (noSysDirs) ( [(if atLeast12 then ./gcc-12-no-sys-dirs.patch else ./no-sys-dirs.patch)] ++ ({ + "14" = [ ./13/no-sys-dirs-riscv.patch ./13/mangle-NIX_STORE-in-__FILE__.patch ]; "13" = [ ./13/no-sys-dirs-riscv.patch ./13/mangle-NIX_STORE-in-__FILE__.patch ]; "12" = [ ./no-sys-dirs-riscv.patch ./12/mangle-NIX_STORE-in-__FILE__.patch ]; "11" = [ ./no-sys-dirs-riscv.patch ];