mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-11-17 06:06:13 +03:00
buildRustCrate: pass extraRustcOpts to configure crate
Previously build flags would not be available during the configure phase while they might be required to build the `build.rs` file.
This commit is contained in:
parent
5d42605b91
commit
044a8a24ed
@ -8,11 +8,11 @@
|
||||
let
|
||||
|
||||
deps = makeDeps dependencies;
|
||||
rustcOpts =
|
||||
lib.lists.foldl' (opts: opt: opts + " " + opt)
|
||||
(if release then "-C opt-level=3" else "-C debuginfo=2")
|
||||
(["-C codegen-units=1"] ++ extraRustcOpts);
|
||||
rustcMeta = "-C metadata=${metadata} -C extra-filename=-${metadata}";
|
||||
rustcOpts =
|
||||
lib.lists.foldl' (opts: opt: opts + " " + opt)
|
||||
(if release then "-C opt-level=3" else "-C debuginfo=2")
|
||||
(["-C codegen-units=1"] ++ extraRustcOpts);
|
||||
rustcMeta = "-C metadata=${metadata} -C extra-filename=-${metadata}";
|
||||
|
||||
# Some platforms have different names for rustc.
|
||||
rustPlatform =
|
||||
|
@ -1,9 +1,27 @@
|
||||
{ lib, stdenv, echo_build_heading, noisily, makeDeps }:
|
||||
{ build, buildDependencies, colors, completeBuildDeps, completeDeps, crateAuthors, crateFeatures, crateName, crateVersion, extraLinkFlags, libName, libPath, release, target_os, verbose, workspace_member }:
|
||||
{ build
|
||||
, buildDependencies
|
||||
, colors
|
||||
, completeBuildDeps
|
||||
, completeDeps
|
||||
, crateAuthors
|
||||
, crateFeatures
|
||||
, crateName
|
||||
, crateVersion
|
||||
, extraLinkFlags
|
||||
, extraRustcOpts
|
||||
, libName
|
||||
, libPath
|
||||
, release
|
||||
, target_os
|
||||
, verbose
|
||||
, workspace_member }:
|
||||
let version_ = lib.splitString "-" crateVersion;
|
||||
versionPre = if lib.tail version_ == [] then "" else builtins.elemAt version_ 1;
|
||||
version = lib.splitString "." (lib.head version_);
|
||||
rustcOpts = (if release then "-C opt-level=3" else "-C debuginfo=2");
|
||||
rustcOpts = lib.lists.foldl' (opts: opt: opts + " " + opt)
|
||||
(if release then "-C opt-level=3" else "-C debuginfo=2")
|
||||
(["-C codegen-units=1"] ++ extraRustcOpts);
|
||||
buildDeps = makeDeps buildDependencies;
|
||||
authors = lib.concatStringsSep ":" crateAuthors;
|
||||
optLevel = if release then 3 else 0;
|
||||
|
@ -136,13 +136,13 @@ stdenv.mkDerivation (rec {
|
||||
(crate.type or ["lib"]);
|
||||
colors = lib.attrByPath [ "colors" ] "always" crate;
|
||||
extraLinkFlags = builtins.concatStringsSep " " (crate.extraLinkFlags or []);
|
||||
extraRustcOpts = (if crate ? extraRustcOpts then crate.extraRustcOpts else []) ++ extraRustcOpts_;
|
||||
configurePhase = configureCrate {
|
||||
inherit crateName buildDependencies completeDeps completeBuildDeps
|
||||
crateFeatures libName build workspace_member release libPath crateVersion
|
||||
extraLinkFlags
|
||||
extraLinkFlags extraRustcOpts
|
||||
crateAuthors verbose colors target_os;
|
||||
};
|
||||
extraRustcOpts = (if crate ? extraRustcOpts then crate.extraRustcOpts else []) ++ extraRustcOpts_;
|
||||
buildPhase = buildCrate {
|
||||
inherit crateName dependencies
|
||||
crateFeatures libName release libPath crateType
|
||||
|
Loading…
Reference in New Issue
Block a user