1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-12-01 01:51:24 +00:00
nixpkgs/pkgs/build-support/rust/hooks/maturin-build-hook.sh
Daniël de Kok 160cf87086 rustPlatform.maturinBuildHook: init
This build hook can be used to build Python packages using maturin.
2021-02-12 08:40:43 +01:00

40 lines
902 B
Bash

maturinBuildHook() {
echo "Executing maturinBuildHook"
runHook preBuild
if [ ! -z "${buildAndTestSubdir-}" ]; then
pushd "${buildAndTestSubdir}"
fi
(
set -x
env \
"CC_@rustBuildPlatform@=@ccForBuild@" \
"CXX_@rustBuildPlatform@=@cxxForBuild@" \
"CC_@rustTargetPlatform@=@ccForHost@" \
"CXX_@rustTargetPlatform@=@cxxForHost@" \
maturin build \
--cargo-extra-args="-j $NIX_BUILD_CORES --frozen" \
--target @rustTargetPlatformSpec@ \
--manylinux off \
--strip \
--release \
${maturinBuildFlags-}
)
runHook postBuild
if [ ! -z "${buildAndTestSubdir-}" ]; then
popd
fi
# Move the wheel to dist/ so that regular Python tooling can find it.
mkdir -p dist
mv target/wheels/*.whl dist/
echo "Finished maturinBuildHook"
}
buildPhase=maturinBuildHook