google-cloud-cpp: enable darwin, fix cross

This commit is contained in:
Tobias Mayer 2024-10-13 04:30:59 +02:00
parent ab670da1b6
commit 21d546b7f0
No known key found for this signature in database
GPG Key ID: F8657E90819A1298

View File

@ -14,6 +14,7 @@
, openssl
, pkg-config
, protobuf
, pkgsBuildHost
# default list of APIs: https://github.com/googleapis/google-cloud-cpp/blob/v1.32.1/CMakeLists.txt#L173
, apis ? [ "*" ]
, staticOnly ? stdenv.hostPlatform.isStatic
@ -97,14 +98,21 @@ stdenv.mkDerivation rec {
''
);
installCheckPhase = lib.optionalString doInstallCheck ''
installCheckPhase = let
disabledTests = lib.optionalString stdenv.hostPlatform.isDarwin ''
common_internal_async_connection_ready_test
bigtable_async_read_stream_test
bigtable_metadata_update_policy_test
bigtable_bigtable_benchmark_test
bigtable_embedded_server_test
'';
in ''
runHook preInstallCheck
# Disable any integration tests, which need to contact the internet.
# Also disable the `storage_benchmark_*` tests.
# With Protobuf < 23.x they require -DGOOGLE_CLOUD_CPP_ENABLE_CTYPE_WORKAROUND=ON.
# With Protobuf >= 23.x they require They require setting -DGOOGLE_CLOUD_CPP_ENABLE_CTYPE_WORKAROUND=OFF
ctest --label-exclude integration-test --exclude-regex storage_benchmarks_
ctest \
--label-exclude integration-test \
--exclude-from-file <(echo '${disabledTests}')
runHook postInstallCheck
'';
@ -122,6 +130,8 @@ stdenv.mkDerivation rec {
"-DGOOGLE_CLOUD_CPP_ENABLE_EXAMPLES:BOOL=OFF"
] ++ lib.optionals (apis != [ "*" ]) [
"-DGOOGLE_CLOUD_CPP_ENABLE=${lib.concatStringsSep ";" apis}"
] ++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [
"-DGOOGLE_CLOUD_CPP_GRPC_PLUGIN_EXECUTABLE=${lib.getBin pkgsBuildHost.grpc}/bin/grpc_cpp_plugin"
];
requiredSystemFeatures = [ "big-parallel" ];
@ -130,7 +140,7 @@ stdenv.mkDerivation rec {
license = with licenses; [ asl20 ];
homepage = "https://github.com/googleapis/google-cloud-cpp";
description = "C++ Idiomatic Clients for Google Cloud Platform services";
platforms = [ "x86_64-linux" "aarch64-linux" ];
platforms = lib.platforms.linux ++ lib.platforms.darwin;
maintainers = with maintainers; [ cpcloud ];
};
}