a8efb2053f
- API change: remove the `target` argument of `buildRustPackage`, the target should always be in sync with the C/C++ compiler that is used. - Gathering of binaries has moved from `buildPhase` to `installPhase`, this simplifies the hook and orders this functionality logically with the installation logic.
34 lines
706 B
Bash
34 lines
706 B
Bash
cargoBuildHook() {
|
|
echo "Executing cargoBuildHook"
|
|
|
|
runHook preBuild
|
|
|
|
if [ ! -z "${buildAndTestSubdir-}" ]; then
|
|
pushd "${buildAndTestSubdir}"
|
|
fi
|
|
|
|
(
|
|
set -x
|
|
env \
|
|
"CC_@rustBuildPlatform@=@ccForBuild@" \
|
|
"CXX_@rustBuildPlatform@=@cxxForBuild@" \
|
|
"CC_@rustTargetPlatform@=@ccForHost@" \
|
|
"CXX_@rustTargetPlatform@=@cxxForHost@" \
|
|
cargo build -j $NIX_BUILD_CORES \
|
|
--target @rustTargetPlatformSpec@ \
|
|
--frozen \
|
|
${cargoBuildType} \
|
|
${cargoBuildFlags}
|
|
)
|
|
|
|
runHook postBuild
|
|
|
|
if [ ! -z "${buildAndTestSubdir-}" ]; then
|
|
popd
|
|
fi
|
|
|
|
echo "Finished cargoBuildHook"
|
|
}
|
|
|
|
buildPhase=cargoBuildHook
|