Merge pull request #261856 from paveloom/mold

This commit is contained in:
Artturi
2023-10-20 01:52:23 +03:00
committed by GitHub
2 changed files with 11 additions and 13 deletions
+7 -3
View File
@@ -11,6 +11,8 @@
, zstd
, buildPackages
, clangStdenv
, gccStdenv
, hello
, mold
, mold-wrapped
@@ -21,13 +23,13 @@
stdenv.mkDerivation rec {
pname = "mold";
version = "2.2.0";
version = "2.3.0";
src = fetchFromGitHub {
owner = "rui314";
repo = "mold";
rev = "v${version}";
hash = "sha256-ePX80hzzIzSJdGUX96GyxYWcdbXxXyuyNQqj5RDSkKU=";
hash = "sha256-TgDGAYdJjqGQradB7UJlV2emvG7q4F9ctzPaGRUgvxU=";
};
nativeBuildInputs = [
@@ -89,11 +91,13 @@ stdenv.mkDerivation rec {
in
{
version = testers.testVersion { package = mold; };
} // lib.optionalAttrs stdenv.isLinux {
adapter-gcc = helloTest "adapter-gcc" (hello.override (old: { stdenv = useMoldLinker gccStdenv; }));
adapter-llvm = helloTest "adapter-llvm" (hello.override (old: { stdenv = useMoldLinker clangStdenv; }));
wrapped = helloTest "wrapped" (hello.overrideAttrs (previousAttrs: {
nativeBuildInputs = (previousAttrs.nativeBuildInputs or [ ]) ++ [ mold-wrapped ];
NIX_CFLAGS_LINK = toString (previousAttrs.NIX_CFLAGS_LINK or "") + " -fuse-ld=mold";
}));
adapter = helloTest "adapter" (hello.override (old: { stdenv = useMoldLinker old.stdenv; }));
};
};
+4 -10
View File
@@ -197,16 +197,10 @@ rec {
'';
};
in stdenv.override (old: {
cc = stdenv.cc.override {
inherit bintools;
};
allowedRequisites =
(lib.optional (stdenv.allowedRequisites or null != null) stdenv.allowedRequisites)
++ [ bintools pkgs.mold ]
# need to `outputSpecified = false` to make getLib work
++ (builtins.map (p: lib.getLib (p // { outputSpecified = false; })) pkgs.mold.buildInputs);
# gcc >12.1.0 supports '-fuse-ld=mold'
# the wrap ld above in bintools supports gcc <12.1.0 and shouldn't harm >12.1.0
allowedRequisites = null;
cc = stdenv.cc.override { inherit bintools; };
# gcc >12.1.0 supports '-fuse-ld=mold'
# the wrap ld above in bintools supports gcc <12.1.0 and shouldn't harm >12.1.0
# https://github.com/rui314/mold#how-to-use
} // lib.optionalAttrs (stdenv.cc.isClang || (stdenv.cc.isGNU && lib.versionAtLeast stdenv.cc.version "12")) {
mkDerivationFromStdenv = extendMkDerivationArgs old (args: {