+# Copyright © 2020 Nick Bowler
+# License GPLv3+: GNU General Public License version 3 or any later version.
+# This is free software: you are free to change and redistribute it.
+# There is NO WARRANTY, to the extent permitted by law.
+
+EAPI=7
+
+PYTHON_COMPAT=( python2_7 )
+
+inherit autotools python-single-r1
+
+MY_P=${P/-python/}
+
+DESCRIPTION="Python plugin support for GIMP"
+HOMEPAGE="https://www.gimp.org/"
+SRC_URI="mirror://gimp/v2.10/$MY_P.tar.bz2"
+
+LICENSE="GPL-3+"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="cpu_flags_ppc_altivec cpu_flags_x86_mmx cpu_flags_x86_sse"
+
+DEPEND="$PYTHON_DEPS
+ >=media-gfx/gimp-$PV
+ $(python_gen_cond_dep '
+ >=dev-python/pycairo-1.0.2:2[${PYTHON_USEDEP}]
+ >=dev-python/pygtk-2.10.4:2[${PYTHON_USEDEP}]')
+ !media-gfx/gimp[python(-)]"
+RDEPEND=$DEPEND
+REQUIRED_USE=$PYTHON_REQUIRED_USE
+
+S=$WORKDIR/$MY_P
+
+src_prepare () {
+ sed -i '/^libgimp/s|[^ ]*/lib\(gimp[^-]*\)-[^ ]*\.la|-l\1-2.0|' \
+ plug-ins/pygimp/Makefile.am
+
+ default
+
+ eautoreconf
+}
+
+src_configure () {
+ local myconf=(
+ GDBUS_CODEGEN="/bin/false"
+ GEGL="$EPREFIX/usr/bin/gegl-0.4"
+
+ $(use_enable cpu_flags_ppc_altivec altivec)
+ $(use_enable cpu_flags_x86_mmx mmx)
+ $(use_enable cpu_flags_x86_sse sse)
+ --enable-python
+ )
+
+ econf "${myconf[@]}"
+}
+
+src_compile () {
+ cd plug-ins/pygimp && emake
+}
+
+src_install () {
+ cd plug-ins/pygimp && emake DESTDIR="$D" install
+ find "$D" -name '*.la' -delete
+}