nixpkgs/pkgs/build-support/rust/hooks/maturin-build-hook.sh

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

41 lines
904 B
Bash
Raw Normal View History

2024-08-24 21:41:25 +00:00
# shellcheck shell=bash disable=SC2154,SC2164
maturinBuildHook() {
echo "Executing maturinBuildHook"
runHook preBuild
# Put the wheel to dist/ so that regular Python tooling can find it.
local dist="$PWD/dist"
2024-08-24 21:41:25 +00:00
if [ -n "${buildAndTestSubdir-}" ]; then
pushd "${buildAndTestSubdir}"
fi
local flagsArray=(
"--jobs=$NIX_BUILD_CORES"
"--offline"
"--target" "@rustTargetPlatformSpec@"
"--manylinux" "off"
"--strip"
"--release"
"--out" "$dist"
)
concatTo flagsArray maturinBuildFlags
echoCmd 'maturinBuildHook flags' "${flagsArray[@]}"
@setEnv@ maturin build "${flagsArray[@]}"
2024-08-24 21:41:25 +00:00
if [ -n "${buildAndTestSubdir-}" ]; then
popd
fi
# These are python build hooks and may depend on ./dist
runHook postBuild
echo "Finished maturinBuildHook"
}
buildPhase=maturinBuildHook