zipline: refactor environment variables (#377101)
[NixPkgs.git] / pkgs / by-name / li / lib2geom / package.nix
blobe40f82fdd73c4e5618aacbdc0d6b3dcad74bd6e8
2   stdenv,
3   fetchFromGitLab,
4   cmake,
5   ninja,
6   pkg-config,
7   boost,
8   glib,
9   gsl,
10   cairo,
11   double-conversion,
12   gtest,
13   lib,
14   inkscape,
15   pkgsCross,
18 stdenv.mkDerivation (finalAttrs: {
19   pname = "lib2geom";
20   version = "1.4";
22   outputs = [
23     "out"
24     "dev"
25   ];
27   src = fetchFromGitLab {
28     owner = "inkscape";
29     repo = "lib2geom";
30     rev = "refs/tags/${finalAttrs.version}";
31     hash = "sha256-kbcnefzNhUj/ZKZaB9r19bpI68vxUKOLVAwUXSr/zz0=";
32   };
34   nativeBuildInputs = [
35     cmake
36     ninja
37     pkg-config
38   ];
40   buildInputs = [
41     boost
42     glib
43     gsl
44     cairo
45     double-conversion
46   ];
48   nativeCheckInputs = [
49     gtest
50   ];
52   cmakeFlags = [
53     "-D2GEOM_BUILD_SHARED=ON"
54     # For cross compilation.
55     (lib.cmakeBool "2GEOM_TESTING" finalAttrs.doCheck)
56   ];
58   doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
60   # TODO: Update cmake hook to make it simpler to selectively disable cmake tests: #113829
61   checkPhase =
62     let
63       disabledTests =
64         lib.optionals stdenv.hostPlatform.isMusl [
65           # Fails due to rounding differences
66           # https://gitlab.com/inkscape/lib2geom/-/issues/70
67           "circle-test"
68         ]
69         ++ lib.optionals (stdenv.hostPlatform.system != "x86_64-linux") [
70           # Broken on all platforms, test just accidentally passes on some.
71           # https://gitlab.com/inkscape/lib2geom/-/issues/63
72           "elliptical-arc-test"
74           # https://gitlab.com/inkscape/lib2geom/-/issues/69
75           "polynomial-test"
77           # https://gitlab.com/inkscape/lib2geom/-/issues/75
78           "line-test"
80           # Failure observed on i686
81           "angle-test"
82           "self-intersections-test"
84           # Failure observed on aarch64-darwin
85           "bezier-test"
86           "ellipse-test"
87         ];
88     in
89     ''
90       runHook preCheck
91       ctest --output-on-failure -E '^${lib.concatStringsSep "|" disabledTests}$'
92       runHook postCheck
93     '';
95   passthru = {
96     tests =
97       {
98         inherit inkscape;
99       }
100       # Make sure x86_64-linux -> aarch64-linux cross compilation works
101       // lib.optionalAttrs (stdenv.buildPlatform.system == "x86_64-linux") {
102         aarch64-cross = pkgsCross.aarch64-multiplatform.lib2geom;
103       };
104   };
106   meta = with lib; {
107     description = "Easy to use 2D geometry library in C++";
108     homepage = "https://gitlab.com/inkscape/lib2geom";
109     license = [
110       licenses.lgpl21Only
111       licenses.mpl11
112     ];
113     maintainers = with maintainers; [ jtojnar ];
114     platforms = platforms.unix;
115   };