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
This commit is contained in:
r-burns 2021-08-08 18:08:47 -07:00 committed by GitHub
parent bf906eaf04
commit d63e4e2367
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,6 +7,14 @@
customMemoryManagement ? true 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 { stdenv.mkDerivation rec {
pname = "aws-sdk-cpp"; pname = "aws-sdk-cpp";
version = "1.8.130"; version = "1.8.130";
@ -49,6 +57,7 @@ stdenv.mkDerivation rec {
"-DENABLE_TESTING=OFF" "-DENABLE_TESTING=OFF"
"-DCURL_HAS_H2=1" "-DCURL_HAS_H2=1"
"-DCURL_HAS_TLS_PROXY=1" "-DCURL_HAS_TLS_PROXY=1"
"-DTARGET_ARCH=${host_os}"
] ++ lib.optional (apis != ["*"]) ] ++ lib.optional (apis != ["*"])
"-DBUILD_ONLY=${lib.concatStringsSep ";" apis}"; "-DBUILD_ONLY=${lib.concatStringsSep ";" apis}";