buildRustCrate: rename makeDeps
function to mkRustcDepArgs
This should carry the function better then `makeDeps` as it isn't producing deps but the rustc arguments required to link against those.
This commit is contained in:
parent
f4aeabd04a
commit
d37f001164
@ -1,4 +1,4 @@
|
|||||||
{ lib, stdenv, echo_build_heading, noisily, makeDeps, rust }:
|
{ lib, stdenv, echo_build_heading, noisily, mkRustcDepArgs, rust }:
|
||||||
{ crateName,
|
{ crateName,
|
||||||
dependencies,
|
dependencies,
|
||||||
crateFeatures, crateRenames, libName, release, libPath,
|
crateFeatures, crateRenames, libName, release, libPath,
|
||||||
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
deps = makeDeps dependencies crateRenames;
|
deps = mkRustcDepArgs dependencies crateRenames;
|
||||||
rustcOpts =
|
rustcOpts =
|
||||||
lib.foldl' (opts: opt: opts + " " + opt)
|
lib.foldl' (opts: opt: opts + " " + opt)
|
||||||
(if release then "-C opt-level=3" else "-C debuginfo=2")
|
(if release then "-C opt-level=3" else "-C debuginfo=2")
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{ lib, stdenv, echo_build_heading, noisily, makeDeps }:
|
{ lib, stdenv, echo_build_heading, noisily, mkRustcDepArgs }:
|
||||||
{ build
|
{ build
|
||||||
, buildDependencies
|
, buildDependencies
|
||||||
, colors
|
, colors
|
||||||
@ -25,7 +25,7 @@ let version_ = lib.splitString "-" crateVersion;
|
|||||||
rustcOpts = lib.foldl' (opts: opt: opts + " " + opt)
|
rustcOpts = lib.foldl' (opts: opt: opts + " " + opt)
|
||||||
(if release then "-C opt-level=3" else "-C debuginfo=2")
|
(if release then "-C opt-level=3" else "-C debuginfo=2")
|
||||||
(["-C codegen-units=$NIX_BUILD_CORES"] ++ extraRustcOpts);
|
(["-C codegen-units=$NIX_BUILD_CORES"] ++ extraRustcOpts);
|
||||||
buildDeps = makeDeps buildDependencies crateRenames;
|
buildDeps = mkRustcDepArgs buildDependencies crateRenames;
|
||||||
authors = lib.concatStringsSep ":" crateAuthors;
|
authors = lib.concatStringsSep ":" crateAuthors;
|
||||||
optLevel = if release then 3 else 0;
|
optLevel = if release then 3 else 0;
|
||||||
completeDepsDir = lib.concatStringsSep " " completeDeps;
|
completeDepsDir = lib.concatStringsSep " " completeDeps;
|
||||||
|
@ -13,7 +13,9 @@ let
|
|||||||
then "macos"
|
then "macos"
|
||||||
else stdenv.hostPlatform.parsed.kernel.name;
|
else stdenv.hostPlatform.parsed.kernel.name;
|
||||||
|
|
||||||
makeDeps = dependencies: crateRenames:
|
# Create rustc arguments to link against the given list of dependencies and
|
||||||
|
# renames
|
||||||
|
mkRustcDepArgs = dependencies: crateRenames:
|
||||||
lib.concatMapStringsSep " " (dep:
|
lib.concatMapStringsSep " " (dep:
|
||||||
let
|
let
|
||||||
extern = lib.replaceStrings ["-"] ["_"] dep.libName;
|
extern = lib.replaceStrings ["-"] ["_"] dep.libName;
|
||||||
@ -27,15 +29,14 @@ let
|
|||||||
" --extern ${name}=${dep.lib}/lib/lib${extern}-${dep.metadata}${stdenv.hostPlatform.extensions.sharedLibrary}")
|
" --extern ${name}=${dep.lib}/lib/lib${extern}-${dep.metadata}${stdenv.hostPlatform.extensions.sharedLibrary}")
|
||||||
) dependencies;
|
) dependencies;
|
||||||
|
|
||||||
|
|
||||||
inherit (import ./log.nix { inherit lib; }) noisily echo_build_heading;
|
inherit (import ./log.nix { inherit lib; }) noisily echo_build_heading;
|
||||||
|
|
||||||
configureCrate = import ./configure-crate.nix {
|
configureCrate = import ./configure-crate.nix {
|
||||||
inherit lib stdenv echo_build_heading noisily makeDeps;
|
inherit lib stdenv echo_build_heading noisily mkRustcDepArgs;
|
||||||
};
|
};
|
||||||
|
|
||||||
buildCrate = import ./build-crate.nix {
|
buildCrate = import ./build-crate.nix {
|
||||||
inherit lib stdenv echo_build_heading noisily makeDeps rust;
|
inherit lib stdenv echo_build_heading noisily mkRustcDepArgs rust;
|
||||||
};
|
};
|
||||||
|
|
||||||
installCrate = import ./install-crate.nix;
|
installCrate = import ./install-crate.nix;
|
||||||
|
Loading…
Reference in New Issue
Block a user