Commit Graph

150 Commits

Author SHA1 Message Date
worldofpeace
3f4a353737 treewide: use dontUnpack 2019-07-01 04:23:51 -04:00
volth
f3282c8d1e treewide: remove unused variables (#63177)
* treewide: remove unused variables

* making ofborg happy
2019-06-16 19:59:05 +00:00
Peter Kolloch
61ac550082 Fix #60125 - buildRustCrate: Always set CARGO_PKG_VERSION_PRE and CARGO_PKG_HOMEPAGE
(as cargo does)
2019-04-23 23:41:57 +02:00
Andreas Rammhold
1bb989ca70 cargo-vendor: fix build on Darwin
This is supposedly fixing the build of the cargo crate on Drawin [1].

[1] https://github.com/NixOS/nixpkgs/pull/57017#pullrequestreview-228868016
2019-04-21 12:11:54 +02:00
Andreas Rammhold
2e2f7cba90 cargo: fix build on Darwin
This is supposedly fixing the build of the cargo crate on Drawin [1].

[1] https://github.com/NixOS/nixpkgs/pull/57017#pullrequestreview-228868016
2019-04-21 12:11:54 +02:00
Alexander Krupenkin
a4902a33bf cargo-vendor: 0.1.13 -> 0.1.23 2019-04-21 12:11:54 +02:00
Frederik Rietdijk
d108b49168 Merge master into staging-next 2019-04-09 16:38:35 +02:00
Andreas Rammhold
1462ef27bb
Merge pull request #58394 from P-E-Meunier/carnix-0.10
Carnix: 0.9 -> 0.10
2019-04-08 20:46:14 +00:00
Jan Tojnar
cb1a20499a
Merge branch 'master' into staging 2019-04-05 11:37:15 +02:00
Michael Eden
f93470d7a3 rust: set PKG_CONFIG_ALLOW_CROSS conditionally in buildRustPackage 2019-03-29 11:11:00 -04:00
Michael Eden
bdd3c3fdcb rust: allow building in debug or release modes 2019-03-29 11:11:00 -04:00
Michael Eden
60761e65ba rust: move releaseDir to target/release in the buildPhase 2019-03-29 11:11:00 -04:00
Jörg Thalheim
912dca193a rust: fix cross-compilation 2019-03-29 11:11:00 -04:00
Andreas Rammhold
e0b4356c0d
Merge pull request #57936 from andir/build-rust-crate-nix-build-cores
buildRustCrate: use $NIX_BUILD_CORES for each of the crates
2019-03-29 12:29:43 +01:00
Pierre-Étienne Meunier
81d9ddab1a Carnix: 0.9 -> 0.10 2019-03-26 18:54:28 +00:00
Teo Klestrup Röijezon
5eec83eb83 buildRustCrate: Fix include filter
buildRustCrate has a handy `include` helper, that only imports those whitelisted
files and folders to the store.

However, the function's matching logic is broken and includes all files,
regardless of whether or not they're whitelisted, as long as the whitelist
contains at least one name (regardless of whether that name exists). This is
because it doesn't take into account that
`lib.strings.removePrefix "foo" "bar" == "bar"` (that is, paths that don't match
the prefix are passed straight through).
2019-03-25 15:24:42 +01:00
Andreas Rammhold
4c89619152
buildRustCrate: use $NIX_BUILD_CORES for each of the crates 2019-03-20 02:19:50 +01:00
Jörg Thalheim
cd498f7c80
Merge pull request #56634 from marsam/buildrustcreate-pname-attribute
buildRustPackage: Allow pname attribute
2019-03-11 10:08:00 +00:00
Peter Kolloch
baa3d6f43b
buildRustCrate: Make CARGO_MANIFEST_DIR absolute
While it is not obvious from the source, cargo sets CARGO_MANIFEST_DIR to an absolute directory. This let to a build problem with the popular "tera" crate using the "pest" crate.

## Cargo details

The variable is set here:

f7c91ba622/src/cargo/core/compiler/compilation.rs (L229)

and computed from the `manifest_path`:

f7c91ba622/src/cargo/core/package.rs (L163)

The manifest path is also exported via `cargo metadata` where you can see that it is absolute.
2019-03-03 12:02:26 +01:00
Mario Rodas
435b326722
buildRustPackage: Allow pname attribute 2019-03-01 21:48:44 -05:00
Pierre-Étienne Meunier
32e94c2674 buildRustCrate: adding the description field 2019-02-25 15:22:03 +00:00
Ryan Mulligan
d461adff17
Merge pull request #56314 from P-E-Meunier/carnix-0.9.8
Carnix: 0.9.7 -> 0.9.8
2019-02-24 15:10:31 -08:00
Pierre-Étienne Meunier
7a1853ef35 Carnix: 0.9.7 -> 0.9.8 2019-02-24 19:29:13 +00:00
Andreas Rammhold
6a3b144d02
buildRustCrate: support rust editions
In combination with carnix we can now build crates that require a
specific edition of rust features. A few crates started requiring that
already and having this in nixpkgs is just logical.
2019-02-18 01:09:54 +01:00
Andreas Rammhold
044a8a24ed
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.
2019-02-18 00:10:36 +01:00
Pierre-Etienne Meunier
121318a9b4 toml2nix: init at 0.1.1 (#53883) 2019-01-15 23:36:36 +02:00
Alexander Krupenkin
451b181586
fetchcargo: fixed config installation path 2018-12-14 16:23:33 +03:00
Darius Jahandarie
da84602f61 buildRustCrate: fix extraRustcOpts so it is not discarded 2018-12-12 01:21:46 -06:00
Frederik Rietdijk
5f554279ec Merge master into staging-next 2018-12-07 15:22:35 +01:00
Austin Seipp
3aa9091162 buildRustCreate: export RUSTDOC during cargo config
See https://github.com/NixOS/nixpkgs/pull/50452#issuecomment-443455411

Signed-off-by: Austin Seipp <aseipp@pobox.com>
2018-12-04 19:51:51 -06:00
Graham Christensen
fc459de60e
Merge pull request #50452 from P-E-Meunier/carnix-fix
Rust build-support: fixing a compilation error in some crates
2018-12-03 10:53:25 -05:00
Pierre-Étienne Meunier
3083fa2aa1 Carnix 0.9.2 2018-11-27 16:08:11 +00:00
Jörg Thalheim
dc8aca448d
Merge pull request #51028 from clefru/tmp-cargo-config
buildRustPackage: write cargo config to temporary file instead of source dir
2018-11-26 15:00:16 +00:00
Clemens Fruhwirth
8d4fbc55d8 Write cargo config to temporary file instead of source dir.
... as this fails if the source dir contains a "config" directory.
2018-11-25 15:26:31 +01:00
Pierre-Étienne Meunier
0e8332ca2b Fixing "include" 2018-11-22 11:40:03 +00:00
Jörg Thalheim
952f4fda86
makeRustPlatform: refactor to make it easier to understand
It is now clearer what is supposed to be in the rust attribute set
without having studied type theory. The amount of code is identically.
2018-11-21 12:44:58 +00:00
Austin Seipp
04a543b3a0 defaultCrateOverrides: foundationdb native dependencies
Signed-off-by: Austin Seipp <aseipp@pobox.com>
2018-11-17 19:28:48 -06:00
Pierre-Étienne Meunier
f1de24feb8 Rust build-support: fixing a compilation error in some crates (such as proc-macro2) 2018-11-16 12:12:59 +00:00
Jörg Thalheim
96c627b3f6
defaultCrateOverrides: add serde_derive 2018-10-28 21:59:19 +00:00
Jörg Thalheim
e0a5689528
defaultCrateOverrides: order alphabetically 2018-10-28 21:55:26 +00:00
Pierre-Etienne Meunier
ae3b4655a4 Carnix: 0.7.2 -> 0.8.10 (#40587)
Carnix: splits input into two parts: creates from creates.io and local ones
2018-10-28 00:06:29 +01:00
Justin Humm
64d0676fe1
buildRustPackage: fix regex for separating lib and bin
E.g. exa was wrongly put into /lib, as it matches

  .*.a

but not

  .*\.a
2018-10-07 22:14:19 +02:00
Edward Tate
6ad43a0bce
buildRustPackage now correctly installs binaries to bin and libraries to lib. 2018-10-03 16:27:10 +02:00
John Ericson
7319013ea1 Merge remote-tracking branch 'upstream/master' into staging 2018-09-18 16:55:42 -04:00
Silvan Mosberger
50578abfc5
fetchcargo: Fix cargo-vendor-normalise for darwin 2018-09-17 20:23:50 +02:00
Andreas Rammhold
fc5e595003
buildRustCrate: added some edge cases with binaries
This commit adds test based on real-world crates (brotli).
There were a few more edge cases that were missing beforehand. Also it
turned out that we can get rid of the `finalBins` list since that will
now be handled during runtime.
2018-09-13 22:00:29 +02:00
Andreas Rammhold
0f95d05548 buildRustCrate: add test cases 2018-09-13 20:28:39 +02:00
Andreas Rammhold
fdc2017f1c buildRustCrate: binary heuristic should be able to treat spaces 2018-09-13 20:28:39 +02:00
Andreas Rammhold
1371815060 buildRustCrate: extracted builder scripts into dedicated files
The build expression got quiet large over time and to make it a bit
easier to grasp the different scripts involved in the build are now
separated from the nix file.
2018-09-13 20:28:39 +02:00
Andreas Rammhold
0c50140da5 buildRustCrate: add heuristic to picking the right source files
Cargo has a few odd (old) ways of picking source files if the `bin.path`
attribute isn't given in the Cargo.toml. This commit adds support for
some of those. The previous behaviour always defaulted to `src/main.rs`
which was not always the right choice.

Since there is  look-ahead into the unpacked sources before running the
actual builder the path selection logic has to be embedded within the
build script.

`buildRustCrate` currently supports two ways of running building
binaries when processing a crate:

- Explicit definition of all the binaries (& optionally the paths to
their respective `main.rs`) and,
- if not binary was explictly configured all files matching the patterns
  `src/main.rs`, `src/bin/*.rs`.

When the explicit list is given without path information paths are now
being picked from a list of candidates. The first match wins. The order
is the same as within the cargo compatibility code.

If the crate does not provide any libraries the path `src/{bin_name}.rs`
is also considered.

All underscores within the binary names are translated into dashes (`-`)
before the lookups are made. This seems to be a common convention.
2018-09-13 20:28:39 +02:00