From 87251ce42c6e4bc7f09ad799c499f2ebf8daecd3 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Sat, 21 Dec 2024 18:15:39 +0100 Subject: [PATCH 1/4] lib2geom: Switch to finalAttrs --- pkgs/by-name/li/lib2geom/package.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/by-name/li/lib2geom/package.nix b/pkgs/by-name/li/lib2geom/package.nix index 8e86b6e87f2af..25275f7149588 100644 --- a/pkgs/by-name/li/lib2geom/package.nix +++ b/pkgs/by-name/li/lib2geom/package.nix @@ -13,7 +13,7 @@ lib, }: -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "lib2geom"; version = "1.4"; @@ -25,7 +25,7 @@ stdenv.mkDerivation rec { src = fetchFromGitLab { owner = "inkscape"; repo = "lib2geom"; - rev = "refs/tags/${version}"; + rev = "refs/tags/${finalAttrs.version}"; hash = "sha256-kbcnefzNhUj/ZKZaB9r19bpI68vxUKOLVAwUXSr/zz0="; }; @@ -92,4 +92,4 @@ stdenv.mkDerivation rec { maintainers = with maintainers; [ jtojnar ]; platforms = platforms.unix; }; -} +}) From 18a46ed9ec43b8ca10c86f43217218fc001d3b3a Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Sat, 21 Dec 2024 18:44:21 +0100 Subject: [PATCH 2/4] lib2geom: Explicitly disable `doCheck` when cross-compiling Avoid `doCheck = true` since `makeDerivation` will force-disable it when cross-compiling (d834ba6654fc5fa79c6cc8b0d5cdaa5d8f85fd0e) in a way that is not reflected in `finalAttrs`. --- pkgs/by-name/li/lib2geom/package.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/by-name/li/lib2geom/package.nix b/pkgs/by-name/li/lib2geom/package.nix index 25275f7149588..58d8863cb30b9 100644 --- a/pkgs/by-name/li/lib2geom/package.nix +++ b/pkgs/by-name/li/lib2geom/package.nix @@ -48,7 +48,7 @@ stdenv.mkDerivation (finalAttrs: { "-D2GEOM_BUILD_SHARED=ON" ]; - doCheck = true; + doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform; # TODO: Update cmake hook to make it simpler to selectively disable cmake tests: #113829 checkPhase = From bbbf7fb942b783a91a7efe62b4732dbb09a9773b Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Sat, 21 Dec 2024 17:56:49 +0100 Subject: [PATCH 3/4] lib2geom: Move gtest back to check inputs This reverts commit 1973e2a627a7614395a336f113cb2a23be7add44 and disables building tests instead. --- pkgs/by-name/li/lib2geom/package.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkgs/by-name/li/lib2geom/package.nix b/pkgs/by-name/li/lib2geom/package.nix index 58d8863cb30b9..9a6c86be98a91 100644 --- a/pkgs/by-name/li/lib2geom/package.nix +++ b/pkgs/by-name/li/lib2geom/package.nix @@ -41,11 +41,16 @@ stdenv.mkDerivation (finalAttrs: { gsl cairo double-conversion + ]; + + nativeCheckInputs = [ gtest ]; cmakeFlags = [ "-D2GEOM_BUILD_SHARED=ON" + # For cross compilation. + (lib.cmakeBool "2GEOM_TESTING" finalAttrs.doCheck) ]; doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform; From aeea7ebc571455f5e7f42a4b561c4670d8a1eb08 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Sat, 21 Dec 2024 18:13:21 +0100 Subject: [PATCH 4/4] lib2geom: Add passthru.tests Inkscape is the primary consumer. Also make sure the cross compilation works. --- pkgs/by-name/li/lib2geom/package.nix | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pkgs/by-name/li/lib2geom/package.nix b/pkgs/by-name/li/lib2geom/package.nix index 9a6c86be98a91..1077a133290c6 100644 --- a/pkgs/by-name/li/lib2geom/package.nix +++ b/pkgs/by-name/li/lib2geom/package.nix @@ -11,6 +11,8 @@ double-conversion, gtest, lib, + inkscape, + pkgsCross, }: stdenv.mkDerivation (finalAttrs: { @@ -87,6 +89,17 @@ stdenv.mkDerivation (finalAttrs: { runHook postCheck ''; + passthru = { + tests = + { + inherit inkscape; + } + # Make sure x86_64-linux -> aarch64-linux cross compilation works + // lib.optionalAttrs (stdenv.buildPlatform.system == "x86_64-linux") { + aarch64-cross = pkgsCross.aarch64-multiplatform.lib2geom; + }; + }; + meta = with lib; { description = "Easy to use 2D geometry library in C++"; homepage = "https://gitlab.com/inkscape/lib2geom";