core/pkgs/by-name/py/python/hooks/setuptools-rust-hook.sh

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

19 lines
709 B
Bash
Raw Normal View History

2024-05-02 00:46:19 +00:00
echo "Sourcing setuptools-rust-hook"
setuptoolsRustSetup() {
# This can work only if rustPlatform.cargoSetupHook is also included
if ! command -v cargoSetupPostPatchHook >/dev/null; then
echo "ERROR: setuptools-rust has to be used alongside with rustPlatform.cargoSetupHook!"
exit 1
fi
export PYO3_CROSS_LIB_DIR="@pyLibDir@"
export CARGO_BUILD_TARGET=@cargoBuildTarget@
# TODO theoretically setting linker should not be required because it is
# already set in pkgs/build-support/rust/hooks/default.nix but build fails
# on missing linker without this.
export CARGO_TARGET_@cargoLinkerVar@_LINKER=@targetLinker@
}
preConfigureHooks+=(setuptoolsRustSetup)