about summary refs log tree commit diff
path: root/pkgs/development/libraries/aws-sdk-cpp
diff options
context:
space:
mode:
authorr-burns <52847440+r-burns@users.noreply.github.com>2021-08-08 18:08:47 -0700
committerGitHub <noreply@github.com>2021-08-08 21:08:47 -0400
commitd63e4e2367bd53089d51673236289468b0256daa (patch)
treea69d75f2b7fd632bec26eed07f77633d2ba3a296 /pkgs/development/libraries/aws-sdk-cpp
parentbf906eaf04e88a41171bff872e8610a7d728bdc0 (diff)
aws-sdk-cpp: fix cross-OS crosscompilation (#133182)
The TARGET_ARCH cmake variable is used to specify the host OS, which if
unspecified defaults to the same as the build OS. So to crosscompile
aws-sdk-cpp to another OS, the TARGET_ARCH variable must be specified.

Example hydra failure: https://hydra.nixos.org/build/149290553/nixlog/3
Diffstat (limited to 'pkgs/development/libraries/aws-sdk-cpp')
-rw-r--r--pkgs/development/libraries/aws-sdk-cpp/default.nix9
1 files changed, 9 insertions, 0 deletions
diff --git a/pkgs/development/libraries/aws-sdk-cpp/default.nix b/pkgs/development/libraries/aws-sdk-cpp/default.nix
index 1ba2d79dcec53..fa081ab3f24fe 100644
--- a/pkgs/development/libraries/aws-sdk-cpp/default.nix
+++ b/pkgs/development/libraries/aws-sdk-cpp/default.nix
@@ -7,6 +7,14 @@
   customMemoryManagement ? true
 }:
 
+let
+  host_os = if stdenv.hostPlatform.isDarwin then "APPLE"
+       else if stdenv.hostPlatform.isAndroid then "ANDROID"
+       else if stdenv.hostPlatform.isWindows then "WINDOWS"
+       else if stdenv.hostPlatform.isLinux then "LINUX"
+       else throw "Unknown host OS";
+in
+
 stdenv.mkDerivation rec {
   pname = "aws-sdk-cpp";
   version = "1.8.130";
@@ -49,6 +57,7 @@ stdenv.mkDerivation rec {
     "-DENABLE_TESTING=OFF"
     "-DCURL_HAS_H2=1"
     "-DCURL_HAS_TLS_PROXY=1"
+    "-DTARGET_ARCH=${host_os}"
   ] ++ lib.optional (apis != ["*"])
     "-DBUILD_ONLY=${lib.concatStringsSep ";" apis}";