1echo "Sourcing setuptools-rust-hook"
2
3setuptoolsRustSetup() {
4 # This can work only if rustPlatform.cargoSetupHook is also included
5 if ! command -v cargoSetupPostPatchHook >/dev/null; then
6 echo "ERROR: setuptools-rust has to be used alongside with rustPlatform.cargoSetupHook!"
7 exit 1
8 fi
9
10 export PYO3_CROSS_LIB_DIR="@pyLibDir@"
11 export CARGO_BUILD_TARGET=@cargoBuildTarget@
12 # TODO theoretically setting linker should not be required because it is
13 # already set in pkgs/build-support/rust/hooks/default.nix but build fails
14 # on missing linker without this.
15 export CARGO_TARGET_@cargoLinkerVar@_LINKER=@targetLinker@
16}
17
18preConfigureHooks+=(setuptoolsRustSetup)