diff options
author | Andreas Rammhold <andreas@rammhold.de> | 2018-09-13 21:12:14 +0200 |
---|---|---|
committer | Andreas Rammhold <andreas@rammhold.de> | 2018-09-13 22:00:29 +0200 |
commit | fc5e5950031d8af57f8b5b9e55187f3e4cb4f063 (patch) | |
tree | 895ddddd79334d54a0b61f8dba405bc70ac2f5e0 /pkgs/build-support/rust/build-rust-crate/build-crate.nix | |
parent | 0f95d05548171ba14c4424c735f05633edccd1a9 (diff) | |
download | nixlib-fc5e5950031d8af57f8b5b9e55187f3e4cb4f063.tar nixlib-fc5e5950031d8af57f8b5b9e55187f3e4cb4f063.tar.gz nixlib-fc5e5950031d8af57f8b5b9e55187f3e4cb4f063.tar.bz2 nixlib-fc5e5950031d8af57f8b5b9e55187f3e4cb4f063.tar.lz nixlib-fc5e5950031d8af57f8b5b9e55187f3e4cb4f063.tar.xz nixlib-fc5e5950031d8af57f8b5b9e55187f3e4cb4f063.tar.zst nixlib-fc5e5950031d8af57f8b5b9e55187f3e4cb4f063.zip |
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.
Diffstat (limited to 'pkgs/build-support/rust/build-rust-crate/build-crate.nix')
-rw-r--r-- | pkgs/build-support/rust/build-rust-crate/build-crate.nix | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/pkgs/build-support/rust/build-rust-crate/build-crate.nix b/pkgs/build-support/rust/build-rust-crate/build-crate.nix index bd9d96d96cd6..f65118ba4a64 100644 --- a/pkgs/build-support/rust/build-rust-crate/build-crate.nix +++ b/pkgs/build-support/rust/build-rust-crate/build-crate.nix @@ -2,7 +2,7 @@ { crateName, dependencies, crateFeatures, libName, release, libPath, - crateType, metadata, crateBin, finalBins, + crateType, metadata, crateBin, extraRustcOpts, verbose, colors }: let @@ -117,11 +117,11 @@ # the first two cases are the "new" default IIRC BIN_NAME_=$(echo $BIN_NAME | sed -e 's/-/_/g') - FILES=( "src/bin/$BIN_NAME_.rs" "src/bin/$BIN_NAME_/main.rs" "src/bin/main.rs" "src/main.rs" ) + FILES=( "src/bin/$BIN_NAME.rs" "src/bin/$BIN_NAME/main.rs" "src/bin/$BIN_NAME_.rs" "src/bin/$BIN_NAME_/main.rs" "src/bin/main.rs" "src/main.rs" ) if ! [ -e "${libPath}" -o -e src/lib.rs -o -e "src/${libName}.rs" ]; then # if this is not a library the following path is also valid - FILES=( "src/$BIN_NAME_.rs" "''${FILES[@]}" ) + FILES=( "src/$BIN_NAME.rs" "src/$BIN_NAME_.rs" "''${FILES[@]}" ) fi for file in "''${FILES[@]}"; @@ -153,6 +153,5 @@ ''} # Remove object files to avoid "wrong ELF type" find target -type f -name "*.o" -print0 | xargs -0 rm -f - '' + finalBins + '' runHook postBuild '' |