Various updates and fixes

This commit is contained in:
Torsten Kurbad 2024-11-05 12:51:21 +01:00
parent 1b59ab7cfc
commit 430bf5360d
22 changed files with 1445 additions and 0 deletions

View File

@ -0,0 +1,5 @@
AUX inkscape-1.4-gcc15.patch 1088 BLAKE2B 56e9e4e14d87d20d7a03e388105ccdaa219fc26146c771c2c6942ca82abee54fb43d0807ce0ddf59cc77ec6e5184db5e628980209f5eda651ac6ee09af96f74e SHA512 b6f18c645c9946a7052c2d93df1475f1d9db626f200754b767f4372c17e056389c93fc129385d1c9ed3f0e329866696adfb8a61f6e4bc4058c23f20324287072
AUX inkscape-1.4-poppler-24.10-fix-backport.patch 19196 BLAKE2B 02f58958180e2362f1e11a1cbacd72611b37cdaa41abd922df6106ef5485f243ef105286a92727b5731a4d0f607846a3e0a48fa53e3b9542d3667f136fd07f9b SHA512 6283ccd63157bc8ccdcf6127afa72cb50a72a9f09ec2327a5f180f0eb2d212e5600ed0f3d31df845cf6d20c2fe84d01f1edb126f39456a27de36cca616495fb9
DIST inkscape-1.4.tar.xz 46321868 BLAKE2B 3f21402019995122f043f5ebd8f07e1c9548c507f27c494e4214e090c46acae016c21f950609c95cef2e1b0011693e6629326d733b257402391e2d919bcd0303 SHA512 3b81306b81416597073e7eda2a103112cee63493bcf96fa737bb1edfbd682ebb329e415bbbbfda877aef2a78dc376460040ebc5c0cc2c90c0fe60db5d7d12368
EBUILD inkscape-1.4.ebuild 5562 BLAKE2B 42c0b1b622d2ad1c2c25921693379c9863615c344e7f5d8ac49026dd030f606f6dff7bedeaa3774c0482cfa30a779b02e96b6d5ab6b1da1b588109f05c30f342 SHA512 921678f6be488dea5d2de172c505f5faf7600b76f35888c20b9dc386a1e0588acea6c8a431dfe28f8f26159f742d7a0776e722ba4e0b8f993b4fd13a7480fd7e
MISC metadata.xml 982 BLAKE2B f44f534865614c8dd7bf71e92ce69cff708fc08e3eb701765bf93144b433ec52df52a506b69cc98969909c695015881b60592cccdf27613c6fe82812fc50727b SHA512 2963a9b473f139d06cefd1c3231ef148045c005adb4688850522c183f39ba15a36331b7eae7752e9bf15a26e6370f2af14ec02e59735f1753246c45821c0cdbc

View File

@ -0,0 +1,21 @@
https://bugs.gentoo.org/941674
https://gitlab.com/inkscape/inkscape/-/commit/eb6dadcf1a5c660167ba43f3606c8e7cc6529787
From eb6dadcf1a5c660167ba43f3606c8e7cc6529787 Mon Sep 17 00:00:00 2001
From: Liam <byteslice@airmail.cc>
Date: Sat, 12 Oct 2024 05:22:29 -0400
Subject: [PATCH] gobjectptr: fix member name
--- a/src/util/gobjectptr.h
+++ b/src/util/gobjectptr.h
@@ -20,7 +20,7 @@ public:
GObjectPtr() = default;
explicit GObjectPtr(T *p, bool add_ref = false) : _p(p) { if (add_ref) _ref(); }
GObjectPtr(GObjectPtr const &other) : _p(other._p) { _ref(); }
- GObjectPtr &operator=(GObjectPtr const &other) { if (&other != this) { _unref(); _p = other.p; _ref(); } return *this; }
+ GObjectPtr &operator=(GObjectPtr const &other) { if (&other != this) { _unref(); _p = other._p; _ref(); } return *this; }
GObjectPtr(GObjectPtr &&other) noexcept : _p(other._p) { other._p = nullptr; }
GObjectPtr &operator=(GObjectPtr &&other) { if (&other != this) { _unref(); _p = other._p; other._p = nullptr; } return *this; }
~GObjectPtr() { _unref(); }
--
GitLab

View File

