gmic-qt: allow building non-Krita hosts

* Use qt5’s mkDerivation
* Also switch gimpPlugins.gmic to qmic-qt
This commit is contained in:
Jan Tojnar 2019-09-07 12:33:56 +02:00
parent 8ad04d92f6
commit d8749430e4
No known key found for this signature in database
GPG Key ID: 7FAB2A15F7A607A4
4 changed files with 87 additions and 15 deletions

View File

@ -152,7 +152,9 @@ stdenv.lib.makeScope pkgs.newScope (self: with self; {
installPhase = "installPlugins src/gimp-lqr-plugin";
};
gmic = pkgs.gmic.gimpPlugin;
gmic = pkgs.gmic-qt.override {
variant = "gimp";
};
ufraw = pkgs.ufraw.gimpPlugin;

View File

@ -1,5 +1,8 @@
{ stdenv
{ lib
, mkDerivation
, fetchurl
, fetchpatch
, variant ? "standalone"
, fetchFromGitHub
, cmake
, pkgconfig
@ -12,17 +15,44 @@
, libtiff
, libpng
, curl
, krita
, krita ? null
, gimp ? null
, qtbase
, qttools
, fetchgit
}:
let
variants = {
gimp = {
extraDeps = [
gimp
gimp.gtk
];
description = "GIMP plugin for the G'MIC image processing framework";
};
krita = {
extraDeps = [
krita
];
description = "Krita plugin for the G'MIC image processing framework";
};
standalone = {
description = "Versatile front-end to the image processing framework G'MIC";
};
};
in
assert lib.assertMsg (builtins.hasAttr variant variants) "gmic-qt variant ${variant} is not supported. Please use one of ${lib.concatStringsSep ", " (builtins.attrNames variants)}.";
assert lib.assertMsg (builtins.all (d: d != null) variants.${variant}.extraDeps or []) "gmic-qt variant ${variant} is missing one of its dependencies.";
mkDerivation rec {
pname = "gmic-qt${lib.optionalString (variant != "standalone") ''-${variant}''}";
version = "2.3.6";
in stdenv.mkDerivation rec {
pname = "gmic_krita_qt";
inherit version;
gmic-community = fetchFromGitHub {
owner = "dtschump";
@ -58,6 +88,24 @@ in stdenv.mkDerivation rec {
sha256 = "0j9wqlq67dwzir36yg58xy5lbblwizvgcvlmzcv9d6l901d5ayf3";
};
patches = [
# Add install targets
(fetchpatch {
url = https://github.com/c-koi/gmic-qt/commit/ec4babbaf06a8711a4fd841f7de4106cda765109.patch;
sha256 = "1rim6vjx3k0yw8mplq8ampb2ykfabjj6d8vynmp8lm6n8id99yr0";
})
# Fix translations installation
(fetchpatch {
url = https://github.com/c-koi/gmic-qt/commit/91f92ba589d6559541d5dfacf39dab4e0faaa106.patch;
sha256 = "1kh39349qcna386lx80kgj87xxlyh95xmwnv539z4zqnpzyqdxfs";
})
# Install GIMP plug-in to a correct destination
# https://github.com/c-koi/gmic-qt/pull/78
./fix-gimp-plugin-path.patch
];
unpackPhase = ''
cp -r ${gmic} gmic
ln -s ${gmic-community} gmic-community
@ -91,20 +139,19 @@ in stdenv.mkDerivation rec {
openexr
graphicsmagick
curl
krita
];
] ++ variants.${variant}.extraDeps or [];
cmakeFlags = [
"-DGMIC_QT_HOST=krita"
"-DGMIC_QT_HOST=${if variant == "standalone" then "none" else variant}"
];
installPhase = ''
mkdir -p $out/bin;
install -Dm755 gmic_krita_qt "$out/bin/gmic_krita_qt"
postFixup = lib.optionalString (variant == "gimp") ''
echo "wrapping $out/${gimp.targetPluginDir}/gmic_gimp_qt"
wrapQtApp "$out/${gimp.targetPluginDir}/gmic_gimp_qt"
'';
meta = with stdenv.lib; {
description = "Krita plugin for the G'MIC image processing framework";
meta = with lib; {
description = variants.${variant}.description;
homepage = http://gmic.eu/;
license = licenses.gpl3;
platforms = platforms.unix;

View File

@ -0,0 +1,21 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1483056..26d2b9a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -473,6 +473,7 @@
execute_process(COMMAND gimptool-2.0 --libs-noui OUTPUT_VARIABLE GIMP2_LIBRARIES OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND gimptool-2.0 --cflags-noui OUTPUT_VARIABLE GIMP2_INCLUDE_DIRS OUTPUT_STRIP_TRAILING_WHITESPACE)
+ execute_process(COMMAND pkg-config gimp-2.0 --define-variable=prefix=${CMAKE_INSTALL_PREFIX} --variable gimplibdir OUTPUT_VARIABLE GIMP2_PKGLIBDIR OUTPUT_STRIP_TRAILING_WHITESPACE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GIMP2_INCLUDE_DIRS}")
set (gmic_qt_SRCS ${gmic_qt_SRCS} src/Host/Gimp/host_gimp.cpp)
@@ -484,7 +485,7 @@
${GIMP2_LIBRARIES}
${gmic_qt_LIBRARIES}
)
- install(TARGETS gmic_gimp_qt RUNTIME DESTINATION bin)
+ install(TARGETS gmic_gimp_qt RUNTIME DESTINATION "${GIMP2_PKGLIBDIR}/plug-ins")
elseif (${GMIC_QT_HOST} STREQUAL "krita")

View File

@ -1696,7 +1696,9 @@ in
gmic-qt = libsForQt5.callPackage ../tools/graphics/gmic-qt { };
gmic-qt-krita = gmic-qt;
gmic-qt-krita = gmic-qt.override {
variant = "krita";
};
goa = callPackage ../development/tools/goa { };