3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/build-support/rust/build-rust-crate/install-crate.nix
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

29 lines
688 B
Nix

crateName: metadata:
''
runHook preInstall
mkdir -p $out
if [[ -s target/env ]]; then
cp target/env $out/env
fi
if [[ -s target/link.final ]]; then
mkdir -p $out/lib
cp target/link.final $out/lib/link
fi
if [[ "$(ls -A target/lib)" ]]; then
mkdir -p $out/lib
cp target/lib/* $out/lib #*/
for lib in $out/lib/*.so $out/lib/*.dylib; do #*/
ln -s $lib $(echo $lib | sed -e "s/-${metadata}//")
done
fi
if [[ "$(ls -A target/build)" ]]; then # */
mkdir -p $out/lib
cp -r target/build/* $out/lib # */
fi
if [[ "$(ls -A target/bin)" ]]; then
mkdir -p $out/bin
cp -P target/bin/* $out/bin # */
fi
runHook postInstall
''