Gentoo Archives: gentoo-commits

From: Marek Szuba <marecki@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: media-gfx/gmic/files/, media-gfx/gmic/
Date: Thu, 01 Sep 2022 14:54:46
Message-Id: 1662044078.acb79ff2418e54589a4c3d0eebed048054e27889.marecki@gentoo
1 commit: acb79ff2418e54589a4c3d0eebed048054e27889
2 Author: Marek Szuba <marecki <AT> gentoo <DOT> org>
3 AuthorDate: Thu Sep 1 14:53:35 2022 +0000
4 Commit: Marek Szuba <marecki <AT> gentoo <DOT> org>
5 CommitDate: Thu Sep 1 14:54:38 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=acb79ff2
7
8 media-gfx/gmic: add 3.1.6
9
10 Signed-off-by: Marek Szuba <marecki <AT> gentoo.org>
11
12 media-gfx/gmic/Manifest | 1 +
13 .../gmic/files/gmic-3.1.6-makefile_automagic.patch | 131 ++++++++++++++++++++
14 .../gmic/files/gmic-3.1.6-relative_rpath.patch | 11 ++
15 media-gfx/gmic/gmic-3.1.6.ebuild | 136 +++++++++++++++++++++
16 4 files changed, 279 insertions(+)
17
18 diff --git a/media-gfx/gmic/Manifest b/media-gfx/gmic/Manifest
19 index 12e056f95844..faa5c8711243 100644
20 --- a/media-gfx/gmic/Manifest
21 +++ b/media-gfx/gmic/Manifest
22 @@ -1 +1,2 @@
23 DIST gmic_3.0.1.tar.gz 10457923 BLAKE2B b495d10237abf5abe3d7df166119d2fc0b04142975d97db01ab0c5aa177f6e681931799fb392844e5c34d0503874a16d946a7146c5152cca1e64107948c02c03 SHA512 4bc08a3510e8987eea0463bfcf04de6dfd9a8ee8a38c14661ff201b8f563cab1b914dc60dc35b082cb5e868eb6232e2240a2d6703e0751215a82d6709236946a
24 +DIST gmic_3.1.6.tar.gz 10843311 BLAKE2B c50bcb9bd6c3d7d68a06f72faf0061d22b37c6fa357b40c16963c16a8841dba5ee8cf4509076a6734bb4eedbddfa2870897cb30687715ee6d7d84f2520700c17 SHA512 7d1ab97e8dfdf75b647cb7248eaa153e3ebcd5d1b799c67a6e027a5e2e8746047d348ea8e25485aed615d62f485dd06895fe6234f67a055cab423997b96f9775
25
26 diff --git a/media-gfx/gmic/files/gmic-3.1.6-makefile_automagic.patch b/media-gfx/gmic/files/gmic-3.1.6-makefile_automagic.patch
27 new file mode 100644
28 index 000000000000..8dbe50d6e194
29 --- /dev/null
30 +++ b/media-gfx/gmic/files/gmic-3.1.6-makefile_automagic.patch
31 @@ -0,0 +1,131 @@
32 +Includes the OpenEXR3 patch as well as support for building with USE=-X,
33 +as the relevant lines are deeply embedded in the automagic stuff.
34 +
35 +--- a/src/Makefile
36 ++++ b/src/Makefile
37 +@@ -226,8 +226,10 @@
38 +
39 + # Enable parallelization in CImg, using OpenMP.
40 + # (http://www.openmp.org/)
41 ++ifeq ($(GMIC_USE_OPENMP),yes)
42 + OPENMP_CFLAGS = -fopenmp -Dcimg_use_openmp
43 + OPENMP_LIBS = -lgomp
44 ++endif
45 +
46 + # Enable software debugging.
47 + # (Use address sanitizer and thus slows down the code)
48 +@@ -249,9 +251,13 @@
49 + # Enable image display, using X11 (Unix).
50 + # (Keep /usr/ dirname here since X11 is located in /usr/ on Mac too)
51 + ifneq ($(OS),Darwin)
52 ++ifeq ($(GMIC_USE_X11),yes)
53 + X11_CFLAGS = -Dcimg_display=1 $(shell pkg-config --cflags x11 || echo -I/usr/X11R6/include) #-Dcimg_use_xrandr
54 + X11_LIBS = $(shell pkg-config --libs x11 || echo -L/usr/X11R6/lib -lX11) -lpthread # $(shell pkg-config --libs xrandr || echo -lXrandr)
55 + else
56 ++X11_CFLAGS = -Dcimg_display=0
57 ++endif
58 ++else
59 + ifeq (,$(wildcard /usr/X11))
60 + X11_CFLAGS = -Dcimg_display=0 #-Dcimg_use_xrandr
61 + X11_LIBS = -lpthread # $(shell pkg-config --libs xrandr || echo -lXrandr)
62 +@@ -263,8 +269,10 @@
63 +
64 + # Enable faster X11 display, using XShm extension.
65 + # (ftp://www.x.org/pub/X11R7.7/doc/man/man3/XShm.3.xhtml)
66 ++ifeq ($(GMIC_USE_XSHM),yes)
67 + XSHM_CFLAGS = -Dcimg_use_xshm $(shell pkg-config --cflags xcb-shm)
68 + XSHM_LIBS = $(shell pkg-config --libs xcb-shm || echo -L$(USR)/X11R6/lib) -lXext
69 ++endif
70 +
71 + # Enable image display, using GDI32 (Windows).
72 + GDI32_CFLAGS = -Dcimg_display=2
73 +@@ -273,8 +281,10 @@
74 + # Enable native support of PNG image files, using the PNG library.
75 + # (http://www.libpng.org/pub/png/libpng.html)
76 + ifneq ($(OS),Darwin)
77 ++ifeq ($(GMIC_USE_PNG),yes)
78 + PNG_CFLAGS = -Dcimg_use_png $(shell pkg-config --cflags libpng)
79 + PNG_LIBS = $(shell pkg-config --libs libpng || echo -lpng -lz)
80 ++endif
81 + else
82 + ifeq (,$(wildcard /tmp/skl))
83 + PNG_CFLAGS = -Dcimg_use_png $(shell pkg-config --cflags libpng)
84 +@@ -287,56 +297,76 @@
85 +
86 + # Enable native support of JPEG image files, using the JPEG library.
87 + # (http://libjpeg.sourceforge.net/)
88 ++ifeq ($(GMIC_USE_JPEG),yes)
89 + JPEG_CFLAGS = -Dcimg_use_jpeg $(shell pkg-config --cflags libjpeg)
90 + JPEG_LIBS = $(shell pkg-config --libs libjpeg || echo -ljpeg)
91 ++endif
92 +
93 + # Enable native support of TIFF image files, using the TIFF library.
94 + # (http://www.libtiff.org/)
95 ++ifeq ($(GMIC_USE_TIFF),yes)
96 + TIFF_CFLAGS = -Dcimg_use_tiff $(shell pkg-config --cflags libtiff-4)
97 + TIFF_LIBS = $(shell pkg-config --libs libtiff-4 || echo -ltiff)
98 ++endif
99 +
100 + # Enable native support for loading HEIC/AVIF image files, using the libheif library.
101 + # ( https://github.com/strukturag/libheif )
102 ++ifeq ($(GMIC_USE_HEIF),yes)
103 + HEIF_CFLAGS = -Dcimg_use_heif
104 + HEIF_LIBS = -lheif
105 ++endif
106 +
107 + # Enable native support of MINC2 image files, using the MINC2 library.
108 + # ( http://en.wikibooks.org/wiki/MINC/Reference/MINC2.0_Users_Guide )
109 ++ifeq ($(GMIC_USE_MINC2),yes)
110 + MINC2_CFLAGS = -Dcimg_use_minc2 -I${HOME}/local/include
111 + MINC2_LIBS = -lminc_io -lvolume_io2 -lminc2 -lnetcdf -lhdf5 -lz -L${HOME}/local/lib
112 ++endif
113 +
114 + # Enable native support for downloading files from the network.
115 + # ( http://curl.haxx.se/libcurl/ )
116 ++ifeq ($(GMIC_USE_CURL),yes)
117 + CURL_CFLAGS = -Dcimg_use_curl $(shell pkg-config --cflags libcurl)
118 + CURL_LIBS = $(shell pkg-config --libs libcurl || echo -lcurl)
119 ++endif
120 +
121 + # Enable native support of webcams and video streaming, using the OpenCV library.
122 + # (https://opencv.org/)
123 ++ifeq ($(GMIC_USE_OPENCV),yes)
124 + OPENCV_CFLAGS = -Dcimg_use_opencv $(shell pkg-config opencv --cflags) -I/usr/include/opencv -I/usr/include/opencv4
125 + OPENCV_LIBS = $(shell pkg-config opencv --libs || echo -lopencv_core -lopencv_highgui -lopencv_videoio)
126 ++endif
127 +
128 + # Enable support of most classical image file formats, using the GraphicsMagick++ library.
129 + # (http://www.graphicsmagick.org/Magick++/)
130 ++ifeq ($(GMIC_USE_GRAPHICSMAGICK),yes)
131 + MAGICK_CFLAGS = -Dcimg_use_magick $(shell pkg-config --cflags GraphicsMagick++ || echo -I$(USR)/$(INCLUDE)/GraphicsMagick)
132 + MAGICK_LIBS = $(shell pkg-config --libs GraphicsMagick++ || echo -lGraphicsMagick++)
133 ++endif
134 +
135 + # Enable native support of EXR image files, using the OpenEXR library.
136 + # (http://www.openexr.com/)
137 +-OPENEXR_CFLAGS = -Dcimg_use_openexr $(shell pkg-config --cflags OpenEXR || echo -I$(USR)/$(INCLUDE)/OpenEXR)
138 +-OPENEXR_LIBS = $(shell pkg-config --libs OpenEXR || echo -lIlmImf -lHalf)
139 ++ifeq ($(GMIC_USE_EXR),yes)
140 ++OPENEXR_CFLAGS = -Dcimg_use_openexr $(shell pkg-config --cflags OpenEXR || echo -I$(USR)/$(INCLUDE)/OpenEXR -I$(USR)/$(INCLUDE)/Imath)
141 ++OPENEXR_LIBS = $(shell pkg-config --libs OpenEXR || echo -lOpenEXR -lImath)
142 ++endif
143 +
144 + # Enable Fast Fourier Transforms, using the FFTW3 library.
145 + # (http://www.fftw.org/)
146 ++ifeq ($(GMIC_USE_FFTW),yes)
147 + FFTW_CFLAGS = -Dcimg_use_fftw3 $(shell pkg-config --cflags fftw3)
148 + FFTW_LIBS = $(shell pkg-config --libs fftw3 || echo -lfftw3)
149 + ifneq ($(OS),Windows)
150 + FFTW_LIBS += -lfftw3_threads
151 + endif
152 ++endif
153 +
154 + # Enable native support of the BOARD library.
155 + # (https://github.com/c-koi/libboard)
156 ++ifeq ($(GMIC_USE_BOARD),yes)
157 + BOARD_CFLAGS = -Dcimg_use_board
158 + BOARD_LIBS = -lboard
159 ++endif
160 +
161 + GMIC_STD_CFLAGS = $(MANDATORY_CFLAGS) $(ABORT_CFLAGS) $(PARALLEL_CFLAGS) $(FFTW_CFLAGS) $(CURL_CFLAGS) $(PNG_CFLAGS) $(JPEG_CFLAGS) $(TIFF_CFLAGS)
162 + GMIC_STD_LIBS = $(MANDATORY_LIBS) $(PARALLEL_LIBS) $(FFTW_LIBS) $(CURL_LIBS) $(PNG_LIBS) $(JPEG_LIBS) $(TIFF_LIBS)
163
164 diff --git a/media-gfx/gmic/files/gmic-3.1.6-relative_rpath.patch b/media-gfx/gmic/files/gmic-3.1.6-relative_rpath.patch
165 new file mode 100644
166 index 000000000000..e2da793f31a8
167 --- /dev/null
168 +++ b/media-gfx/gmic/files/gmic-3.1.6-relative_rpath.patch
169 @@ -0,0 +1,11 @@
170 +--- a/src/Makefile
171 ++++ b/src/Makefile
172 +@@ -187,7 +187,7 @@
173 + ifndef NO_SRIPDLIB
174 + MANDATORY_CFLAGS += -std=c++11 -pedantic
175 + endif
176 +-MANDATORY_LIBS += -L. -L$(USR)/$(LIB) -Wl,-rpath,.
177 ++MANDATORY_LIBS += -L. -L$(USR)/$(LIB)
178 + ifdef IS_GCC
179 + MANDATORY_CFLAGS += -Wall -Wextra -Wfatal-errors -Werror=unknown-pragmas -Werror=unused-label
180 + GCC_VER_GTEQ5 = $(shell expr `$(CXX) -dumpversion | cut -f1 -d.` \>= 5)
181
182 diff --git a/media-gfx/gmic/gmic-3.1.6.ebuild b/media-gfx/gmic/gmic-3.1.6.ebuild
183 new file mode 100644
184 index 000000000000..06ca0c8a4cc3
185 --- /dev/null
186 +++ b/media-gfx/gmic/gmic-3.1.6.ebuild
187 @@ -0,0 +1,136 @@
188 +# Copyright 1999-2022 Gentoo Authors
189 +# Distributed under the terms of the GNU General Public License v2
190 +
191 +EAPI=8
192 +
193 +inherit bash-completion-r1 toolchain-funcs
194 +
195 +if [[ ${PV} == "9999" ]]; then
196 + EGIT_REPO_URI="https://github.com/dtschump/gmic.git"
197 + inherit git-r3
198 +else
199 + SRC_URI="https://gmic.eu/files/source/${PN}_${PV}.tar.gz"
200 + KEYWORDS="~amd64 ~arm64 ~ppc64 ~riscv ~x86"
201 +fi
202 +
203 +DESCRIPTION="GREYC's Magic Image Converter"
204 +HOMEPAGE="https://gmic.eu/ https://github.com/dtschump/gmic"
205 +
206 +LICENSE="CeCILL-2 GPL-3"
207 +SLOT="0"
208 +IUSE="cli curl ffmpeg fftw gimp graphicsmagick jpeg opencv openexr openmp png qt5 tiff X"
209 +REQUIRED_USE="
210 + gimp? ( png fftw X )
211 + qt5? ( png fftw X )
212 +"
213 +
214 +MIN_QT_VER="5.2.0"
215 +QT_DEPEND="
216 + >=dev-qt/qtcore-${MIN_QT_VER}:5
217 + >=dev-qt/qtgui-${MIN_QT_VER}:5
218 + >=dev-qt/qtnetwork-${MIN_QT_VER}:5
219 + >=dev-qt/qtwidgets-${MIN_QT_VER}:5
220 +"
221 +DEPEND="
222 + sys-libs/zlib:0=
223 + curl? ( net-misc/curl )
224 + fftw? ( sci-libs/fftw:3.0=[threads] )
225 + gimp? (
226 + media-gfx/gimp:0/2
227 + ${QT_DEPEND}
228 + )
229 + graphicsmagick? ( media-gfx/graphicsmagick:0= )
230 + jpeg? ( media-libs/libjpeg-turbo:= )
231 + opencv? ( >=media-libs/opencv-2.3.1a-r1:0= )
232 + openexr? (
233 + dev-libs/imath:=
234 + media-libs/openexr:=
235 + )
236 + png? ( media-libs/libpng:0= )
237 + qt5? ( ${QT_DEPEND} )
238 + tiff? ( media-libs/tiff:0 )
239 + X? (
240 + x11-libs/libX11
241 + x11-libs/libXext
242 + )"
243 +RDEPEND="${DEPEND}
244 + ffmpeg? ( media-video/ffmpeg:0= )
245 +"
246 +BDEPEND="
247 + virtual/pkgconfig
248 + gimp? (
249 + dev-qt/linguist-tools:5
250 + media-gfx/gimp:0/2
251 + )
252 + qt5? ( dev-qt/linguist-tools:5 )
253 +"
254 +
255 +PATCHES=(
256 + "${FILESDIR}"/${PN}-3.1.6-makefile_automagic.patch
257 + "${FILESDIR}"/${PN}-3.1.6-relative_rpath.patch
258 +)
259 +
260 +pkg_pretend() {
261 + [[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
262 +}
263 +
264 +pkg_setup() {
265 + [[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
266 +}
267 +
268 +gmic_emake() {
269 + emake -j1 -C src \
270 + CC="$(tc-getCC)" \
271 + CXX="$(tc-getCXX)" \
272 + STRIP="/bin/true" \
273 + LIB="$(get_libdir)" \
274 + OPT_CFLAGS="${CXXFLAGS}" \
275 + OPT_LIBS="${LDFLAGS}" \
276 + GMIC_USE_CURL=$(usex curl) \
277 + GMIC_USE_EXR=$(usex openexr) \
278 + GMIC_USE_FFTW=$(usex fftw) \
279 + GMIC_USE_GRAPHICSMAGICK=$(usex graphicsmagick) \
280 + GMIC_USE_JPEG=$(usex jpeg) \
281 + GMIC_USE_OPENCV=$(usex opencv) \
282 + GMIC_USE_OPENMP=$(usex openmp) \
283 + GMIC_USE_PNG=$(usex png) \
284 + GMIC_USE_TIFF=$(usex tiff) \
285 + GMIC_USE_X11=$(usex X) \
286 + QMAKE="qmake5" \
287 + $@
288 +}
289 +
290 +# FIXME:
291 +# - honour user CFLAGS while building C binaries (i.e. 'use_libcgmic')
292 +src_compile() {
293 + gmic_emake lib libc
294 + use cli && gmic_emake cli_shared
295 + use gimp && gmic_emake gimp_shared
296 + use qt5 && gmic_emake gmic_qt_shared
297 +}
298 +
299 +src_install() {
300 + # See below for why this has to name a directory even if USE=-gimp
301 + local gimp_plugindir="/deleteme"
302 + if use gimp; then
303 + if type gimptool &>/dev/null; then
304 + gimp_plugindir="$(gimptool --gimpplugindir)/plug-ins"
305 + elif type gimptool-2.0 &>/dev/null; then
306 + gimp_plugindir="$(gimptool-2.0 --gimpplugindir)/plug-ins"
307 + elif type gimptool-2.99 &>/dev/null; then
308 + gimp_plugindir="$(gimptool-2.99 --gimpplugindir)/plug-ins"
309 + else
310 + die "Cannot find GIMP plugin directory"
311 + fi
312 + fi
313 +
314 + gmic_emake DESTDIR="${ED}" PLUGINDIR="${gimp_plugindir}" install
315 +
316 + # Upstream build scripts create PLUGINDIR and write some files to it
317 + # regardless of whether the GIMP plug-in has been built or not, or even
318 + # when they haven't been able to execute gimptool to get the base path.
319 + use gimp || rm -rf "${ED}/${gimp_plugindir}"
320 +
321 + # These are already gzipped in the source tarballs
322 + find "${ED}/usr/share/man" -name "*.gz" -exec gunzip {} \; || die
323 +}