protobuf*: only build tests when necessary (#344994)

That fixes cross compilation of protobuf_28.
This commit is contained in:
Vladimír Čunát
2024-09-28 09:02:00 +02:00
@@ -76,18 +76,20 @@ stdenv.mkDerivation (finalAttrs: {
] ++ lib.optionals enableShared [
"-Dprotobuf_BUILD_SHARED_LIBS=ON"
]
# Tests fail to build on 32-bit platforms; fixed in 22.x
# https://github.com/protocolbuffers/protobuf/issues/10418
++ lib.optionals (stdenv.hostPlatform.is32bit && lib.versionOlder version "22") [
++ lib.optionals (!finalAttrs.finalPackage.doCheck) [
"-Dprotobuf_BUILD_TESTS=OFF"
];
# FIXME: investigate. 24.x and 23.x have different errors.
# At least some of it is not reproduced on some other machine; example:
# https://hydra.nixos.org/build/235677717/nixlog/4/tail
# Also AnyTest.TestPackFromSerializationExceedsSizeLimit fails on 32-bit platforms
# https://github.com/protocolbuffers/protobuf/issues/8460
doCheck = !(stdenv.hostPlatform.isDarwin && lib.versionAtLeast version "23") && !stdenv.hostPlatform.is32bit;
doCheck =
# FIXME: investigate. 24.x and 23.x have different errors.
# At least some of it is not reproduced on some other machine; example:
# https://hydra.nixos.org/build/235677717/nixlog/4/tail
!(stdenv.hostPlatform.isDarwin && lib.versionAtLeast version "23")
# Tests fail to build on 32-bit platforms; fixed in 22.x
# https://github.com/protocolbuffers/protobuf/issues/10418
# Also AnyTest.TestPackFromSerializationExceedsSizeLimit fails on 32-bit platforms
# https://github.com/protocolbuffers/protobuf/issues/8460
&& !stdenv.hostPlatform.is32bit;
passthru = {
tests = {