diff options
author | Jan Tojnar <jtojnar@gmail.com> | 2019-09-07 12:33:56 +0200 |
---|---|---|
committer | Jan Tojnar <jtojnar@gmail.com> | 2019-09-07 19:55:11 +0200 |
commit | d8749430e43c05e3ee1602eb1a12d53362ae29e7 (patch) | |
tree | 87dacc7e7af97915f9f6b5dfa3130c0086500137 /pkgs/tools/graphics | |
parent | 8ad04d92f6be2254f58024842fbdbea7afd5e1c5 (diff) |
gmic-qt: allow building non-Krita hosts
* Use qt5’s mkDerivation
* Also switch gimpPlugins.gmic to qmic-qt
Diffstat (limited to 'pkgs/tools/graphics')
-rw-r--r-- | pkgs/tools/graphics/gmic-qt/default.nix | 73 | ||||
-rw-r--r-- | pkgs/tools/graphics/gmic-qt/fix-gimp-plugin-path.patch | 21 |
2 files changed, 81 insertions, 13 deletions
diff --git a/pkgs/tools/graphics/gmic-qt/default.nix b/pkgs/tools/graphics/gmic-qt/default.nix index 44e9243d91c..b8714e9b355 100644 --- a/pkgs/tools/graphics/gmic-qt/default.nix +++ b/pkgs/tools/graphics/gmic-qt/default.nix @@ -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; diff --git a/pkgs/tools/graphics/gmic-qt/fix-gimp-plugin-path.patch b/pkgs/tools/graphics/gmic-qt/fix-gimp-plugin-path.patch new file mode 100644 index 00000000000..ac0600fb76c --- /dev/null +++ b/pkgs/tools/graphics/gmic-qt/fix-gimp-plugin-path.patch @@ -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") + |