18 , # Allow building a limited set of APIs, e.g. ["s3" "ec2"].
20 , # Whether to enable AWS' custom memory management.
21 customMemoryManagement ? true
25 host_os = if stdenv.hostPlatform.isDarwin then "APPLE"
26 else if stdenv.hostPlatform.isAndroid then "ANDROID"
27 else if stdenv.hostPlatform.isWindows then "WINDOWS"
28 else if stdenv.hostPlatform.isLinux then "LINUX"
29 else throw "Unknown host OS";
32 stdenv.mkDerivation rec {
33 pname = "aws-sdk-cpp";
36 src = fetchFromGitHub {
40 sha256 = "sha256-Z1eRKW+8nVD53GkNyYlZjCcT74MqFqqRMeMc33eIQ9g=";
48 # Avoid blanket -Werror to evade build failures on less
50 substituteInPlace cmake/compiler_settings.cmake \
51 --replace '"-Werror"' ' '
53 # Missing includes for GCC11
54 sed '5i#include <thread>' -i \
55 aws-cpp-sdk-cloudfront-integration-tests/CloudfrontOperationTest.cpp \
56 aws-cpp-sdk-cognitoidentity-integration-tests/IdentityPoolOperationTest.cpp \
57 aws-cpp-sdk-dynamodb-integration-tests/TableOperationTest.cpp \
58 aws-cpp-sdk-elasticfilesystem-integration-tests/ElasticFileSystemTest.cpp \
59 aws-cpp-sdk-lambda-integration-tests/FunctionTest.cpp \
60 aws-cpp-sdk-mediastore-data-integration-tests/MediaStoreDataTest.cpp \
61 aws-cpp-sdk-queues/source/sqs/SQSQueue.cpp \
62 aws-cpp-sdk-redshift-integration-tests/RedshiftClientTest.cpp \
63 aws-cpp-sdk-s3-crt-integration-tests/BucketAndObjectOperationTest.cpp \
64 aws-cpp-sdk-s3-integration-tests/BucketAndObjectOperationTest.cpp \
65 aws-cpp-sdk-s3control-integration-tests/S3ControlTest.cpp \
66 aws-cpp-sdk-sqs-integration-tests/QueueOperationTest.cpp \
67 aws-cpp-sdk-transfer-tests/TransferTests.cpp
69 rm aws-cpp-sdk-core-tests/aws/auth/AWSCredentialsProviderTest.cpp
70 # Includes aws-c-auth private headers, so only works with submodule build
71 rm aws-cpp-sdk-core-tests/aws/auth/AWSAuthSignerTest.cpp
72 '' + lib.optionalString stdenv.hostPlatform.isMusl ''
73 # TestRandomURLMultiThreaded fails
74 rm aws-cpp-sdk-core-tests/http/HttpClientTest.cpp
75 '' + lib.optionalString stdenv.isi686 ''
77 rm aws-cpp-sdk-core-tests/aws/client/AdaptiveRetryStrategyTest.cpp
80 # FIXME: might be nice to put different APIs in different outputs
81 # (e.g. libaws-cpp-sdk-s3.so in output "s3").
82 outputs = [ "out" "dev" ];
84 nativeBuildInputs = [ cmake curl ];
88 ] ++ lib.optionals (stdenv.isDarwin &&
89 ((builtins.elem "text-to-speech" apis) ||
90 (builtins.elem "*" apis)))
91 [ CoreAudio AudioToolbox ];
93 # propagation is needed for Security.framework to be available when linking
94 propagatedBuildInputs = [ aws-crt-cpp ];
98 ] ++ lib.optional (!customMemoryManagement) "-DCUSTOM_MEMORY_MANAGEMENT=0"
99 ++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [
100 "-DENABLE_TESTING=OFF"
102 "-DCURL_HAS_TLS_PROXY=1"
103 "-DTARGET_ARCH=${host_os}"
104 ] ++ lib.optional (apis != ["*"])
105 "-DBUILD_ONLY=${lib.concatStringsSep ";" apis}";
107 NIX_CFLAGS_COMPILE = [
108 # openssl 3 generates several deprecation warnings
109 "-Wno-error=deprecated-declarations"
112 # aws-cpp-sdk-core-tests/aws/client/AWSClientTest.cpp
113 # seem to have a datarace
114 enableParallelChecking = false;
117 # This bodge is necessary so that the file that the generated -config.cmake file
118 # points to an existing directory.
119 "mkdir -p $out/include"
122 __darwinAllowLocalNetworking = true;
124 # Builds in 2+h with 2 cores, and ~10m with a big-parallel builder.
125 requiredSystemFeatures = [ "big-parallel" ];
128 description = "A C++ interface for Amazon Web Services";
129 homepage = "https://github.com/aws/aws-sdk-cpp";
130 license = licenses.asl20;
131 platforms = platforms.unix;
132 maintainers = with maintainers; [ eelco orivej ];
133 # building ec2 runs out of memory: cc1plus: out of memory allocating 33554372 bytes after a total of 74424320 bytes
134 broken = stdenv.buildPlatform.is32bit && ((builtins.elem "ec2" apis) || (builtins.elem "*" apis));