From 6bec6c20b6b18dc173383a6828f1bb84314f986b Mon Sep 17 00:00:00 2001 From: Guillaume Le Vaillant Date: Thu, 22 Aug 2024 15:30:32 +0200 Subject: [PATCH] gnu: openscad: Fix build. Fixes . * gnu/packages/patches/openscad-fix-boost-join.patch: New file. * gnu/packages/patches/openscad-with-cgal-5.3.patch: New file. * gnu/packages/patches/openscad-with-cgal-5.4.patch: New file. * gnu/local.mk (dist_patch_DATA): Register new patches. * gnu/packages/engineering.scm (openscad)[source]: Use new patches. [inputs, native-inputs]: Remove labels. [arguments]: Disable a few more tests. Remove trailing booleans. Change-Id: I3ce103afd8669dd68c95352a87d76994a3f08504 --- gnu/local.mk | 3 + gnu/packages/engineering.scm | 76 +++++++++++-------- .../patches/openscad-fix-boost-join.patch | 62 +++++++++++++++ .../patches/openscad-with-cgal-5.3.patch | 47 ++++++++++++ .../patches/openscad-with-cgal-5.4.patch | 38 ++++++++++ 5 files changed, 194 insertions(+), 32 deletions(-) create mode 100644 gnu/packages/patches/openscad-fix-boost-join.patch create mode 100644 gnu/packages/patches/openscad-with-cgal-5.3.patch create mode 100644 gnu/packages/patches/openscad-with-cgal-5.4.patch diff --git a/gnu/local.mk b/gnu/local.mk index 16e1c003f1..ad5494fe95 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1815,6 +1815,9 @@ dist_patch_DATA = \ %D%/packages/patches/openssh-trust-guix-store-directory.patch \ %D%/packages/patches/openresolv-restartcmd-guix.patch \ %D%/packages/patches/openrgb-unbundle-hueplusplus.patch \ + %D%/packages/patches/openscad-fix-boost-join.patch \ + %D%/packages/patches/openscad-with-cgal-5.3.patch \ + %D%/packages/patches/openscad-with-cgal-5.4.patch \ %D%/packages/patches/opensles-add-license-file.patch \ %D%/packages/patches/openssl-1.1-c-rehash-in.patch \ %D%/packages/patches/openssl-3.0-c-rehash-in.patch \ diff --git a/gnu/packages/engineering.scm b/gnu/packages/engineering.scm index 8108b8f6d1..9f620dc004 100644 --- a/gnu/packages/engineering.scm +++ b/gnu/packages/engineering.scm @@ -2810,44 +2810,49 @@ (define-public openscad ".src.tar.gz")) (sha256 (base32 - "0n83szr88h8snccjrslr96mgw3f65x3sq726n6x5vxp5wybw4f6r")))) + "0n83szr88h8snccjrslr96mgw3f65x3sq726n6x5vxp5wybw4f6r")) + (patches + ;; Upstream patches to make version 2021.01 build with recent versions + ;; of boost and cgal. + (search-patches "openscad-with-cgal-5.3.patch" + "openscad-with-cgal-5.4.patch" + "openscad-fix-boost-join.patch")))) (build-system cmake-build-system) (inputs - `(("boost" ,boost) - ("cgal" ,cgal) - ("double-conversion" ,double-conversion) - ("eigen" ,eigen) - ("fontconfig" ,fontconfig) - ("glew" ,glew) - ("gmp" ,gmp) - ("harfbuzz" ,harfbuzz) - ("lib3mf" ,lib3mf) - ("libxml2" ,libxml2) - ("libzip" ,libzip) - ("mpfr" ,mpfr) - ("opencsg" ,opencsg) - ("qscintilla" ,qscintilla) - ("qtbase" ,qtbase-5) - ("qtmultimedia-5" ,qtmultimedia-5))) + (list boost + cgal + double-conversion + eigen + fontconfig + glew + gmp + harfbuzz + lib3mf + libxml2 + libzip + mpfr + opencsg + qscintilla + qtbase-5 + qtmultimedia-5)) (native-inputs - `(("bison" ,bison) - ("flex" ,flex) - ("gettext" ,gettext-minimal) - ("pkg-config" ,pkg-config) - ("which" ,which) - ;; the following are only needed for tests - ("imagemagick" ,imagemagick) - ("ps" ,procps) - ("python" ,python) - ("xvfb" ,xorg-server-for-tests))) + (list bison + flex + gettext-minimal + pkg-config + which + ;; the following are only needed for tests + imagemagick + procps + python + xorg-server-for-tests)) (arguments `(#:phases (modify-phases %standard-phases (replace 'configure (lambda* (#:key outputs #:allow-other-keys) (invoke "qmake" - (string-append "PREFIX=" (assoc-ref outputs "out"))) - #t)) + (string-append "PREFIX=" (assoc-ref outputs "out"))))) (replace 'check (lambda _ (with-directory-excursion "tests" @@ -2873,12 +2878,19 @@ (define-public openscad "cgalpngtest_nef3_broken" "opencsgtest_nef3_broken" "csgpngtest_nef3_broken" - "throwntogethertest_nef3_broken") + "throwntogethertest_nef3_broken" + + ;; FIXME: Tests probably broken by the patches allowing + ;; to build with recent cgal versions. + "cgalpngtest_polyhedron-nonplanar-tests" + "csgpngtest_polyhedron-nonplanar-tests" + "monotonepngtest_polyhedron-nonplanar-tests" + "cgalstlcgalpngtest_polyhedron-nonplanar-tests" + "cgalbinstlcgalpngtest_polyhedron-nonplanar-tests") "|"))) ;; strip python test files since lib dir ends up in out/share (for-each delete-file - (find-files "libraries/MCAD" ".*\\.py")) - #t))))) + (find-files "libraries/MCAD" ".*\\.py"))))))) (synopsis "Script-based 3D modeling application") (description "OpenSCAD is a 3D Computer-aided Design (CAD) application. Unlike an diff --git a/gnu/packages/patches/openscad-fix-boost-join.patch b/gnu/packages/patches/openscad-fix-boost-join.patch new file mode 100644 index 0000000000..1347c2746a --- /dev/null +++ b/gnu/packages/patches/openscad-fix-boost-join.patch @@ -0,0 +1,62 @@ +From 08bf69b4115c989fc5671254e0d05735d01bcca5 Mon Sep 17 00:00:00 2001 +From: Torsten Paul +Date: Wed, 2 Feb 2022 00:50:43 +0100 +Subject: [PATCH] Fix build issue with overloaded join(). + +--- + src/openscad.cc | 11 +++++------ + 1 file changed, 5 insertions(+), 6 deletions(-) + +diff --git a/src/openscad.cc b/src/openscad.cc +index a6f648d2a2..3c46cda2af 100644 +--- a/src/openscad.cc ++++ b/src/openscad.cc +@@ -65,7 +65,6 @@ + #include + #include + #include +-#include + #include + #include + #include +@@ -307,7 +306,7 @@ void set_render_color_scheme(const std::string color_scheme, const bool exit_if_ + } + + if (exit_if_not_found) { +- LOG(message_group::None,Location::NONE,"",(boost::join(ColorMap::inst()->colorSchemeNames(), "\n"))); ++ LOG(message_group::None,Location::NONE,"",(boost::algorithm::join(ColorMap::inst()->colorSchemeNames(), "\n"))); + + exit(1); + } else { +@@ -885,7 +884,7 @@ struct CommaSeparatedVector + }; + + template +-std::string join(const Seq &seq, const std::string &sep, const ToString &toString) ++std::string str_join(const Seq &seq, const std::string &sep, const ToString &toString) + { + return boost::algorithm::join(boost::adaptors::transform(seq, toString), sep); + } +@@ -947,7 +946,7 @@ int main(int argc, char **argv) + ("P,P", po::value(), "customizer parameter set") + #ifdef ENABLE_EXPERIMENTAL + ("enable", po::value>(), ("enable experimental features: " + +- join(boost::make_iterator_range(Feature::begin(), Feature::end()), " | ", ++ str_join(boost::make_iterator_range(Feature::begin(), Feature::end()), " | ", + [](const Feature *feature) { + return feature->get_name(); + }) + +@@ -964,11 +963,11 @@ int main(int argc, char **argv) + ("render", po::value()->implicit_value(""), "for full geometry evaluation when exporting png") + ("preview", po::value()->implicit_value(""), "[=throwntogether] -for ThrownTogether preview png") + ("animate", po::value(), "export N animated frames") +- ("view", po::value(), ("=view options: " + boost::join(viewOptions.names(), " | ")).c_str()) ++ ("view", po::value(), ("=view options: " + boost::algorithm::join(viewOptions.names(), " | ")).c_str()) + ("projection", po::value(), "=(o)rtho or (p)erspective when exporting png") + ("csglimit", po::value(), "=n -stop rendering at n CSG elements when exporting png") + ("colorscheme", po::value(), ("=colorscheme: " + +- join(ColorMap::inst()->colorSchemeNames(), " | ", ++ str_join(ColorMap::inst()->colorSchemeNames(), " | ", + [](const std::string& colorScheme) { + return (colorScheme == ColorMap::inst()->defaultColorSchemeName() ? "*" : "") + colorScheme; + }) + diff --git a/gnu/packages/patches/openscad-with-cgal-5.3.patch b/gnu/packages/patches/openscad-with-cgal-5.3.patch new file mode 100644 index 0000000000..dc3c1caa3b --- /dev/null +++ b/gnu/packages/patches/openscad-with-cgal-5.3.patch @@ -0,0 +1,47 @@ +From 9aa0d7e9f2914fe5f547bdde69202161d1c6064d Mon Sep 17 00:00:00 2001 +From: Jordan Brown +Date: Sun, 18 Jul 2021 21:01:46 -0700 +Subject: [PATCH] Fix build failure with "generic_print_polyhedron" on + CGAL-5.3. + +--- + src/cgalutils-polyhedron.cc | 13 ------------- + src/cgalutils.h | 1 - + 2 files changed, 14 deletions(-) + +diff --git a/src/cgalutils-polyhedron.cc b/src/cgalutils-polyhedron.cc +index 9f4f98f623..41cca4b3f2 100644 +--- a/src/cgalutils-polyhedron.cc ++++ b/src/cgalutils-polyhedron.cc +@@ -337,19 +337,6 @@ namespace CGALUtils { + } + }; + +- template +- std::string printPolyhedron(const Polyhedron &p) { +- std::ostringstream sstream; +- sstream.precision(20); +- +- Polyhedron_writer writer; +- generic_print_polyhedron(sstream, p, writer); +- +- return sstream.str(); +- } +- +- template std::string printPolyhedron(const CGAL_Polyhedron &p); +- + }; // namespace CGALUtils + + #endif /* ENABLE_CGAL */ +diff --git a/src/cgalutils.h b/src/cgalutils.h +index 21a01cdba6..c08a3aa7df 100644 +--- a/src/cgalutils.h ++++ b/src/cgalutils.h +@@ -45,7 +45,6 @@ namespace CGALUtils { + bool is_approximately_convex(const PolySet &ps); + Geometry const* applyMinkowski(const Geometry::Geometries &children); + +- template std::string printPolyhedron(const Polyhedron &p); + template bool createPolySetFromPolyhedron(const Polyhedron &p, PolySet &ps); + template bool createPolyhedronFromPolySet(const PolySet &ps, Polyhedron &p); + template diff --git a/gnu/packages/patches/openscad-with-cgal-5.4.patch b/gnu/packages/patches/openscad-with-cgal-5.4.patch new file mode 100644 index 0000000000..f1fedc2cd8 --- /dev/null +++ b/gnu/packages/patches/openscad-with-cgal-5.4.patch @@ -0,0 +1,38 @@ +From abfebc651343909b534ef337aacc7604c99cf0ea Mon Sep 17 00:00:00 2001 +From: Torsten Paul +Date: Wed, 2 Feb 2022 02:30:59 +0100 +Subject: [PATCH] CGAL build fix, v5.4 renames projection traits header files + and classes. + +--- + src/cgalutils-tess.cc | 9 +++++---- + 1 file changed, 5 insertions(+), 4 deletions(-) + +diff --git a/src/cgalutils-tess.cc b/src/cgalutils-tess.cc +index ec1cc1eeb3..37f8cf08b1 100644 +--- a/src/cgalutils-tess.cc ++++ b/src/cgalutils-tess.cc +@@ -6,10 +6,12 @@ + #pragma push_macro("NDEBUG") + #undef NDEBUG + #include +-#if CGAL_VERSION_NR >= CGAL_VERSION_NUMBER(4,11,0) +- #include ++#if CGAL_VERSION_NR < 1050401000 ++#include ++typedef CGAL::Triangulation_2_filtered_projection_traits_3 Projection; + #else +- #include ++#include ++typedef CGAL::Filtered_projection_traits_3 Projection; + #endif + #include + #pragma pop_macro("NDEBUG") +@@ -19,7 +21,6 @@ struct FaceInfo { + bool in_domain() { return nesting_level%2 == 1; } + }; + +-typedef CGAL::Triangulation_2_filtered_projection_traits_3 Projection; + typedef CGAL::Triangulation_face_base_with_info_2 Fbb; + typedef CGAL::Triangulation_data_structure_2< + CGAL::Triangulation_vertex_base_2,