1{ lib, stdenv, fetchFromGitHub, cmake, curl
2, # Allow building a limited set of APIs, e.g. ["s3" "ec2"].
3 apis ? ["*"]
4, # Whether to enable AWS' custom memory management.
5 customMemoryManagement ? true
6}:
7
8stdenv.mkDerivation rec {
9 name = "aws-sdk-cpp-${version}";
10 version = "0.9.6";
11
12 src = fetchFromGitHub {
13 owner = "awslabs";
14 repo = "aws-sdk-cpp";
15 rev = version;
16 sha256 = "022v7naa5vjvq3wfn4mcp99li61ffsk2fnc8qqi52cb1pyxz9sk1";
17 };
18
19 buildInputs = [ cmake curl ];
20
21 cmakeFlags =
22 lib.optional (!customMemoryManagement) "-DCUSTOM_MEMORY_MANAGEMENT=0"
23 ++ lib.optional (apis != ["*"])
24 "-DBUILD_ONLY=${lib.concatMapStringsSep ";" (api: "aws-cpp-sdk-" + api) apis}";
25
26 enableParallelBuilding = true;
27
28 preBuild =
29 ''
30 # Ensure that the unit tests can find the *.so files.
31 for i in testing-resources aws-cpp-sdk-*; do
32 export LD_LIBRARY_PATH=$(pwd)/$i:$LD_LIBRARY_PATH
33 done
34 '';
35
36 postInstall =
37 ''
38 # Move the .so files to a more reasonable location.
39 mv $out/lib/linux/*/Release/*.so $out/lib
40 rm -rf $out/lib/linux
41 '';
42
43 meta = {
44 description = "A C++ interface for Amazon Web Services";
45 homepage = https://github.com/awslabs/aws-sdk-cpp;
46 license = lib.licenses.asl20;
47 platforms = lib.platforms.linux;
48 maintainers = [ lib.maintainers.eelco ];
49 };
50}