summaryrefslogtreecommitdiff
path: root/media-gfx/mypaint
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2020-09-16 09:32:48 +0100
committerV3n3RiX <venerix@redcorelinux.org>2020-09-16 09:32:48 +0100
commit9ee6d97c2883d42f204a533a8bc1f4562df778fb (patch)
treeb690ddc0ca30f1472887edbb0b8313629bfcbbb2 /media-gfx/mypaint
parentb17a3ef12038de50228bade1f05502c74e135321 (diff)
gentoo resync : 16.09.2020
Diffstat (limited to 'media-gfx/mypaint')
-rw-r--r--media-gfx/mypaint/Manifest6
-rw-r--r--media-gfx/mypaint/files/mypaint-2.0.1-GIL-hold.patch112
-rw-r--r--media-gfx/mypaint/files/mypaint-2.0.1-build-system.patch37
-rw-r--r--media-gfx/mypaint/files/mypaint-2.0.1-r1-build-system.patch22
-rw-r--r--media-gfx/mypaint/mypaint-2.0.1-r1.ebuild76
-rw-r--r--media-gfx/mypaint/mypaint-2.0.1.ebuild32
6 files changed, 264 insertions, 21 deletions
diff --git a/media-gfx/mypaint/Manifest b/media-gfx/mypaint/Manifest
index 032578bf8825..f846f2bd9a04 100644
--- a/media-gfx/mypaint/Manifest
+++ b/media-gfx/mypaint/Manifest
@@ -1,6 +1,10 @@
AUX mypaint-1.2.1-json-c-boolean-defs.patch 1189 BLAKE2B 7cc9728fbe01195b0c95bd844592d4fbae29a7a26758d242933ed712b940d8a893cd41bd2987952e2a817208efbffd779e9c39d4dde42d809a1e11de06a234fa SHA512 8e5815c281a6c63c7818f378d0e75a94860dd24ea69e9fff8e5951b05c407f12e2e19fefeaa559476a4dab46c88eab8821eff061e8c8eadd1f3ce150e42563c2
+AUX mypaint-2.0.1-GIL-hold.patch 5153 BLAKE2B 3d70b414bfb6396fffb9ebfc9c1fe6791878a97a999355b103fd848993172049db7f97f81d96e253294b9629a2a5dfe7c6710f29561f45b89f4fb26d4cf9a788 SHA512 aa64bb4ffb907516af811bb8ef4c0bccce9b785f94e0d71a44be30e7c96ea3a35dcceeac618956bf11c9d2c5c4e05524c8492ed14967148e2d6b9646b1ed5c15
+AUX mypaint-2.0.1-build-system.patch 1141 BLAKE2B c888061735a4297ec93343a1cb41582774c1a84a642095992b043e459c11c8222f21e1b041c67e345fdc61e194bdf58b6a21daaa00d12263354740330283f8c3 SHA512 55d7c826fc955459d7089baaf31cd4b3a38d0a6b7bdcff64f88e406dd152d4d40344bbff0dbd297f5dfc65a6cc8bd6d0dc06d5c57d8e8dda03b4c42e709a2142
+AUX mypaint-2.0.1-r1-build-system.patch 638 BLAKE2B 8e0209eb8fdba535cb8c0075e183681b0d8f8a11613cf7c3d2ddb5e20954d6c95da3ef3824063ac55bb11feda38cdf00eb8190cf76ca7753d2432d870926194b SHA512 8c088a089408542f57ef0fb608a63ae6fa0cce5392cb309376198813d35f5c3e54466945419984973af77e11f5bc4908961b5e81982a32fbef04c081df1b0349
DIST mypaint-1.2.1.tar.xz 37897196 BLAKE2B 2d8f6b03f710febae1c2d617a6e542543786be384585ae8a973604da2eba8a0fb770d185aa3d2dfc6f794adf29ffb9c217356a96ab27d677ebb57816f62fae9c SHA512 1783765e495b9535669a83a29d27ba684e6201fdfe0875bdd2c167b1dab8af05993b19025767fe0b2770ed9e578e4709f75d8a4820ac945812cba85609f9eb9b
DIST mypaint-2.0.1.tar.xz 7295048 BLAKE2B 813a939f95ea6887c57d8c0868e33e9bc8b1b95746d5ecd793d4fd13a32198ee5a445cfdd2691a15e944bfb0099d6ac624dff320ae29465db5b1e0d197bedb30 SHA512 449beddcc6da5d720c9efbeac94a466ed0057bd1962d42ebb419190e8b7fd8ffd341327408467fc5da47920f9d0da1fd6d78233a0dda88de5f5d52d53d9ab562
EBUILD mypaint-1.2.1-r5.ebuild 2016 BLAKE2B 0a00318c334adc4c97021ca1e52cb089075b1db667f0ad431fcf758345756d7d3558e50a353c8578d5749172ea4bbe396a99041c026cecce6174cb7cc6e4caf3 SHA512 5b1a703cf2efb5e0d729315ea092c58954975dedc177472467f03726956211b34744018cb3ef730f4b5a8ff2053f30218f838609ef225dd05eab21f5d8a683d8
-EBUILD mypaint-2.0.1.ebuild 1561 BLAKE2B b007519875279d38483c18cc383cbef204c138ac1b9a9b876262a9d89fefd5916f79696baee97e457de35d12ecfe1a6eae8815ea1fe4b0600a2e35cab184fcd3 SHA512 7e64726112465bd52a907700ba5db4f1acbbc04e8f9599a772694850ba29e1523bc170943380cb6a1fb5abd943f87e1e8a4b2c2e2650c5b1b81af70bff68e08f
+EBUILD mypaint-2.0.1-r1.ebuild 1793 BLAKE2B a8b15a6f608d1d20ddf4844074a746905a163fdc3e1083defe8b176a7f281f8480b50282dfb3bb203176731fbf44ea816d6dcf04858330462e425a78fcfbb9c1 SHA512 da6d1c0291c169758b9524b0c752586b78702fda147b077bbee5368b6898fb3ee533c5a4e341e0e143cefc5b77fc25b4f93c0be9dc70ef0f7258a563d1cd7bcd
+EBUILD mypaint-2.0.1.ebuild 1555 BLAKE2B f9ec58013d9adbea0c569fc915659abd6c96e5cd943f85d935b04bc697fc3ad8549e3f1c42d8ae86b4fa12b552e32c71f65c34ccdf1140762231d0da0fed803f SHA512 87d5098d2460b8fb002c87116216885779e72107e262dc8910ce9a69fc85424028ad740339d92750e9f9524ab3fe45545ac3c0a4644ad26e1f6a64eb15305078
MISC metadata.xml 247 BLAKE2B 3a8d267e6befd2f46c41982b7196470f32b4fcf5dc6a42ead10b13e81bdcb7975ea998a51d0deb2c3c1a49f00b5f9216d8e43ad7e6dd0aea0f3352b19532d0a0 SHA512 21b957bb801d29dfed1d0aeceac553c9ba039a7fe94ebf899e7ab5c3316bbad116c7bd63a07ccbbb8277d2ce19f27b964499d2ccd942028290519e465e989dbb
diff --git a/media-gfx/mypaint/files/mypaint-2.0.1-GIL-hold.patch b/media-gfx/mypaint/files/mypaint-2.0.1-GIL-hold.patch
new file mode 100644
index 000000000000..7fbf6ef9f265
--- /dev/null
+++ b/media-gfx/mypaint/files/mypaint-2.0.1-GIL-hold.patch
@@ -0,0 +1,112 @@
+https://github.com/mypaint/mypaint/issues/1107
+https://bugs.gentoo.org/739122
+https://github.com/mypaint/mypaint/commit/356716e7bacfcbb1f3ab80171fea405fdd10b2b9.patch
+----
+From 356716e7bacfcbb1f3ab80171fea405fdd10b2b9 Mon Sep 17 00:00:00 2001
+From: Red Rozenglass <rozenglass@protonmail.com>
+Date: Fri, 11 Sep 2020 02:43:49 +0300
+Subject: [PATCH] Acquire/release the GIL while processing tile requests
+
+Fixes crashes on some Linux distros, potentially improves performance.
+
+When handling tile requests we currently use an openmp critical block in a
+callback registered with libmypaint. The callback calls into Python code
+without locking the GIL. This sometimes crashes mypaint in numpy's memory
+cache allocator on some Linux distros that compile numpy with run-time
+asserts (without `-DNDEBUG`), like Gentoo, as numpy uses Python's GIL
+internally as a locking mechanism for its non-thread-safe global cache
+management.
+
+Acquiring the GIL in the C callback, before calling into Python, ensures
+that the GIL is still locked by the current thread when it reaches numpy's
+code, and thus prevents the crashes. We yield the GIL whenever Python code
+calls again into libmypaint, This allows other threads to acquire it, and
+concurrent callbacks to run, which prevents deadlocks that would otherwise
+happen while waiting for all the callbacks to finish on Python's side. When
+libmypaint is done we re-acquire the GIL, and return up to the callback
+where the GIL is released again after some Python reference count
+bookkeeping.
+
+The OpenMP critical block is no longer necessary after introducing the GIL
+locking mechanism. This would potentially improve performance as the C code
+in libmypaint can process multiple callbacks at the same time during the
+`Py_BEGIN_ALLOW_THREADS' period that yields the GIL.
+---
+ lib/brush.hpp | 16 ++++++++++++++--
+ lib/pythontiledsurface.cpp | 7 +++++--
+ lib/tiledsurface.hpp | 4 +++-
+ 3 files changed, 22 insertions(+), 5 deletions(-)
+
+diff --git a/lib/brush.hpp b/lib/brush.hpp
+index f717a42df..0db455377 100644
+--- a/lib/brush.hpp
++++ b/lib/brush.hpp
+@@ -66,13 +66,25 @@ class Brush {
+ bool stroke_to (Surface * surface, float x, float y, float pressure, float xtilt, float ytilt, double dtime, float viewzoom, float viewrotation, float barrel_rotation)
+ {
+ MyPaintSurface2 *c_surface = surface->get_surface2_interface();
+- return mypaint_brush_stroke_to_2(c_brush, c_surface, x, y, pressure, xtilt, ytilt, dtime, viewzoom, viewrotation, barrel_rotation);
++ bool stroke_finished_or_empty;
++
++ Py_BEGIN_ALLOW_THREADS
++ stroke_finished_or_empty = mypaint_brush_stroke_to_2(c_brush, c_surface, x, y, pressure, xtilt, ytilt, dtime, viewzoom, viewrotation, barrel_rotation);
++ Py_END_ALLOW_THREADS
++
++ return stroke_finished_or_empty;
+ }
+
+ bool stroke_to_linear (Surface * surface, float x, float y, float pressure, float xtilt, float ytilt, double dtime, float viewzoom, float viewrotation, float barrel_rotation)
+ {
+ MyPaintSurface2 *c_surface = surface->get_surface2_interface();
+- return mypaint_brush_stroke_to_2_linearsRGB(c_brush, c_surface, x, y, pressure, xtilt, ytilt, dtime, viewzoom, viewrotation, barrel_rotation);
++ bool stroke_finished_or_empty;
++
++ Py_BEGIN_ALLOW_THREADS
++ stroke_finished_or_empty = mypaint_brush_stroke_to_2_linearsRGB(c_brush, c_surface, x, y, pressure, xtilt, ytilt, dtime, viewzoom, viewrotation, barrel_rotation);
++ Py_END_ALLOW_THREADS
++
++ return stroke_finished_or_empty;
+ }
+
+ double get_total_stroke_painting_time()
+diff --git a/lib/pythontiledsurface.cpp b/lib/pythontiledsurface.cpp
+index 46c515c99..2c6e773db 100644
+--- a/lib/pythontiledsurface.cpp
++++ b/lib/pythontiledsurface.cpp
+@@ -36,8 +36,9 @@ tile_request_start(MyPaintTiledSurface2 *tiled_surface, MyPaintTileRequest *requ
+ const int ty = request->ty;
+ PyArrayObject* rgba = NULL;
+
+-#pragma omp critical
+ {
++ PyGILState_STATE gstate = PyGILState_Ensure();
++
+ rgba = (PyArrayObject*)PyObject_CallMethod(self->py_obj, "_get_tile_numpy", "(iii)", tx, ty, readonly);
+ if (rgba == NULL) {
+ request->buffer = NULL;
+@@ -59,7 +60,9 @@ tile_request_start(MyPaintTiledSurface2 *tiled_surface, MyPaintTileRequest *requ
+ Py_DECREF((PyObject *)rgba);
+ request->buffer = (uint16_t*)PyArray_DATA(rgba);
+ }
+-} // #end pragma opt critical
++
++ PyGILState_Release(gstate);
++}
+
+
+ }
+diff --git a/lib/tiledsurface.hpp b/lib/tiledsurface.hpp
+index 3a6b2e61d..d1a5d1307 100644
+--- a/lib/tiledsurface.hpp
++++ b/lib/tiledsurface.hpp
+@@ -66,7 +66,9 @@ class TiledSurface : public Surface {
+ MyPaintRectangle* rects = this->bbox_rectangles;
+ MyPaintRectangles bboxes = {BBOXES, rects};
+
+- mypaint_surface2_end_atomic((MyPaintSurface2 *)c_surface, &bboxes);
++ Py_BEGIN_ALLOW_THREADS
++ mypaint_surface2_end_atomic((MyPaintSurface2 *)c_surface, &bboxes);
++ Py_END_ALLOW_THREADS
+
+ // The capacity of the bounding box array will most often exceed the number
+ // of rectangles that are actually used. The call to mypaint_surface_end_atomic
diff --git a/media-gfx/mypaint/files/mypaint-2.0.1-build-system.patch b/media-gfx/mypaint/files/mypaint-2.0.1-build-system.patch
new file mode 100644
index 000000000000..c7806e7119dc
--- /dev/null
+++ b/media-gfx/mypaint/files/mypaint-2.0.1-build-system.patch
@@ -0,0 +1,37 @@
+diff --git a/setup.py b/setup.py
+index 670df4d..703f9d2 100644
+--- a/setup.py
++++ b/setup.py
+@@ -471,9 +471,6 @@ class BuildExt (build_ext):
+ linkflags.extend([
+ "-O0",
+ ])
+- else:
+- linkflags.append("-O3")
+- ccflags.append("-O3")
+
+ return build_ext.build_extension(self, ext)
+
+@@ -869,7 +866,6 @@ def get_ext_modules():
+ '-Wno-write-strings',
+ '-D_POSIX_C_SOURCE=200809L',
+ "-DNO_TESTS", # FIXME: we're building against shared libmypaint now
+- '-g', # always include symbols, for profiling
+ ]
+ extra_link_args = []
+
+diff --git a/setup.py b/setup.py
+index 703f9d2..cc8abbd 100644
+--- a/setup.py
++++ b/setup.py
+@@ -456,10 +456,6 @@ class BuildExt (build_ext):
+ ccflags = ext.extra_compile_args
+ linkflags = ext.extra_link_args
+
+- if sys.platform != "darwin" and not self.disable_openmp:
+- linkflags.append(OPENMP_CFLAG)
+- ccflags.append(OPENMP_LDFLAG)
+-
+ if self.debug:
+ skip = ["-DNDEBUG"]
+ ccflags[:] = [f for f in ccflags if f not in skip]
diff --git a/media-gfx/mypaint/files/mypaint-2.0.1-r1-build-system.patch b/media-gfx/mypaint/files/mypaint-2.0.1-r1-build-system.patch
new file mode 100644
index 000000000000..63a7a5bf75ed
--- /dev/null
+++ b/media-gfx/mypaint/files/mypaint-2.0.1-r1-build-system.patch
@@ -0,0 +1,22 @@
+diff --git a/setup.py b/setup.py
+index 670df4d..703f9d2 100644
+--- a/setup.py
++++ b/setup.py
+@@ -471,9 +471,6 @@ class BuildExt (build_ext):
+ linkflags.extend([
+ "-O0",
+ ])
+- else:
+- linkflags.append("-O3")
+- ccflags.append("-O3")
+
+ return build_ext.build_extension(self, ext)
+
+@@ -869,7 +866,6 @@ def get_ext_modules():
+ '-Wno-write-strings',
+ '-D_POSIX_C_SOURCE=200809L',
+ "-DNO_TESTS", # FIXME: we're building against shared libmypaint now
+- '-g', # always include symbols, for profiling
+ ]
+ extra_link_args = []
+
diff --git a/media-gfx/mypaint/mypaint-2.0.1-r1.ebuild b/media-gfx/mypaint/mypaint-2.0.1-r1.ebuild
new file mode 100644
index 000000000000..9cc5552420b7
--- /dev/null
+++ b/media-gfx/mypaint/mypaint-2.0.1-r1.ebuild
@@ -0,0 +1,76 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{6,7,8,9} )
+DISTUTILS_SINGLE_IMPL=1
+
+inherit desktop distutils-r1 xdg
+
+DESCRIPTION="Fast and easy graphics application for digital painters"
+HOMEPAGE="http://mypaint.org/"
+SRC_URI="https://github.com/mypaint/${PN}/releases/download/v${PV}/${P}.tar.xz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="openmp"
+LANGS="cs de en_CA en_GB es fr hu id it ja ko nb nn_NO pl pt_BR ro ru sl sv uk zh_CN zh_TW"
+
+BDEPEND="
+ ${PYTHON_DEPS}
+ dev-lang/swig
+ sys-devel/gettext
+ virtual/pkgconfig
+"
+RDEPEND="
+ ${PYTHON_DEPS}
+ $(python_gen_cond_dep '
+ dev-python/pygobject:3[${PYTHON_USEDEP}]
+ dev-python/numpy[${PYTHON_USEDEP}]
+ >=dev-python/pycairo-1.4[${PYTHON_USEDEP}]
+ dev-python/protobuf-python[${PYTHON_USEDEP}]
+ ')
+ >=dev-libs/json-c-0.11:=
+ gnome-base/librsvg
+ media-gfx/mypaint-brushes:2.0
+ media-libs/lcms:2
+ >=media-libs/libmypaint-1.5.0[openmp?]
+ media-libs/libpng:0=
+ sys-devel/gettext
+ sys-libs/libomp
+ x11-libs/gtk+:3
+"
+DEPEND="${RDEPEND}"
+
+PATCHES=(
+ "${FILESDIR}/${PN}-2.0.1-r1-build-system.patch"
+ "${FILESDIR}/${P}-GIL-hold.patch"
+)
+
+distutils_enable_tests setup.py
+
+src_compile() {
+ # --disable-openmp can't be passed to setup.py build,
+ # only setup.py build_ext.
+ # Trying to call build_ext then build and such fails.
+ #
+ # We just override the environment instead for simplicity.
+ local openmp=$(usex openmp '-fopenmp' '-fno-openmp')
+
+ OPENMP_CFLAG="${openmp}" OPENMP_LDFLAG="${openmp}" distutils-r1_src_compile
+}
+
+src_install() {
+ distutils-r1_src_install
+
+ newicon pixmaps/${PN}_logo.png ${PN}.png
+
+ local lang=
+ for lang in ${LANGS}; do
+ if ! has ${lang} ${LINGUAS}; then
+ rm -rf "${ED}"/usr/share/locale/${lang} || die
+ fi
+ done
+}
diff --git a/media-gfx/mypaint/mypaint-2.0.1.ebuild b/media-gfx/mypaint/mypaint-2.0.1.ebuild
index cb35547d5db7..1ca2e261568c 100644
--- a/media-gfx/mypaint/mypaint-2.0.1.ebuild
+++ b/media-gfx/mypaint/mypaint-2.0.1.ebuild
@@ -4,10 +4,11 @@
EAPI=7
PYTHON_COMPAT=( python3_{7,8,9} )
+DISTUTILS_SINGLE_IMPL=1
-inherit desktop distutils-r1 gnome2-utils xdg xdg-utils
+inherit desktop distutils-r1 xdg
-DESCRIPTION="fast and easy graphics application for digital painters"
+DESCRIPTION="Fast and easy graphics application for digital painters"
HOMEPAGE="http://mypaint.org/"
SRC_URI="https://github.com/mypaint/${PN}/releases/download/v${PV}/${P}.tar.xz"
@@ -18,6 +19,7 @@ KEYWORDS="~amd64 ~x86"
LANGS="cs de en_CA en_GB es fr hu id it ja ko nb nn_NO pl pt_BR ro ru sl sv uk zh_CN zh_TW"
BDEPEND="
+ ${PYTHON_DEPS}
dev-lang/swig
sys-devel/gettext
virtual/pkgconfig
@@ -42,12 +44,17 @@ RDEPEND="
"
DEPEND="${RDEPEND}"
-# Need to poke at failing tests
-# Dying on a numpy assert
-RESTRICT="test"
+PATCHES=(
+ "${FILESDIR}/${PN}-2.0.1-build-system.patch"
+)
distutils_enable_tests setup.py
+# TODO: Allow openmp support (patched out)
+# There's no urgency on this given that it currently
+# breaks runtime use [0]
+# [0] https://github.com/mypaint/mypaint/issues/1107.
+
src_install() {
distutils-r1_src_install
@@ -60,18 +67,3 @@ src_install() {
fi
done
}
-
-pkg_preinst() {
- xdg_pkg_preinst
- gnome2_icon_savelist
-}
-
-pkg_postinst() {
- xdg_pkg_postinst
- xdg_icon_cache_update
-}
-
-pkg_postrm() {
- xdg_pkg_postrm
- xdg_mimeinfo_database_update
-}