From 18f9f26a79fc75158d2abb388071a2e637705984 Mon Sep 17 00:00:00 2001 From: Artturin Date: Tue, 7 Feb 2023 19:15:18 +0200 Subject: [PATCH] gcc6: move dependencies to common/dependencies.nix the (vc4 redox) flex conditional was missing in all other gcc version because gcc6 was the default at the time it was added that is one of the problems common/dependencies.nix fixes --- pkgs/development/compilers/gcc/6/default.nix | 64 ++++++++++--------- .../compilers/gcc/common/dependencies.nix | 9 ++- 2 files changed, 40 insertions(+), 33 deletions(-) diff --git a/pkgs/development/compilers/gcc/6/default.nix b/pkgs/development/compilers/gcc/6/default.nix index 450b23310337..27d57a509aae 100644 --- a/pkgs/development/compilers/gcc/6/default.nix +++ b/pkgs/development/compilers/gcc/6/default.nix @@ -193,38 +193,40 @@ stdenv.mkDerivation ({ inherit noSysDirs staticCompiler langJava crossStageStatic libcCross crossMingw; - depsBuildBuild = [ buildPackages.stdenv.cc ]; - nativeBuildInputs = [ texinfo which gettext ] - ++ (optional (perl != null) perl) - ++ (optional javaAwtGtk pkg-config) - ++ (optional (with stdenv.targetPlatform; isVc4 || isRedox) flex) - ++ (optional langAda gnatboot) - # 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. - ++ (optional buildPlatform.isDarwin gnused) + inherit (import ../common/dependencies.nix { + inherit + lib + stdenv + buildPackages + targetPackages + crossStageStatic + threadsCross + version + langAda + gnatboot + flex + langJava + javaAwtGtk + texinfo + which + gettext + pkg-config + gnused + patchelf + gmp + mpfr + libmpc + isl + zlib + boehmgc + zip + unzip + gtk2 + libart_lgpl + perl + xlibs ; - - # For building runtime libs - depsBuildTarget = - ( - if hostPlatform == buildPlatform then [ - targetPackages.stdenv.cc.bintools # newly-built gcc will be used - ] else assert targetPlatform == hostPlatform; [ # build != host == target - stdenv.cc - ] - ) - ++ optional targetPlatform.isLinux patchelf; - - buildInputs = [ - gmp mpfr libmpc - targetPackages.stdenv.cc.bintools # For linking code at run-time - ] ++ (optional (isl != null) isl) - ++ (optional (zlib != null) zlib) - ++ (optionals langJava [ boehmgc zip unzip ]) - ++ (optionals javaAwtGtk ([ gtk2 libart_lgpl ] ++ xlibs)) - ; - - depsTargetTarget = optional (!crossStageStatic && threadsCross != {}) threadsCross.package; + }) depsBuildBuild nativeBuildInputs depsBuildTarget buildInputs depsTargetTarget; NIX_LDFLAGS = lib.optionalString hostPlatform.isSunOS "-lm -ldl"; diff --git a/pkgs/development/compilers/gcc/common/dependencies.nix b/pkgs/development/compilers/gcc/common/dependencies.nix index fe6d5a68d1cd..8bb794bf2359 100644 --- a/pkgs/development/compilers/gcc/common/dependencies.nix +++ b/pkgs/development/compilers/gcc/common/dependencies.nix @@ -15,6 +15,8 @@ , cloog ? null , isl ? null , zlib ? null +, gnatboot ? null +, flex ? null , boehmgc , zip , unzip @@ -22,8 +24,9 @@ , libart_lgpl , perl ? null , xlibs ? null -, langJava ? null -, javaAwtGtk ? null +, langJava ? false +, javaAwtGtk ? false +, langAda ? false , crossStageStatic ? null , threadsCross ? null }: @@ -44,6 +47,8 @@ in ] ++ optionals (perl != null) [ perl ] ++ optionals javaAwtGtk [ pkg-config ] + ++ optionals (with stdenv.targetPlatform; isVc4 || isRedox) [ flex ] + ++ optionals langAda [ gnatboot ] # 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. ++ optionals buildPlatform.isDarwin [ gnused ]