summaryrefslogtreecommitdiff
path: root/media-gfx/gmic/gmic-3.1.6.ebuild
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2022-09-01 19:24:10 +0100
committerV3n3RiX <venerix@koprulu.sector>2022-09-01 19:24:10 +0100
commitb052fbf151106a4f47cac7fdf0ffff983decb773 (patch)
tree5d21279a4eeaf4076caee87654b610a0fe8a4051 /media-gfx/gmic/gmic-3.1.6.ebuild
parentc3b55a6be7da027d97d8aef00ef88c3011121a42 (diff)
gentoo auto-resync : 01:09:2022 - 19:24:10
Diffstat (limited to 'media-gfx/gmic/gmic-3.1.6.ebuild')
-rw-r--r--media-gfx/gmic/gmic-3.1.6.ebuild136
1 files changed, 136 insertions, 0 deletions
diff --git a/media-gfx/gmic/gmic-3.1.6.ebuild b/media-gfx/gmic/gmic-3.1.6.ebuild
new file mode 100644
index 000000000000..06ca0c8a4cc3
--- /dev/null
+++ b/media-gfx/gmic/gmic-3.1.6.ebuild
@@ -0,0 +1,136 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit bash-completion-r1 toolchain-funcs
+
+if [[ ${PV} == "9999" ]]; then
+ EGIT_REPO_URI="https://github.com/dtschump/gmic.git"
+ inherit git-r3
+else
+ SRC_URI="https://gmic.eu/files/source/${PN}_${PV}.tar.gz"
+ KEYWORDS="~amd64 ~arm64 ~ppc64 ~riscv ~x86"
+fi
+
+DESCRIPTION="GREYC's Magic Image Converter"
+HOMEPAGE="https://gmic.eu/ https://github.com/dtschump/gmic"
+
+LICENSE="CeCILL-2 GPL-3"
+SLOT="0"
+IUSE="cli curl ffmpeg fftw gimp graphicsmagick jpeg opencv openexr openmp png qt5 tiff X"
+REQUIRED_USE="
+ gimp? ( png fftw X )
+ qt5? ( png fftw X )
+"
+
+MIN_QT_VER="5.2.0"
+QT_DEPEND="
+ >=dev-qt/qtcore-${MIN_QT_VER}:5
+ >=dev-qt/qtgui-${MIN_QT_VER}:5
+ >=dev-qt/qtnetwork-${MIN_QT_VER}:5
+ >=dev-qt/qtwidgets-${MIN_QT_VER}:5
+"
+DEPEND="
+ sys-libs/zlib:0=
+ curl? ( net-misc/curl )
+ fftw? ( sci-libs/fftw:3.0=[threads] )
+ gimp? (
+ media-gfx/gimp:0/2
+ ${QT_DEPEND}
+ )
+ graphicsmagick? ( media-gfx/graphicsmagick:0= )
+ jpeg? ( media-libs/libjpeg-turbo:= )
+ opencv? ( >=media-libs/opencv-2.3.1a-r1:0= )
+ openexr? (
+ dev-libs/imath:=
+ media-libs/openexr:=
+ )
+ png? ( media-libs/libpng:0= )
+ qt5? ( ${QT_DEPEND} )
+ tiff? ( media-libs/tiff:0 )
+ X? (
+ x11-libs/libX11
+ x11-libs/libXext
+ )"
+RDEPEND="${DEPEND}
+ ffmpeg? ( media-video/ffmpeg:0= )
+"
+BDEPEND="
+ virtual/pkgconfig
+ gimp? (
+ dev-qt/linguist-tools:5
+ media-gfx/gimp:0/2
+ )
+ qt5? ( dev-qt/linguist-tools:5 )
+"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-3.1.6-makefile_automagic.patch
+ "${FILESDIR}"/${PN}-3.1.6-relative_rpath.patch
+)
+
+pkg_pretend() {
+ [[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
+}
+
+pkg_setup() {
+ [[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
+}
+
+gmic_emake() {
+ emake -j1 -C src \
+ CC="$(tc-getCC)" \
+ CXX="$(tc-getCXX)" \
+ STRIP="/bin/true" \
+ LIB="$(get_libdir)" \
+ OPT_CFLAGS="${CXXFLAGS}" \
+ OPT_LIBS="${LDFLAGS}" \
+ GMIC_USE_CURL=$(usex curl) \
+ GMIC_USE_EXR=$(usex openexr) \
+ GMIC_USE_FFTW=$(usex fftw) \
+ GMIC_USE_GRAPHICSMAGICK=$(usex graphicsmagick) \
+ GMIC_USE_JPEG=$(usex jpeg) \
+ GMIC_USE_OPENCV=$(usex opencv) \
+ GMIC_USE_OPENMP=$(usex openmp) \
+ GMIC_USE_PNG=$(usex png) \
+ GMIC_USE_TIFF=$(usex tiff) \
+ GMIC_USE_X11=$(usex X) \
+ QMAKE="qmake5" \
+ $@
+}
+
+# FIXME:
+# - honour user CFLAGS while building C binaries (i.e. 'use_libcgmic')
+src_compile() {
+ gmic_emake lib libc
+ use cli && gmic_emake cli_shared
+ use gimp && gmic_emake gimp_shared
+ use qt5 && gmic_emake gmic_qt_shared
+}
+
+src_install() {
+ # See below for why this has to name a directory even if USE=-gimp
+ local gimp_plugindir="/deleteme"
+ if use gimp; then
+ if type gimptool &>/dev/null; then
+ gimp_plugindir="$(gimptool --gimpplugindir)/plug-ins"
+ elif type gimptool-2.0 &>/dev/null; then
+ gimp_plugindir="$(gimptool-2.0 --gimpplugindir)/plug-ins"
+ elif type gimptool-2.99 &>/dev/null; then
+ gimp_plugindir="$(gimptool-2.99 --gimpplugindir)/plug-ins"
+ else
+ die "Cannot find GIMP plugin directory"
+ fi
+ fi
+
+ gmic_emake DESTDIR="${ED}" PLUGINDIR="${gimp_plugindir}" install
+
+ # Upstream build scripts create PLUGINDIR and write some files to it
+ # regardless of whether the GIMP plug-in has been built or not, or even
+ # when they haven't been able to execute gimptool to get the base path.
+ use gimp || rm -rf "${ED}/${gimp_plugindir}"
+
+ # These are already gzipped in the source tarballs
+ find "${ED}/usr/share/man" -name "*.gz" -exec gunzip {} \; || die
+}