1{ lib, stdenv, fetchFromGitHub, cmake, curl, openssl, zlib
2, aws-c-common, aws-c-event-stream, aws-checksums
3, CoreAudio, AudioToolbox
4, # Allow building a limited set of APIs, e.g. ["s3" "ec2"].
5 apis ? ["*"]
6, # Whether to enable AWS' custom memory management.
7 customMemoryManagement ? true
8}:
9
10stdenv.mkDerivation rec {
11 name = "aws-sdk-cpp-${version}";
12 version = "1.7.53";
13
14 src = fetchFromGitHub {
15 owner = "awslabs";
16 repo = "aws-sdk-cpp";
17 rev = version;
18 sha256 = "0ybccffz5nrhp4n4nyb6ykrk9fdi0vqqqhjkaxx3l0xvmqx9rbrv";
19 };
20
21 # FIXME: might be nice to put different APIs in different outputs
22 # (e.g. libaws-cpp-sdk-s3.so in output "s3").
23 outputs = [ "out" "dev" ];
24 separateDebugInfo = stdenv.isLinux;
25
26 nativeBuildInputs = [ cmake curl ];
27
28 buildInputs = [
29 curl openssl zlib
30 aws-c-common aws-c-event-stream aws-checksums
31 ] ++ lib.optionals (stdenv.isDarwin &&
32 ((builtins.elem "text-to-speech" apis) ||
33 (builtins.elem "*" apis)))
34 [ CoreAudio AudioToolbox ];
35
36 cmakeFlags = [
37 "-DBUILD_DEPS=OFF"
38 "-DCMAKE_SKIP_BUILD_RPATH=OFF"
39 ] ++ lib.optional (!customMemoryManagement) "-DCUSTOM_MEMORY_MANAGEMENT=0"
40 ++ lib.optional (stdenv.buildPlatform != stdenv.hostPlatform) "-DENABLE_TESTING=OFF"
41 ++ lib.optional (apis != ["*"])
42 "-DBUILD_ONLY=${lib.concatStringsSep ";" apis}";
43
44 preConfigure =
45 ''
46 rm aws-cpp-sdk-core-tests/aws/auth/AWSCredentialsProviderTest.cpp
47 '';
48
49 __darwinAllowLocalNetworking = true;
50
51 meta = with lib; {
52 description = "A C++ interface for Amazon Web Services";
53 homepage = https://github.com/awslabs/aws-sdk-cpp;
54 license = licenses.asl20;
55 platforms = platforms.unix;
56 maintainers = with maintainers; [ eelco orivej ];
57 };
58}