From 9024f9e43bf032a183063e0e96935b17e3e6d8cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?= Date: Mon, 15 Nov 2021 21:46:23 +0700 Subject: [PATCH] gmic: fix license, clean do_build --- srcpkgs/gmic/patches/includedir.patch | 44 +++++++++++++++++++ srcpkgs/gmic/patches/opt-flags.patch | 28 ++++++++++++ .../gmic/patches/plugindir-and-no-wget.patch | 15 +++++++ srcpkgs/gmic/template | 29 ++---------- 4 files changed, 91 insertions(+), 25 deletions(-) create mode 100644 srcpkgs/gmic/patches/includedir.patch create mode 100644 srcpkgs/gmic/patches/opt-flags.patch create mode 100644 srcpkgs/gmic/patches/plugindir-and-no-wget.patch diff --git a/srcpkgs/gmic/patches/includedir.patch b/srcpkgs/gmic/patches/includedir.patch new file mode 100644 index 000000000000..2cf9031443e5 --- /dev/null +++ b/srcpkgs/gmic/patches/includedir.patch @@ -0,0 +1,44 @@ +Index: gmic-2.9.9/src/Makefile +=================================================================== +--- gmic-2.9.9.orig/src/Makefile ++++ gmic-2.9.9/src/Makefile +@@ -163,13 +163,13 @@ NO_PRERELEASE = $(shell date +%y%m%d) + NO_PRERELEASE_CFLAGS = -Dgmic_prerelease="\\\"$(PRERELEASE)\\\"" + + # Minimal set of flags mandatory to compile G'MIC. +-MANDATORY_CFLAGS = -Dgmic_build -Dcimg_date=\\\"\\\" -Dcimg_time=\\\"\\\" -Dcimg_use_zlib -I. $(shell pkg-config --cflags zlib || echo -I$(USR)/$(INCLUDE)) $(PRERELEASE_CFLAGS) $(EXTRA_CFLAGS) ++MANDATORY_CFLAGS = -Dgmic_build -Dcimg_date=\\\"\\\" -Dcimg_time=\\\"\\\" -Dcimg_use_zlib -I. $(shell pkg-config --cflags zlib) $(PRERELEASE_CFLAGS) $(EXTRA_CFLAGS) + MANDATORY_LIBS = $(shell pkg-config --libs zlib || echo -lz) $(EXTRA_LIBS) + + ifndef NO_SRIPDLIB + MANDATORY_CFLAGS += -std=c++11 -pedantic + endif +-MANDATORY_LIBS += -L$(USR)/$(LIB) ++MANDATORY_LIBS += + ifdef IS_GCC + MANDATORY_CFLAGS += -Wall -Wextra -Wfatal-errors -Werror=unknown-pragmas -Werror=unused-label + MANDATORY_LIBS += -lm +@@ -250,7 +250,7 @@ endif + # Enable faster X11 display, using XShm extension. + # (ftp://www.x.org/pub/X11R7.7/doc/man/man3/XShm.3.xhtml) + XSHM_CFLAGS = -Dcimg_use_xshm $(shell pkg-config --cflags xcb-shm) +-XSHM_LIBS = $(shell pkg-config --libs xcb-shm || echo -L$(USR)/X11R6/lib) -lXext ++XSHM_LIBS = $(shell pkg-config --libs xcb-shm) -lXext + + # Enable image display, using GDI32 (Windows). + GDI32_CFLAGS = -Dcimg_display=2 +@@ -303,12 +303,12 @@ OPENCV_LIBS = $(shell pkg-config opencv + + # Enable support of most classical image file formats, using the GraphicsMagick++ library. + # (http://www.graphicsmagick.org/Magick++/) +-MAGICK_CFLAGS = -Dcimg_use_magick $(shell pkg-config --cflags GraphicsMagick++ || echo -I$(USR)/$(INCLUDE)/GraphicsMagick) ++MAGICK_CFLAGS = -Dcimg_use_magick $(shell pkg-config --cflags GraphicsMagick++ || echo -I$(XBPS_CROSS_BASE)$(USR)/$(INCLUDE)/GraphicsMagick) + MAGICK_LIBS = $(shell pkg-config --libs GraphicsMagick++ || echo -lGraphicsMagick++) + + # Enable native support of EXR image files, using the OpenEXR library. + # (http://www.openexr.com/) +-OPENEXR_CFLAGS = -Dcimg_use_openexr -I$(USR)/$(INCLUDE)/OpenEXR ++OPENEXR_CFLAGS = -Dcimg_use_openexr -I$(XBPS_CROSS_BASE)$(USR)/$(INCLUDE)/OpenEXR + OPENEXR_LIBS = -lIlmImf -lHalf + + # Enable Fast Fourier Transforms, using the FFTW3 library. diff --git a/srcpkgs/gmic/patches/opt-flags.patch b/srcpkgs/gmic/patches/opt-flags.patch new file mode 100644 index 000000000000..0d3a5894e589 --- /dev/null +++ b/srcpkgs/gmic/patches/opt-flags.patch @@ -0,0 +1,28 @@ +Index: gmic-2.9.9/src/Makefile +=================================================================== +--- gmic-2.9.9.orig/src/Makefile ++++ gmic-2.9.9/src/Makefile +@@ -192,9 +192,9 @@ endif + + # Enable optimizations for 'cli'. + FLTO = -flto +-OPT_CLI_CFLAGS = -Ofast ++OPT_CLI_CFLAGS = + ifdef IS_GCC +-OPT_CLI_CFLAGS = -Ofast -mtune=generic $(FLTO) ++OPT_CLI_CFLAGS = $(FLTO) + OPT_CLI_LIBS = $(FLTO) + endif + ifdef icpc +Index: gmic-2.9.9/gmic-qt/gmic_qt.pro +=================================================================== +--- gmic-2.9.9.orig/gmic-qt/gmic_qt.pro ++++ gmic-2.9.9/gmic-qt/gmic_qt.pro +@@ -445,7 +445,6 @@ translations/zh_tw.ts + + # PRE_TARGETDEPS += + +-QMAKE_CXXFLAGS_RELEASE += -Ofast # -O3 -s + QMAKE_LFLAGS_RELEASE += -s + QMAKE_CXXFLAGS_DEBUG += -Dcimg_verbosity=3 + diff --git a/srcpkgs/gmic/patches/plugindir-and-no-wget.patch b/srcpkgs/gmic/patches/plugindir-and-no-wget.patch new file mode 100644 index 000000000000..5b403240efc9 --- /dev/null +++ b/srcpkgs/gmic/patches/plugindir-and-no-wget.patch @@ -0,0 +1,15 @@ +Index: gmic-2.9.9/src/Makefile +=================================================================== +--- gmic-2.9.9.orig/src/Makefile ++++ gmic-2.9.9/src/Makefile +@@ -67,8 +67,8 @@ INCLUDE = include + SO = .so + PIC = -fPIC + EXE = +-WGET = wget --no-check-certificate --quiet -O +-PLUGINDIR = $(shell gimptool-2.0 --gimpplugindir)/plug-ins ++WGET = false ++PLUGINDIR = /usr/lib/gimp/2.0/plug-ins + VERSION = $(shell grep 'gmic_version\ ' gmic.h | tail -c4 | head -c3) + VERSION1 = $(shell grep 'gmic_version\ ' gmic.h | tail -c4 | head -c1) + VERSION2 = $(shell grep 'gmic_version\ ' gmic.h | tail -c3 | head -c1) diff --git a/srcpkgs/gmic/template b/srcpkgs/gmic/template index 8c1fa6962d8d..2bb69f4df0cd 100644 --- a/srcpkgs/gmic/template +++ b/srcpkgs/gmic/template @@ -1,18 +1,20 @@ # Template file for 'gmic' pkgname=gmic version=2.9.9 -revision=1 +revision=2 _zart_hash=939cf381c5871e506aabd066037acf2b55143c1d build_wrksrc="src" build_style=gnu-makefile build_helper=qmake +make_build_args=NOSTRIP=yes +make_use_env=yes hostmakedepends="pkg-config gimp qt5-host-tools qt5-qmake" makedepends="fftw-devel ilmbase-devel libopenexr-devel MesaLib-devel libopencv-devel libgomp-devel lcms2-devel libpng-devel libjpeg-turbo-devel tiff-devel libcurl-devel gtk+-devel gimp-devel qt5-devel" short_desc="GREYC's Magic for Image Computing (image processing framework)" maintainer="Jakub Skrzypnik " -license="CECILL-2.1" +license="CECILL-2.1, CECILL-C" homepage="http://gmic.eu/" distfiles="http://gmic.eu/files/source/gmic_${version}.tar.gz https://github.com/c-koi/zart/archive/${_zart_hash}.tar.gz" @@ -24,29 +26,6 @@ post_extract() { mv ../zart-${_zart_hash} zart } -post_patch() { - vsed -i Makefile -e "s,-I[\$](USR),-I$XBPS_CROSS_BASE/usr,g" - vsed -i Makefile -e "s/-Ofast/-O2/g" - # uses gimptool-2.0 to determine PLUGINDIR which fails in cross builds - vsed -i Makefile -e "s,^PLUGINDIR = .*,PLUGINDIR = /usr/lib/gimp/2\.0/plug-ins,g" - vsed -i ../gmic-qt/gmic_qt.pro -e "s/-Ofast/-O2/g" - # Not supported on ppc but we already compile for baselines - case "$XBPS_TARGET_MACHINE" in - ppc*) vsed -i Makefile -e 's;-mtune=generic;;' ;; - esac -} - -do_build() { - make CC="$CC" CXX="$CXX" LD="$LD" AR="$AR" RANLIB="$RANLIB" \ - CPP="$CPP" AS="$AS" OBJCOPY="$OBJCOPY" OBJDUMP="$OBJDUMP" \ - CFLAGS="$CFLAGS" CXXFLAGS="$CXXFLAGS" LDFLAGS="$LDFLAGS" \ - cli lib libc - - for _target in gimp krita gmic_qt zart; do - make $_target - done -} - post_install() { vlicense ../COPYING }