mirror of
https://github.com/NotAShelf/microfetch.git
synced 2026-06-17 17:36:55 +00:00
build: replace mold with the wild linker
This commit is contained in:
parent
b43d88c749
commit
b42e6f4af9
8 changed files with 53 additions and 66 deletions
|
|
@ -2,12 +2,20 @@
|
|||
lib,
|
||||
rustPlatform,
|
||||
llvm,
|
||||
clang,
|
||||
wild,
|
||||
}: let
|
||||
pname = "microfetch";
|
||||
toml = (lib.importTOML ../Cargo.toml).workspace.package;
|
||||
inherit (toml) version;
|
||||
inherit (llvm) stdenv;
|
||||
|
||||
# wild + clang are only used on Linux tier-1 arches
|
||||
hasWild =
|
||||
stdenv.hostPlatform.isLinux
|
||||
&& (stdenv.hostPlatform.isx86_64 || stdenv.hostPlatform.isAarch64);
|
||||
in
|
||||
rustPlatform.buildRustPackage.override {inherit (llvm) stdenv;} (finalAttrs: {
|
||||
rustPlatform.buildRustPackage.override {inherit stdenv;} (finalAttrs: {
|
||||
__structuredAttrs = true;
|
||||
|
||||
inherit pname version;
|
||||
|
|
@ -21,12 +29,17 @@ in
|
|||
(s + /.cargo)
|
||||
(s + /crates)
|
||||
(s + /microfetch)
|
||||
(s + /scripts/ld-wrapper)
|
||||
(s + /Cargo.lock)
|
||||
(s + /Cargo.toml)
|
||||
];
|
||||
};
|
||||
|
||||
nativeBuildInputs = lib.optionals hasWild [wild clang];
|
||||
|
||||
env = lib.optionalAttrs hasWild {
|
||||
RUSTFLAGS = "-Cforce-unwind-tables=no -Clinker=${clang}/bin/clang -Clink-arg=--ld-path=${wild}/bin/wild";
|
||||
};
|
||||
|
||||
cargoLock.lockFile = "${finalAttrs.src}/Cargo.lock";
|
||||
enableParallelBuilding = true;
|
||||
buildNoDefaultFeatures = true;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
mkShell,
|
||||
cargo,
|
||||
rustc,
|
||||
mold,
|
||||
wild,
|
||||
clang,
|
||||
rust-analyzer,
|
||||
rustfmt,
|
||||
|
|
@ -16,7 +16,7 @@ mkShell {
|
|||
nativeBuildInputs = [
|
||||
cargo
|
||||
rustc
|
||||
mold
|
||||
wild
|
||||
clang
|
||||
|
||||
rust-analyzer
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue