dev-qt/qtopengl: stable 5.14.2 for ppc, bug #719732
[gentoo.git] / media-gfx / gimp / gimp-2.10.18-r1.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5 PYTHON_COMPAT=( python2_7 )
6 GNOME2_EAUTORECONF=yes
7 WANT_AUTOMAKE=
8
9 inherit autotools gnome2 python-single-r1 virtualx
10
11 DESCRIPTION="GNU Image Manipulation Program"
12 HOMEPAGE="https://www.gimp.org/"
13 SRC_URI="mirror://gimp/v2.10/${P}.tar.bz2"
14 LICENSE="GPL-3 LGPL-3"
15 SLOT="2"
16 KEYWORDS="~alpha amd64 arm64 ~hppa ~ia64 ppc64 ~x86"
17
18 IUSE="aalib alsa aqua debug doc gnome heif jpeg2k mng openexr postscript python udev unwind vector-icons webp wmf xpm cpu_flags_ppc_altivec cpu_flags_x86_mmx cpu_flags_x86_sse"
19 REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
20
21 RESTRICT="!test? ( test )"
22
23 COMMON_DEPEND="
24         >=app-text/poppler-0.50[cairo]
25         >=app-text/poppler-data-0.4.7
26         >=dev-libs/atk-2.2.0
27         >=dev-libs/glib-2.56.0:2
28         >=dev-libs/json-glib-1.2.6
29         dev-libs/libxml2:2
30         dev-libs/libxslt
31         >=gnome-base/librsvg-2.40.6:2
32         >=media-gfx/mypaint-brushes-1.3.0
33         >=media-libs/babl-0.1.74
34         >=media-libs/fontconfig-2.12.4
35         >=media-libs/freetype-2.1.7
36         >=media-libs/gegl-0.4.22:0.4[cairo]
37         >=media-libs/gexiv2-0.10.6
38         >=media-libs/harfbuzz-0.9.19
39         >=media-libs/lcms-2.8:2
40         >=media-libs/libmypaint-1.3.0:=
41         >=media-libs/libpng-1.6.25:0=
42         >=media-libs/tiff-3.5.7:0
43         net-libs/glib-networking[ssl]
44         sys-libs/zlib
45         virtual/jpeg
46         >=x11-libs/cairo-1.12.2
47         >=x11-libs/gdk-pixbuf-2.31:2
48         >=x11-libs/gtk+-2.24.32:2
49         x11-libs/libXcursor
50         >=x11-libs/pango-1.29.4
51         aalib? ( media-libs/aalib )
52         alsa? ( >=media-libs/alsa-lib-1.0.0 )
53         aqua? ( >=x11-libs/gtk-mac-integration-2.0.0 )
54         heif? ( >=media-libs/libheif-1.3.2:= )
55         jpeg2k? ( >=media-libs/openjpeg-2.1.0:2= )
56         mng? ( media-libs/libmng:= )
57         openexr? ( >=media-libs/openexr-1.6.1:= )
58         postscript? ( app-text/ghostscript-gpl )
59         python? (
60                 ${PYTHON_DEPS}
61                 $(python_gen_cond_dep '
62                         >=dev-python/pycairo-1.0.2[${PYTHON_MULTI_USEDEP}]
63                         >=dev-python/pygtk-2.10.4:2[${PYTHON_MULTI_USEDEP}]
64                 ')
65         )
66         udev? ( dev-libs/libgudev:= )
67         unwind? ( >=sys-libs/libunwind-1.1.0:= )
68         webp? ( >=media-libs/libwebp-0.6.0:= )
69         wmf? ( >=media-libs/libwmf-0.2.8 )
70         xpm? ( x11-libs/libXpm )
71 "
72
73 RDEPEND="
74         ${COMMON_DEPEND}
75         x11-themes/hicolor-icon-theme
76         gnome? ( gnome-base/gvfs )
77 "
78
79 DEPEND="
80         ${COMMON_DEPEND}
81         >=dev-lang/perl-5.10.0
82         dev-libs/appstream-glib
83         dev-util/gtk-update-icon-cache
84         >=dev-util/intltool-0.40.1
85         sys-apps/findutils
86         >=sys-devel/gettext-0.19
87         >=sys-devel/libtool-2.2
88         virtual/pkgconfig
89 "
90
91 DOCS=( "AUTHORS" "ChangeLog" "HACKING" "NEWS" "README" "README.i18n" )
92
93 # Bugs 685210 (and duplicate 691070)
94 PATCHES=(
95         "${FILESDIR}/${PN}-2.10_fix_test-appdata.patch"
96 )
97
98 pkg_setup() {
99         use python && python-single-r1_pkg_setup
100 }
101
102 src_prepare() {
103         # Disable system CFLAGS suppressing on SSE{2,4.1} support tests by addition of {SSE2,SSE4_1}_EXTRA_CFLAGS: bug #702554
104         sed -i -e 's:\$intrinsics_save_CFLAGS \$SSE2_EXTRA_CFLAGS:\$SSE2_EXTRA_CFLAGS \$intrinsics_save_CFLAGS:' \
105                 -e 's:\$intrinsics_save_CFLAGS \$SSE4_1_EXTRA_CFLAGS:\$SSE4_1_EXTRA_CFLAGS \$intrinsics_save_CFLAGS:' configure.ac || die
106
107         sed -i -e 's/== "xquartz"/= "xquartz"/' configure.ac || die #494864
108         sed 's:-DGIMP_DISABLE_DEPRECATED:-DGIMP_protect_DISABLE_DEPRECATED:g' -i configure.ac || die #615144
109
110         gnome2_src_prepare  # calls eautoreconf
111
112         sed 's:-DGIMP_protect_DISABLE_DEPRECATED:-DGIMP_DISABLE_DEPRECATED:g' -i configure || die #615144
113         fgrep -q GIMP_DISABLE_DEPRECATED configure || die #615144, self-test
114 }
115
116 _adjust_sandbox() {
117         # Bugs #569738 and #591214
118         local nv
119         for nv in /dev/nvidia-uvm /dev/nvidiactl /dev/nvidia{0..9} ; do
120                 # We do not check for existence as they may show up later
121                 # https://bugs.gentoo.org/show_bug.cgi?id=569738#c21
122                 addwrite "${nv}"
123         done
124
125         addwrite /dev/dri/  # bugs #574038 and #684886
126         addwrite /dev/ati/  # bug #589198
127         addwrite /proc/mtrr  # bug #589198
128 }
129
130 src_configure() {
131         _adjust_sandbox
132
133         local myconf=(
134                 GEGL="${EPREFIX}"/usr/bin/gegl-0.4
135                 GDBUS_CODEGEN="${EPREFIX}"/bin/false
136
137                 --enable-default-binary
138
139                 --disable-check-update
140                 --enable-mp
141                 --with-appdata-test
142                 --with-bug-report-url=https://bugs.gentoo.org/
143                 --with-xmc
144                 --without-libbacktrace
145                 --without-webkit
146                 --without-xvfb-run
147                 $(use_enable cpu_flags_ppc_altivec altivec)
148                 $(use_enable cpu_flags_x86_mmx mmx)
149                 $(use_enable cpu_flags_x86_sse sse)
150                 $(use_enable python)
151                 $(use_enable vector-icons)
152                 $(use_with aalib aa)
153                 $(use_with alsa)
154                 $(use_with !aqua x)
155                 $(use_with heif libheif)
156                 $(use_with jpeg2k jpeg2000)
157                 $(use_with mng libmng)
158                 $(use_with openexr)
159                 $(use_with postscript gs)
160                 $(use_with udev gudev)
161                 $(use_with unwind libunwind)
162                 $(use_with webp)
163                 $(use_with wmf)
164                 $(use_with xpm libxpm)
165         )
166
167         gnome2_src_configure "${myconf[@]}"
168 }
169
170 src_compile() {
171         export XDG_DATA_DIRS="${EPREFIX}"/usr/share  # bug 587004
172         gnome2_src_compile
173 }
174
175 # for https://bugs.gentoo.org/664938
176 _rename_plugins() {
177         einfo 'Renaming plug-ins to not collide with pre-2.10.6 file layout (bug #664938)...'
178         local prepend=gimp-org-
179         (
180                 cd "${ED%/}"/usr/$(get_libdir)/gimp/2.0/plug-ins || exit 1
181                 for plugin_slash in $(ls -d1 */); do
182                     plugin=${plugin_slash%/}
183                     if [[ -f ${plugin}/${plugin} ]]; then
184                         # NOTE: Folder and file name need to match for Gimp to load that plug-in
185                         #       so "file-svg/file-svg" becomes "${prepend}file-svg/${prepend}file-svg"
186                         mv ${plugin}/{,${prepend}}${plugin} || exit 1
187                         mv {,${prepend}}${plugin} || exit 1
188                     fi
189                 done
190         )
191 }
192
193 src_test() {
194         virtx emake check
195 }
196
197 src_install() {
198         gnome2_src_install
199
200         use python && python_optimize
201
202         # Workaround for bug #321111 to give GIMP the least
203         # precedence on PDF documents by default
204         mv "${ED%/}"/usr/share/applications/{,zzz-}gimp.desktop || die
205
206         find "${D}" -name '*.la' -type f -delete || die
207
208         # Prevent dead symlink gimp-console.1 from downstream man page compression (bug #433527)
209         local gimp_app_version=$(get_version_component_range 1-2)
210         mv "${ED%/}"/usr/share/man/man1/gimp-console{-${gimp_app_version},}.1 || die
211
212         # Remove gimp devel-docs html files if user doesn't need it
213         if ! use doc; then
214                 rm -r "${ED%/}"/usr/share/gtk-doc || die
215         fi
216
217         _rename_plugins || die
218 }
219
220 pkg_postinst() {
221         gnome2_pkg_postinst
222 }
223
224 pkg_postrm() {
225         gnome2_pkg_postrm
226 }