summaryrefslogtreecommitdiff
path: root/gnu/packages
diff options
context:
space:
mode:
authorMaxim Cournoyer <maxim.cournoyer@gmail.com>2021-10-05 22:51:47 -0400
committerMaxim Cournoyer <maxim.cournoyer@gmail.com>2021-11-11 10:31:24 -0500
commit8ee17f03a553b5c3abe2a0b96d64638d7c95c264 (patch)
treead0631a59a254d6641009e36f41c41d4ceea161d /gnu/packages
parent55ad2f80f2a5628a7157012c510069c67539c534 (diff)
gnu: lib2geom: Update to 1.1.
* gnu/packages/graphics.scm (lib2geom): Update to 1.1. [source]: Remove patches, modules and snippet fields. [phases]: Remove trailing #t. * gnu/packages/patches/lib2geom-fix-tests.patch: Delete file. * gnu/local.mk (dist_patch_DATA): De-register it.
Diffstat (limited to 'gnu/packages')
-rw-r--r--gnu/packages/graphics.scm126
-rw-r--r--gnu/packages/patches/lib2geom-fix-tests.patch192
2 files changed, 55 insertions, 263 deletions
diff --git a/gnu/packages/graphics.scm b/gnu/packages/graphics.scm
index dbb489452e..4b4385d3ff 100644
--- a/gnu/packages/graphics.scm
+++ b/gnu/packages/graphics.scm
@@ -21,7 +21,7 @@
;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
;;; Copyright © 2020, 2021 Nicolas Goaziou <mail@nicolasgoaziou.fr>
;;; Copyright © 2020 Raghav Gururajan <raghavgururajan@disroot.org>
-;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;; Copyright © 2020, 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; Copyright © 2020 Gabriel Arazas <foo.dogsquared@gmail.com>
;;; Copyright © 2021 Antoine Côté <antoine.cote@posteo.net>
;;; Copyright © 2021 Andy Tai <atai@atai.org>
@@ -855,79 +855,63 @@ exception-handling library.")
(license license:bsd-3)))
(define-public lib2geom
- ;; Use the latest master commit, as the 1.0 release suffer build problems.
- (let ((revision "4")
- (commit "b29d60e49a58f4e8069544b44863b1a623e4ee59"))
- (package
- (name "lib2geom")
- (version (git-version "1.0" revision commit))
- (source (origin
- (method git-fetch)
- (uri (git-reference
- (url "https://gitlab.com/inkscape/lib2geom.git")
- (commit commit)))
- (file-name (git-file-name name version))
- (sha256
- (base32
- "0xd8f3cgfnipdav4w8j54r7hzy9f3m7xk42ppcfhdjz2hriggyk6"))
- (patches
- ;; Patch submitted to upstream (see:
- ;; https://gitlab.com/inkscape/lib2geom/-/merge_requests/32).
- (search-patches "lib2geom-fix-tests.patch"))
- (modules '((guix build utils)))
- (snippet
- '(begin
- ;; Fix py2geom module initialization (see:
- ;; https://gitlab.com/inkscape/lib2geom/merge_requests/18).
- (substitute* "src/py2geom/__init__.py"
- (("_py2geom") "py2geom._py2geom"))
- #t))))
- (build-system cmake-build-system)
- (arguments
- `(#:imported-modules ((guix build python-build-system)
- ,@%cmake-build-system-modules)
- #:configure-flags '("-D2GEOM_BUILD_SHARED=ON"
- "-D2GEOM_BOOST_PYTHON=ON"
- ;; Compiling the Cython bindings fail (see:
- ;; https://gitlab.com/inkscape/lib2geom/issues/21).
- "-D2GEOM_CYTHON_BINDINGS=OFF")
- #:phases
- (modify-phases %standard-phases
- (add-after 'unpack 'patch-python-lib-install-path
- (lambda* (#:key inputs outputs #:allow-other-keys)
- (let* ((python-version (@ (guix build python-build-system)
- python-version))
- (python-maj-min-version (python-version
- (assoc-ref inputs "python")))
- (site-package (string-append
- (assoc-ref outputs "out")
- "/lib/python" python-maj-min-version
- "/site-packages")))
- (substitute* '("src/cython/CMakeLists.txt"
- "src/py2geom/CMakeLists.txt")
- (("PYTHON_LIB_INSTALL \"[^\"]*\"")
- (format #f "PYTHON_LIB_INSTALL ~s" site-package))))
- #t)))))
- (native-inputs `(("python" ,python-wrapper)
- ("googletest" ,googletest)
- ("pkg-config" ,pkg-config)))
- (inputs `(("cairo" ,cairo)
- ("pycairo" ,python-pycairo)
- ("double-conversion" ,double-conversion)
- ("glib" ,glib)
- ("gsl" ,gsl)))
- (propagated-inputs
- `(("boost" ,boost))) ;referred to in 2geom/pathvector.h.
- (home-page "https://gitlab.com/inkscape/lib2geom/")
- (synopsis "C++ 2D graphics library")
- (description "2geom is a C++ library of mathematics for paths, curves,
+ (package
+ (name "lib2geom")
+ (version "1.1")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://gitlab.com/inkscape/lib2geom.git")
+ (commit version)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "03bx9k1m4bfhmx0ldsg0bks6i8h7fmvl5vbg6gmpq0bk0nkmpnmv"))))
+ (build-system cmake-build-system)
+ (arguments
+ `(#:imported-modules ((guix build python-build-system)
+ ,@%cmake-build-system-modules)
+ #:configure-flags '("-D2GEOM_BUILD_SHARED=ON"
+ "-D2GEOM_BOOST_PYTHON=ON"
+ ;; Compiling the Cython bindings fail (see:
+ ;; https://gitlab.com/inkscape/lib2geom/issues/21).
+ "-D2GEOM_CYTHON_BINDINGS=OFF")
+ #:phases
+ (modify-phases %standard-phases
+ (add-after 'unpack 'patch-python-lib-install-path
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (let* ((python-version (@ (guix build python-build-system)
+ python-version))
+ (python-maj-min-version (python-version
+ (assoc-ref inputs "python")))
+ (site-package (string-append
+ (assoc-ref outputs "out")
+ "/lib/python" python-maj-min-version
+ "/site-packages")))
+ (substitute* '("src/cython/CMakeLists.txt"
+ "src/py2geom/CMakeLists.txt")
+ (("PYTHON_LIB_INSTALL \"[^\"]*\"")
+ (format #f "PYTHON_LIB_INSTALL ~s" site-package)))))))))
+ (native-inputs `(("python" ,python-wrapper)
+ ("googletest" ,googletest)
+ ("pkg-config" ,pkg-config)))
+ (inputs `(("cairo" ,cairo)
+ ("pycairo" ,python-pycairo)
+ ("double-conversion" ,double-conversion)
+ ("glib" ,glib)
+ ("gsl" ,gsl)))
+ (propagated-inputs
+ `(("boost" ,boost))) ;referred to in 2geom/pathvector.h.
+ (home-page "https://gitlab.com/inkscape/lib2geom/")
+ (synopsis "C++ 2D graphics library")
+ (description "2geom is a C++ library of mathematics for paths, curves,
and other geometric calculations. Designed for vector graphics, it tackles
Bézier curves, conic sections, paths, intersections, transformations, and
basic geometries.")
- ;; Because the library is linked with the GNU Scientific Library
- ;; (GPLv3+), the combined work must be licensed as GPLv3+ (see:
- ;; https://gitlab.com/inkscape/inkscape/issues/784).
- (license license:gpl3+))))
+ ;; Because the library is linked with the GNU Scientific Library
+ ;; (GPLv3+), the combined work must be licensed as GPLv3+ (see:
+ ;; https://gitlab.com/inkscape/inkscape/issues/784).
+ (license license:gpl3+)))
(define-public pstoedit
(package
diff --git a/gnu/packages/patches/lib2geom-fix-tests.patch b/gnu/packages/patches/lib2geom-fix-tests.patch
deleted file mode 100644
index 47e8f6e2ec..0000000000
--- a/gnu/packages/patches/lib2geom-fix-tests.patch
+++ /dev/null
@@ -1,192 +0,0 @@
-From 3e858cc87f2f8b7dc514a8ad7709c1f47f1f4cde Mon Sep 17 00:00:00 2001
-From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
-Date: Wed, 17 Jun 2020 23:20:53 -0400
-Subject: [PATCH] tests: Fix tests on non-x86_64 platforms.
-
-On platform other than x86_64 such as aarch64-linux or i686-linux,
-some double comparisons would fail.
-
-See <http://issues.guix.gnu.org/41827>.
-
-* tests/bezier-test.cpp: (Casteljau): Replace EXPECT_EQ by
-EXPECT_near.
-(Subdivide): Replace EXPECT_EQ by EXPECT_DOUBLE_EQ.
-(Portion): Replace EXPECT_EQ by EXPECT_near.
-* tests/ellipse-test.cpp (BezierIntersection): Lower error tolerance
-from 6e-13 to 6e-12.
-(LineIntersection): Replace EXPECT_DOUBLE_EQ by EXPECT_NEAR.
-* tests/line-test.cpp (Reflection): Replace EXPECT_FLOAT_EQ BY
-EXPECT_near.
-(Coefficients): Skip test.
-* tests/parallelogram-test.cpp (area): Replace EXPECT_EQ by
-EXPECT_DOUBLE_EQ.
----
- tests/bezier-test.cpp | 31 +++++++++++++++++--------------
- tests/ellipse-test.cpp | 11 ++++++-----
- tests/line-test.cpp | 11 +++++++----
- tests/parallelogram-test.cpp | 8 ++++----
- 4 files changed, 34 insertions(+), 27 deletions(-)
-
-diff --git a/tests/bezier-test.cpp b/tests/bezier-test.cpp
-index 4054a654..46209f40 100644
---- a/tests/bezier-test.cpp
-+++ b/tests/bezier-test.cpp
-@@ -152,11 +152,13 @@ TEST_F(BezierTest, Casteljau) {
- EXPECT_vector_equal(right2, right);
-
- double vnone = casteljau_subdivision<double>(t, &wiggle[0], NULL, NULL, wiggle.order());
-- EXPECT_EQ(vnone, vok);
-+ EXPECT_near(vnone, vok, 1e-12);
- }
- }
-
- TEST_F(BezierTest, Portion) {
-+ constexpr Coord eps{1e-12};
-+
- for (unsigned i = 0; i < 10000; ++i) {
- double from = g_random_double_range(0, 1);
- double to = g_random_double_range(0, 1);
-@@ -165,8 +167,8 @@ TEST_F(BezierTest, Portion) {
- Bezier result = portion(input, from, to);
-
- // the endpoints must correspond exactly
-- EXPECT_EQ(result.at0(), input.valueAt(from));
-- EXPECT_EQ(result.at1(), input.valueAt(to));
-+ EXPECT_near(result.at0(), input.valueAt(from), eps);
-+ EXPECT_near(result.at1(), input.valueAt(to), eps);
- }
- }
- }
-@@ -181,16 +183,16 @@ TEST_F(BezierTest, Subdivide) {
-
- // the endpoints must correspond exactly
- // moreover, the subdivision point must be exactly equal to valueAt(t)
-- EXPECT_EQ(result.first.at0(), input.at0());
-- EXPECT_EQ(result.first.at1(), result.second.at0());
-- EXPECT_EQ(result.second.at0(), input.valueAt(t));
-- EXPECT_EQ(result.second.at1(), input.at1());
-+ EXPECT_DOUBLE_EQ(result.first.at0(), input.at0());
-+ EXPECT_DOUBLE_EQ(result.first.at1(), result.second.at0());
-+ EXPECT_DOUBLE_EQ(result.second.at0(), input.valueAt(t));
-+ EXPECT_DOUBLE_EQ(result.second.at1(), input.at1());
-
- // ditto for valueAt
-- EXPECT_EQ(result.first.valueAt(0), input.valueAt(0));
-- EXPECT_EQ(result.first.valueAt(1), result.second.valueAt(0));
-- EXPECT_EQ(result.second.valueAt(0), input.valueAt(t));
-- EXPECT_EQ(result.second.valueAt(1), input.valueAt(1));
-+ EXPECT_DOUBLE_EQ(result.first.valueAt(0), input.valueAt(0));
-+ EXPECT_DOUBLE_EQ(result.first.valueAt(1), result.second.valueAt(0));
-+ EXPECT_DOUBLE_EQ(result.second.valueAt(0), input.valueAt(t));
-+ EXPECT_DOUBLE_EQ(result.second.valueAt(1), input.valueAt(1));
-
- if (result.first.at1() != result.second.at0()) {
- errors.push_back(std::pair<Bezier,double>(input, t));
-@@ -271,9 +273,10 @@ TEST_F(BezierTest, Deflate) {
- EXPECT_FLOAT_EQ(0, b.at0());
- b = b.deflate();
- const double rootposition = (0.5-0.25) / (1-0.25);
-- EXPECT_FLOAT_EQ(0, b.valueAt(rootposition));
-+ constexpr Coord eps{1e-12};
-+ EXPECT_near(0.0, b.valueAt(rootposition), eps);
- b = b.subdivide(rootposition).second;
-- EXPECT_FLOAT_EQ(0, b.at0());
-+ EXPECT_near(0.0, b.at0(), eps);
- }
-
- TEST_F(BezierTest, Roots) {
-@@ -364,7 +367,7 @@ TEST_F(BezierTest, Operators) {
- for(int i = 0; i <= 16; i++) {
- double t = i/16.0;
- double b = B.valueAt(t);
-- EXPECT_FLOAT_EQ(b*b, product.valueAt(t));
-+ EXPECT_near(b*b, product.valueAt(t), 1e-12);
- }
- }
- }
-diff --git a/tests/ellipse-test.cpp b/tests/ellipse-test.cpp
-index 561c285a..8e4de12c 100644
---- a/tests/ellipse-test.cpp
-+++ b/tests/ellipse-test.cpp
-@@ -158,13 +158,14 @@ TEST(EllipseTest, LineIntersection) {
- std::vector<ShapeIntersection> xs = e.intersect(l);
-
- ASSERT_EQ(xs.size(), 2ul);
-- EXPECT_FLOAT_EQ(xs[0].point()[X], 0);
-- EXPECT_FLOAT_EQ(xs[0].point()[Y], -2);
-- EXPECT_FLOAT_EQ(xs[1].point()[X], 9./5);
-- EXPECT_FLOAT_EQ(xs[1].point()[Y], 8./5);
-
- // due to numeric imprecision when evaluating Ellipse,
- // the points may deviate by around 2e-16
-+ EXPECT_NEAR(xs[0].point()[X], 0, 1e-15);
-+ EXPECT_NEAR(xs[0].point()[Y], -2, 1e-15);
-+ EXPECT_NEAR(xs[1].point()[X], 9./5, 1e-15);
-+ EXPECT_NEAR(xs[1].point()[Y], 8./5, 1e-15);
-+
- EXPECT_intersections_valid(e, l, xs, 1e-15);
- }
-
-@@ -199,7 +200,7 @@ TEST(EllipseTest, BezierIntersection) {
- std::vector<ShapeIntersection> xs = e.intersect(b);
-
- EXPECT_EQ(xs.size(), 2ul);
-- EXPECT_intersections_valid(e, b, xs, 6e-13);
-+ EXPECT_intersections_valid(e, b, xs, 6e-12);
- }
-
- TEST(EllipseTest, Coefficients) {
-diff --git a/tests/line-test.cpp b/tests/line-test.cpp
-index 99546ddc..23991300 100644
---- a/tests/line-test.cpp
-+++ b/tests/line-test.cpp
-@@ -91,10 +91,12 @@ TEST(LineTest, Reflection) {
-
- Point testra = pa * reflecta;
- Point testrb = pb * reflectb;
-- EXPECT_FLOAT_EQ(testra[X], ra[X]);
-- EXPECT_FLOAT_EQ(testra[Y], ra[Y]);
-- EXPECT_FLOAT_EQ(testrb[X], rb[X]);
-- EXPECT_FLOAT_EQ(testrb[Y], rb[Y]);
-+
-+ constexpr Coord eps{1e-12};
-+ EXPECT_near(testra[X], ra[X], eps);
-+ EXPECT_near(testra[Y], ra[Y], eps);
-+ EXPECT_near(testrb[X], rb[X], eps);
-+ EXPECT_near(testrb[Y], rb[Y], eps);
- }
-
- TEST(LineTest, RotationToZero) {
-@@ -115,6 +117,7 @@ TEST(LineTest, RotationToZero) {
- }
-
- TEST(LineTest, Coefficients) {
-+ GTEST_SKIP() << "This test fails on i686-linux and aarch64-linux";
- std::vector<Line> lines;
- lines.push_back(Line(Point(1e9,1e9), Point(1,1)));
- //the case below will never work without normalizing the line
-diff --git a/tests/parallelogram-test.cpp b/tests/parallelogram-test.cpp
-index 8109eadd..70ccea13 100644
---- a/tests/parallelogram-test.cpp
-+++ b/tests/parallelogram-test.cpp
-@@ -106,13 +106,13 @@ TEST(ParallelogramTest, area)
- {
- Rect r(2, 4, 7, 8);
- Parallelogram p(r);
-- EXPECT_EQ(p.area(), r.area());
-+ EXPECT_DOUBLE_EQ(p.area(), r.area());
- p *= Rotate(M_PI / 4.0); // 45°
-- EXPECT_EQ(p.area(), r.area());
-+ EXPECT_DOUBLE_EQ(p.area(), r.area());
- p *= HShear(2);
-- EXPECT_EQ(p.area(), r.area());
-+ EXPECT_DOUBLE_EQ(p.area(), r.area());
- p *= Scale(2);
-- EXPECT_EQ(p.area(), r.area() * 4);
-+ EXPECT_DOUBLE_EQ(p.area(), r.area() * 4);
- }
-
- class ParallelogramTest
---
-2.27.0
-