at 18.09-beta 70 lines 2.2 kB view raw
1{ lib, stdenv, fetchFromGitHub, cmake, curl, openssl, zlib 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, darwin 7}: 8 9let 10 loaderVar = 11 if stdenv.isLinux 12 then "LD_LIBRARY_PATH" 13 else if stdenv.isDarwin 14 then "DYLD_LIBRARY_PATH" 15 else throw "Unsupported system!"; 16in stdenv.mkDerivation rec { 17 name = "aws-sdk-cpp-${version}"; 18 version = "1.5.17"; 19 20 src = fetchFromGitHub { 21 owner = "awslabs"; 22 repo = "aws-sdk-cpp"; 23 rev = version; 24 sha256 = "0mmzf3js6090kk9vdwrmib5cjny43mqf044iynkhkglzvwhadc8z"; 25 }; 26 27 # FIXME: might be nice to put different APIs in different outputs 28 # (e.g. libaws-cpp-sdk-s3.so in output "s3"). 29 outputs = [ "out" "dev" ]; 30 separateDebugInfo = stdenv.isLinux; 31 32 nativeBuildInputs = [ cmake curl ]; 33 buildInputs = [ zlib curl openssl ] 34 ++ lib.optionals (stdenv.isDarwin && 35 ((builtins.elem "text-to-speech" apis) || 36 (builtins.elem "*" apis))) 37 (with darwin.apple_sdk.frameworks; [ CoreAudio AudioToolbox ]); 38 39 cmakeFlags = 40 lib.optional (!customMemoryManagement) "-DCUSTOM_MEMORY_MANAGEMENT=0" 41 ++ lib.optional (stdenv.buildPlatform != stdenv.hostPlatform) "-DENABLE_TESTING=OFF" 42 ++ lib.optional (apis != ["*"]) 43 "-DBUILD_ONLY=${lib.concatStringsSep ";" apis}"; 44 45 enableParallelBuilding = true; 46 47 # Behold the escaping nightmare below on loaderVar o.O 48 preBuild = 49 '' 50 # Ensure that the unit tests can find the *.so files. 51 for i in testing-resources aws-cpp-sdk-*; do 52 export ${loaderVar}=$(pwd)/$i:''${${loaderVar}} 53 done 54 ''; 55 56 preConfigure = 57 '' 58 rm aws-cpp-sdk-core-tests/aws/auth/AWSCredentialsProviderTest.cpp 59 ''; 60 61 NIX_CFLAGS_COMPILE = [ "-Wno-error=noexcept-type" ]; 62 63 meta = { 64 description = "A C++ interface for Amazon Web Services"; 65 homepage = https://github.com/awslabs/aws-sdk-cpp; 66 license = lib.licenses.asl20; 67 platforms = lib.platforms.linux ++ lib.platforms.darwin; 68 maintainers = [ lib.maintainers.eelco ]; 69 }; 70}