build(flake): Wrap mold so that it works with the nix supplied libraries
This commit is contained in:
parent
a8112d554e
commit
eb63cb6247
24
flake.nix
24
flake.nix
|
@ -52,6 +52,28 @@
|
|||
...
|
||||
}:
|
||||
flake-utils.lib.eachDefaultSystem (system: let
|
||||
inherit (pkgs) lib;
|
||||
bintools-wrapper = "${nixpkgs}/pkgs/build-support/bintools-wrapper";
|
||||
mold' = pkgs.symlinkJoin {
|
||||
name = "mold";
|
||||
paths = [pkgs.mold];
|
||||
nativeBuildInputs = [pkgs.makeWrapper];
|
||||
suffixSalt = lib.replaceStrings ["-" "."] ["_" "_"] pkgs.targetPlatform.config;
|
||||
postBuild = ''
|
||||
for bin in ${pkgs.mold}/bin/*; do
|
||||
rm $out/bin/"$(basename "$bin")"
|
||||
|
||||
export prog="$bin"
|
||||
substituteAll "${bintools-wrapper}/ld-wrapper.sh" $out/bin/"$(basename "$bin")"
|
||||
chmod +x $out/bin/"$(basename "$bin")"
|
||||
|
||||
mkdir -p $out/nix-support
|
||||
substituteAll "${bintools-wrapper}/add-flags.sh" $out/nix-support/add-flags.sh
|
||||
substituteAll "${bintools-wrapper}/add-hardening.sh" $out/nix-support/add-hardening.sh
|
||||
substituteAll "${bintools-wrapper}/../wrapper-common/utils.bash" $out/nix-support/utils.bash
|
||||
done
|
||||
'';
|
||||
};
|
||||
c_rust = pkgs.rust-bin.fromRustupToolchainFile "${rustc_cranelift_backend}/rust-toolchain";
|
||||
rcb = pkgs.stdenv.mkDerivation {
|
||||
pname = "rustc_cranelift_backend";
|
||||
|
@ -146,7 +168,7 @@
|
|||
|
||||
nativeBuildInputs = with pkgs; [
|
||||
pkg-config
|
||||
mold
|
||||
mold'
|
||||
rcb
|
||||
];
|
||||
buildInputs = with pkgs; [
|
||||
|
|
Reference in New Issue