wild: init at 0.7.0

This commit is contained in:
Ross Smyth
2025-11-04 11:28:44 -05:00
parent 93fd89651f
commit 5a4feee182
2 changed files with 159 additions and 0 deletions
+99
View File
@@ -0,0 +1,99 @@
{
lib,
stdenv,
makeBinaryWrapper,
gcc,
wild,
binutils-unwrapped-all-targets,
clang,
lld,
clang-tools,
}:
let
# These wrappers are REQUIRED for the Wild test suite to pass
#
# Write a wrapper for GCC that passes -B to *unwrapped* binutils.
# This ensures that if -fuse-ld=bfd is used, gcc picks up unwrapped ld.bfd
# instead of the hardcoded wrapper search directory.
# We pass it last because apparently gcc likes picking ld from the *first* -B,
# which we want our wild target directory to be if passed.
gccWrapper = stdenv.mkDerivation {
inherit (gcc) name;
dontUnpack = true;
dontConfigure = true;
dontInstall = true;
buildInputs = [ makeBinaryWrapper ];
buildPhase = ''
runHook preBuild
makeWrapper ${lib.getExe gcc} $out/bin/gcc \
--append-flag -B${binutils-unwrapped-all-targets}/bin
runHook postBuild
'';
};
gppWrapper = stdenv.mkDerivation {
dontUnpack = true;
dontConfigure = true;
dontInstall = true;
name = "g++-wrapped";
buildInputs = [ makeBinaryWrapper ];
buildPhase = ''
runHook preBuild
makeWrapper ${lib.getExe' gcc "g++"} $out/bin/g++ \
--append-flag -B${binutils-unwrapped-all-targets}/bin
runHook postBuild
'';
};
in
{
testWild = wild.overrideAttrs {
pname = "wild-tests";
doCheck = true;
doInstallCheck = false;
dontBuild = true;
buildType = "debug";
checkInputs = [
stdenv.cc.libc.out
stdenv.cc.libc.static
];
# https://github.com/davidlattimore/wild/discussions/832#discussioncomment-14482948
checkFlags = lib.optionals stdenv.hostPlatform.isAarch64 [
"--skip=integration_test::program_name_71___unresolved_symbols_object_c__"
];
# wild's tests compare the outputs of several different linkers. nixpkgs's
# patching and wrappers change the output behavior, so we must make sure
# that their behavior is compatible.
#
# Does not work if they are put in nativeCheckInputs or checkInputs
preCheck = ''
export LD_LIBRARY_PATH=${
lib.makeLibraryPath [
stdenv.cc.cc.lib
]
}:$LD_LIBRARY_PATH
export PATH=${
lib.makeBinPath [
binutils-unwrapped-all-targets
clang
gccWrapper
gppWrapper
lld
clang-tools
]
}:$PATH
'';
installPhase = "touch $out";
};
}
+60
View File
@@ -0,0 +1,60 @@
{
lib,
fetchFromGitHub,
callPackage,
versionCheckHook,
rustPlatform,
pkg-config,
zstd,
nix-update-script,
}:
rustPlatform.buildRustPackage (finalAttrs: {
pname = "wild";
version = "0.7.0";
src = fetchFromGitHub {
owner = "davidlattimore";
repo = "wild";
tag = finalAttrs.version;
hash = "sha256-x0IZuWjj0LRMj4pu2FVaD8SENm/UVtE1e4rl0EOZZZM=";
};
cargoHash = "sha256-5s0qS8y0+EH+R1tgN2W5/+t+GdjbQdRVLlcA2KjpHsE=";
cargoBuildFlags = [ "-p wild-linker" ];
strictDeps = true;
nativeBuildInputs = [
pkg-config
];
buildInputs = [
zstd
];
env.ZSTD_SYS_USE_PKG_CONFIG = true;
doCheck = false; # Tests are ran in passthru tests
doInstallCheck = true;
nativeInstallCheckInputs = [ versionCheckHook ];
versionCheckProgramArg = "--version";
passthru = {
updateScript = nix-update-script { };
tests = callPackage ./adapterTest.nix { wild = finalAttrs.finalPackage; };
};
meta = {
description = "Very fast linker for Linux";
homepage = "https://github.com/davidlattimore/wild";
changelog = "https://github.com/davidlattimore/wild/blob/${finalAttrs.version}/CHANGELOG.md";
license = [
lib.licenses.asl20 # or
lib.licenses.mit
];
mainProgram = "wild";
maintainers = with lib.maintainers; [ RossSmyth ];
platforms = lib.platforms.linux;
};
})