summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2022-02-12 21:38:26 +0000
committerSam James <sam@gentoo.org>2022-02-15 19:50:16 +0000
commit300ac949ce26921799260da56eb99980d3a9ef46 (patch)
tree0336472a8ee7e5af2627d0de010241c919b9f0aa /media-gfx/gmic
parentmedia-libs/opencv: support OpenEXR 3 / imath (diff)
downloadgentoo-300ac949ce26921799260da56eb99980d3a9ef46.tar.gz
gentoo-300ac949ce26921799260da56eb99980d3a9ef46.tar.bz2
gentoo-300ac949ce26921799260da56eb99980d3a9ef46.zip
media-gfx/gmic: support OpenEXR 3 / imath
Bug: https://bugs.gentoo.org/833158 Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'media-gfx/gmic')
-rw-r--r--media-gfx/gmic/files/gmic-3.0.1-openexr-3-imath.patch28
-rw-r--r--media-gfx/gmic/gmic-3.0.1-r1.ebuild176
2 files changed, 204 insertions, 0 deletions
diff --git a/media-gfx/gmic/files/gmic-3.0.1-openexr-3-imath.patch b/media-gfx/gmic/files/gmic-3.0.1-openexr-3-imath.patch
new file mode 100644
index 000000000000..e97ef6bf6138
--- /dev/null
+++ b/media-gfx/gmic/files/gmic-3.0.1-openexr-3-imath.patch
@@ -0,0 +1,28 @@
+https://src.fedoraproject.org/rpms/gmic/raw/rawhide/f/gmic-openexr3.patch
+--- a/cmake/FindCImg.cmake
++++ b/cmake/FindCImg.cmake
+@@ -147,7 +147,10 @@ if(ENABLE_JPEG)
+ endif()
+
+ if(ENABLE_OPENEXR)
+- find_package(OpenEXR)
++ find_package(OpenEXR CONFIG)
++ if(NOT TARGET OpenEXR::OpenEXR)
++ find_package(OpenEXR)
++ endif()
+
+ if(OpenEXR_FOUND)
+ list(APPEND CLI_COMPILE_FLAGS "cimg_use_openexr")
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -307,8 +307,8 @@
+
+ # Enable native support of EXR image files, using the OpenEXR library.
+ # (http://www.openexr.com/)
+-OPENEXR_CFLAGS = -Dcimg_use_openexr $(shell pkg-config --cflags OpenEXR || echo -I$(USR)/$(INCLUDE)/OpenEXR)
+-OPENEXR_LIBS = $(shell pkg-config --libs OpenEXR || echo -lIlmImf -lHalf)
++OPENEXR_CFLAGS = -Dcimg_use_openexr $(shell pkg-config --cflags OpenEXR || echo -I$(USR)/$(INCLUDE)/OpenEXR -I$(USR)/$(INCLUDE)/Imath)
++OPENEXR_LIBS = $(shell pkg-config --libs OpenEXR || echo -lOpenEXR -lImath)
+
+ # Enable Fast Fourier Transforms, using the FFTW3 library.
+ # (http://www.fftw.org/)
diff --git a/media-gfx/gmic/gmic-3.0.1-r1.ebuild b/media-gfx/gmic/gmic-3.0.1-r1.ebuild
new file mode 100644
index 000000000000..e1eadca4d27c
--- /dev/null
+++ b/media-gfx/gmic/gmic-3.0.1-r1.ebuild
@@ -0,0 +1,176 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit cmake 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 zlib"
+REQUIRED_USE="
+ gimp? ( png zlib fftw X )
+ qt5? ( png zlib 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=
+"
+COMMON_DEPEND="
+ 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? ( virtual/jpeg:0 )
+ 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
+ )
+ zlib? ( sys-libs/zlib:0= )"
+RDEPEND="${COMMON_DEPEND}
+ ffmpeg? ( media-video/ffmpeg:0= )
+"
+DEPEND="${COMMON_DEPEND}
+ gimp? ( dev-qt/linguist-tools )
+ qt5? ( dev-qt/linguist-tools )
+"
+BDEPEND="virtual/pkgconfig"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-3.0.0_ipa-sra.patch
+ "${FILESDIR}"/${PN}-3.0.1-openexr-3-imath.patch
+)
+
+pkg_pretend() {
+ if [[ ${MERGE_TYPE} != binary ]]; then
+ if use openmp; then
+ tc-has-openmp || die "Please switch to an openmp compatible compiler"
+ fi
+ fi
+}
+
+src_prepare() {
+ cmake_src_prepare
+ sed -i '/CMAKE_CXX_FLAGS/s/-g //' CMakeLists.txt || die
+
+ if use gimp || use qt5; then
+ # respect user flags
+ sed -e '/CMAKE_CXX_FLAGS_RELEASE/d' \
+ -e '/${CMAKE_EXE_LINKER_FLAGS} -s/d' \
+ -i gmic-qt/CMakeLists.txt || die
+ local S="${S}/gmic-qt"
+ # Bug #753377
+ local PATCHES=()
+ cmake_src_prepare
+ fi
+}
+
+src_configure() {
+ local mycmakeargs=(
+ -DBUILD_LIB=ON
+ -DBUILD_LIB_STATIC=no
+ -DBUILD_CLI=$(usex cli)
+ -DBUILD_MAN=$(usex cli)
+ -DBUILD_BASH_COMPLETION=$(usex cli)
+ -DCUSTOM_CFLAGS=ON
+ -DENABLE_CURL=$(usex curl)
+ -DENABLE_X=$(usex X)
+ -DENABLE_FFMPEG=$(usex ffmpeg)
+ -DENABLE_FFTW=$(usex fftw)
+ -DENABLE_GRAPHICSMAGICK=$(usex graphicsmagick)
+ -DENABLE_JPEG=$(usex jpeg)
+ -DENABLE_OPENCV=$(usex opencv)
+ -DENABLE_OPENEXR=$(usex openexr)
+ -DENABLE_OPENMP=$(usex openmp)
+ -DENABLE_PNG=$(usex png)
+ -DENABLE_TIFF=$(usex tiff)
+ -DENABLE_ZLIB=$(usex zlib)
+ -DENABLE_DYNAMIC_LINKING=ON
+ )
+
+ cmake_src_configure
+
+ # configure gmic-qt frontends
+ local CMAKE_USE_DIR="${S}/gmic-qt"
+ mycmakeargs=(
+ -DENABLE_DYNAMIC_LINKING=ON
+ -DENABLE_CURL=$(usex curl)
+ -DGMIC_LIB_PATH="${BUILD_DIR}"
+ -DGMIC_PATH="${S}/src"
+ )
+
+ if use gimp; then
+ mycmakeargs+=( -DGMIC_QT_HOST=gimp )
+ BUILD_DIR="${BUILD_DIR}"/gimp cmake_src_configure
+ fi
+
+ if use qt5; then
+ mycmakeargs+=( -DGMIC_QT_HOST=none )
+ BUILD_DIR="${BUILD_DIR}"/qt5 cmake_src_configure
+ fi
+}
+
+src_compile() {
+ cmake_src_compile
+
+ # build gmic-qt frontends
+ local S="${S}/gmic-qt"
+ use gimp && { BUILD_DIR="${BUILD_DIR}"/gimp cmake_src_compile || die "failed building gimp plugin" ; }
+ use qt5 && { BUILD_DIR="${BUILD_DIR}"/qt5 cmake_src_compile || die "failed building qt5 GUI" ; }
+}
+
+src_install() {
+ cmake_src_install
+
+ use cli && newbashcomp "${BUILD_DIR}"/resources/gmic_bashcompletion.sh ${PN}
+
+ local PLUGINDIR="/usr/$(get_libdir)/gimp/2.0/plug-ins"
+ insinto "${PLUGINDIR}"
+ doins resources/gmic_cluts.gmz
+
+ # install gmic-qt frontends
+ if use gimp; then
+ exeinto "${PLUGINDIR}"
+ doexe "${BUILD_DIR}"/gimp/gmic_gimp_qt
+ fi
+ use qt5 && dobin "${BUILD_DIR}"/qt5/gmic_qt
+}
+
+pkg_postinst() {
+ if [[ -n "${REPLACING_VERSIONS}" ]]; then
+ local v
+ for v in ${REPLACING_VERSIONS}; do
+ if ver_test "${v}" -le "3.0.0"; then
+ einfo "Note that starting with version 3.0.1 ${CATEGORY}/${PN} no longer provides a Krita interface."
+ einfo "Please use the built-in G'MIC plugin provided with Krita 5, or use an older version."
+ break
+ fi
+ done
+ fi
+}