libphonenumber: allow building without openjdk

This commit is contained in:
Weijia Wang
2025-08-14 14:31:07 +08:00
parent c40ccbcd46
commit 5956f328e2
+17 -7
View File
@@ -4,6 +4,7 @@
fetchFromGitHub,
buildPackages,
cmake,
enableTests ? true,
gtest,
jre,
pkg-config,
@@ -31,27 +32,36 @@ stdenv.mkDerivation (finalAttrs: {
nativeBuildInputs = [
cmake
pkg-config
]
++ lib.optionals enableTests [
gtest
jre
pkg-config
];
buildInputs = [
boost
icu
protobuf
]
++ lib.optionals enableTests [
boost
];
cmakeDir = "../cpp";
doCheck = true;
doCheck = enableTests;
checkTarget = "tests";
cmakeFlags = lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [
(lib.cmakeFeature "CMAKE_CROSSCOMPILING_EMULATOR" (stdenv.hostPlatform.emulator buildPackages))
(lib.cmakeFeature "PROTOC_BIN" (lib.getExe buildPackages.protobuf))
];
cmakeFlags =
lib.optionals (!enableTests) [
(lib.cmakeBool "REGENERATE_METADATA" false)
(lib.cmakeBool "USE_BOOST" false)
]
++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [
(lib.cmakeFeature "CMAKE_CROSSCOMPILING_EMULATOR" (stdenv.hostPlatform.emulator buildPackages))
(lib.cmakeFeature "PROTOC_BIN" (lib.getExe buildPackages.protobuf))
];
meta = with lib; {
changelog = "https://github.com/google/libphonenumber/blob/${finalAttrs.src.rev}/release_notes.txt";