@ -0,0 +1,432 @@
https://bugs.gentoo.org/941933
From 22304ae8034d067670a9f95022083a75fac92b4c Mon Sep 17 00:00:00 2001
From: PBS <pbs3141@gmail.com>
Date: Tue, 22 Oct 2024 14:48:31 +0100
Subject: [PATCH] Future-proof against poppler 24.10 changes
---
.../internal/pdfinput/pdf-parser.cpp | 120 ++++++++----------
src/extension/internal/pdfinput/pdf-parser.h | 4 +-
.../pdfinput/poppler-transition-api.h | 6 +
3 files changed, 61 insertions(+), 69 deletions(-)
diff --git a/src/extension/internal/pdfinput/pdf-parser.cpp b/src/extension/internal/pdfinput/pdf-parser.cpp
index 97b2909218a..28000a87b0c 100644
--- a/src/extension/internal/pdfinput/pdf-parser.cpp
+++ b/src/extension/internal/pdfinput/pdf-parser.cpp
@@ -817,11 +817,11 @@ void PdfParser::opSetExtGState(Object args[], int /*numArgs*/)
_POPPLER_FREE(obj3);
if (_POPPLER_CALL_ARGS_DEREF(obj3, obj2.dictLookup, "G").isStream()) {
if (_POPPLER_CALL_ARGS_DEREF(obj4, obj3.streamGetDict()->lookup, "Group").isDict()) {
- GfxColorSpace *blendingColorSpace = nullptr;
+ std::unique_ptr<GfxColorSpace> blendingColorSpace;
GBool isolated = gFalse;
GBool knockout = gFalse;
if (!_POPPLER_CALL_ARGS_DEREF(obj5, obj4.dictLookup, "CS").isNull()) {
- blendingColorSpace = GfxColorSpace::parse(nullptr, &obj5, nullptr, state);
+ blendingColorSpace = std::unique_ptr<GfxColorSpace>(GfxColorSpace::parse(nullptr, &obj5, nullptr, state));
}
_POPPLER_FREE(obj5);
if (_POPPLER_CALL_ARGS_DEREF(obj5, obj4.dictLookup, "I").isBool()) {
@@ -842,7 +842,7 @@ void PdfParser::opSetExtGState(Object args[], int /*numArgs*/)
}
}
}
- doSoftMask(&obj3, alpha, blendingColorSpace, isolated, knockout, funcs[0], &backdropColor);
+ doSoftMask(&obj3, alpha, blendingColorSpace.get(), isolated, knockout, funcs[0], &backdropColor);
if (funcs[0]) {
delete funcs[0];
}
@@ -927,9 +927,6 @@ void PdfParser::doSoftMask(Object *str, GBool alpha,
alpha, transferFunc, backdropColor);
--formDepth;
- if (blendingColorSpace) {
- delete blendingColorSpace;
- }
_POPPLER_FREE(obj1);
}
@@ -946,42 +943,43 @@ void PdfParser::opSetRenderingIntent(Object /*args*/[], int /*numArgs*/)
*
* Maintains a cache for named color spaces to avoid expensive re-parsing.
*/
-GfxColorSpace *PdfParser::lookupColorSpaceCopy(Object &arg)
+std::unique_ptr<GfxColorSpace> PdfParser::lookupColorSpaceCopy(Object &arg)
{
assert(!arg.isNull());
- GfxColorSpace *colorSpace = nullptr;
if (char const *name = arg.isName() ? arg.getName() : nullptr) {
auto const cache_name = std::to_string(formDepth) + "-" + name;
- if ((colorSpace = colorSpacesCache[cache_name].get())) {
- return colorSpace->copy();
+ if (auto cached = colorSpacesCache[cache_name].get()) {
+ return std::unique_ptr<GfxColorSpace>(cached->copy());
}
- Object obj = res->lookupColorSpace(name);
- if (obj.isNull()) {
- colorSpace = GfxColorSpace::parse(res, &arg, nullptr, state);
+ std::unique_ptr<GfxColorSpace> colorSpace;
+ if (auto obj = res->lookupColorSpace(name); !obj.isNull()) {
+ colorSpace = std::unique_ptr<GfxColorSpace>(GfxColorSpace::parse(res, &obj, nullptr, state));
} else {
- colorSpace = GfxColorSpace::parse(res, &obj, nullptr, state);
+ colorSpace = std::unique_ptr<GfxColorSpace>(GfxColorSpace::parse(res, &arg, nullptr, state));
}
if (colorSpace && colorSpace->getMode() != csPattern) {
- colorSpacesCache[cache_name].reset(colorSpace->copy());
+ colorSpacesCache[cache_name] = std::unique_ptr<GfxColorSpace>(colorSpace->copy());
}
+
+ return colorSpace;
} else {
// We were passed in an object directly.
- colorSpace = GfxColorSpace::parse(res, &arg, nullptr, state);
+ return std::unique_ptr<GfxColorSpace>(GfxColorSpace::parse(res, &arg, nullptr, state));
}
- return colorSpace;
}
/**
* Look up pattern/gradients from the GfxResource dictionary
*/
-GfxPattern *PdfParser::lookupPattern(Object *obj, GfxState *state)
+std::unique_ptr<GfxPattern> PdfParser::lookupPattern(Object *obj, GfxState *state)
{
- if (!obj->isName())
- return nullptr;
- return res->lookupPattern(obj->getName(), nullptr, state);
+ if (!obj->isName()) {
+ return {};
+ }
+ return std::unique_ptr<GfxPattern>(res->lookupPattern(obj->getName(), nullptr, state));
}
// TODO not good that numArgs is ignored but args[] is used:
@@ -990,7 +988,7 @@ void PdfParser::opSetFillGray(Object args[], int /*numArgs*/)
GfxColor color;
builder->beforeStateChange(state);
state->setFillPattern(nullptr);
- state->setFillColorSpace(new GfxDeviceGrayColorSpace());
+ state->setFillColorSpace(_POPPLER_CONSUME_UNIQPTR_ARG(std::make_unique<GfxDeviceGrayColorSpace>()));
color.c[0] = dblToCol(args[0].getNum());
state->setFillColor(&color);
builder->updateStyle(state);
@@ -1002,7 +1000,7 @@ void PdfParser::opSetStrokeGray(Object args[], int /*numArgs*/)
GfxColor color;
builder->beforeStateChange(state);
state->setStrokePattern(nullptr);
- state->setStrokeColorSpace(new GfxDeviceGrayColorSpace());
+ state->setStrokeColorSpace(_POPPLER_CONSUME_UNIQPTR_ARG(std::make_unique<GfxDeviceGrayColorSpace>()));
color.c[0] = dblToCol(args[0].getNum());
state->setStrokeColor(&color);
builder->updateStyle(state);
@@ -1015,7 +1013,7 @@ void PdfParser::opSetFillCMYKColor(Object args[], int /*numArgs*/)
int i;
builder->beforeStateChange(state);
state->setFillPattern(nullptr);
- state->setFillColorSpace(new GfxDeviceCMYKColorSpace());
+ state->setFillColorSpace(_POPPLER_CONSUME_UNIQPTR_ARG(std::make_unique<GfxDeviceCMYKColorSpace>()));
for (i = 0; i < 4; ++i) {
color.c[i] = dblToCol(args[i].getNum());
}
@@ -1029,7 +1027,7 @@ void PdfParser::opSetStrokeCMYKColor(Object args[], int /*numArgs*/)
GfxColor color;
builder->beforeStateChange(state);
state->setStrokePattern(nullptr);
- state->setStrokeColorSpace(new GfxDeviceCMYKColorSpace());
+ state->setStrokeColorSpace(_POPPLER_CONSUME_UNIQPTR_ARG(std::make_unique<GfxDeviceCMYKColorSpace>()));
for (int i = 0; i < 4; ++i) {
color.c[i] = dblToCol(args[i].getNum());
}
@@ -1043,7 +1041,7 @@ void PdfParser::opSetFillRGBColor(Object args[], int /*numArgs*/)
GfxColor color;
builder->beforeStateChange(state);
state->setFillPattern(nullptr);
- state->setFillColorSpace(new GfxDeviceRGBColorSpace());
+ state->setFillColorSpace(_POPPLER_CONSUME_UNIQPTR_ARG(std::make_unique<GfxDeviceRGBColorSpace>()));
for (int i = 0; i < 3; ++i) {
color.c[i] = dblToCol(args[i].getNum());
}
@@ -1056,7 +1054,7 @@ void PdfParser::opSetStrokeRGBColor(Object args[], int /*numArgs*/) {
GfxColor color;
builder->beforeStateChange(state);
state->setStrokePattern(nullptr);
- state->setStrokeColorSpace(new GfxDeviceRGBColorSpace());
+ state->setStrokeColorSpace(_POPPLER_CONSUME_UNIQPTR_ARG(std::make_unique<GfxDeviceRGBColorSpace>()));
for (int i = 0; i < 3; ++i) {
color.c[i] = dblToCol(args[i].getNum());
}
@@ -1068,14 +1066,14 @@ void PdfParser::opSetStrokeRGBColor(Object args[], int /*numArgs*/) {
void PdfParser::opSetFillColorSpace(Object args[], int numArgs)
{
assert(numArgs >= 1);
- GfxColorSpace *colorSpace = lookupColorSpaceCopy(args[0]);
+ auto colorSpace = lookupColorSpaceCopy(args[0]);
builder->beforeStateChange(state);
state->setFillPattern(nullptr);
if (colorSpace) {
GfxColor color;
- state->setFillColorSpace(colorSpace);
colorSpace->getDefaultColor(&color);
+ state->setFillColorSpace(_POPPLER_CONSUME_UNIQPTR_ARG(colorSpace));
state->setFillColor(&color);
builder->updateStyle(state);
} else {
@@ -1089,14 +1087,14 @@ void PdfParser::opSetStrokeColorSpace(Object args[], int numArgs)
assert(numArgs >= 1);
builder->beforeStateChange(state);
- GfxColorSpace *colorSpace = lookupColorSpaceCopy(args[0]);
+ auto colorSpace = lookupColorSpaceCopy(args[0]);
state->setStrokePattern(nullptr);
if (colorSpace) {
GfxColor color;
- state->setStrokeColorSpace(colorSpace);
colorSpace->getDefaultColor(&color);
+ state->setStrokeColorSpace(_POPPLER_CONSUME_UNIQPTR_ARG(colorSpace));
state->setStrokeColor(&color);
builder->updateStyle(state);
} else {
@@ -1159,7 +1157,7 @@ void PdfParser::opSetFillColorN(Object args[], int numArgs) {
builder->updateStyle(state);
}
if (auto pattern = lookupPattern(&(args[numArgs - 1]), state)) {
- state->setFillPattern(pattern);
+ state->setFillPattern(_POPPLER_CONSUME_UNIQPTR_ARG(pattern));
builder->updateStyle(state);
}
@@ -1202,7 +1200,7 @@ void PdfParser::opSetStrokeColorN(Object args[], int numArgs) {
builder->updateStyle(state);
}
if (auto pattern = lookupPattern(&(args[numArgs - 1]), state)) {
- state->setStrokePattern(pattern);
+ state->setStrokePattern(_POPPLER_CONSUME_UNIQPTR_ARG(pattern));
builder->updateStyle(state);
}
@@ -1579,11 +1577,11 @@ void PdfParser::doShadingPatternFillFallback(GfxShadingPattern *sPat,
// TODO not good that numArgs is ignored but args[] is used:
void PdfParser::opShFill(Object args[], int /*numArgs*/)
{
- GfxShading *shading = nullptr;
GfxPath *savedPath = nullptr;
bool savedState = false;
- if (!(shading = res->lookupShading(args[0].getName(), nullptr, state))) {
+ auto shading = std::unique_ptr<GfxShading>(res->lookupShading(args[0].getName(), nullptr, state));
+ if (!shading) {
return;
}
@@ -1615,19 +1613,19 @@ void PdfParser::opShFill(Object args[], int /*numArgs*/)
// do shading type-specific operations
switch (shading->getType()) {
case 1: // Function-based shading
- doFunctionShFill(static_cast<GfxFunctionShading *>(shading));
+ doFunctionShFill(static_cast<GfxFunctionShading *>(shading.get()));
break;
case 2: // Axial shading
case 3: // Radial shading
- builder->addClippedFill(shading, stateToAffine(state));
+ builder->addClippedFill(shading.get(), stateToAffine(state));
break;
case 4: // Free-form Gouraud-shaded triangle mesh
case 5: // Lattice-form Gouraud-shaded triangle mesh
- doGouraudTriangleShFill(static_cast<GfxGouraudTriangleShading *>(shading));
+ doGouraudTriangleShFill(static_cast<GfxGouraudTriangleShading *>(shading.get()));
break;
case 6: // Coons patch mesh
case 7: // Tensor-product patch mesh
- doPatchMeshShFill(static_cast<GfxPatchMeshShading *>(shading));
+ doPatchMeshShFill(static_cast<GfxPatchMeshShading *>(shading.get()));
break;
}
@@ -1636,8 +1634,6 @@ void PdfParser::opShFill(Object args[], int /*numArgs*/)
restoreState();
state->setPath(savedPath);
}
-
- delete shading;
}
void PdfParser::doFunctionShFill(GfxFunctionShading *shading) {
@@ -2528,7 +2524,7 @@ void PdfParser::doImage(Object * /*ref*/, Stream *str, GBool inlineImg)
} else {
// get color space and color map
- GfxColorSpace *colorSpace;
+ std::unique_ptr<GfxColorSpace> colorSpace;
_POPPLER_CALL_ARGS(obj1, dict->lookup, "ColorSpace");
if (obj1.isNull()) {
_POPPLER_FREE(obj1);
@@ -2537,13 +2533,11 @@ void PdfParser::doImage(Object * /*ref*/, Stream *str, GBool inlineImg)
if (!obj1.isNull()) {
colorSpace = lookupColorSpaceCopy(obj1);
} else if (csMode == streamCSDeviceGray) {
- colorSpace = new GfxDeviceGrayColorSpace();
+ colorSpace = std::make_unique<GfxDeviceGrayColorSpace>();
} else if (csMode == streamCSDeviceRGB) {
- colorSpace = new GfxDeviceRGBColorSpace();
+ colorSpace = std::make_unique<GfxDeviceRGBColorSpace>();
} else if (csMode == streamCSDeviceCMYK) {
- colorSpace = new GfxDeviceCMYKColorSpace();
- } else {
- colorSpace = nullptr;
+ colorSpace = std::make_unique<GfxDeviceCMYKColorSpace>();
}
_POPPLER_FREE(obj1);
if (!colorSpace) {
@@ -2554,10 +2548,9 @@ void PdfParser::doImage(Object * /*ref*/, Stream *str, GBool inlineImg)
_POPPLER_FREE(obj1);
_POPPLER_CALL_ARGS(obj1, dict->lookup, "D");
}
- GfxImageColorMap *colorMap = new GfxImageColorMap(bits, &obj1, colorSpace);
+ auto colorMap = std::make_unique<GfxImageColorMap>(bits, &obj1, _POPPLER_CONSUME_UNIQPTR_ARG(colorSpace));
_POPPLER_FREE(obj1);
if (!colorMap->isOk()) {
- delete colorMap;
goto err1;
}
@@ -2568,7 +2561,7 @@ void PdfParser::doImage(Object * /*ref*/, Stream *str, GBool inlineImg)
int maskWidth = 0;
int maskHeight = 0;
maskInvert = gFalse;
- GfxImageColorMap *maskColorMap = nullptr;
+ std::unique_ptr<GfxImageColorMap> maskColorMap;
_POPPLER_CALL_ARGS(maskObj, dict->lookup, "Mask");
_POPPLER_CALL_ARGS(smaskObj, dict->lookup, "SMask");
Dict* maskDict;
@@ -2624,7 +2617,7 @@ void PdfParser::doImage(Object * /*ref*/, Stream *str, GBool inlineImg)
_POPPLER_FREE(obj1);
_POPPLER_CALL_ARGS(obj1, maskDict->lookup, "CS");
}
- GfxColorSpace *maskColorSpace = lookupColorSpaceCopy(obj1);
+ auto maskColorSpace = lookupColorSpaceCopy(obj1);
_POPPLER_FREE(obj1);
if (!maskColorSpace || maskColorSpace->getMode() != csDeviceGray) {
goto err1;
@@ -2634,10 +2627,9 @@ void PdfParser::doImage(Object * /*ref*/, Stream *str, GBool inlineImg)
_POPPLER_FREE(obj1);
_POPPLER_CALL_ARGS(obj1, maskDict->lookup, "D");
}
- maskColorMap = new GfxImageColorMap(maskBits, &obj1, maskColorSpace);
+ maskColorMap = std::make_unique<GfxImageColorMap>(maskBits, &obj1, _POPPLER_CONSUME_UNIQPTR_ARG(maskColorSpace));
_POPPLER_FREE(obj1);
if (!maskColorMap->isOk()) {
- delete maskColorMap;
goto err1;
}
//~ handle the Matte entry
@@ -2718,17 +2710,15 @@ void PdfParser::doImage(Object * /*ref*/, Stream *str, GBool inlineImg)
// draw it
if (haveSoftMask) {
- builder->addSoftMaskedImage(state, str, width, height, colorMap, interpolate,
- maskStr, maskWidth, maskHeight, maskColorMap, maskInterpolate);
- delete maskColorMap;
+ builder->addSoftMaskedImage(state, str, width, height, colorMap.get(), interpolate,
+ maskStr, maskWidth, maskHeight, maskColorMap.get(), maskInterpolate);
} else if (haveExplicitMask) {
- builder->addMaskedImage(state, str, width, height, colorMap, interpolate,
+ builder->addMaskedImage(state, str, width, height, colorMap.get(), interpolate,
maskStr, maskWidth, maskHeight, maskInvert, maskInterpolate);
} else {
- builder->addImage(state, str, width, height, colorMap, interpolate,
- haveColorKeyMask ? maskColors : static_cast<int *>(nullptr));
+ builder->addImage(state, str, width, height, colorMap.get(), interpolate,
+ haveColorKeyMask ? maskColors : nullptr);
}
- delete colorMap;
_POPPLER_FREE(maskObj);
_POPPLER_FREE(smaskObj);
@@ -2746,7 +2736,6 @@ void PdfParser::doForm(Object *str, double *offset)
{
Dict *dict;
GBool transpGroup, isolated, knockout;
- GfxColorSpace *blendingColorSpace;
Object matrixObj, bboxObj;
double m[6], bbox[4];
Object resObj;
@@ -2812,12 +2801,12 @@ void PdfParser::doForm(Object *str, double *offset)
// check for a transparency group
transpGroup = isolated = knockout = gFalse;
- blendingColorSpace = nullptr;
+ std::unique_ptr<GfxColorSpace> blendingColorSpace;
if (_POPPLER_CALL_ARGS_DEREF(obj1, dict->lookup, "Group").isDict()) {
if (_POPPLER_CALL_ARGS_DEREF(obj2, obj1.dictLookup, "S").isName("Transparency")) {
transpGroup = gTrue;
if (!_POPPLER_CALL_ARGS_DEREF(obj3, obj1.dictLookup, "CS").isNull()) {
- blendingColorSpace = GfxColorSpace::parse(nullptr, &obj3, nullptr, state);
+ blendingColorSpace = std::unique_ptr<GfxColorSpace>(GfxColorSpace::parse(nullptr, &obj3, nullptr, state));
}
_POPPLER_FREE(obj3);
if (_POPPLER_CALL_ARGS_DEREF(obj3, obj1.dictLookup, "I").isBool()) {
@@ -2835,12 +2824,9 @@ void PdfParser::doForm(Object *str, double *offset)
// draw it
++formDepth;
- doForm1(str, resDict, m, bbox, transpGroup, gFalse, blendingColorSpace, isolated, knockout);
+ doForm1(str, resDict, m, bbox, transpGroup, gFalse, blendingColorSpace.get(), isolated, knockout);
--formDepth;
- if (blendingColorSpace) {
- delete blendingColorSpace;
- }
_POPPLER_FREE(resObj);
}
diff --git a/src/extension/internal/pdfinput/pdf-parser.h b/src/extension/internal/pdfinput/pdf-parser.h
index c7c10caefed..8325ea24364 100644
--- a/src/extension/internal/pdfinput/pdf-parser.h
+++ b/src/extension/internal/pdfinput/pdf-parser.h
@@ -137,7 +137,7 @@ public:
void loadPatternColorProfiles(Dict *resources);
void loadColorProfile();
void loadColorSpaceProfile(GfxColorSpace *space, Object *obj);
- GfxPattern *lookupPattern(Object *obj, GfxState *state);
+ std::unique_ptr<GfxPattern> lookupPattern(Object *obj, GfxState *state);
std::shared_ptr<CairoFontEngine> getFontEngine();
@@ -176,7 +176,7 @@ private:
//! Caches color spaces by name
std::map<std::string, std::unique_ptr<GfxColorSpace>> colorSpacesCache;
- GfxColorSpace *lookupColorSpaceCopy(Object &);
+ std::unique_ptr<GfxColorSpace> lookupColorSpaceCopy(Object &);
void setDefaultApproximationPrecision(); // init color deltas
void pushOperator(const char *name);
diff --git a/src/extension/internal/pdfinput/poppler-transition-api.h b/src/extension/internal/pdfinput/poppler-transition-api.h
index 481aefadf46..8f03aa17779 100644
--- a/src/extension/internal/pdfinput/poppler-transition-api.h
+++ b/src/extension/internal/pdfinput/poppler-transition-api.h
@@ -15,6 +15,12 @@
#include <glib/poppler-features.h>
#include <poppler/UTF.h>
+#if POPPLER_CHECK_VERSION(24, 10, 0)
+#define _POPPLER_CONSUME_UNIQPTR_ARG(value) std::move(value)
+#else
+#define _POPPLER_CONSUME_UNIQPTR_ARG(value) value.release()
+#endif
+
#if POPPLER_CHECK_VERSION(24, 5, 0)
#define _POPPLER_HAS_UNICODE_BOM(value) (hasUnicodeByteOrderMark(value->toStr()))
#define _POPPLER_HAS_UNICODE_BOMLE(value) (hasUnicodeByteOrderMarkLE(value->toStr()))
--
GitLab

View File

@ -0,0 +1,205 @@
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{10..13} )
PYTHON_REQ_USE="xml(+)"
inherit cmake flag-o-matic xdg toolchain-funcs python-single-r1
MY_P="${P/_/}"
DESCRIPTION="SVG based generic vector-drawing program"
HOMEPAGE="https://inkscape.org/ https://gitlab.com/inkscape/inkscape/"
if [[ ${PV} = 9999* ]]; then
inherit git-r3
EGIT_REPO_URI="https://gitlab.com/inkscape/inkscape.git"
else
SRC_URI="https://media.inkscape.org/dl/resources/file/${MY_P}.tar.xz"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~ppc ~ppc64 ~riscv ~sparc ~x86"
fi
S="${WORKDIR}/${MY_P}"
LICENSE="GPL-2 LGPL-2.1"
SLOT="0"
IUSE="cdr dia exif graphicsmagick imagemagick inkjar jpeg openmp postscript readline sourceview spell svg2 test visio wpg X"
REQUIRED_USE="${PYTHON_REQUIRED_USE}"
# Lots of test failures which need investigating, bug #871621
RESTRICT="!test? ( test ) test"
BDEPEND="
dev-util/glib-utils
>=sys-devel/gettext-0.17
virtual/pkgconfig
test? ( virtual/imagemagick-tools )
"
COMMON_DEPEND="${PYTHON_DEPS}
>=app-text/poppler-0.57.0:=[cairo]
>=dev-cpp/cairomm-1.12:0
>=dev-cpp/glibmm-2.58:2
dev-cpp/gtkmm:3.0
>=dev-cpp/pangomm-2.40:1.4
>=dev-libs/boehm-gc-7.1:=
dev-libs/boost:=[stacktrace(-)]
dev-libs/double-conversion:=
>=dev-libs/glib-2.41
>=dev-libs/libsigc++-2.8:2
>=dev-libs/libxml2-2.7.4
>=dev-libs/libxslt-1.1.25
dev-libs/popt
media-gfx/potrace
media-libs/libepoxy
media-libs/fontconfig
media-libs/freetype:2
media-libs/lcms:2
media-libs/libpng:0=
sci-libs/gsl:=
>=x11-libs/pango-1.44
x11-libs/gtk+:3[X?]
X? ( x11-libs/libX11 )
$(python_gen_cond_dep '
dev-python/appdirs[${PYTHON_USEDEP}]
dev-python/cachecontrol[${PYTHON_USEDEP}]
dev-python/cssselect[${PYTHON_USEDEP}]
dev-python/filelock[${PYTHON_USEDEP}]
dev-python/lockfile[${PYTHON_USEDEP}]
dev-python/lxml[${PYTHON_USEDEP}]
dev-python/pillow[jpeg?,tiff,webp,${PYTHON_USEDEP}]
media-gfx/scour[${PYTHON_USEDEP}]
')
cdr? (
app-text/libwpg:0.3
dev-libs/librevenge
media-libs/libcdr
)
exif? ( media-libs/libexif )
imagemagick? (
!graphicsmagick? ( media-gfx/imagemagick:=[cxx] )
graphicsmagick? ( media-gfx/graphicsmagick:=[cxx] )
)
jpeg? ( media-libs/libjpeg-turbo:= )
readline? ( sys-libs/readline:= )
sourceview? ( x11-libs/gtksourceview:4 )
spell? ( app-text/gspell )
visio? (
app-text/libwpg:0.3
dev-libs/librevenge
media-libs/libvisio
)
wpg? (
app-text/libwpg:0.3
dev-libs/librevenge
)
"
# These only use executables provided by these packages
# See share/extensions for more details. inkscape can tell you to
# install these so we could of course just not depend on those and rely
# on that.
RDEPEND="${COMMON_DEPEND}
$(python_gen_cond_dep '
dev-python/numpy[${PYTHON_USEDEP}]
')
dia? ( app-office/dia )
postscript? ( app-text/ghostscript-gpl )
"
DEPEND="${COMMON_DEPEND}
test? ( dev-cpp/gtest )
"
PATCHES=(
"${FILESDIR}"/${PN}-1.4-gcc15.patch
"${FILESDIR}"/${PN}-1.4-poppler-24.10-fix-backport.patch
)
pkg_pretend() {
[[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
}
pkg_setup() {
[[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
python-single-r1_pkg_setup
}
src_unpack() {
if [[ ${PV} = 9999* ]]; then
git-r3_src_unpack
else
default
fi
[[ -d "${S}" ]] || mv -v "${WORKDIR}/${P/_/-}_202"?-??-* "${S}" || die
}
src_prepare() {
cmake_src_prepare
sed -i "/install.*COPYING/d" CMakeScripts/ConfigCPack.cmake || die
}
src_configure() {
# ODR violation (https://gitlab.com/inkscape/lib2geom/-/issues/71, bug #859628)
filter-lto
# Aliasing unsafe (bug #310393)
append-flags -fno-strict-aliasing
local mycmakeargs=(
# -DWITH_LPETOOL # Compile with LPE Tool and experimental LPEs enabled
-DWITH_NLS=ON
-DENABLE_POPPLER=ON
-DENABLE_POPPLER_CAIRO=ON
-DWITH_PROFILING=OFF
-DWITH_INTERNAL_2GEOM=ON
-DBUILD_TESTING=$(usex test)
-DWITH_LIBCDR=$(usex cdr)
-DWITH_IMAGE_MAGICK=$(usex imagemagick $(usex !graphicsmagick)) # requires ImageMagick 6, only IM must be enabled
-DWITH_GRAPHICS_MAGICK=$(usex graphicsmagick $(usex imagemagick)) # both must be enabled to use GraphicsMagick
-DWITH_GNU_READLINE=$(usex readline)
-DWITH_GSPELL=$(usex spell)
-DWITH_JEMALLOC=OFF
-DENABLE_LCMS=ON
-DWITH_OPENMP=$(usex openmp)
-DBUILD_SHARED_LIBS=ON
-DWITH_GSOURCEVIEW=$(usex sourceview)
-DWITH_SVG2=$(usex svg2)
-DWITH_LIBVISIO=$(usex visio)
-DWITH_LIBWPG=$(usex wpg)
-DWITH_X11=$(usex X)
)
cmake_src_configure
}
src_test() {
CMAKE_SKIP_TESTS=(
# render_text*: needs patched Cairo / maybe upstream changes
# not yet in a release.
# test_lpe/test_lpe64: precision differences b/c of new GCC?
# cli_export-png-color-mode-gray-8_png_check_output: ditto?
render_test-use
render_test-glyph-y-pos
render_text-glyphs-combining
render_text-glyphs-vertical
render_test-rtl-vertical
test_lpe
test_lpe64
cli_export-png-color-mode-gray-8_png_check_output
)
# bug #871621
cmake_src_compile tests
cmake_src_test -j1
}
src_install() {
cmake_src_install
find "${ED}" -type f -name "*.la" -delete || die
find "${ED}"/usr/share/man -type f -maxdepth 3 -name '*.bz2' -exec bzip2 -d {} \; || die
find "${ED}"/usr/share/man -type f -maxdepth 3 -name '*.gz' -exec gzip -d {} \; || die
local extdir="${ED}"/usr/share/${PN}/extensions
if [[ -e "${extdir}" ]] && [[ -n $(find "${extdir}" -mindepth 1) ]]; then
python_fix_shebang "${ED}"/usr/share/${PN}/extensions
python_optimize "${ED}"/usr/share/${PN}/extensions
fi
}

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<email>dilfridge@gentoo.org</email>
<name>Andreas K. Hüttel</name>
</maintainer>
<use>
<flag name="cdr">Enable support for CorelDRAW files via <pkg>media-libs/libcdr</pkg></flag>
<flag name="dia">Enable DIA flow chart import via <pkg>app-office/dia</pkg></flag>
<flag name="inkjar">Enable support for OpenOffice.org SVG jar files</flag>
<flag name="sourceview">Enable syntax highlighting support via <pkg>x11-libs/gtksourceview</pkg></flag>
<flag name="svg2">Enable support for new SVG2 features</flag>
<flag name="visio">Enable support for Microsoft Visio diagrams via <pkg>media-libs/libvisio</pkg></flag>
<flag name="wpg">Enable support for WordPerfect graphics via <pkg>app-text/libwpg</pkg></flag>
</use>
<upstream>
<remote-id type="gitlab">inkscape/inkscape</remote-id>
</upstream>
</pkgmetadata>

View File

@ -1,2 +1,15 @@
AUX 50openscad-gentoo.el 167 BLAKE2B 36292439057e2b9a5993c73cf5d46e5b6b0b56695f46307114fcfffa79990be0b0622ec3a6918726d4a5f7e4343525b9e67f785996ec4eb7abb938b6df1cb2f7 SHA512 ce669eba45ab90e9dbcd770a7470ca9ed7088b1acabbc876fe4d31dc7a6edd36076063e4bd417d348c3e073113e3ad2bc2dd0ac89e02d3d8aeca7627ad7d2a1e
AUX openscad-2021.01-0001-Gentoo-specific-Disable-ccache-building.patch 790 BLAKE2B b08a024f81a29d7fb4e0860977b814d2ec6ce6dcbf8ab87655f5d36f51ea3bbce6559369363c33ca7593cbc3284de920f71be3c38e3ab7b5efa83d3466132b79 SHA512 2af887d7b085c49203e72ad41cb5c0e32b772a8abd35843485434cb11b263ba8a727a0ebc34c7138bff1e6852245f2bdaf7d91711184a5f16ed22603578a0892
AUX openscad-2021.01-0002-fix-to-find-lib3mf-2.patch 1396 BLAKE2B a43872dd83427f28a48528fbac534924796db769bd0213ba1b6fca41a65c766aa3355aa9ee3f7d68dcbbf3d578cee984f2ad61f599fdf9551ef55724f460f4db SHA512 ffbf402976054c1e7294a0d661e0648bdb359cf57e676d818cf1140644b7a0d0943f5adf1d2f511ad17ca45a35e31785aae584dc7607f13bfc9d94795fc3812b
AUX openscad-2021.01-CGAL-build-fix-v5.4-renames-projection-traits-header.patch 1380 BLAKE2B b359211ef34bd0e1306f37fcf84f65fc8b3a03036608abb36ece8e134bee419646754fedb52134947f1a3943c02fc07d778127f544d873346d62e5cd36c3ce9a SHA512 4c0dea73a578db8e6ff499a4fc9b337292d66dc1d652559d73616e85ee57d4a5c06d93e96a4e543a9b7087d3f4939e98bd7e22f9a9305c612a487527454e4d38
AUX openscad-2021.01-CVE-2022-0496-Out-of-bounds-memory-access-in-DXF-loa.patch 3690 BLAKE2B c320ddd5077e8f4c92f21e9ea18e741b6844f409d1be1ca90fcf8ed8fe0b394694d2a4198b068858b92d8b004e603070bd51a0de1ccafdd3afc1925377f00082 SHA512 1a08d7207a6c98493022a6019d44db468ad8b1b0a7623296302895ffcda789fd9ad90f3d361026b6309fbbd23051a5f686e1a21c01bd90a668dd5ce08fd6ba9f
AUX openscad-2021.01-CVE-2022-0497-Out-of-bounds-memory-access-in-comment.patch 752 BLAKE2B a54676bdf69a78cbc0ff1d11676de4b5913030093f06a2029bb44bb301dee681a7a971f3cd31b033061f5f4e03ac243c83b51d21576b0bbe21cdc8457632d885 SHA512 49f43408021397d8ca8a628de102dde9f55ccc4fa219f84f7a0e08db6b63232d5d31562814669728273379db521e98d819fe939521ba7a346232a05aa9dcdc89
AUX openscad-2021.01-Fix-build-failure-with-generic_print_polyhedron-on-C.patch 1390 BLAKE2B 2c5e96675b15f9dc7020f21d5d2b5a9f7edcde154533dcda14762aef5cbe8bec78ac0fb9cc8b0426817027543313a6862c07dd5d17eb46fa101633ed55ed75d6 SHA512 58cfa61093edb3e18022b73cca93d4741ba2fddd259c37864d604ee66bc8f9f1f170677f2151b539ebdf70e3043c6d1650fa7578037c70c277d3eec4ca030a4e
AUX openscad-2021.01-Fix-build-issue-with-overloaded-join.patch 3336 BLAKE2B c92caab0f33551ee7e66c6527dfa61d5ae70c3820d51188b6b4fc042a66cd58d207d4dbcdc87641b79733784d1c088af34a85078899fa4468522b4653fed7ab7 SHA512 f8860ec827efcdf1e0037c22ec0c1f8364b5f9554d264d2bac5be57c1b86e79f6ab284b65f1763c1548e8e3479c0ca510954937907f18f0db745826338a4f2f8
AUX openscad-2021.01-Remove-double-quoting-of-the-output-file-parameter-f.patch 775 BLAKE2B eed37277c3e7ea84635c0b8cd02cc4ffde7abea78400ee39e67bcc782800197c57dae07a82084df47705951ced8968be78243a1d0e14a551783b8adcb669d43f SHA512 94306e68e53b01e799a5feb6f16a8f44c965a4b653b60227833013712f23648d20ac8272a7bfe38bde201af42946f91fe17231f120adfbe5b16e42b07d9f8d10
AUX openscad-2021.01-boost-1.85.patch 621 BLAKE2B f86fa92c1f3c4a059550017e7a16ee808bdd4ff4a4196c19dacf8b86fd97458f72ebbf0ef763b88115d56eb0cb6ec565b63dd789c4558d8011aaf252b9ceea00 SHA512 786bf3739f8296b83047ac6c36432d331f392a1d1cf67fc2135a98f227840ff1b099437f5157bf8472ea47206a7ff2ef0de09e2b8780830e235c94bfe6ccad5b
AUX openscad-2021.01-fix-cstd.patch 459 BLAKE2B 883e7c080d625093dfab151abe116d77651c8d6a40cec0f30c537153051aa102f81e94fa7c516410ff4b9d14fafd36486504a93804df18985d3aca86b1a3a341 SHA512 bc66c0300b7f23256f1b66aa55e1219e25fbcc7490f55e0163448e90450d4d3023b19a1a2862652fa3f9dc9befa27d14db24c74580e5ddd92364d58971246613
DIST openscad-2021.01.tar.gz 15817555 BLAKE2B 417857d704fa3c14312641ebda983eb85a1e3bc0d517a235fa3bd2523fce6f93c1ea526c330179bc35f03e6c73d3cd7c4c57cd71480088c21bfc99bb020ab7cd SHA512 8deaa26bf4c295c12da38f323d2b2e6f827851337f5bc1cc9c79afc083c9f913c19a263086e6e853bf2c8434c1ccc705ea22ddb02dc99d39bb1e5e03fc58d128
EBUILD openscad-2021.01-r5.ebuild 2937 BLAKE2B e3dd68f56119438f43d14fdc38a79b7d9d7f379b1f767622cbfe531195353d8d7a83a4e2e5dfecd8be88f112be6c2f03cfbb6193ab3de6ba6c0cef4bb16af00d SHA512 f5d288bfedf36ff8f956250bec83f58ba798e20a558db9de0d7a9fb6a93eddef5a7c651b043705e8e60958ec77bf5a75d3f8318c9c9ac17fc56b95c71cfc8eb6
EBUILD openscad-9999.ebuild 2489 BLAKE2B e073d8eecb56895c3886177abd346cf19d6215462dd0a6a15a5b9b1adddee17853fa2b808c6e8f03908647bf518e3bd7a77a5f69cd640cb8c701c894594e0764 SHA512 751617f4f6b1164cc1cb42f61665a6f10c47f18e8693b6451e9ea87cf45ee25d26892ac2c72321c234a943befe0e707f5cc7d08535461e478c3c392d28ce9e77
MISC metadata.xml 1348 BLAKE2B b15a74a20ef94a6a47de57826c5279a4e8c388a52bf9d1058a1ba0b347fcd77e0c8b79a42515f5411d0991fb8fb71c604f792dd2a2addaaca78bc85dbfc7a611 SHA512 fea109a00324f0bdcaae855e18fba456a449bb8192e633cfd5806fa1040fe3bba24f75493e0012d54afe8828073fc4d02ae01533b45648e05c575777b23572d1

View File

@ -0,0 +1,3 @@
(add-to-list 'load-path "@SITELISP@")
(autoload 'scad-mode "scad-mode" "Major mode for editing SCAD code." t)
(add-to-list 'auto-mode-alist '("\\.scad$" . scad-mode))

View File

@ -0,0 +1,32 @@
From c138881767262b9f5c64a465a0e1e46ffcfc5899 Mon Sep 17 00:00:00 2001
From: Bernd Waibel <waebbl-gentoo@posteo.net>
Date: Sun, 28 Feb 2021 16:51:30 +0100
Subject: [PATCH] [Gentoo specific] Disable ccache building
On Gentoo, we use a USE flag to determine whether ccache
should be used for building.
Signed-off-by: Bernd Waibel <waebbl-gentoo@posteo.net>
---
openscad.pro | 5 -----
1 file changed, 5 deletions(-)
diff --git a/openscad.pro b/openscad.pro
index b76ca76..678e08d 100755
--- a/openscad.pro
+++ b/openscad.pro
@@ -211,11 +211,6 @@ mdi {
DEFINES += ENABLE_MDI
}
-system("ccache -V >/dev/null 2>/dev/null") {
- CONFIG += ccache
- message("Using ccache")
-}
-
include(common.pri)
# mingw has to come after other items so OBJECT_DIRS will work properly
--
2.30.1

View File

@ -0,0 +1,43 @@
From 16847a70cf05484a668d8f79aba4ccec7e16c025 Mon Sep 17 00:00:00 2001
From: Bernd Waibel <waebbl-gentoo@posteo.net>
Date: Sat, 6 Mar 2021 22:59:17 +0100
Subject: [PATCH] fix to find lib3mf-2
The pkgconfig file for lib3mf has been renamed in case
for lib3mf-2 versions.
This patch uses the news names.
Signed-off-by: Bernd Waibel <waebbl-gentoo@posteo.net>
---
features/lib3mf.prf | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/features/lib3mf.prf b/features/lib3mf.prf
index 2c512da..47be364 100644
--- a/features/lib3mf.prf
+++ b/features/lib3mf.prf
@@ -15,8 +15,8 @@ isEmpty(LIB3MF_LIBPATH) {
}
isEmpty(LIB3MF_INCLUDEPATH) {
- LIB3MF_CFLAGS = $$system("$$PKG_CONFIG --cflags lib3MF")
- LIB3MF_INCLUDEPATH = $$system("$$PKG_CONFIG --variable=includedir lib3MF")
+ LIB3MF_CFLAGS = $$system("$$PKG_CONFIG --cflags lib3mf")
+ LIB3MF_INCLUDEPATH = $$system("$$PKG_CONFIG --variable=includedir lib3mf")
!isEmpty(LIB3MF_CFLAGS) {
ENABLE_LIB3MF=yes
}
@@ -25,8 +25,8 @@ isEmpty(LIB3MF_INCLUDEPATH) {
}
isEmpty(LIB3MF_LIBPATH) {
- LIB3MF_LIBS = $$system("$$PKG_CONFIG --libs lib3MF")
- LIB3MF_LIBPATH = $$system("$$PKG_CONFIG --variable=libdir lib3MF")
+ LIB3MF_LIBS = $$system("$$PKG_CONFIG --libs lib3mf")
+ LIB3MF_LIBPATH = $$system("$$PKG_CONFIG --variable=libdir lib3mf")
!isEmpty(LIB3MF_LIBS) {
ENABLE_LIB3MF=yes
}
--
2.30.1

View File

@ -0,0 +1,36 @@
https://bugs.gentoo.org/851189
From https://github.com/openscad/openscad/commit/abfebc651343909b534ef337aacc7604c99cf0ea Mon Sep 17 00:00:00 2001
From: Torsten Paul <Torsten.Paul@gmx.de>
Date: Wed, 2 Feb 2022 02:30:59 +0100
Subject: [PATCH 09/11] CGAL build fix, v5.4 renames projection traits header
files and classes.
--- a/src/cgalutils-tess.cc
+++ b/src/cgalutils-tess.cc
@@ -6,10 +6,12 @@
#pragma push_macro("NDEBUG")
#undef NDEBUG
#include <CGAL/Constrained_Delaunay_triangulation_2.h>
-#if CGAL_VERSION_NR >= CGAL_VERSION_NUMBER(4,11,0)
- #include <CGAL/Triangulation_2_projection_traits_3.h>
+#if CGAL_VERSION_NR < 1050401000
+#include <CGAL/Triangulation_2_projection_traits_3.h>
+typedef CGAL::Triangulation_2_filtered_projection_traits_3<K> Projection;
#else
- #include <CGAL/Triangulation_2_filtered_projection_traits_3.h>
+#include <CGAL/Projection_traits_3.h>
+typedef CGAL::Filtered_projection_traits_3<K> Projection;
#endif
#include <CGAL/Triangulation_face_base_with_info_2.h>
#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<K> Projection;
typedef CGAL::Triangulation_face_base_with_info_2<FaceInfo, K> Fbb;
typedef CGAL::Triangulation_data_structure_2<
CGAL::Triangulation_vertex_base_2<Projection>,
--
2.35.1

View File

@ -0,0 +1,74 @@
From https://github.com/openscad/openscad/commit/00a4692989c4e2f191525f73f24ad8727bacdf41 Mon Sep 17 00:00:00 2001
From: Torsten Paul <Torsten.Paul@gmx.de>
Date: Sat, 5 Feb 2022 18:38:31 +0100
Subject: [PATCH 01/11] CVE-2022-0496 Out-of-bounds memory access in DXF
loader.
Public issue:
https://github.com/openscad/openscad/issues/4037
Fix in master branch:
https://github.com/openscad/openscad/pull/4090
--- a/src/dxfdata.cc
+++ b/src/dxfdata.cc
@@ -441,6 +441,11 @@ DxfData::DxfData(double fn, double fs, double fa,
auto lv = grid.data(this->points[lines[idx].idx[j]][0], this->points[lines[idx].idx[j]][1]);
for (size_t ki = 0; ki < lv.size(); ++ki) {
int k = lv.at(ki);
+ if (k < 0 || k >= lines.size()) {
+ LOG(message_group::Warning,Location::NONE,"",
+ "Bad DXF line index in %1$s.",QuotedString(boostfs_uncomplete(filename, fs::current_path()).generic_string()));
+ continue;
+ }
if (k == idx || lines[k].disabled) continue;
goto next_open_path_j;
}
@@ -466,13 +471,20 @@ DxfData::DxfData(double fn, double fs, double fa,
auto lv = grid.data(ref_point[0], ref_point[1]);
for (size_t ki = 0; ki < lv.size(); ++ki) {
int k = lv.at(ki);
+ if (k < 0 || k >= lines.size()) {
+ LOG(message_group::Warning,Location::NONE,"",
+ "Bad DXF line index in %1$s.",QuotedString(boostfs_uncomplete(filename, fs::current_path()).generic_string()));
+ continue;
+ }
if (lines[k].disabled) continue;
- if (grid.eq(ref_point[0], ref_point[1], this->points[lines[k].idx[0]][0], this->points[lines[k].idx[0]][1])) {
+ auto idk0 = lines[k].idx[0]; // make it easier to read and debug
+ auto idk1 = lines[k].idx[1];
+ if (grid.eq(ref_point[0], ref_point[1], this->points[idk0][0], this->points[idk0][1])) {
current_line = k;
current_point = 0;
goto found_next_line_in_open_path;
}
- if (grid.eq(ref_point[0], ref_point[1], this->points[lines[k].idx[1]][0], this->points[lines[k].idx[1]][1])) {
+ if (grid.eq(ref_point[0], ref_point[1], this->points[idk1][0], this->points[idk1][1])) {
current_line = k;
current_point = 1;
goto found_next_line_in_open_path;
@@ -501,13 +513,20 @@ DxfData::DxfData(double fn, double fs, double fa,
auto lv = grid.data(ref_point[0], ref_point[1]);
for (size_t ki = 0; ki < lv.size(); ++ki) {
int k = lv.at(ki);
+ if (k < 0 || k >= lines.size()) {
+ LOG(message_group::Warning,Location::NONE,"",
+ "Bad DXF line index in %1$s.",QuotedString(boostfs_uncomplete(filename, fs::current_path()).generic_string()));
+ continue;
+ }
if (lines[k].disabled) continue;
- if (grid.eq(ref_point[0], ref_point[1], this->points[lines[k].idx[0]][0], this->points[lines[k].idx[0]][1])) {
+ auto idk0 = lines[k].idx[0]; // make it easier to read and debug
+ auto idk1 = lines[k].idx[1];
+ if (grid.eq(ref_point[0], ref_point[1], this->points[idk0][0], this->points[idk0][1])) {
current_line = k;
current_point = 0;
goto found_next_line_in_closed_path;
}
- if (grid.eq(ref_point[0], ref_point[1], this->points[lines[k].idx[1]][0], this->points[lines[k].idx[1]][1])) {
+ if (grid.eq(ref_point[0], ref_point[1], this->points[idk1][0], this->points[idk1][1])) {
current_line = k;
current_point = 1;
goto found_next_line_in_closed_path;
--
2.35.1

View File

@ -0,0 +1,25 @@
From https://github.com/openscad/openscad/commit/84addf3c1efbd51d8ff424b7da276400bbfa1a4b Mon Sep 17 00:00:00 2001
From: Torsten Paul <Torsten.Paul@gmx.de>
Date: Sat, 5 Feb 2022 18:45:29 +0100
Subject: [PATCH 02/11] CVE-2022-0497 Out-of-bounds memory access in comment
parser.
Public issue:
https://github.com/openscad/openscad/issues/4043
Fix in master branch:
https://github.com/openscad/openscad/pull/4044
--- a/src/comment.cpp
+++ b/src/comment.cpp
@@ -92,7 +92,7 @@ static std::string getComment(const std::string &fulltext, int line)
}
int end = start + 1;
- while (fulltext[end] != '\n') end++;
+ while (end < fulltext.size() && fulltext[end] != '\n') end++;
std::string comment = fulltext.substr(start, end - start);
--
2.35.1

View File

@ -0,0 +1,42 @@
https://bugs.gentoo.org/851189
From https://github.com/openscad/openscad/commit/9aa0d7e9f2914fe5f547bdde69202161d1c6064d Mon Sep 17 00:00:00 2001
From: Jordan Brown <github@jordan.maileater.net>
Date: Sun, 18 Jul 2021 21:01:46 -0700
Subject: [PATCH 05/11] Fix build failure with "generic_print_polyhedron" on
CGAL-5.3.
--- a/src/cgalutils-polyhedron.cc
+++ b/src/cgalutils-polyhedron.cc
@@ -337,19 +337,6 @@ namespace CGALUtils {
}
};
- template <typename Polyhedron>
- 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 */
--- 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 <typename Polyhedron> std::string printPolyhedron(const Polyhedron &p);
template <typename Polyhedron> bool createPolySetFromPolyhedron(const Polyhedron &p, PolySet &ps);
template <typename Polyhedron> bool createPolyhedronFromPolySet(const PolySet &ps, Polyhedron &p);
template <class Polyhedron_A, class Polyhedron_B>
--
2.35.1

View File

@ -0,0 +1,60 @@
https://bugs.gentoo.org/851189
From https://github.com/openscad/openscad/commit/08bf69b4115c989fc5671254e0d05735d01bcca5 Mon Sep 17 00:00:00 2001
From: Torsten Paul <Torsten.Paul@gmx.de>
Date: Wed, 2 Feb 2022 00:50:43 +0100
Subject: [PATCH 10/11] Fix build issue with overloaded join().
--- a/src/openscad.cc
+++ b/src/openscad.cc
@@ -65,7 +65,6 @@
#include <chrono>
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/split.hpp>
-#include <boost/algorithm/string/join.hpp>
#include <boost/range/adaptor/transformed.hpp>
#include <boost/program_options.hpp>
#include <boost/filesystem.hpp>
@@ -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 <class Seq, typename ToString>
-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<string>(), "customizer parameter set")
#ifdef ENABLE_EXPERIMENTAL
("enable", po::value<vector<string>>(), ("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<string>()->implicit_value(""), "for full geometry evaluation when exporting png")
("preview", po::value<string>()->implicit_value(""), "[=throwntogether] -for ThrownTogether preview png")
("animate", po::value<unsigned>(), "export N animated frames")
- ("view", po::value<CommaSeparatedVector>(), ("=view options: " + boost::join(viewOptions.names(), " | ")).c_str())
+ ("view", po::value<CommaSeparatedVector>(), ("=view options: " + boost::algorithm::join(viewOptions.names(), " | ")).c_str())
("projection", po::value<string>(), "=(o)rtho or (p)erspective when exporting png")
("csglimit", po::value<unsigned int>(), "=n -stop rendering at n CSG elements when exporting png")
("colorscheme", po::value<string>(), ("=colorscheme: " +
- join(ColorMap::inst()->colorSchemeNames(), " | ",
+ str_join(ColorMap::inst()->colorSchemeNames(), " | ",
[](const std::string& colorScheme) {
return (colorScheme == ColorMap::inst()->defaultColorSchemeName() ? "*" : "") + colorScheme;
}) +
--
2.35.1

View File

@ -0,0 +1,20 @@
From https://github.com/openscad/openscad/commit/45a5e3bdd6c8071cb50b9c3f2b14a62554aafc4a Mon Sep 17 00:00:00 2001
From: Torsten Paul <Torsten.Paul@gmx.de>
Date: Thu, 14 Apr 2022 16:07:04 +0200
Subject: [PATCH 11/11] Remove double quoting of the output file parameter for
ghostscript.
--- a/tests/export_pngtest.py
+++ b/tests/export_pngtest.py
@@ -82,7 +82,7 @@ result = subprocess.call(export_cmd, env = fontenv)
if result != 0:
failquit('OpenSCAD failed with return code ' + str(result))
-convert_cmd = gs_cmd + ["-sOutputFile=\"" + pngfile + "\"", exportfile]
+convert_cmd = gs_cmd + ["-sOutputFile=" + pngfile, exportfile]
print('Running Converter:', ' '.join(convert_cmd), file=sys.stderr)
result = subprocess.call(convert_cmd)
if result != 0:
--
2.35.1

View File

@ -0,0 +1,12 @@
diff '--color=auto' -ur openscad-2021.01-orig/src/FileModule.cc openscad-2021.01/src/FileModule.cc
--- openscad-2021.01-orig/src/FileModule.cc 2021-01-31 21:17:41.000000000 +0100
+++ openscad-2021.01/src/FileModule.cc 2024-05-20 07:50:31.746487490 +0200
@@ -65,7 +65,7 @@
auto ext = fs::path(path).extension().generic_string();
if (boost::iequals(ext, ".otf") || boost::iequals(ext, ".ttf")) {
- if (fs::is_regular(path)) {
+ if (fs::is_regular_file(path)) {
FontCache::instance()->register_font_file(path);
} else {
LOG(message_group::Error,Location::NONE,"","Can't read font with path '%1$s'",path);

View File

@ -0,0 +1,14 @@
diff '--color=auto' -ur openscad-2021.01.orig/c++std.pri openscad-2021.01/c++std.pri
--- openscad-2021.01.orig/c++std.pri 2021-01-31 21:17:41.000000000 +0100
+++ openscad-2021.01/c++std.pri 2024-11-05 11:27:55.002178949 +0100
@@ -26,8 +26,8 @@
}
c++std {
- CONFIG += c++14 strict_c++
- message("Using C++14")
+ CONFIG += c++17 strict_c++
+ message("Using C++17")
*clang*: {
# 3rd party libraries will probably violate this for a long time

View File

@ -0,0 +1,119 @@
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit elisp-common flag-o-matic qmake-utils xdg
SITEFILE="50${PN}-gentoo.el"
DESCRIPTION="The Programmers Solid 3D CAD Modeller"
HOMEPAGE="https://openscad.org/"
SRC_URI="https://github.com/${PN}/${PN}/releases/download/${P}/${P}.src.tar.gz -> ${P}.tar.gz"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="amd64 ~arm64 ~ppc64 ~x86"
IUSE="emacs"
# tests are not fully working and need cmake which isn't yet
# officially supported.
RESTRICT="test"
RDEPEND="
dev-cpp/eigen:3
dev-libs/boost:=
dev-libs/double-conversion:=
dev-libs/glib:2
dev-libs/gmp:0=
dev-libs/hidapi
dev-libs/libspnav
dev-libs/libxml2
dev-libs/libzip:=
dev-libs/mpfr:0=
dev-qt/qtconcurrent:5
dev-qt/qtcore:5
dev-qt/qtdbus:5
dev-qt/qtgui:5[-gles2-only]
dev-qt/qtmultimedia:5
dev-qt/qtnetwork:5
dev-qt/qtopengl:5
dev-qt/qtwidgets:5
media-gfx/opencsg:=
media-libs/fontconfig
media-libs/freetype
>=media-libs/glew-2.0.0:0=
media-libs/harfbuzz:=
media-libs/lib3mf
sci-mathematics/cgal:=
x11-libs/cairo
>=x11-libs/qscintilla-2.10.3:=[qt5(+)]
emacs? ( >=app-editors/emacs-23.1:* )
"
DEPEND="${RDEPEND}"
BDEPEND="
dev-util/itstool
app-alternatives/yacc
app-alternatives/lex
sys-devel/gettext
virtual/pkgconfig
"
PATCHES=(
"${FILESDIR}"/${P}-0001-Gentoo-specific-Disable-ccache-building.patch
"${FILESDIR}"/${P}-0002-fix-to-find-lib3mf-2.patch
"${FILESDIR}"/${P}-CVE-2022-0496-Out-of-bounds-memory-access-in-DXF-loa.patch
"${FILESDIR}"/${P}-CVE-2022-0497-Out-of-bounds-memory-access-in-comment.patch
"${FILESDIR}"/${P}-Fix-build-failure-with-generic_print_polyhedron-on-C.patch
"${FILESDIR}"/${P}-CGAL-build-fix-v5.4-renames-projection-traits-header.patch
"${FILESDIR}"/${P}-Fix-build-issue-with-overloaded-join.patch
"${FILESDIR}"/${P}-Remove-double-quoting-of-the-output-file-parameter-f.patch
"${FILESDIR}"/${P}-boost-1.85.patch
"${FILESDIR}"/${P}-fix-cstd.patch
)
src_configure() {
# -Werror=odr
# https://github.com/openscad/openscad/issues/5239
filter-lto
if has ccache ${FEATURES}; then
eqmake5 "PREFIX = ${ESYSROOT}/usr" "CONFIG += ccache" "${PN}.pro"
else
eqmake5 "PREFIX = ${ESYSROOT}/usr" "${PN}.pro"
fi
}
src_compile() {
# We have random parallel build issues, bug #856430
emake -j1
if use emacs ; then
elisp-compile contrib/*.el
fi
}
src_install() {
emake install INSTALL_ROOT="${D}"
if use emacs; then
elisp-site-file-install "${FILESDIR}/${SITEFILE}"
elisp-install ${PN} contrib/*.el contrib/*.elc
fi
mv -i "${ED}"/usr/share/openscad/locale "${ED}"/usr/share || die "failed to move locales"
ln -sf ../locale "${ED}"/usr/share/openscad/locale || die
einstalldocs
}
pkg_postinst() {
use emacs && elisp-site-regen
xdg_desktop_database_update
xdg_mimeinfo_database_update
}
pkg_postrm() {
use emacs && elisp-site-regen
xdg_desktop_database_update
xdg_mimeinfo_database_update
}

View File

@ -1,3 +1,7 @@
AUX kicad-8.0.5-boost-1.86.patch 1826 BLAKE2B 40ea53bf5f9a23e3a2cf7a244a164dea426d4046623130187b9c73274f4bc768c799365211b2d57ad6cd51e0a69476fa0beebe90682266f669030a1b96aedab0 SHA512 c481ff6905fa2434958b755c408e293dfd488d5a5a028ce7c21380a3704138be343ebecb8087f70684864de82ba40c6ac13d1f4c220a956d143df46dfd930871
AUX kicad-8.0.5-libgit2-1.8.4.patch 1433 BLAKE2B 2ebe5e8254c27720d9f119d57b09ba7ad5b821f4b0681192d961830dbd91ca385b54286c30411717c7a52473bdd4b5086e860bf489f758d455cfde2d5d49e719 SHA512 cc56a039d44b7e36af4f270f457077939a6cb31f8155afb9a1e8f3333260e87cd7744a70756ade1b44cc3003893358e738e2a549f57b0075e0b0e28fb657a55a
DIST kicad-8.0.2.tar.bz2 72713030 BLAKE2B ba47a16b5c435970a45aef9988a5f6d218df043a5ce3547a191991ef63620125989e6218e97266a62c76ece604248bdf0652a10d423346fe3648c8ba240651c4 SHA512 192bcd494f00eccc430ddf9e9034f252bae177f06da81e730fb82f000a58bac9201d49ecba93c3bd17608b6df6a944beea85849050e306e11c1abfbd0028ff4a
DIST kicad-8.0.5.tar.bz2 72957862 BLAKE2B ae5c9c96a723bae7bc40577f5275b622d741d3ec8038ed11f5e1fac81b767be42d222a5ce1a121e26462f75998d296a07178e51dd61a08a2419583bd7e5ac1ad SHA512 a093debe0029d18db89d341ce1767a7cc2cf0598c5e36be2781ba6d72c25a8fbd16e12d7c9f184f3628984be31c375000fd5b702ccc9851702e126aeba15dbea
EBUILD kicad-8.0.2-r1.ebuild 4477 BLAKE2B e80525202782c7e7e58d976a0b495150e3d8ba9b4073c9dac854933ad22973927c6dea3fd39099928f675ce866979ef094e182334cd5e9c5e03c26a03f5ba5a5 SHA512 7c1b65eb3ef115346140cabea04ab4f64f791872bd999136e32bba2a1c2c172c70a3757b17412826f32c2793c80d7d60050f47630e50bcd7c032e592fef0c152
EBUILD kicad-8.0.5.ebuild 4609 BLAKE2B e818be339b6a6b9a4a962ececbf90dd6c67a085f4f984a2d2708ed81d4069b7c0f621c9c66f711f153b788882df6d735858e0778fa4e76ba175301a01a9ebef3 SHA512 7aa8e2178455fcdb8d1ff8a38683266e2ccf3e1f8682965d8ffb90f016bb0c8febb6db734422542d13fd9be12058d3e9d3cd541dc65e5d33151d0d6559b45ea8
MISC metadata.xml 811 BLAKE2B 4f2150b49b1bebf73aa3440ae1ace1624ce02e022d361051e895a18d28f2ab802fed04c94552b36fc0265335a1eacd5d3a7c407fc88f0c4f7de9e4fa6afa6c5f SHA512 c09c2143516f361a8553ab5c44ffa47c77c7a8dbf53596dfe9ba81378c1a7e3aee8378353950cd8805b675d0a29444848fddd4acfe107a54e3f56e87183a1c6c

View File

@ -0,0 +1,49 @@
diff '--color=auto' -ur kicad-8.0.5.orig/3d-viewer/3d_cache/3d_cache.cpp kicad-8.0.5/3d-viewer/3d_cache/3d_cache.cpp
--- kicad-8.0.5.orig/3d-viewer/3d_cache/3d_cache.cpp 2024-09-06 18:28:40.000000000 +0200
+++ kicad-8.0.5/3d-viewer/3d_cache/3d_cache.cpp 2024-11-05 11:40:58.773367999 +0100
@@ -381,7 +381,13 @@
fclose( fp );
unsigned int digest[5];
- dblock.get_digest( digest );
+ // V8 only
+ // Boost 1.86 and later changed digest_type from uchar[20] from int[5]
+ // But KiCad 8.99 and later use MurmurHash3 here, so just do a fairly ugly cast to keep
+ // this going for another few months.
+ static_assert( sizeof( digest ) == sizeof( boost::uuids::detail::sha1::digest_type& ),
+ "SHA1 digest size mismatch" );
+ dblock.get_digest( reinterpret_cast<boost::uuids::detail::sha1::digest_type&>( digest ) );
// ensure MSB order
for( int i = 0; i < 5; ++i )
diff '--color=auto' -ur kicad-8.0.5.orig/common/kiid.cpp kicad-8.0.5/common/kiid.cpp
--- kicad-8.0.5.orig/common/kiid.cpp 2024-09-06 18:28:40.000000000 +0200
+++ kicad-8.0.5/common/kiid.cpp 2024-11-05 11:40:49.030394379 +0100
@@ -25,9 +25,9 @@
#include <kiid.h>
+#include <boost/random/mersenne_twister.hpp>
#include <boost/uuid/uuid_generators.hpp>
#include <boost/uuid/uuid_io.hpp>
-#include <boost/functional/hash.hpp>
#if BOOST_VERSION >= 106700
#include <boost/uuid/entropy_error.hpp>
@@ -235,15 +235,7 @@
size_t KIID::Hash() const
{
- size_t hash = 0;
-
- // Note: this is NOT little-endian/big-endian safe, but as long as it's just used
- // at runtime it won't matter.
-
- for( int i = 0; i < 4; ++i )
- boost::hash_combine( hash, reinterpret_cast<const uint32_t*>( m_uuid.data )[i] );
-
- return hash;
+ return boost::uuids::hash_value( m_uuid );
}

View File

@ -0,0 +1,27 @@
diff '--color=auto' -ur kicad-8.0.5.orig/kicad/project_tree_pane.cpp kicad-8.0.5/kicad/project_tree_pane.cpp
--- kicad-8.0.5.orig/kicad/project_tree_pane.cpp 2024-09-06 18:28:40.000000000 +0200
+++ kicad-8.0.5/kicad/project_tree_pane.cpp 2024-11-05 12:20:14.524026741 +0100
@@ -2240,12 +2240,19 @@
}
git_oid oid;
- // Check if the libgit2 library version is 1.8.0 or higher
-#if( LIBGIT2_VER_MAJOR > 1 ) || ( LIBGIT2_VER_MAJOR == 1 && LIBGIT2_VER_MINOR >= 8 )
- // For libgit2 version 1.8.0 and above
+
+#if ( ( LIBGIT2_VER_MAJOR == 1 \
+ && ( ( LIBGIT2_VER_MINOR == 8 \
+ && ( LIBGIT2_VER_REVISION < 2 || LIBGIT2_VER_REVISION == 3 ) ) \
+ || ( LIBGIT2_VER_MINOR > 8 ) ) ) \
+ || LIBGIT2_VER_MAJOR > 1 )
+ // For libgit2 versions 1.8.0, 1.8.1.
+ // This change was reverted for 1.8.2
+ // This change was re-reverted for 1.8.3
+ // This change was re-re-reverted for 1.8.4+
git_commit* const parents[1] = { parent };
#else
- // For libgit2 versions older than 1.8.0
+ // For libgit2 versions older than 1.8.0, or equal to 1.8.2/1.8.4
const git_commit* parents[1] = { parent };
#endif

View File

@ -0,0 +1,189 @@
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{10..12} )
WX_GTK_VER="3.2-gtk3"
inherit check-reqs cmake flag-o-matic optfeature python-single-r1 toolchain-funcs wxwidgets xdg-utils
DESCRIPTION="Electronic Schematic and PCB design tools"
HOMEPAGE="https://www.kicad.org"
if [[ ${PV} == *9999* ]]; then
EGIT_REPO_URI="https://gitlab.com/kicad/code/kicad.git"
inherit git-r3
else
MY_PV="${PV/_rc/-rc}"
MY_P="${PN}-${MY_PV}"
SRC_URI="https://gitlab.com/kicad/code/${PN}/-/archive/${MY_PV}/${MY_P}.tar.bz2 -> ${P}.tar.bz2"
S="${WORKDIR}/${PN}-${MY_PV}"
if [[ ${PV} != *_rc* ]] ; then
KEYWORDS="~amd64 ~arm64 ~riscv ~x86"
fi
fi
# BSD for bundled pybind
LICENSE="GPL-2+ GPL-3+ Boost-1.0 BSD"
SLOT="0"
IUSE="doc examples nls openmp test"
REQUIRED_USE="${PYTHON_REQUIRED_USE}"
RESTRICT="!test? ( test )"
# Contains bundled pybind but it's patched for wx
# See https://gitlab.com/kicad/code/kicad/-/commit/74e4370a9b146b21883d6a2d1df46c7a10bd0424
# Depend on opencascade:0 to get unslotted variant (so we know path to it), bug #833301
# Depend wxGTK version needs to be limited due to switch from EGL to GLX, bug #911120
COMMON_DEPEND="
app-crypt/libsecret
dev-db/unixODBC
dev-libs/boost:=[context,nls]
dev-libs/libgit2:=
media-libs/freeglut
media-libs/glew:0=
>=media-libs/glm-0.9.9.1
media-libs/mesa[X(+)]
net-misc/curl
>=sci-libs/opencascade-7.5.0:0=
>=x11-libs/cairo-1.8.8:=
>=x11-libs/pixman-0.30
>sci-electronics/ngspice-27[shared]
sys-libs/zlib
>=x11-libs/wxGTK-3.2.2.1-r3:${WX_GTK_VER}[X,opengl]
$(python_gen_cond_dep '
dev-libs/boost:=[context,nls,python,${PYTHON_USEDEP}]
>=dev-python/wxpython-4.2.0:*[${PYTHON_USEDEP}]
')
${PYTHON_DEPS}
nls? (
sys-devel/gettext
)
test? (
media-gfx/cairosvg
)
"
DEPEND="${COMMON_DEPEND}"
RDEPEND="${COMMON_DEPEND}
sci-electronics/electronics-menu
"
BDEPEND=">=dev-lang/swig-4.0
doc? ( app-text/doxygen )"
if [[ ${PV} == 9999 ]] ; then
# x11-misc-util/macros only required on live ebuilds
BDEPEND+=" >=x11-misc/util-macros-1.18"
fi
CHECKREQS_DISK_BUILD="1500M"
PATCHES=(
"${FILESDIR}/${P}"-boost-1.86.patch
"${FILESDIR}/${P}"-libgit2-1.8.4.patch
)
pkg_setup() {
[[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
python-single-r1_pkg_setup
check-reqs_pkg_setup
}
src_unpack() {
if [[ ${PV} == 9999 ]]; then
git-r3_src_unpack
else
default_src_unpack
fi
}
src_prepare() {
filter-lto # Bug 927482
cmake_src_prepare
}
src_configure() {
xdg_environment_reset
local mycmakeargs=(
-DKICAD_DOCS="${EPREFIX}/usr/share/doc/${PN}-doc-${PV}"
-DKICAD_SCRIPTING_WXPYTHON=ON
-DKICAD_USE_EGL=OFF
-DKICAD_BUILD_I18N="$(usex nls)"
-DKICAD_I18N_UNIX_STRICT_PATH="$(usex nls)"
-DPYTHON_DEST="$(python_get_sitedir)"
-DPYTHON_EXECUTABLE="${PYTHON}"
-DPYTHON_INCLUDE_DIR="$(python_get_includedir)"
-DPYTHON_LIBRARY="$(python_get_library_path)"
-DKICAD_INSTALL_DEMOS="$(usex examples)"
-DCMAKE_SKIP_RPATH="ON"
-DOCC_INCLUDE_DIR="${CASROOT}"/include/opencascade
-DOCC_LIBRARY_DIR="${CASROOT}"/$(get_libdir)/opencascade
-DKICAD_SPICE_QA="$(usex test)"
-DKICAD_BUILD_QA_TESTS="$(usex test)"
)
setup-wxwidgets
cmake_src_configure
}
src_compile() {
cmake_src_compile
if use doc; then
cmake_src_compile doxygen-docs
fi
}
src_test() {
# Test cannot find library in Portage's sandbox. Let's create a link so test can run.
mkdir -p "${BUILD_DIR}/qa/eeschema/" || die
ln -s "${BUILD_DIR}/eeschema/_eeschema.kiface" "${BUILD_DIR}/qa/eeschema/_eeschema.kiface" || die
export CMAKE_SKIP_TESTS=(
qa_cli
)
# LD_LIBRARY_PATH is there to help it pick up the just-built libraries
LD_LIBRARY_PATH="${BUILD_DIR}/common:${BUILD_DIR}/common/gal:${BUILD_DIR}/3d-viewer/3d_cache/sg:${LD_LIBRARY_PATH}" \
cmake_src_test
}
src_install() {
cmake_src_install
python_optimize
dodoc doxygen/eagle-plugin-notes.txt
if use doc ; then
cd doxygen || die
dodoc -r out/html/.
fi
}
pkg_postinst() {
optfeature "Component symbols library" sci-electronics/kicad-symbols
optfeature "Component footprints library" sci-electronics/kicad-footprints
optfeature "3D models of components " sci-electronics/kicad-packages3d
optfeature "Project templates" sci-electronics/kicad-templates
optfeature "Extended documentation" app-doc/kicad-doc
optfeature "Creating 3D models of components" media-gfx/wings
xdg_desktop_database_update
xdg_mimeinfo_database_update
xdg_icon_cache_update
}
pkg_postrm() {
xdg_desktop_database_update
xdg_mimeinfo_database_update
xdg_icon_cache_update
}