2021-05-28 09:39:13 +00:00
|
|
|
{ stdenv
|
2022-12-17 10:02:37 +00:00
|
|
|
, fetchpatch
|
2021-05-28 09:39:13 +00:00
|
|
|
, fetchFromGitLab
|
|
|
|
, cmake
|
|
|
|
, ninja
|
|
|
|
, pkg-config
|
|
|
|
, boost
|
|
|
|
, glib
|
|
|
|
, gsl
|
|
|
|
, cairo
|
|
|
|
, double-conversion
|
|
|
|
, gtest
|
|
|
|
, lib
|
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "lib2geom";
|
2023-11-16 04:20:00 +00:00
|
|
|
version = "1.3";
|
2021-05-28 09:39:13 +00:00
|
|
|
|
|
|
|
outputs = [ "out" "dev" ];
|
|
|
|
|
|
|
|
src = fetchFromGitLab {
|
|
|
|
owner = "inkscape";
|
|
|
|
repo = "lib2geom";
|
|
|
|
rev = "refs/tags/${version}";
|
2023-11-16 04:20:00 +00:00
|
|
|
hash = "sha256-llUpW8VRBD8RKaGfyedzsMbLRb8DIo0ePt6m2T2w7Po=";
|
2021-05-28 09:39:13 +00:00
|
|
|
};
|
|
|
|
|
2022-12-17 10:02:37 +00:00
|
|
|
patches = [
|
2023-11-16 04:20:00 +00:00
|
|
|
# Fix compilation with Clang.
|
|
|
|
# https://gitlab.com/inkscape/lib2geom/-/merge_requests/102
|
2022-12-17 10:02:37 +00:00
|
|
|
(fetchpatch {
|
2023-11-16 04:20:00 +00:00
|
|
|
url = "https://gitlab.com/inkscape/lib2geom/-/commit/a5b5ac7d992023f8a80535ede60421e73ecd8e20.patch";
|
|
|
|
hash = "sha256-WJYkk3WRYVyPSvyTbKDUrYvUwFgKA9mmTiEWtYQqM4Q=";
|
|
|
|
})
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://gitlab.com/inkscape/lib2geom/-/commit/23d9393af4bee17aeb66a3c13bdad5dbed982d08.patch";
|
|
|
|
hash = "sha256-LAaGMIXpDI/Wzv5E2LasW1Y2/G4ukhuEzDmFu3AzZOA=";
|
2022-12-17 10:02:37 +00:00
|
|
|
})
|
2024-01-02 11:29:13 +00:00
|
|
|
|
|
|
|
# Fix ellipses rendering near page corners.
|
|
|
|
# https://gitlab.com/inkscape/lib2geom/-/issues/66
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://gitlab.com/inkscape/lib2geom/-/commit/039ce8d4af23a0a2a9d48eb970b321d9795dcc08.patch";
|
|
|
|
hash = "sha256-JfgGrqBcYSYKcdl4Bt7vGZ4aTBPSHM6JjZ95IlzxPwI=";
|
|
|
|
})
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://gitlab.com/inkscape/lib2geom/-/commit/cf523857e48c87f9f6a09217bdf935fff457823d.patch";
|
|
|
|
hash = "sha256-BRg8ANHMSgoi6vt9PNbhwG1fRkzEPXb4gPTPO3sY0XE=";
|
|
|
|
})
|
2022-12-17 10:02:37 +00:00
|
|
|
];
|
|
|
|
|
2021-05-28 09:39:13 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
|
|
|
ninja
|
|
|
|
pkg-config
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
boost
|
|
|
|
glib
|
|
|
|
gsl
|
|
|
|
cairo
|
|
|
|
double-conversion
|
|
|
|
];
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [
|
2021-05-28 09:39:13 +00:00
|
|
|
gtest
|
|
|
|
];
|
|
|
|
|
|
|
|
cmakeFlags = [
|
|
|
|
"-D2GEOM_BUILD_SHARED=ON"
|
|
|
|
];
|
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
# TODO: Update cmake hook to make it simpler to selectively disable cmake tests: #113829
|
|
|
|
checkPhase = let
|
|
|
|
disabledTests =
|
|
|
|
lib.optionals stdenv.isAarch64 [
|
|
|
|
# Broken on all platforms, test just accidentally passes on some.
|
|
|
|
# https://gitlab.com/inkscape/lib2geom/-/issues/63
|
|
|
|
"elliptical-arc-test"
|
2024-01-02 11:29:13 +00:00
|
|
|
]
|
|
|
|
++ lib.optionals stdenv.hostPlatform.isMusl [
|
|
|
|
# Fails due to rounding differences
|
|
|
|
# https://gitlab.com/inkscape/lib2geom/-/issues/70
|
|
|
|
"circle-test"
|
|
|
|
]
|
|
|
|
;
|
2023-11-16 04:20:00 +00:00
|
|
|
in ''
|
|
|
|
runHook preCheck
|
|
|
|
ctest --output-on-failure -E '^${lib.concatStringsSep "|" disabledTests}$'
|
|
|
|
runHook postCheck
|
|
|
|
'';
|
|
|
|
|
2021-05-28 09:39:13 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "Easy to use 2D geometry library in C++";
|
|
|
|
homepage = "https://gitlab.com/inkscape/lib2geom";
|
|
|
|
license = [ licenses.lgpl21Only licenses.mpl11 ];
|
|
|
|
maintainers = with maintainers; [ jtojnar ];
|
|
|
|
platforms = platforms.unix;
|
|
|
|
};
|
|
|
|
}
|