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