diff --git a/pkgs/development/compilers/gcc/7/default.nix b/pkgs/development/compilers/gcc/7/default.nix index a0465e8bdd60..d22e85c61adc 100644 --- a/pkgs/development/compilers/gcc/7/default.nix +++ b/pkgs/development/compilers/gcc/7/default.nix @@ -165,33 +165,29 @@ stdenv.mkDerivation ({ inherit noSysDirs staticCompiler crossStageStatic libcCross crossMingw; - depsBuildBuild = [ buildPackages.stdenv.cc ]; - nativeBuildInputs = [ texinfo which gettext ] - ++ (optional (perl != null) perl) - # 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 + texinfo + which + gettext + gnused + patchelf + gmp + mpfr + libmpc + isl + zlib + zip + perl ; - - # 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) - ; - - depsTargetTarget = optional (!crossStageStatic && threadsCross != {}) threadsCross.package; + }) depsBuildBuild nativeBuildInputs depsBuildTarget buildInputs depsTargetTarget; NIX_CFLAGS_COMPILE = lib.optionalString (stdenv.cc.isClang && langFortran) "-Wno-unused-command-line-argument"; NIX_LDFLAGS = lib.optionalString hostPlatform.isSunOS "-lm -ldl"; diff --git a/pkgs/development/compilers/gcc/8/default.nix b/pkgs/development/compilers/gcc/8/default.nix index 03fb9fb1205c..2b43fc124bf0 100644 --- a/pkgs/development/compilers/gcc/8/default.nix +++ b/pkgs/development/compilers/gcc/8/default.nix @@ -147,33 +147,29 @@ stdenv.mkDerivation ({ inherit noSysDirs staticCompiler crossStageStatic libcCross crossMingw; - depsBuildBuild = [ buildPackages.stdenv.cc ]; - nativeBuildInputs = [ texinfo which gettext ] - ++ (optional (perl != null) perl) - # 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 + texinfo + which + gettext + gnused + patchelf + gmp + mpfr + libmpc + isl + zlib + zip + perl ; - - # 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) - ; - - 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 8bb794bf2359..2890ee298112 100644 --- a/pkgs/development/compilers/gcc/common/dependencies.nix +++ b/pkgs/development/compilers/gcc/common/dependencies.nix @@ -6,7 +6,7 @@ , texinfo , which , gettext -, pkg-config +, pkg-config ? null , gnused , patchelf , gmp @@ -17,11 +17,11 @@ , zlib ? null , gnatboot ? null , flex ? null -, boehmgc -, zip -, unzip -, gtk2 -, libart_lgpl +, boehmgc ? null +, zip ? null +, unzip ? null +, gtk2 ? null +, libart_lgpl ? null , perl ? null , xlibs ? null , langJava ? false @@ -47,7 +47,7 @@ in ] ++ optionals (perl != null) [ perl ] ++ optionals javaAwtGtk [ pkg-config ] - ++ optionals (with stdenv.targetPlatform; isVc4 || isRedox) [ flex ] + ++ optionals (with stdenv.targetPlatform; isVc4 || isRedox && flex != null) [ 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.