From f9156b4cc19784d9b17306b3a1f7284e9c78bbfe 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/01-includedir.patch | 44 +++++++++++++++++++ srcpkgs/gmic/patches/02-opt-flags.patch | 28 ++++++++++++ .../patches/03-plugindir-and-no-wget.patch | 15 +++++++ .../gmic/patches/04-no-krita-and-order.patch | 39 ++++++++++++++++ srcpkgs/gmic/template | 31 +++---------- 5 files changed, 131 insertions(+), 26 deletions(-) create mode 100644 srcpkgs/gmic/patches/01-includedir.patch create mode 100644 srcpkgs/gmic/patches/02-opt-flags.patch create mode 100644 srcpkgs/gmic/patches/03-plugindir-and-no-wget.patch create mode 100644 srcpkgs/gmic/patches/04-no-krita-and-order.patch diff --git a/srcpkgs/gmic/patches/01-includedir.patch b/srcpkgs/gmic/patches/01-includedir.patch new file mode 100644 index 00000000000..2cf9031443e --- /dev/null +++ b/srcpkgs/gmic/patches/01-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/02-opt-flags.patch b/srcpkgs/gmic/patches/02-opt-flags.patch new file mode 100644 index 00000000000..0d3a5894e58 --- /dev/null +++ b/srcpkgs/gmic/patches/02-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/03-plugindir-and-no-wget.patch b/srcpkgs/gmic/patches/03-plugindir-and-no-wget.patch new file mode 100644 index 00000000000..5b403240efc --- /dev/null +++ b/srcpkgs/gmic/patches/03-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/patches/04-no-krita-and-order.patch b/srcpkgs/gmic/patches/04-no-krita-and-order.patch new file mode 100644 index 00000000000..18ce17a97a7 --- /dev/null +++ b/srcpkgs/gmic/patches/04-no-krita-and-order.patch @@ -0,0 +1,39 @@ +Index: gmic-2.9.9/src/Makefile +=================================================================== +--- gmic-2.9.9.orig/src/Makefile ++++ gmic-2.9.9/src/Makefile +@@ -327,25 +327,32 @@ BOARD_LIBS = -lboard + #------------------------------- + # Define main Makefile entries. + #------------------------------- + + # Multi-targets + #-------------- +-all: ++all: cli lib gimp gmic_qt libc zart ++ ++gmic_qt: gimp ++ ++gimp zart: cli lib libc ++ ++cli lib libc: all-banner ++ ++all-banner: + @echo "**" + ifeq ($(OS),Unix) + @echo "** Start building G'MIC with default Unix configuration." + else + ifeq ($(OS),Darwin) + @echo "** Start building G'MIC with default MacOSX configuration." + else + @echo "** Start building G'MIC with default Windows configuration." + endif + endif + @echo "**" +- $(MAKE) cli lib gimp krita gmic_qt libc zart + + native: + $(MAKE) "CFLAGS+=$(GMIC_CLI_CFLAGS) -Ofast -march=native" "LIBS+=$(GMIC_CLI_LIBS)" cli + + # CLI (standard) + #--------------- diff --git a/srcpkgs/gmic/template b/srcpkgs/gmic/template index 46ce0133821..b9871e7bbe7 100644 --- a/srcpkgs/gmic/template +++ b/srcpkgs/gmic/template @@ -1,52 +1,31 @@ # 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" checksum="9f053338752ec96a6b619718037767682c5fd58e2471c08f3740fdb070605bc0 eec47cc9b572cb3e3c26b424381948e12161e129f3d0d3ceca87ff4a8f99fe5d" -disable_parallel_build="yes" +# disable_parallel_build="yes" 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 gmic_qt zart; do - make $_target - done -} - post_install() { vlicense ../COPYING }