2021-03-09 03:18:52 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
2021-12-06 16:07:01 +00:00
|
|
|
, fetchFromGitHub
|
|
|
|
, c-ares
|
2021-03-09 03:18:52 +00:00
|
|
|
, cmake
|
2021-12-06 16:07:01 +00:00
|
|
|
, crc32c
|
|
|
|
, curl
|
|
|
|
, gbenchmark
|
|
|
|
, grpc
|
|
|
|
, gtest
|
|
|
|
, ninja
|
|
|
|
, nlohmann_json
|
2022-03-10 19:12:11 +00:00
|
|
|
, openssl
|
2021-03-09 03:18:52 +00:00
|
|
|
, pkg-config
|
|
|
|
, protobuf
|
2021-12-06 16:07:01 +00:00
|
|
|
# default list of APIs: https://github.com/googleapis/google-cloud-cpp/blob/v1.32.1/CMakeLists.txt#L173
|
|
|
|
, apis ? [ "*" ]
|
|
|
|
, staticOnly ? stdenv.hostPlatform.isStatic
|
2021-03-09 03:18:52 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
let
|
2023-08-22 20:05:09 +00:00
|
|
|
googleapisRev = "85f8c758016c279fb7fa8f0d51ddc7ccc0dd5e05";
|
2020-04-24 23:36:52 +00:00
|
|
|
googleapis = fetchFromGitHub {
|
2022-12-17 10:02:37 +00:00
|
|
|
name = "googleapis-src";
|
2020-04-24 23:36:52 +00:00
|
|
|
owner = "googleapis";
|
|
|
|
repo = "googleapis";
|
2021-12-06 16:07:01 +00:00
|
|
|
rev = googleapisRev;
|
2023-08-22 20:05:09 +00:00
|
|
|
hash = "sha256-4Qiz0pBgW3OZi+Z8Zq6k9E94+8q6/EFMwPh8eQxDjdI=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
2021-12-06 16:07:01 +00:00
|
|
|
excludedTests = builtins.fromTOML (builtins.readFile ./skipped_tests.toml);
|
|
|
|
in
|
|
|
|
stdenv.mkDerivation rec {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "google-cloud-cpp";
|
2023-08-22 20:05:09 +00:00
|
|
|
version = "2.14.0";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "googleapis";
|
|
|
|
repo = "google-cloud-cpp";
|
|
|
|
rev = "v${version}";
|
2023-08-22 20:05:09 +00:00
|
|
|
sha256 = "sha256-0SoOaAqvk8cVC5W3ejTfe4O/guhrro3uAzkeIpAkCpg=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace external/googleapis/CMakeLists.txt \
|
2022-12-17 10:02:37 +00:00
|
|
|
--replace "https://github.com/googleapis/googleapis/archive/\''${_GOOGLE_CLOUD_CPP_GOOGLEAPIS_COMMIT_SHA}.tar.gz" "file://${googleapis}"
|
|
|
|
sed -i '/https:\/\/storage.googleapis.com\/cloud-cpp-community-archive\/com_google_googleapis/d' external/googleapis/CMakeLists.txt
|
2021-12-06 16:07:01 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
|
|
|
ninja
|
|
|
|
pkg-config
|
|
|
|
] ++ lib.optionals (!doInstallCheck) [
|
2022-03-10 19:12:11 +00:00
|
|
|
# enable these dependencies when doInstallCheck is false because we're
|
2021-12-06 16:07:01 +00:00
|
|
|
# unconditionally building tests and benchmarks
|
|
|
|
#
|
2023-02-02 18:25:31 +00:00
|
|
|
# when doInstallCheck is true, these deps are added to nativeInstallCheckInputs
|
2021-12-06 16:07:01 +00:00
|
|
|
gbenchmark
|
|
|
|
gtest
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
buildInputs = [
|
|
|
|
c-ares
|
|
|
|
crc32c
|
2022-09-14 18:05:37 +00:00
|
|
|
(curl.override { inherit openssl; })
|
2021-12-06 16:07:01 +00:00
|
|
|
grpc
|
|
|
|
nlohmann_json
|
2022-03-10 19:12:11 +00:00
|
|
|
openssl
|
2021-12-06 16:07:01 +00:00
|
|
|
protobuf
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
# https://hydra.nixos.org/build/222679737/nixlog/3/tail
|
|
|
|
NIX_CFLAGS_COMPILE = if stdenv.isAarch64 then "-Wno-error=maybe-uninitialized" else null;
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
doInstallCheck = true;
|
|
|
|
|
|
|
|
preInstallCheck =
|
|
|
|
let
|
|
|
|
# These paths are added to (DY)LD_LIBRARY_PATH because they contain
|
|
|
|
# testing-only shared libraries that do not need to be installed, but
|
|
|
|
# need to be loadable by the test executables.
|
|
|
|
#
|
|
|
|
# Setting (DY)LD_LIBRARY_PATH is only necessary when building shared libraries.
|
|
|
|
additionalLibraryPaths = [
|
|
|
|
"$PWD/google/cloud/bigtable"
|
|
|
|
"$PWD/google/cloud/bigtable/benchmarks"
|
|
|
|
"$PWD/google/cloud/pubsub"
|
|
|
|
"$PWD/google/cloud/spanner"
|
|
|
|
"$PWD/google/cloud/spanner/benchmarks"
|
|
|
|
"$PWD/google/cloud/storage"
|
|
|
|
"$PWD/google/cloud/storage/benchmarks"
|
|
|
|
"$PWD/google/cloud/testing_util"
|
|
|
|
];
|
|
|
|
ldLibraryPathName = "${lib.optionalString stdenv.isDarwin "DY"}LD_LIBRARY_PATH";
|
|
|
|
in
|
|
|
|
lib.optionalString doInstallCheck (
|
|
|
|
lib.optionalString (!staticOnly) ''
|
|
|
|
export ${ldLibraryPathName}=${lib.concatStringsSep ":" additionalLibraryPaths}
|
|
|
|
'' + ''
|
|
|
|
export GTEST_FILTER="-${lib.concatStringsSep ":" excludedTests.cases}"
|
|
|
|
''
|
|
|
|
);
|
|
|
|
|
|
|
|
installCheckPhase = lib.optionalString doInstallCheck ''
|
|
|
|
runHook preInstallCheck
|
|
|
|
|
|
|
|
# disable tests that contact the internet
|
|
|
|
ctest --exclude-regex '^(${lib.concatStringsSep "|" excludedTests.whole})'
|
|
|
|
|
|
|
|
runHook postInstallCheck
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeInstallCheckInputs = lib.optionals doInstallCheck [
|
2021-12-06 16:07:01 +00:00
|
|
|
gbenchmark
|
|
|
|
gtest
|
|
|
|
];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
cmakeFlags = [
|
2021-12-06 16:07:01 +00:00
|
|
|
"-DBUILD_SHARED_LIBS:BOOL=${if staticOnly then "OFF" else "ON"}"
|
|
|
|
# unconditionally build tests to catch linker errors as early as possible
|
|
|
|
# this adds a good chunk of time to the build
|
|
|
|
"-DBUILD_TESTING:BOOL=ON"
|
|
|
|
"-DGOOGLE_CLOUD_CPP_ENABLE_EXAMPLES:BOOL=OFF"
|
|
|
|
] ++ lib.optionals (apis != [ "*" ]) [
|
|
|
|
"-DGOOGLE_CLOUD_CPP_ENABLE=${lib.concatStringsSep ";" apis}"
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
requiredSystemFeatures = [ "big-parallel" ];
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
license = with licenses; [ asl20 ];
|
|
|
|
homepage = "https://github.com/googleapis/google-cloud-cpp";
|
|
|
|
description = "C++ Idiomatic Clients for Google Cloud Platform services";
|
2023-07-15 17:15:38 +00:00
|
|
|
platforms = [ "x86_64-linux" "aarch64-linux" ];
|
2021-12-06 16:07:01 +00:00
|
|
|
maintainers = with maintainers; [ cpcloud ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|