anvil-editor: init at 0.4
[NixPkgs.git] / pkgs / build-support / rust / hooks / maturin-build-hook.sh
blob2eab2124e70bef43697a01050cd57e9603eeeaf1
1 # shellcheck shell=bash disable=SC2154,SC2164
3 maturinBuildHook() {
4 echo "Executing maturinBuildHook"
6 runHook preBuild
8 # Put the wheel to dist/ so that regular Python tooling can find it.
9 local dist="$PWD/dist"
11 if [ -n "${buildAndTestSubdir-}" ]; then
12 pushd "${buildAndTestSubdir}"
15 local flagsArray=(
16 "--jobs=$NIX_BUILD_CORES"
17 "--offline"
18 "--target" "@rustTargetPlatformSpec@"
19 "--manylinux" "off"
20 "--strip"
21 "--release"
22 "--out" "$dist"
25 concatTo flagsArray maturinBuildFlags
27 echoCmd 'maturinBuildHook flags' "${flagsArray[@]}"
28 @setEnv@ maturin build "${flagsArray[@]}"
30 if [ -n "${buildAndTestSubdir-}" ]; then
31 popd
34 # These are python build hooks and may depend on ./dist
35 runHook postBuild
37 echo "Finished maturinBuildHook"
40 buildPhase=maturinBuildHook