mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-10-04 05:50:00 +00:00
git: fix rust cross-compilation
... while trying to avoid triggering rebuilds in the non-cross case. It feels like there is surely a better way to do this?
This commit is contained in:
@@ -166,6 +166,11 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
substituteInPlace "$x" \
|
||||
--subst-var-by ssh "${openssh}/bin/ssh"
|
||||
done
|
||||
''
|
||||
+ lib.optionalString (rustSupport && (stdenv.buildPlatform != stdenv.hostPlatform)) ''
|
||||
substituteInPlace Makefile \
|
||||
--replace-fail "RUST_TARGET_DIR = target/" \
|
||||
"RUST_TARGET_DIR = target/${stdenv.hostPlatform.rust.rustcTargetSpec}/"
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [
|
||||
@@ -207,10 +212,16 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
libsecret
|
||||
];
|
||||
|
||||
# required to support pthread_cancel()
|
||||
env.NIX_LDFLAGS =
|
||||
lib.optionalString (stdenv.cc.isGNU && stdenv.hostPlatform.libc == "glibc") "-lgcc_s"
|
||||
+ lib.optionalString (stdenv.hostPlatform.isFreeBSD) "-lthr";
|
||||
env = {
|
||||
# required to support pthread_cancel()
|
||||
NIX_LDFLAGS =
|
||||
lib.optionalString (stdenv.cc.isGNU && stdenv.hostPlatform.libc == "glibc") "-lgcc_s"
|
||||
+ lib.optionalString (stdenv.hostPlatform.isFreeBSD) "-lthr";
|
||||
}
|
||||
// lib.attrsets.optionalAttrs (rustSupport && (stdenv.buildPlatform != stdenv.hostPlatform)) {
|
||||
# Rust cross-compilation
|
||||
CARGO_BUILD_TARGET = stdenv.hostPlatform.rust.rustcTargetSpec;
|
||||
};
|
||||
|
||||
configureFlags = [
|
||||
"ac_cv_prog_CURL_CONFIG=${lib.getDev curl}/bin/curl-config"
|
||||
|
||||
Reference in New Issue
Block a user