From 27fe364091597b39bf23323d3bb077d6b9bf8da1 Mon Sep 17 00:00:00 2001 From: bakedsnake Date: Sat, 26 Sep 2026 17:27:13 +0200 Subject: [PATCH] media-gfx/slic3r: replace vendored code Uses the following system libraries: * dev-cpp/exprtk * dev-libs/expat * dev-libs/miniz * media-libs/admesh ::guru Replacing the vendored code in: * xs/src/exprtk * xs/src/expat * xs/src/miniz * xs/src/admesh Signed-off-by: bakedsnake --- media-gfx/slic3r/files/boost-header.patch | 42 ----- .../slic3r/files/boost-io-context-1.3.0.patch | 82 ++++++++++ .../slic3r/files/boost-io-context-9999.patch | 11 ++ .../slic3r/files/boost-placeholders.patch | 70 --------- .../files/build-with-system-libs-1.3.0.patch | 143 ++++++++++++++++++ .../files/build-with-system-libs-9999.patch | 132 ++++++++++++++++ .../slic3r/files/cmake-with-system-libs.patch | 42 +++++ .../files/libexpat-cve-2024-45492.patch | 25 --- ...1.3.0-r1.ebuild => slic3r-1.3.0-r2.ebuild} | 36 +++-- ...r-9999-r1.ebuild => slic3r-9999-r2.ebuild} | 31 +++- 10 files changed, 457 insertions(+), 157 deletions(-) delete mode 100644 media-gfx/slic3r/files/boost-header.patch delete mode 100644 media-gfx/slic3r/files/boost-placeholders.patch create mode 100644 media-gfx/slic3r/files/build-with-system-libs-1.3.0.patch create mode 100644 media-gfx/slic3r/files/build-with-system-libs-9999.patch create mode 100644 media-gfx/slic3r/files/cmake-with-system-libs.patch delete mode 100644 media-gfx/slic3r/files/libexpat-cve-2024-45492.patch rename media-gfx/slic3r/{slic3r-1.3.0-r1.ebuild => slic3r-1.3.0-r2.ebuild} (75%) rename media-gfx/slic3r/{slic3r-9999-r1.ebuild => slic3r-9999-r2.ebuild} (75%) diff --git a/media-gfx/slic3r/files/boost-header.patch b/media-gfx/slic3r/files/boost-header.patch deleted file mode 100644 index 85fee321e7..0000000000 --- a/media-gfx/slic3r/files/boost-header.patch +++ /dev/null @@ -1,42 +0,0 @@ -From ce966c2450183dfc1c6415161463ea8d59dcccd5 Mon Sep 17 00:00:00 2001 -From: zdroyer -Date: Fri, 12 Apr 2019 12:47:34 +0000 -Subject: [PATCH] Removed unused header wchich generated tons of warnings with - boost 1.69 ---- - ---- a/src/admesh/stl.h -+++ b/src/admesh/stl.h -@@ -26,7 +26,6 @@ - #include - #include - #include --#include - - #if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) - #include "windows.h" - -From a0f0616b43f50124164ed274c687cf98f532b3ce Mon Sep 17 00:00:00 2001 -From: Chow Loong Jin -Date: Tue, 6 Nov 2018 01:10:33 +0800 -Subject: [PATCH] Drop #error "admesh works correctly on little endian machines - only" - -admesh works fine on little-endian machines as of b9592961. It just doesn't -compile because of this pesky #error. ---- - ---- a/src/admesh/stl.h -+++ b/src/admesh/stl.h -@@ -28,10 +28,6 @@ - #include - #include - --#ifndef BOOST_LITTLE_ENDIAN --#error "admesh works correctly on little endian machines only!" --#endif -- - #if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) - #include "windows.h" - #define ADMESH_CHAR wchar_t - diff --git a/media-gfx/slic3r/files/boost-io-context-1.3.0.patch b/media-gfx/slic3r/files/boost-io-context-1.3.0.patch index 7f27aba377..12335d9458 100644 --- a/media-gfx/slic3r/files/boost-io-context-1.3.0.patch +++ b/media-gfx/slic3r/files/boost-io-context-1.3.0.patch @@ -81,3 +81,85 @@ Subject: [PATCH] add missing boost noncopyable #include namespace Slic3r { +From d5084db14e7b4e75bf588fe063a5b9941c1cac31 Mon Sep 17 00:00:00 2001 +From: Jonathan Wakely +Date: Wed, 3 Jun 2020 01:05:39 +0200 +Subject: [PATCH 01/15] Make boost::Placeholders::_1 visible + +Fixes https://github.com/slic3r/Slic3r/issues/4967 +--- + +--- a/src/libslic3r/GCodeTimeEstimator.cpp ++++ b/src/libslic3r/GCodeTimeEstimator.cpp +@@ -1,9 +1,12 @@ + #include "GCodeTimeEstimator.hpp" +-#include ++#include + #include + + namespace Slic3r { + ++using boost::placeholders::_1; ++using boost::placeholders::_2; ++ + void + GCodeTimeEstimator::parse(const std::string &gcode) + { + +--- a/src/libslic3r/SLAPrint.cpp ++++ b/src/libslic3r/SLAPrint.cpp +@@ -7,9 +7,12 @@ + #include + #include + #include ++#include + + namespace Slic3r { + ++using boost::placeholders::_1; ++ + void + SLAPrint::slice() + { +--- a/src/libslic3r/TriangleMesh.cpp ++++ b/src/libslic3r/TriangleMesh.cpp +@@ -15,6 +15,7 @@ + #include + #include + #include ++#include + + #ifdef SLIC3R_DEBUG + #include "SVG.hpp" +@@ -22,6 +23,8 @@ + + namespace Slic3r { + ++using boost::placeholders::_1; ++ + TriangleMesh::TriangleMesh() + : repaired(false) + { +--- a/src/libslic3r/PrintObject.cpp ++++ b/src/libslic3r/PrintObject.cpp +@@ -4,6 +4,9 @@ + #include "Geometry.hpp" + #include + #include ++#include ++ ++using boost::placeholders::_1; + + namespace Slic3r { + +--- a/Build.PL ++++ b/Build.PL +@@ -142,7 +142,7 @@ if (defined $ENV{BOOST_LIBRARYPATH}) { + } + # In order to generate the -l switches we need to know how Boost libraries are named + my $have_boost = 0; +-my @boost_libraries = qw(system thread filesystem); # we need these ++my @boost_libraries = qw(thread filesystem); # we need these + # check without explicit lib path (works on Linux) + if (! $mswin) { + $have_boost = 1 diff --git a/media-gfx/slic3r/files/boost-io-context-9999.patch b/media-gfx/slic3r/files/boost-io-context-9999.patch index fcf8f760f5..5d9f1e4395 100644 --- a/media-gfx/slic3r/files/boost-io-context-9999.patch +++ b/media-gfx/slic3r/files/boost-io-context-9999.patch @@ -68,3 +68,14 @@ able to build. ( latest commit ). boost::thread background_thread; boost::asio::streambuf read_buffer, write_buffer; +--- a/Build.PL ++++ b/Build.PL +@@ -152,7 +152,7 @@ if (defined $ENV{BOOST_LIBRARYPATH}) { + # In order to generate the -l switches we need to know how Boost libraries are named + my $have_boost = 0; + my $have_boost_optional = 0; +-my @boost_libraries = qw(system thread filesystem); # we need these ++my @boost_libraries = qw(thread filesystem); # we need these + my @boost_optional_libraries = qw(nowide); # we need these, but if they aren't present we can deal + # check without explicit lib path (works on Linux) + if (! $mswin) { diff --git a/media-gfx/slic3r/files/boost-placeholders.patch b/media-gfx/slic3r/files/boost-placeholders.patch deleted file mode 100644 index 3ec2c8974f..0000000000 --- a/media-gfx/slic3r/files/boost-placeholders.patch +++ /dev/null @@ -1,70 +0,0 @@ -From d5084db14e7b4e75bf588fe063a5b9941c1cac31 Mon Sep 17 00:00:00 2001 -From: Jonathan Wakely -Date: Wed, 3 Jun 2020 01:05:39 +0200 -Subject: [PATCH 01/15] Make boost::Placeholders::_1 visible - -Fixes https://github.com/slic3r/Slic3r/issues/4967 ---- - ---- a/src/libslic3r/GCodeTimeEstimator.cpp -+++ b/src/libslic3r/GCodeTimeEstimator.cpp -@@ -1,9 +1,12 @@ - #include "GCodeTimeEstimator.hpp" --#include -+#include - #include - - namespace Slic3r { - -+using boost::placeholders::_1; -+using boost::placeholders::_2; -+ - void - GCodeTimeEstimator::parse(const std::string &gcode) - { - ---- a/src/libslic3r/SLAPrint.cpp -+++ b/src/libslic3r/SLAPrint.cpp -@@ -7,9 +7,12 @@ - #include - #include - #include -+#include - - namespace Slic3r { - -+using boost::placeholders::_1; -+ - void - SLAPrint::slice() - { ---- a/src/libslic3r/TriangleMesh.cpp -+++ b/src/libslic3r/TriangleMesh.cpp -@@ -15,6 +15,7 @@ - #include - #include - #include -+#include - - #ifdef SLIC3R_DEBUG - #include "SVG.hpp" -@@ -22,6 +23,8 @@ - - namespace Slic3r { - -+using boost::placeholders::_1; -+ - TriangleMesh::TriangleMesh() - : repaired(false) - { ---- a/src/libslic3r/PrintObject.cpp -+++ b/src/libslic3r/PrintObject.cpp -@@ -4,6 +4,9 @@ - #include "Geometry.hpp" - #include - #include -+#include -+ -+using boost::placeholders::_1; - - namespace Slic3r { diff --git a/media-gfx/slic3r/files/build-with-system-libs-1.3.0.patch b/media-gfx/slic3r/files/build-with-system-libs-1.3.0.patch new file mode 100644 index 0000000000..0cfea835ad --- /dev/null +++ b/media-gfx/slic3r/files/build-with-system-libs-1.3.0.patch @@ -0,0 +1,143 @@ +From: bakedsnake +Date: Thu, 24 Sep 2026 23:59:22 +0200 +Subject: [PATCH] no strict ansi + +--- +--- a/Build.PL ++++ b/Build.PL +@@ -20,13 +20,14 @@ $ENV{LD_RUN_PATH} //= ""; + # NOGDI : prevents inclusion of wingdi.h which defines functions Polygon() and Polyline() in global namespace + # BOOST_ASIO_DISABLE_KQUEUE : prevents a Boost ASIO bug on OS X: https://svn.boost.org/trac/boost/ticket/5339 + my @cflags = qw(-D_GLIBCXX_USE_C99 -DHAS_BOOL -DNOGDI -DSLIC3RXS -DBOOST_ASIO_DISABLE_KQUEUE -Dexprtk_disable_rtl_io_file -Dexprtk_disable_return_statement -Dexprtk_disable_rtl_vecops -Dexprtk_disable_string_capabilities -Dexprtk_disable_enhanced_features); ++# std=c++11 Enforce usage of C++11 (required now). Minimum compiler supported: gcc 4.9, clang 3.3, MSVC 14.0 + if ($cpp_guess->is_gcc) { + # GCC is pedantic with c++11 std, so undefine strict ansi to get M_PI back +- push @cflags, qw(-U__STRICT_ANSI__); ++ push @cflags, qw(-std=gnu++11); ++} else { ++ push @cflags, qw(-std=c++11); + } + +-# std=c++11 Enforce usage of C++11 (required now). Minimum compiler supported: gcc 4.9, clang 3.3, MSVC 14.0 +-push @cflags, qw(-std=c++11); + + my @ldflags = (); + +From: bakedsnake +Date: Thu, 24 Sep 2026 11:13:59 +0200 +Subject: [PATCH] use system's libexpat instead of vendored expat code + +--- +--- a/Build.PL ++++ b/Build.PL +@@ -151,6 +151,15 @@ if (! $mswin) { + ); + } + ++if (! $mswin) { ++ push @LIBS, "-lm -ladmesh"; ++ ++ die <<'EOF' unless check_lib(lib => "expat"); ++Could not find expat. Plase install. ++EOF ++ push @LIBS, "-lexpat"; ++} ++ + if (!$ENV{SLIC3R_STATIC} && $have_boost) { + # The boost library was detected by check_lib on Linux. + push @LIBS, map "-lboost_${_}", @boost_libraries; +--- a/MANIFEST ++++ b/MANIFEST +#@@ -2,13 +2,6 @@ Build.PL +# lib/Slic3r/XS.pm +# libslic3r.doxygen +# MANIFEST This list of files +#-src/admesh/connect.c +#-src/admesh/normals.c +#-src/admesh/shared.c +#-src/admesh/stl.h +#-src/admesh/stl_io.c +#-src/admesh/stlinit.c +#-src/admesh/util.c +# src/boost/nowide/args.hpp +# src/boost/nowide/cenv.hpp +# src/boost/nowide/config.hpp +@@ -26,26 +19,6 @@ src/boost/nowide/utf8_codecvt.hpp + src/boost/nowide/windows.hpp + src/clipper.cpp + src/clipper.hpp +-src/expat/ascii.h +-src/expat/asciitab.h +-src/expat/COPYING +-src/expat/expat.h +-src/expat/expat_config.h +-src/expat/expat_external.h +-src/expat/iasciitab.h +-src/expat/internal.h +-src/expat/latin1tab.h +-src/expat/nametab.h +-src/expat/README +-src/expat/utf8tab.h +-src/expat/xmlparse.c +-src/expat/xmlrole.c +-src/expat/xmlrole.h +-src/expat/xmltok.c +-src/expat/xmltok.h +-src/expat/xmltok_impl.h +-src/expat/xmltok_impl.inc +-src/expat/xmltok_ns.inc + src/libslic3r/BoundingBox.cpp + src/libslic3r/BoundingBox.hpp + src/libslic3r/BridgeDetector.cpp +@@ -146,7 +119,6 @@ src/libslic3r/TriangleMesh.hpp + src/libslic3r/utils.cpp + src/libslic3r/Zip/ZipArchive.cpp + src/libslic3r/Zip/ZipArchive.hpp +-src/miniz/miniz.h + src/perlglue.cpp + src/poly2tri/common/shapes.cc + src/poly2tri/common/shapes.h +--- a/src/libslic3r/SlicingAdaptive.hpp ++++ b/src/libslic3r/SlicingAdaptive.hpp +@@ -1,7 +1,7 @@ + #ifndef slic3r_SlicingAdaptive_hpp_ + #define slic3r_SlicingAdaptive_hpp_ + +-#include "admesh/stl.h" ++#include + + namespace Slic3r + { +--- a/src/libslic3r/IO/AMF.cpp ++++ b/src/libslic3r/IO/AMF.cpp +@@ -9,7 +9,7 @@ + #include + #include + #include +-#include ++#include + + namespace Slic3r { namespace IO { + +--- a/src/libslic3r/IO/TMF.hpp ++++ b/src/libslic3r/IO/TMF.hpp +@@ -14,7 +14,7 @@ + #include + #include + #include +-#include ++#include + + #define PI 3.141592653589793238 + +--- a/src/libslic3r/ConditionalGCode.cpp ++++ b/src/libslic3r/ConditionalGCode.cpp +@@ -1,7 +1,7 @@ + #include + + #include +-#include ++#include + #include "ConditionalGCode.hpp" + namespace Slic3r { + diff --git a/media-gfx/slic3r/files/build-with-system-libs-9999.patch b/media-gfx/slic3r/files/build-with-system-libs-9999.patch new file mode 100644 index 0000000000..234821b43b --- /dev/null +++ b/media-gfx/slic3r/files/build-with-system-libs-9999.patch @@ -0,0 +1,132 @@ +From: bakedsnake +Date: Thu, 24 Sep 2026 20:40:55 +0200 +Subject: [PATCH] Use system libs instead of vendored code + +* admesh +* expat +* exprtk +* miniz +--- +--- a/Build.PL ++++ b/Build.PL +@@ -166,6 +166,23 @@ if (! $mswin) { + ); + } + ++if (! $mswin) { ++# die <<'EOF' unless check_lib(lib => "admesh"); ++#Could not find admesh. Plase install. ++#EOF ++ push @LIBS, "-lm -ladmesh"; ++ ++ die <<'EOF' unless check_lib(lib => "expat"); ++Could not find expat. Plase install. ++EOF ++ push @LIBS, "-lexpat"; ++ ++ die <<'EOF' unless check_lib(lib => "miniz"); ++Could not find libexpat. Plase install. ++EOF ++ push @LIBS, "-lminiz"; ++} ++ + if (!$ENV{SLIC3R_STATIC} && $have_boost) { + # The boost library was detected by check_lib on Linux. + push @LIBS, map "-lboost_${_}", @boost_libraries; +--- a/MANIFEST ++++ b/MANIFEST +@@ -2,14 +2,6 @@ Build.PL + lib/Slic3r/XS.pm + libslic3r.doxygen + MANIFEST This list of files +-src/admesh/connect.c +-src/admesh/normals.c +-src/admesh/portable_endian.h +-src/admesh/shared.c +-src/admesh/stl_io.c +-src/admesh/stl.h +-src/admesh/stlinit.c +-src/admesh/util.c + src/boost/nowide/args.hpp + src/boost/nowide/cenv.hpp + src/boost/nowide/config.hpp +@@ -31,27 +23,6 @@ src/BSpline/BSpline.h + src/BSpline/COPYRIGHT + src/clipper.cpp + src/clipper.hpp +-src/expat/ascii.h +-src/expat/asciitab.h +-src/expat/COPYING +-src/expat/expat_config.h +-src/expat/expat_external.h +-src/expat/expat.h +-src/expat/iasciitab.h +-src/expat/internal.h +-src/expat/latin1tab.h +-src/expat/nametab.h +-src/expat/README +-src/expat/utf8tab.h +-src/expat/xmlparse.c +-src/expat/xmlrole.c +-src/expat/xmlrole.h +-src/expat/xmltok_impl.h +-src/expat/xmltok_impl.inc +-src/expat/xmltok_ns.inc +-src/expat/xmltok.c +-src/expat/xmltok.h +-src/exprtk/exprtk.hpp + src/libslic3r/BoundingBox.cpp + src/libslic3r/BoundingBox.hpp + src/libslic3r/BridgeDetector.cpp +@@ -167,7 +138,6 @@ src/libslic3r/TriangleMesh.cpp + src/libslic3r/TriangleMesh.hpp + src/libslic3r/utils.cpp + src/libslic3r/utils.hpp +-src/miniz/miniz.h + src/perlglue.cpp + src/poly2tri/common/shapes.cc + src/poly2tri/common/shapes.h +--- a/src/libslic3r/SlicingAdaptive.hpp ++++ b/src/libslic3r/SlicingAdaptive.hpp +@@ -1,7 +1,7 @@ + #ifndef slic3r_SlicingAdaptive_hpp_ + #define slic3r_SlicingAdaptive_hpp_ + +-#include "admesh/stl.h" ++#include + + namespace Slic3r + { +--- a/src/libslic3r/IO/AMF.cpp ++++ b/src/libslic3r/IO/AMF.cpp +@@ -9,7 +9,7 @@ + #include + #include + #include +-#include ++#include + #include + #include "../Exception.hpp" + #include "miniz_extension.hpp" +--- a/src/libslic3r/IO/TMF.hpp ++++ b/src/libslic3r/IO/TMF.hpp +@@ -14,7 +14,7 @@ + #include + #include + #include +-#include ++#include + + #define PI 3.141592653589793238 + +--- a/src/libslic3r/ConditionalGCode.cpp ++++ b/src/libslic3r/ConditionalGCode.cpp +@@ -1,7 +1,7 @@ + #include + + #include +-#include ++#include + #include "ConditionalGCode.hpp" + namespace Slic3r { + diff --git a/media-gfx/slic3r/files/cmake-with-system-libs.patch b/media-gfx/slic3r/files/cmake-with-system-libs.patch new file mode 100644 index 0000000000..ea690875e5 --- /dev/null +++ b/media-gfx/slic3r/files/cmake-with-system-libs.patch @@ -0,0 +1,42 @@ +From: bakedsnake +Date: Thu, 24 Sep 2026 13:49:56 +0200 +Subject: [PATCH] Use system's libexpat instead of vendored code + +--- +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -32,7 +32,6 @@ include_directories(${LIBDIR}/Slic3r/GUI/) + include_directories(${CMAKE_CURRENT_SOURCE_DIR}/standalone/) + include_directories(${LIBDIR}/admesh/) + include_directories(${LIBDIR}/BSpline/) +-include_directories(${LIBDIR}/expat/) + include_directories(${LIBDIR}/poly2tri/) + include_directories(${LIBDIR}/poly2tri/sweep) + include_directories(${LIBDIR}/poly2tri/common) +@@ -107,11 +106,6 @@ add_library(admesh STATIC + set_property(TARGET admesh PROPERTY C_STANDARD 99) + + add_library(clipper STATIC ${LIBDIR}/clipper.cpp) +-add_library(expat STATIC +- ${LIBDIR}/expat/xmlparse.c +- ${LIBDIR}/expat/xmlrole.c +- ${LIBDIR}/expat/xmltok.c +-) + add_library(polypartition STATIC ${LIBDIR}/polypartition.cpp) + add_library(poly2tri STATIC + ${LIBDIR}/poly2tri/common/shapes.cc +@@ -149,7 +143,7 @@ IF(CMAKE_HOST_UNIX) + #set(Boost_LIBRARIES bsystem bthread bfilesystem) + ENDIF(CMAKE_HOST_UNIX) + +-target_link_libraries (slic3r libslic3r admesh BSpline clipper expat polypartition poly2tri ${Boost_LIBRARIES}) ++target_link_libraries (slic3r libslic3r admesh BSpline clipper polypartition poly2tri ${Boost_LIBRARIES}) + + IF(wxWidgets_FOUND) + MESSAGE("wx found!") +@@ -173,4 +167,4 @@ IF (WIN32) + target_link_libraries(extrude-tin boost-nowide) + ENDIF(WIN32) + +-target_link_libraries (extrude-tin libslic3r admesh BSpline clipper expat polypartition poly2tri ${Boost_LIBRARIES}) ++target_link_libraries (extrude-tin libslic3r admesh BSpline clipper polypartition poly2tri ${Boost_LIBRARIES}) diff --git a/media-gfx/slic3r/files/libexpat-cve-2024-45492.patch b/media-gfx/slic3r/files/libexpat-cve-2024-45492.patch deleted file mode 100644 index 6002ff0a37..0000000000 --- a/media-gfx/slic3r/files/libexpat-cve-2024-45492.patch +++ /dev/null @@ -1,25 +0,0 @@ -From d5d036e83c3893f38bf531f9340234a94bdd549d Mon Sep 17 00:00:00 2001 -From: KIMDONGYEON00 -Date: Tue, 15 Jul 2025 01:48:01 +0900 -Subject: [PATCH] CVE-2024-45492 - ---- - ---- a/src/expat/xmlparse.c -+++ b/src/expat/xmlparse.c -@@ -6333,6 +6333,15 @@ nextScaffoldPart(XML_Parser parser) - int next; - - if (!dtd->scaffIndex) { -+ /* Detect and prevent integer overflow. -+ * The preprocessor guard addresses the "always false" warning -+ * from -Wtype-limits on platforms where -+ * sizeof(unsigned int) < sizeof(size_t), e.g. on x86_64. */ -+#if UINT_MAX >= SIZE_MAX -+ if (parser->m_groupSize > ((size_t)(-1) / sizeof(int))) { -+ return -1; -+ } -+#endif - dtd->scaffIndex = (int *)MALLOC(groupSize * sizeof(int)); - if (!dtd->scaffIndex) - return -1; diff --git a/media-gfx/slic3r/slic3r-1.3.0-r1.ebuild b/media-gfx/slic3r/slic3r-1.3.0-r2.ebuild similarity index 75% rename from media-gfx/slic3r/slic3r-1.3.0-r1.ebuild rename to media-gfx/slic3r/slic3r-1.3.0-r2.ebuild index 062b2f8709..c1ad3535e8 100644 --- a/media-gfx/slic3r/slic3r-1.3.0-r1.ebuild +++ b/media-gfx/slic3r/slic3r-1.3.0-r2.ebuild @@ -19,7 +19,7 @@ fi LICENSE="AGPL-3" SLOT="0" -IUSE="gui xs test" +IUSE="+gui xs test" RESTRICT="!test? ( test )" @@ -36,11 +36,15 @@ BDEPEND=" RDEPEND=" dev-cpp/tbb + dev-cpp/exprtk dev-lang/perl:= dev-libs/boost:= + dev-libs/expat + dev-libs/miniz dev-perl/Encode-Locale[${PERL_USEDEP}] dev-perl/Moo[${PERL_USEDEP}] gui-libs/gtk + media-libs/admesh media-libs/freeglut net-misc/curl[openssl] virtual/perl-Encode @@ -73,24 +77,30 @@ RDEPEND=" DEPEND="${RDEPEND}" PATCHES=( - "${FILESDIR}/admesh-vulnerability.patch" - "${FILESDIR}/boost-header.patch" "${FILESDIR}/boost-io-context-${PV}.patch" - "${FILESDIR}/boost-placeholders.patch" - "${FILESDIR}/libexpat-cve-2024-45492.patch" + "${FILESDIR}/build-with-system-libs-${PV}.patch" ) src_prepare() { default - # boost_system is now part of boost_thread - # since Boost 1.69 - sed -i 's/my @boost_libraries = qw(system thread filesystem);/my @boost_libraries = qw(thread filesystem);/' \ - Build.PL || die "Failed to remove `boost_system`" + local vendored=( admesh expat exprtk ) + for v in "${vendored[@]}"; do + rm -rf src/"${v}" || die "Failed to remove vendored ${v}." + done - # No strict ansi - # See: https://github.com/slic3r/Slic3r/pull/4974 - sed -i "s/push @cflags, qw(-std=c++11);/push @cflags, qw(-std=gnu++11);/" \ - Build.PL || die "Failed to set gnu++11" + if [[ "${PV}" != *9999* ]]; then + cd .. || die + eapply "${FILESDIR}/cmake-with-system-libs.patch" + sed -i "/^src\/admesh/d" xs/MANIFEST || die + else + sed -i "/^set(EXPAT_INCLUDES$/,/^)$/c\find_package(expat REQUIRED)\n" \ + ../src/CMakeLists.txt || die + + rm -rf src/miniz || die "Failed to remove vendored miniz" + sed -i "s|\"miniz/miniz.h\"||" src/Zip/ZipArchive.hpp || die + sed -i "/^add_library(miniz STATIC$/,/^)$/c\find_package(miniz REQUIRED)\n" \ + ../src/CMakeLists.txt || die + fi } src_compile() { diff --git a/media-gfx/slic3r/slic3r-9999-r1.ebuild b/media-gfx/slic3r/slic3r-9999-r2.ebuild similarity index 75% rename from media-gfx/slic3r/slic3r-9999-r1.ebuild rename to media-gfx/slic3r/slic3r-9999-r2.ebuild index 258edfb18a..c1ad3535e8 100644 --- a/media-gfx/slic3r/slic3r-9999-r1.ebuild +++ b/media-gfx/slic3r/slic3r-9999-r2.ebuild @@ -19,7 +19,7 @@ fi LICENSE="AGPL-3" SLOT="0" -IUSE="gui xs test" +IUSE="+gui xs test" RESTRICT="!test? ( test )" @@ -36,11 +36,15 @@ BDEPEND=" RDEPEND=" dev-cpp/tbb + dev-cpp/exprtk dev-lang/perl:= dev-libs/boost:= + dev-libs/expat + dev-libs/miniz dev-perl/Encode-Locale[${PERL_USEDEP}] dev-perl/Moo[${PERL_USEDEP}] gui-libs/gtk + media-libs/admesh media-libs/freeglut net-misc/curl[openssl] virtual/perl-Encode @@ -73,17 +77,30 @@ RDEPEND=" DEPEND="${RDEPEND}" PATCHES=( - "${FILESDIR}/admesh-vulnerability.patch" "${FILESDIR}/boost-io-context-${PV}.patch" - "${FILESDIR}/libexpat-cve-2024-45492.patch" + "${FILESDIR}/build-with-system-libs-${PV}.patch" ) src_prepare() { default - # boost_system is now part of boost_thread - # since Boost 1.69 - sed -i 's/my @boost_libraries = qw(system thread filesystem);/my @boost_libraries = qw(thread filesystem);/' \ - Build.PL || die "Failed to remove `boost_system`" + local vendored=( admesh expat exprtk ) + for v in "${vendored[@]}"; do + rm -rf src/"${v}" || die "Failed to remove vendored ${v}." + done + + if [[ "${PV}" != *9999* ]]; then + cd .. || die + eapply "${FILESDIR}/cmake-with-system-libs.patch" + sed -i "/^src\/admesh/d" xs/MANIFEST || die + else + sed -i "/^set(EXPAT_INCLUDES$/,/^)$/c\find_package(expat REQUIRED)\n" \ + ../src/CMakeLists.txt || die + + rm -rf src/miniz || die "Failed to remove vendored miniz" + sed -i "s|\"miniz/miniz.h\"||" src/Zip/ZipArchive.hpp || die + sed -i "/^add_library(miniz STATIC$/,/^)$/c\find_package(miniz REQUIRED)\n" \ + ../src/CMakeLists.txt || die + fi } src_compile() {