gcc: deduplicate boilerplate
This commit deduplicates libgcc-related boilerplate which appears in every version of our gcc expression, by moving it into libgcc.nix. I will be submitting a separate PR which changes this boilerplate, but that PR will be much easier to review if I can make the change in just one place. Meanwhile, *this* commit has no effect on eval: $ for A in 10 11 12 13 4.8 4.9 6 7 8 9; do nix-instantiate . -A gcc$(echo $A | tr -d .); done 2>/dev/null | sort | tee before /nix/store/1a37lnzpnz0dhm3lphiy2gcdrxgqa7ma-gcc-wrapper-4.8.5.drv /nix/store/5szdivc8il0c3g94dq4wqnq5j77a9h6p-gcc-wrapper-11.4.0.drv /nix/store/bmmc717wmnp1j2xkd3if5dfxicnflvn5-gcc-wrapper-7.5.0.drv /nix/store/fc1ggpixv3wqcazchhl2hnn5zl5ds30l-gcc-wrapper-13.1.0.drv /nix/store/j9c2b20w35r3ag5nxmklhagbwsgjhds2-gcc-wrapper-4.9.4.drv /nix/store/nq7q57bxmsk2g457wr4b9449as3f216w-gcc-wrapper-12.3.0.drv /nix/store/sqmkkfapzykapcs4azvxm83n786ga7q1-gcc-wrapper-10.4.0.drv /nix/store/vxnz30i23mkl4ldsq485kxn7q0p2y4nf-gcc-wrapper-8.5.0.drv /nix/store/yfhv0bv15cg5kj2xsb9fcgb6pdlw42v0-gcc-wrapper-6.5.0.drv /nix/store/yi5gr75pb6kddnll10jg25hhndhkba7s-gcc-wrapper-9.5.0.drv $ for A in 10 11 12 13 4.8 4.9 6 7 8 9; do nix-instantiate . -A gcc$(echo $A | tr -d .); done | sort | tee after /nix/store/1a37lnzpnz0dhm3lphiy2gcdrxgqa7ma-gcc-wrapper-4.8.5.drv /nix/store/5szdivc8il0c3g94dq4wqnq5j77a9h6p-gcc-wrapper-11.4.0.drv /nix/store/bmmc717wmnp1j2xkd3if5dfxicnflvn5-gcc-wrapper-7.5.0.drv /nix/store/fc1ggpixv3wqcazchhl2hnn5zl5ds30l-gcc-wrapper-13.1.0.drv /nix/store/j9c2b20w35r3ag5nxmklhagbwsgjhds2-gcc-wrapper-4.9.4.drv /nix/store/nq7q57bxmsk2g457wr4b9449as3f216w-gcc-wrapper-12.3.0.drv /nix/store/sqmkkfapzykapcs4azvxm83n786ga7q1-gcc-wrapper-10.4.0.drv /nix/store/vxnz30i23mkl4ldsq485kxn7q0p2y4nf-gcc-wrapper-8.5.0.drv /nix/store/yfhv0bv15cg5kj2xsb9fcgb6pdlw42v0-gcc-wrapper-6.5.0.drv /nix/store/yi5gr75pb6kddnll10jg25hhndhkba7s-gcc-wrapper-9.5.0.drv $ diff -u after before $
This commit is contained in:
parent
6f234b303d
commit
0344bcbcf4
@ -27,6 +27,7 @@
|
||||
, cloog ? null # unused; just for compat with gcc4, as we override the parameter on some places
|
||||
, buildPackages
|
||||
, libxcrypt
|
||||
, callPackage
|
||||
}:
|
||||
|
||||
# Make sure we get GNU sed.
|
||||
@ -143,7 +144,7 @@ let majorVersion = "10";
|
||||
|
||||
in
|
||||
|
||||
stdenv.mkDerivation ({
|
||||
lib.pipe (stdenv.mkDerivation ({
|
||||
pname = "${crossNameAddon}${name}";
|
||||
inherit version;
|
||||
|
||||
@ -291,10 +292,8 @@ stdenv.mkDerivation ({
|
||||
|
||||
}
|
||||
|
||||
// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt" && crossStageStatic) {
|
||||
makeFlags = [ "all-gcc" "all-target-libgcc" ];
|
||||
installTargets = "install-gcc install-target-libgcc";
|
||||
}
|
||||
|
||||
// optionalAttrs (enableMultilib) { dontMoveLib64 = true; }
|
||||
)
|
||||
))
|
||||
[
|
||||
(callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform crossStageStatic; })
|
||||
]
|
||||
|
@ -304,14 +304,9 @@ lib.pipe (stdenv.mkDerivation ({
|
||||
};
|
||||
}
|
||||
|
||||
// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt" && crossStageStatic) {
|
||||
makeFlags = [ "all-gcc" "all-target-libgcc" ];
|
||||
installTargets = "install-gcc install-target-libgcc";
|
||||
}
|
||||
|
||||
// optionalAttrs (enableMultilib) { dontMoveLib64 = true; }
|
||||
))
|
||||
[
|
||||
(callPackage ../common/libgcc.nix { inherit langC langCC langJit; })
|
||||
(callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform crossStageStatic; })
|
||||
(callPackage ../common/checksum.nix { inherit langC langCC; })
|
||||
]
|
||||
|
@ -350,15 +350,10 @@ lib.pipe (stdenv.mkDerivation ({
|
||||
};
|
||||
}
|
||||
|
||||
// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt" && crossStageStatic) {
|
||||
makeFlags = [ "all-gcc" "all-target-libgcc" ];
|
||||
installTargets = "install-gcc install-target-libgcc";
|
||||
}
|
||||
|
||||
// optionalAttrs (enableMultilib) { dontMoveLib64 = true; }
|
||||
))
|
||||
[
|
||||
(callPackage ../common/libgcc.nix { inherit langC langCC langJit; })
|
||||
(callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform crossStageStatic; })
|
||||
(callPackage ../common/checksum.nix { inherit langC langCC; })
|
||||
]
|
||||
|
||||
|
@ -344,15 +344,10 @@ lib.pipe (stdenv.mkDerivation ({
|
||||
};
|
||||
}
|
||||
|
||||
// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt" && crossStageStatic) {
|
||||
makeFlags = [ "all-gcc" "all-target-libgcc" ];
|
||||
installTargets = "install-gcc install-target-libgcc";
|
||||
}
|
||||
|
||||
// optionalAttrs (enableMultilib) { dontMoveLib64 = true; }
|
||||
))
|
||||
[
|
||||
(callPackage ../common/libgcc.nix { inherit langC langCC langJit; })
|
||||
(callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform crossStageStatic; })
|
||||
(callPackage ../common/checksum.nix { inherit langC langCC; })
|
||||
]
|
||||
|
||||
|
@ -29,6 +29,7 @@
|
||||
, crossStageStatic ? false
|
||||
, gnused ? null
|
||||
, buildPackages
|
||||
, callPackage
|
||||
}:
|
||||
|
||||
assert langJava -> zip != null && unzip != null
|
||||
@ -192,7 +193,7 @@ in
|
||||
# We need all these X libraries when building AWT with GTK.
|
||||
assert x11Support -> (filter (x: x == null) ([ gtk2 libart_lgpl ] ++ xlibs)) == [];
|
||||
|
||||
stdenv.mkDerivation ({
|
||||
lib.pipe (stdenv.mkDerivation ({
|
||||
pname = "${crossNameAddon}${name}";
|
||||
inherit version;
|
||||
|
||||
@ -319,10 +320,8 @@ stdenv.mkDerivation ({
|
||||
};
|
||||
}
|
||||
|
||||
// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt" && crossStageStatic) {
|
||||
makeFlags = [ "all-gcc" "all-target-libgcc" ];
|
||||
installTargets = "install-gcc install-target-libgcc";
|
||||
}
|
||||
|
||||
// optionalAttrs (enableMultilib) { dontMoveLib64 = true; }
|
||||
)
|
||||
))
|
||||
[
|
||||
(callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform crossStageStatic; })
|
||||
]
|
||||
|
@ -29,6 +29,7 @@
|
||||
, crossStageStatic ? false
|
||||
, gnused ? null
|
||||
, buildPackages
|
||||
, callPackage
|
||||
}:
|
||||
|
||||
assert langJava -> zip != null && unzip != null
|
||||
@ -209,7 +210,7 @@ in
|
||||
# We need all these X libraries when building AWT with GTK.
|
||||
assert x11Support -> (filter (x: x == null) ([ gtk2 libart_lgpl ] ++ xlibs)) == [];
|
||||
|
||||
stdenv.mkDerivation ({
|
||||
lib.pipe (stdenv.mkDerivation ({
|
||||
pname = "${crossNameAddon}${name}";
|
||||
inherit version;
|
||||
|
||||
@ -340,11 +341,6 @@ stdenv.mkDerivation ({
|
||||
};
|
||||
}
|
||||
|
||||
// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt" && crossStageStatic) {
|
||||
makeFlags = [ "all-gcc" "all-target-libgcc" ];
|
||||
installTargets = "install-gcc install-target-libgcc";
|
||||
}
|
||||
|
||||
// optionalAttrs (enableMultilib) { dontMoveLib64 = true; }
|
||||
|
||||
// optionalAttrs (langJava) {
|
||||
@ -352,4 +348,7 @@ stdenv.mkDerivation ({
|
||||
target="$(echo "$out/libexec/gcc"/*/*/ecj*)"
|
||||
patchelf --set-rpath "$(patchelf --print-rpath "$target"):$out/lib" "$target"
|
||||
'';}
|
||||
)
|
||||
))
|
||||
[
|
||||
(callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform crossStageStatic; })
|
||||
]
|
||||
|
@ -33,6 +33,7 @@
|
||||
, gnused ? null
|
||||
, cloog ? null # unused; just for compat with gcc4, as we override the parameter on some places
|
||||
, buildPackages
|
||||
, callPackage
|
||||
}:
|
||||
|
||||
assert langJava -> zip != null && unzip != null
|
||||
@ -198,7 +199,7 @@ in
|
||||
# We need all these X libraries when building AWT with GTK.
|
||||
assert x11Support -> (filter (x: x == null) ([ gtk2 libart_lgpl ] ++ xlibs)) == [];
|
||||
|
||||
stdenv.mkDerivation ({
|
||||
lib.pipe (stdenv.mkDerivation ({
|
||||
pname = "${crossNameAddon}${name}";
|
||||
inherit version;
|
||||
|
||||
@ -358,11 +359,6 @@ stdenv.mkDerivation ({
|
||||
};
|
||||
}
|
||||
|
||||
// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt" && crossStageStatic) {
|
||||
makeFlags = [ "all-gcc" "all-target-libgcc" ];
|
||||
installTargets = "install-gcc install-target-libgcc";
|
||||
}
|
||||
|
||||
// optionalAttrs (enableMultilib) { dontMoveLib64 = true; }
|
||||
|
||||
// optionalAttrs (langJava && !stdenv.hostPlatform.isDarwin) {
|
||||
@ -370,4 +366,7 @@ stdenv.mkDerivation ({
|
||||
target="$(echo "$out/libexec/gcc"/*/*/ecj*)"
|
||||
patchelf --set-rpath "$(patchelf --print-rpath "$target"):$out/lib" "$target"
|
||||
'';}
|
||||
)
|
||||
))
|
||||
[
|
||||
(callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform crossStageStatic; })
|
||||
]
|
||||
|
@ -23,6 +23,7 @@
|
||||
, gnused ? null
|
||||
, cloog ? null # unused; just for compat with gcc4, as we override the parameter on some places
|
||||
, buildPackages
|
||||
, callPackage
|
||||
}:
|
||||
|
||||
# Make sure we get GNU sed.
|
||||
@ -148,7 +149,7 @@ let majorVersion = "7";
|
||||
|
||||
in
|
||||
|
||||
stdenv.mkDerivation ({
|
||||
lib.pipe (stdenv.mkDerivation ({
|
||||
pname = "${crossNameAddon}${name}";
|
||||
inherit version;
|
||||
|
||||
@ -298,10 +299,8 @@ stdenv.mkDerivation ({
|
||||
};
|
||||
}
|
||||
|
||||
// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt" && crossStageStatic) {
|
||||
makeFlags = [ "all-gcc" "all-target-libgcc" ];
|
||||
installTargets = "install-gcc install-target-libgcc";
|
||||
}
|
||||
|
||||
// optionalAttrs (enableMultilib) { dontMoveLib64 = true; }
|
||||
)
|
||||
))
|
||||
[
|
||||
(callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform crossStageStatic; })
|
||||
]
|
||||
|
@ -23,6 +23,7 @@
|
||||
, gnused ? null
|
||||
, cloog ? null # unused; just for compat with gcc4, as we override the parameter on some places
|
||||
, buildPackages
|
||||
, callPackage
|
||||
}:
|
||||
|
||||
# Make sure we get GNU sed.
|
||||
@ -129,7 +130,7 @@ let majorVersion = "8";
|
||||
|
||||
in
|
||||
|
||||
stdenv.mkDerivation ({
|
||||
lib.pipe (stdenv.mkDerivation ({
|
||||
pname = "${crossNameAddon}${name}";
|
||||
inherit version;
|
||||
|
||||
@ -273,10 +274,8 @@ stdenv.mkDerivation ({
|
||||
};
|
||||
}
|
||||
|
||||
// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt" && crossStageStatic) {
|
||||
makeFlags = [ "all-gcc" "all-target-libgcc" ];
|
||||
installTargets = "install-gcc install-target-libgcc";
|
||||
}
|
||||
|
||||
// optionalAttrs (enableMultilib) { dontMoveLib64 = true; }
|
||||
)
|
||||
))
|
||||
[
|
||||
(callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform crossStageStatic; })
|
||||
]
|
||||
|
@ -26,6 +26,7 @@
|
||||
, gnused ? null
|
||||
, cloog # unused; just for compat with gcc4, as we override the parameter on some places
|
||||
, buildPackages
|
||||
, callPackage
|
||||
}:
|
||||
|
||||
# Note: this package is used for bootstrapping fetchurl, and thus
|
||||
@ -143,7 +144,7 @@ let majorVersion = "9";
|
||||
|
||||
in
|
||||
|
||||
stdenv.mkDerivation ({
|
||||
lib.pipe (stdenv.mkDerivation ({
|
||||
pname = "${crossNameAddon}${name}";
|
||||
inherit version;
|
||||
|
||||
@ -287,10 +288,9 @@ stdenv.mkDerivation ({
|
||||
};
|
||||
}
|
||||
|
||||
// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt" && crossStageStatic) {
|
||||
makeFlags = [ "all-gcc" "all-target-libgcc" ];
|
||||
installTargets = "install-gcc install-target-libgcc";
|
||||
}
|
||||
|
||||
// optionalAttrs (enableMultilib) { dontMoveLib64 = true; }
|
||||
)
|
||||
) [
|
||||
(callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform crossStageStatic; })
|
||||
]
|
||||
|
@ -1,16 +1,43 @@
|
||||
{ lib
|
||||
, stdenv
|
||||
, version
|
||||
, langC
|
||||
, langCC
|
||||
, langJit
|
||||
, targetPlatform
|
||||
, hostPlatform
|
||||
, crossStageStatic
|
||||
}:
|
||||
|
||||
let
|
||||
drv: lib.pipe drv
|
||||
|
||||
([
|
||||
|
||||
(pkg: pkg.overrideAttrs (previousAttrs:
|
||||
lib.optionalAttrs (
|
||||
targetPlatform != hostPlatform &&
|
||||
targetPlatform.libc == "msvcrt" &&
|
||||
crossStageStatic
|
||||
) {
|
||||
makeFlags = [ "all-gcc" "all-target-libgcc" ];
|
||||
installTargets = "install-gcc install-target-libgcc";
|
||||
}))
|
||||
|
||||
] ++
|
||||
|
||||
# nixpkgs did not add the "libgcc" output until gcc11. In theory
|
||||
# the following condition can be changed to `true`, but that has not
|
||||
# been tested.
|
||||
lib.optional (lib.versionAtLeast version "11.0")
|
||||
|
||||
(let
|
||||
enableLibGccOutput =
|
||||
(with stdenv; targetPlatform == hostPlatform) &&
|
||||
!langJit &&
|
||||
!stdenv.hostPlatform.isDarwin &&
|
||||
!stdenv.hostPlatform.isStatic;
|
||||
!stdenv.hostPlatform.isStatic
|
||||
;
|
||||
|
||||
in
|
||||
(pkg: pkg.overrideAttrs (previousAttrs: lib.optionalAttrs ((!langC) || langJit || enableLibGccOutput) {
|
||||
outputs = previousAttrs.outputs ++ lib.optionals enableLibGccOutput [ "libgcc" ];
|
||||
@ -97,4 +124,5 @@ in
|
||||
+ ''
|
||||
patchelf --set-rpath "" $libgcc/lib/libgcc_s.so.1
|
||||
'');
|
||||
}))
|
||||
}))))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user