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.10.6";
11
12 src = fetchFromGitHub {
13 owner = "awslabs";
14 repo = "aws-sdk-cpp";
15 rev = version;
16 sha256 = "1x3xam7vprlld6iqhqgdhgmqyclfy8dvzgy3375cijy9akhvv67i";
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 # curl upgrade to 7.50.0 (#17152) changes the libcurl headers slightly and
27 # therefore requires the followin flag until this package gets updated
28 NIX_CFLAGS_COMPILE = [ "-fpermissive" ];
29
30 enableParallelBuilding = true;
31
32 preBuild =
33 ''
34 # Ensure that the unit tests can find the *.so files.
35 for i in testing-resources aws-cpp-sdk-*; do
36 export LD_LIBRARY_PATH=$(pwd)/$i:$LD_LIBRARY_PATH
37 done
38 '';
39
40 postInstall =
41 ''
42 # Move the .so files to a more reasonable location.
43 mv $out/lib/linux/*/Release/*.so $out/lib
44 rm -rf $out/lib/linux
45 '';
46
47 meta = {
48 description = "A C++ interface for Amazon Web Services";
49 homepage = https://github.com/awslabs/aws-sdk-cpp;
50 license = lib.licenses.asl20;
51 platforms = lib.platforms.linux;
52 maintainers = [ lib.maintainers.eelco ];
53 };
54}