python3Packages.setuptools-rust: fix cross build for all setuptools-rust based packages (#467817)
This commit is contained in:
@@ -442,20 +442,6 @@ in
|
||||
} ./setuptools-build-hook.sh
|
||||
) { };
|
||||
|
||||
setuptoolsRustBuildHook = callPackage (
|
||||
{ makePythonHook, setuptools-rust }:
|
||||
makePythonHook {
|
||||
name = "setuptools-rust-setup-hook";
|
||||
propagatedBuildInputs = [ setuptools-rust ];
|
||||
substitutions = {
|
||||
pyLibDir = "${python}/lib/${python.libPrefix}";
|
||||
cargoBuildTarget = stdenv.hostPlatform.rust.rustcTargetSpec;
|
||||
cargoLinkerVar = stdenv.hostPlatform.rust.cargoEnvVarTarget;
|
||||
targetLinker = "${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc";
|
||||
};
|
||||
} ./setuptools-rust-hook.sh
|
||||
) { };
|
||||
|
||||
unittestCheckHook = callPackage (
|
||||
{ makePythonHook }:
|
||||
makePythonHook {
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
# shellcheck shell=bash
|
||||
|
||||
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)
|
||||
Reference in New Issue
Block a user