summary refs log tree commit diff
path: root/pkgs/build-support/rust/build-rust-crate
Commit message (Collapse)AuthorAge
* build-rust-crate: disable incremental buildspandaman642021-07-09
| | | | | | | | According to rustc implementation[1], `-C incremental=no` enables incremental builds with directory name `no`. This patch removes the `-C incremental` argument to disable incremental builds. [1]: https://github.com/rust-lang/rust/blob/ee86f96ba176f598d64dc9f3bb7e074d5b8b86b6/compiler/rustc_session/src/options.rs#L918-L919
* build-rust-crate: disable incremental buildszseri2021-04-08
|
* tests.buildRustCrate: Fix after hashing method changeJohn Ericson2020-12-19
| | | | | | As @lopsided98 points out in #105305, since the hashes are now target sensative, and until we find reason to actually care to test what they are exactly, we are best just normalizing them away in the tests.
* buildRustCrate: set NUM_JOBS to NIX_BUILD_CORESDaniël de Kok2020-12-03
| | | | | | | | | | | | Bofore this change, NUM_JOBS was set to 1. Some crates for building C/C++ code (e.g. the cc and cmake crates), rely on this variable to set the number of jobs. As a consequence, we were compiling embedded libraries serially. Change this to NIX_BUILD_CORES to permit parallel builds. Prior discussion: https://github.com/NixOS/nixpkgs/pull/50452#issuecomment-439407547
* Merge pull request #105305 from lopsided98/build-rust-crate-platform-hashJohn Ericson2020-11-29
|\ | | | | buildRustCrate: add host platform to rlib hash suffix
| * buildRustCrate: add host platform to rlib hash suffixBen Wolsieffer2020-11-28
| |
* | rust: Add support for managing target JSON in NixJohn Ericson2020-10-14
|/
* buildRustCrateTests: support cross-compilationBen Wolsieffer2020-09-29
|
* buildRustCrate: fix target config environment variables on 32-bit ARMBen Wolsieffer2020-09-29
|
* buildRustCrate: support cross compilationBen Wolsieffer2020-09-28
|
* buildRustCrate: editorconfig fixeszowoq2020-08-09
|
* buildRustCrate: set CARGO_FEATURE_* when running the build scriptDaniël de Kok2020-06-13
| | | | | | | | | | | | | | | | | Cargo sets `CARGO_FEATURE_*` for all features when running a build script: https://doc.rust-lang.org/cargo/reference/environment-variables.html#environment-variables-cargo-sets-for-build-scripts Some crates have build scripts (e.g. openblas-src) that rely on the feature variables being properly set. Since we now need several representations of features, this change also updates `createFeatures` to be a list of features, rather than `rustc` feature arguments. `configureCrate` and `buildCrate` then build the required representations as-needed. Fixes #68978
* buildRustCrate: Replace hyphen with underscore in env variables (#88054)Michael Howell2020-05-26
| | | | | | * Add test case for include dir * buildRustCrate: replace hyphen with underscore in env This fixes a bug that prevents encoding_c from building.
* Merge pull request #85172 from andir/buildRustCrate-proc-macroAndreas Rammhold2020-04-13
|\ | | | | buildRustCrate: support proc-macro in default prelude
| * buildRustCrate: support proc-macro in default preludeAndreas Rammhold2020-04-13
| |
* | buildRustCrate: Support versioned crate renamesPeter Kolloch2020-04-10
| |
* | buildRustCrate: Document parametersPeter Kolloch2020-04-10
|/ | | | | | | | | I know, heretic, but... I also know that this is not perfect but it is a good start, I think. It would be nice if this were part of the automatic "nixdoc" function reference. I'd like guidance if this should be part of the rust section or something else.
* buildRustCrate: Add tests for checking files in outputs.Peter Kolloch2020-03-29
| | | | | ...and remove superfluous dependency files (*.d). ...and copy dSYM directories on Mac OS when in release=false mode.
* buildRustCrateTests: Fix link order test on darwinAndreas Rammhold2020-03-28
| | | | | | | | | | | | As it turns out Darwin does most of the things differently then "normal" systems. They are using a different shared library extension and require an obscure commandline parameter that has to be added to every build system out there. That issue seems to be with clang on Darwin as on Linux that flag isn't required to build the very same tests (when using clang). After adjusting these two details the tests are running fine on the darwin box that I was able to obtain.
* Merge pull request #83379 from symphorien/rust-linkAndreas Rammhold2020-03-28
|\ | | | | buildRustCrate: don't sort link flags
| * buildRustCrateTests: add regression test for link orderSymphorien Gibol2020-03-28
| |
| * buildRustCrate: don't sort link flagsSymphorien Gibol2020-03-25
| | | | | | | | Linkage order is significant and sorting can result in link errors.
* | buildRustCrate: fewer backslashesAlyssa Ross2020-03-27
|/ | | | This is a slight readability boost, I think.
* buildRustCrate: sort linker options in-placeDaniël de Kok2020-03-13
|
* buildRustCrate: only link build deps into build scriptDaniël de Kok2020-03-13
| | | | | | | | | | | | | | According to the Cargo documentation: > The build script does not have access to the dependencies listed in > the dependencies or dev-dependencies section (they’re not built > yet!). Also, build dependencies are not available to the package > itself unless also explicitly added in the [dependencies] table. https://doc.rust-lang.org/cargo/reference/build-scripts.html This change separates linkage of regular dependencies and build dependencies.
* build-support/rust/buildRustCrate: Search for matching Cargo.toml in sub ↵Peter Kolloch2020-03-09
| | | | | | | | | | | directories This is what cargo does for git repositories. See related issues: * https://github.com/kolloch/crate2nix/issues/53 * https://github.com/kolloch/crate2nix/issues/33
* buildRustCrate: refactor colored loggingPeter Kolloch2020-03-09
| | | | | | * Make errors include the crate name and make them much more prominent. * Move more code into lib.sh * Already source generated logging code and lib.sh in configure
* Merge pull request #79816 from andir/buildRustCrate-no-override-depAndreas Rammhold2020-02-18
|\ | | | | buildRustCrate: remove superfluous dependency overrides
| * buildRustCrate: remove superfluous dependency overridesAndreas Rammhold2020-02-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | By overriding each dependency on every level of the dependency tree we are creating a lot of unnecessary instances of the same derivation Looking at the output size of `nix-instantiate --trace-function-calls -vvvv …` and the execution time I got about a 10x improvement after applying this change. It was probably good intentions that lead to these overrides but in practice no tooling (that I know of) really needs this. `carnix` and `crate2nix` are fine without those overrides. Furthermore I believe that it is the job of the tooling around `buildRustCrate` to provide a coherent set of overrides. By not enforcing all of the overrides, debug flags, verbosity, … to be the same throughout the closure we also allow consumers to override specific aspects of the crates. Some (older?) crates might need different `crateOverrides` then newer crates with the same name. Currently such situations can not (easily) be implemented with the override in-place.
* | buildRustCrate: remap the current build dir to / for (more) reproducible buildsAndreas Rammhold2020-02-06
|/
* buildRustCrate: fix #78412Andreas Rammhold2020-01-28
| | | | | | `build.rs` files might create files. Those files are supposed to go into `OUT_DIR` (envirionment variable) and not be overlayed onto the source tree.
* buildRustCrateTests: add regression test for #74071Andreas Rammhold2020-01-28
|
* buildRustCrateTests: add test case for rlib linkingAndreas Rammhold2020-01-21
|
* buildRustCrateTests: fix some formatting issuesAndreas Rammhold2020-01-21
|
* buildRustCrate: treat `rlib` crates just like `lib` cratesAndreas Rammhold2020-01-21
| | | | | Both version provide `rlib` files to link against. Previously we would try to find a matching shared library in the `lib` output.
* buildRustCrateTests: use releaseTools.aggregateAndreas Rammhold2020-01-16
| | | | | | Previously I did use `runCommand` to do the same. Using releaseTools.aggregate seems a lot saner and we might get nicer hydra output of the tests that are failing.
* buildRustCrate: remove one of the odd library filename casesAndreas Rammhold2020-01-16
| | | | | | | | | | | | | | | | | | | | | It used to be the case (ref missing) that cargo did treat `src/$libName.rs` as an alternative to `src/lib.rs` when the latter wasn't present. Recently I failed to reproduce that with vanilla cargo and it started to cause pain with some crates of the form: some_crate/ `- src `- main.rs `- some_crate.rs We would build `src/some_crate.rs` and thing it is a library while that might not be the actual case. This crate is a valid `bin` crate not a `lib` crate as far as I can tell from the samples I took. I removed support for the previously required heuristic and commented out the test cases in case we will need them again. We could crawl in the Git history but chances are that the next person looking into this doesn't know about the history.
* buildRustCrate: slight "rewording" and reformattingAndreas Rammhold2020-01-07
| | | | | There is no point in reinventinb builtins through `filterAttrs` or the like. Lets just stick to what we already have in our toolbelt.
* buildRustCrate: add `buildTests` flag to tell rustc to build tests instead ↵Andreas Rammhold2020-01-07
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | of binaries This helps us instruct rustc to build tests instead of binaries. The actual build will then ONLY produce test executables. This is a first step towards having rust crate tests within nixpkgs. We default back to only a single output in test cases since that is the only reasonable thing to do here. Producing libraries or binaries in addition to tests would theoretically be feasible but usually generates different dependency trees. It is very common to have some libraries in `[dev-depdendencies]` within Cargo.toml just for your tests. To not start mixing things up going with a dedicated derivation for the test build sounds like the best choice for now. To use this you must provide a proper test dependency chain to `buildRustCrate` (as you would usually do with your non-test inputs). And then set the `buildTests` attribute to `true`. The derivation will then contain all tests that were built in `$out/tests`. All common test patterns and directories should be supported and tested by this change. Below is an example how you would run a single test from the derivation. This commit contains some more examples in the `buildRustCrateTests` attribute set that might be helpful. ``` let drv = buildRustCrate { … buildTests true; }; in runCommand "test-my-crate" {} '' touch $out exec ${drv}/tests/my-test '' ```
* buildRustCrate: fixup usage of `builtins.filterSource`Andreas Rammhold2020-01-07
| | | | | | While unifying most of the lib function calls I accidentially changed the filterSource functions as well. Since there were no tests I ended up forgetting about this case (even thought I ran into it…).
* buildRustCrate: move common build functions to a dedicated fileAndreas Rammhold2019-12-12
| | | | | This means we aren't rebuilding hat file for each crate we are building and the buildPhase expression is a lot easier to comprehent.
* buildRustCrate: deduplicate dependency override codeAndreas Rammhold2019-12-12
| | | | | | The previous lines were only different in the kind of dependencies but otherwise exactly the same. It makes the entire thing a bit more readable by moving this into a function that takes care of this.
* buildRustCrate: use less bash for the build scriptAndreas Rammhold2019-12-12
| | | | | | | | | | | | | We can get rid of a bunch of workarounds that were in the build script before by just passing on the `crateBin` attribute. Before we converted the list of attributes to a string only to convert it back in bash during the build phase. We can do the entire looping through builds in Nix and thus need no conversion and parsing of attributes over and over again. The big part that still remains bash is the heuristic that cargo introduced and that we can't do at eval time.
* buildRustCrate: reflow the way `extraRustcOpts` is constructedAndreas Rammhold2019-12-11
| | | | | This should make it more obvious that we have three parts to it and not just one long gibberish string that makes up all of it.
* buildRustCrate: rename `makeDeps` function to `mkRustcDepArgs`Andreas Rammhold2019-12-11
| | | | | This should carry the function better then `makeDeps` as it isn't producing deps but the rustc arguments required to link against those.
* buildRustCrate: document and cleanup the symbol seedingAndreas Rammhold2019-12-11
| | | | | | That code had been in the derivation for a while but no explanation was given why that is needed. It might be helpful to our future selfs to document why things are done the way they are.
* buildRustCrate: use tr instead of sed (it reads a bit nicer)Andreas Rammhold2019-12-11
| | | | | I already have a few changes in here that will trigger rebuilds so I might as well do that substitution now.
* buildRustCrate: move the color loggign & remove some runtime checksAndreas Rammhold2019-12-11
| | | | | | | | The expression is already long and confusing enough without the color stuff sprinkled in. Moving it to a dedicated file makes sense. I switched a bit of the color support code to pure Nix since there wasn't much point in doing that in bash while we can just do it in Nix.
* buildRustCrate: builtins -> lib where possibleAndreas Rammhold2019-12-11
| | | | | | We can just use `lib` instead of `builtins` in all cases but the `hashString` case. Also changed a few lines to make use of some optional helpers from lib.
* rust: add support for armv6l-linux and armv7l-linux (#73472)Jörg Thalheim2019-11-29
|\ | | | | rust: add support for armv6l-linux and armv7l-linux