18 # default list of APIs: https://github.com/googleapis/google-cloud-cpp/blob/v1.32.1/CMakeLists.txt#L173
20 , staticOnly ? stdenv.hostPlatform.isStatic
23 # defined in cmake/GoogleapisConfig.cmake
24 googleapisRev = "6a474b31c53cc1797710206824a17b364a835d2d";
25 googleapis = fetchFromGitHub {
26 name = "googleapis-src";
30 hash = "sha256-t5oX6Gc1WSMSBDftXA9RZulckUenxOEHBYeq2qf8jnY=";
33 stdenv.mkDerivation rec {
34 pname = "google-cloud-cpp";
37 src = fetchFromGitHub {
39 repo = "google-cloud-cpp";
41 sha256 = "sha256-gCq8Uc+s/rnJWsGlI7f+tvAZHH8K69+H/leUOKE2GCY=";
46 src = ./hardcode-googleapis-path.patch;
55 ] ++ lib.optionals (!doInstallCheck) [
56 # enable these dependencies when doInstallCheck is false because we're
57 # unconditionally building tests and benchmarks
59 # when doInstallCheck is true, these deps are added to nativeInstallCheckInputs
67 (curl.override { inherit openssl; })
74 doInstallCheck = true;
78 # These paths are added to (DY)LD_LIBRARY_PATH because they contain
79 # testing-only shared libraries that do not need to be installed, but
80 # need to be loadable by the test executables.
82 # Setting (DY)LD_LIBRARY_PATH is only necessary when building shared libraries.
83 additionalLibraryPaths = [
84 "$PWD/google/cloud/bigtable"
85 "$PWD/google/cloud/bigtable/benchmarks"
86 "$PWD/google/cloud/pubsub"
87 "$PWD/google/cloud/spanner"
88 "$PWD/google/cloud/spanner/benchmarks"
89 "$PWD/google/cloud/storage"
90 "$PWD/google/cloud/storage/benchmarks"
91 "$PWD/google/cloud/testing_util"
93 ldLibraryPathName = "${lib.optionalString stdenv.hostPlatform.isDarwin "DY"}LD_LIBRARY_PATH";
95 lib.optionalString doInstallCheck (
96 lib.optionalString (!staticOnly) ''
97 export ${ldLibraryPathName}=${lib.concatStringsSep ":" additionalLibraryPaths}
101 installCheckPhase = let
102 disabledTests = lib.optionalString stdenv.hostPlatform.isDarwin ''
103 common_internal_async_connection_ready_test
104 bigtable_async_read_stream_test
105 bigtable_metadata_update_policy_test
106 bigtable_bigtable_benchmark_test
107 bigtable_embedded_server_test
110 runHook preInstallCheck
112 # Disable any integration tests, which need to contact the internet.
114 --label-exclude integration-test \
115 --exclude-from-file <(echo '${disabledTests}')
117 runHook postInstallCheck
120 nativeInstallCheckInputs = lib.optionals doInstallCheck [
126 "-DBUILD_SHARED_LIBS:BOOL=${if staticOnly then "OFF" else "ON"}"
127 # unconditionally build tests to catch linker errors as early as possible
128 # this adds a good chunk of time to the build
129 "-DBUILD_TESTING:BOOL=ON"
130 "-DGOOGLE_CLOUD_CPP_ENABLE_EXAMPLES:BOOL=OFF"
131 ] ++ lib.optionals (apis != [ "*" ]) [
132 "-DGOOGLE_CLOUD_CPP_ENABLE=${lib.concatStringsSep ";" apis}"
133 ] ++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [
134 "-DGOOGLE_CLOUD_CPP_GRPC_PLUGIN_EXECUTABLE=${lib.getBin pkgsBuildHost.grpc}/bin/grpc_cpp_plugin"
137 requiredSystemFeatures = [ "big-parallel" ];
140 license = with licenses; [ asl20 ];
141 homepage = "https://github.com/googleapis/google-cloud-cpp";
142 description = "C++ Idiomatic Clients for Google Cloud Platform services";
143 platforms = lib.platforms.linux ++ lib.platforms.darwin;
144 maintainers = with maintainers; [ cpcloud ];