From 8e9a6862d73568a7de5c7a87b32bba22610fdf00 Mon Sep 17 00:00:00 2001 From: Nick Cao Date: Fri, 27 Sep 2024 22:29:26 -0400 Subject: [PATCH] protobuf_28: fix cross compilation by only building tests when necessary --- .../libraries/protobuf/generic.nix | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/pkgs/development/libraries/protobuf/generic.nix b/pkgs/development/libraries/protobuf/generic.nix index 4c03454c432c..459f54b2457a 100644 --- a/pkgs/development/libraries/protobuf/generic.nix +++ b/pkgs/development/libraries/protobuf/generic.nix @@ -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 = {