Date: Wednesday, February 22, 2023 @ 13:18:23
  Author: arojas
Revision: 1403608

upgpkg: krita-plugin-gmic 3.2.1.1-1: Update to 3.2.1.1

Added:
  krita-plugin-gmic/trunk/fix-build.patch
Modified:
  krita-plugin-gmic/trunk/PKGBUILD

-----------------+
 PKGBUILD        |   15 ++++++--
 fix-build.patch |   93 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 104 insertions(+), 4 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD    2023-02-22 13:13:37 UTC (rev 1403607)
+++ PKGBUILD    2023-02-22 13:18:23 UTC (rev 1403608)
@@ -1,7 +1,7 @@
 # Maintainer: Antonio Rojas <[email protected]>
 
 pkgname=krita-plugin-gmic
-pkgver=3.1.6.1
+pkgver=3.2.1.1
 pkgrel=1
 pkgdesc='GMic plugin for Krita'
 arch=(x86_64)
@@ -9,11 +9,18 @@
 license=(custom:CeCILL)
 depends=(krita gmic)
 makedepends=(extra-cmake-modules qt5-tools)
-source=(https://github.com/amyspark/gmic/releases/download/v$pkgver/gmic-$pkgver-patched.tar.xz{,.asc})
-sha256sums=('f2b24a24bd99626557d6a99891931a46d7ca87f0a72e966319ba81a1a6905e1c'
-            'SKIP')
+source=(https://github.com/amyspark/gmic/releases/download/v$pkgver/gmic-$pkgver-patched.tar.xz{,.asc}
+        fix-build.patch)
+sha256sums=('1af73f90052f4af6b07e1d4f90e23b3a55576f81959562630fabe395d07ee3b9'
+            'SKIP'
+            'b5709ae7c49fb08e354a3c1f19d91d0233b8397b41593a4f5e6b4dd26a47bd85')
 validpgpkeys=(4894424D2412FEE5176732A3FC00108CFD9DBF1E) # 
https://github.com/amyspark.gpg
 
+prepare() {
+  chmod 755 gmic-$pkgver-patched/gmic-qt/translations/lrelease.sh
+  patch -d gmic-$pkgver-patched -p1 < fix-build.patch
+}
+
 build() {
   cmake -B build -S gmic-$pkgver-patched/gmic-qt \
     -DCMAKE_INSTALL_PREFIX=/usr \

Added: fix-build.patch
===================================================================
--- fix-build.patch                             (rev 0)
+++ fix-build.patch     2023-02-22 13:18:23 UTC (rev 1403608)
@@ -0,0 +1,93 @@
+From 8ec85444535bd50aea2d19050f7d4e4ed7c8380b Mon Sep 17 00:00:00 2001
+From: "L. E. Segovia" <[email protected]>
+Date: Mon, 20 Feb 2023 18:09:05 -0300
+Subject: [PATCH] CMake: actually fix ENABLE_SYSTEM_GMIC
+
+PR c-koi/gmic-qt#172 is correct in that it is no longer possible
+to build without -Dgmic_core, due to G'MIC-Qt relying in
+now-private implementation details of G'MIC; namely, the extensions
+made in gmic.cpp to CImg.
+
+However, the solution chosen has significant shortcomings:
+
+1. It blindly assumes that the consumed library has been built by a
+  GCC-compatible compiler. This is easily inferred from the lack of
+  symbol exports in {CImg,gmic}.{h,cpp}.
+2. It makes no provision for the exported library type; G'MIC can be
+  built statically or dynamically.
+3. In Windows, when built with MSVC, the kind of symbol export that
+  gmic_core implies is only available with a static libgmic.
+
+To fix this, this commit augments G'MIC-Qt's `ENABLE_DYNAMIC_LINKING`
+handling with target detection code for the above described cases.
+In the case where a compatible library is not found, a fallback is
+specified that will build libgmic as a separate target, then make
+G'MIC-Qt link against it in order to mimic the requirements. If a
+suitable system library is found, we augment it with the gmic.cpp
+plugin to make the symbols visible at compile time.
+---
+ gmic-qt/CMakeLists.txt | 49 ++++++++++++++++++++++++++++++++++++++----
+ 1 file changed, 45 insertions(+), 4 deletions(-)
+
+diff --git a/gmic-qt/CMakeLists.txt b/gmic-qt/CMakeLists.txt
+index ed9aa07..7c1c0d1 100644
+--- a/gmic-qt/CMakeLists.txt
++++ b/gmic-qt/CMakeLists.txt
+@@ -562,12 +562,53 @@ set (gmic_qt_FORMS
+ 
+ if(ENABLE_DYNAMIC_LINKING)
+   set(CMAKE_SKIP_RPATH TRUE)
+-  set(gmic_qt_LIBRARIES
+-    ${gmic_qt_LIBRARIES}
+-    "gmic"
++  # G'MIC-Qt needs visibility into the private symbols defined
++  # by the gmic.cpp plugin. However, this is only possible
++  # if the library is static OR if it's dynamic and built by
++  # a compiler that supports .so-style exports.
++  if (TARGET libgmicstatic OR MSVC OR NOT ENABLE_SYSTEM_GMIC)
++    set(gmic_qt_LIBRARIES
++      ${gmic_qt_LIBRARIES}
++      libgmicstatic
++    )
++  elseif(TARGET libgmic)
++    set(gmic_qt_LIBRARIES
++      ${gmic_qt_LIBRARIES}
++      libgmic
++    )
++  elseif(GMIC_LIB_PATH)
++    set(gmic_qt_LIBRARIES
++      ${gmic_qt_LIBRARIES}
++      "gmic"
+     )
++  else()
++    message(FATAL_ERROR "No G'MIC library is available for linking. Please 
build libgmic as a static library.")
++  endif()
+   if (NOT ENABLE_SYSTEM_GMIC)
+-    link_directories(${GMIC_LIB_PATH})
++    if (GMIC_LIB_PATH)
++      link_directories(${GMIC_LIB_PATH})
++      # Inject the G'MIC CImg plugin.
++      include_directories(../src)
++    else()
++      # Mimic an external G'MIC library build for catching link ABI errors.
++      add_library(libgmicstatic STATIC ../src/gmic.cpp)
++      target_include_directories(libgmicstatic PUBLIC ../src)
++      # We need internal access into the gmic-core API.
++      target_compile_definitions(libgmicstatic PUBLIC gmic_core)
++      set_target_properties(libgmicstatic
++        PROPERTIES
++          AUTOMOC OFF
++      )
++      target_link_libraries(libgmicstatic PUBLIC
++        ${PNG_LIBRARIES}
++        ${FFTW3_LIBRARIES}
++        ${ZLIB_LIBRARIES}
++        ${CURL_LIBRARIES}
++        ${EXTRA_LIBRARIES})
++    endif()
++  else()
++    # Inject the G'MIC CImg plugin.
++    include_directories(../src)
+   endif()
+ else(ENABLE_DYNAMIC_LINKING)
+   set(gmic_qt_SRCS

Reply via email to