diff --git a/pkgs/applications/graphics/gimp/plugins/default.nix b/pkgs/applications/graphics/gimp/plugins/default.nix index 008bfdf881e5..2c520f21f848 100644 --- a/pkgs/applications/graphics/gimp/plugins/default.nix +++ b/pkgs/applications/graphics/gimp/plugins/default.nix @@ -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; diff --git a/pkgs/development/libraries/cimg/default.nix b/pkgs/development/libraries/cimg/default.nix index 3e7ef6d96eec..6181122aa7f1 100644 --- a/pkgs/development/libraries/cimg/default.nix +++ b/pkgs/development/libraries/cimg/default.nix @@ -2,11 +2,11 @@ stdenv.mkDerivation rec { pname = "cimg"; - version = "2.7.0"; + version = "2.7.1"; src = fetchurl { url = "http://cimg.eu/files/CImg_${version}.zip"; - sha256 = "1la6332cppyciyn3pflbchxa3av72a70p0n1c9sm1hgfbjlydqnv"; + sha256 = "1lw1hjk65zyd5x9w113yrqyy8db45jdzzkqslkipaiskl9f81y9z"; }; nativeBuildInputs = [ unzip ]; diff --git a/pkgs/tools/graphics/gmic-qt/default.nix b/pkgs/tools/graphics/gmic-qt/default.nix new file mode 100644 index 000000000000..cb0862c63736 --- /dev/null +++ b/pkgs/tools/graphics/gmic-qt/default.nix @@ -0,0 +1,144 @@ +{ lib +, mkDerivation +, fetchurl +, fetchpatch +, variant ? "standalone" +, fetchFromGitHub +, fetchFromGitLab +, cmake +, pkgconfig +, opencv +, openexr +, graphicsmagick +, fftw +, zlib +, libjpeg +, libtiff +, libpng +, curl +, krita ? null +, gimp ? null +, qtbase +, qttools +}: + +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.7.1"; + + gmic-community = fetchFromGitHub { + owner = "dtschump"; + repo = "gmic-community"; + rev = "3fd528f20a2a7d651e96078c205ff21efb9cdd1a"; + sha256 = "08d37b49qgh5d4rds7hvr5wjj4p1y8cnbidz1cyqsibq0555pwq2"; + }; + + CImg = fetchFromGitLab { + domain = "framagit.org"; + owner = "dtschump"; + repo = "CImg"; + rev = "v.${version}"; + sha256 = "1mfkjvf5r3ppc1dd6yvqn7xlhgzfg9k1k5v2sq2k9m70g8p7rgpd"; + }; + + gmic_stdlib = fetchurl { + name = "gmic_stdlib.h"; + url = "http://gmic.eu/gmic_stdlib${lib.replaceStrings ["."] [""] version}.h"; + sha256 = "0v12smknr1s44s6wq2gbnw0hb98xrwp6i3zg9wf49cl7s9qf76j3"; + }; + + gmic = fetchFromGitHub { + owner = "dtschump"; + repo = "gmic"; + rev = "v.${version}"; + sha256 = "0pa6kflr1gqgzh8rk7bylvkxs989r5jy0q7b62mnzx8895slwfb5"; + }; + + gmic_qt = fetchFromGitHub { + owner = "c-koi"; + repo = "gmic-qt"; + rev = "v.${version}"; + sha256 = "08a0660083wv5fb1w9qqhm4f8cfwbqq723qzqq647mid1n7sy959"; + }; + + patches = [ + # 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 + cp -r ${gmic_qt} gmic_qt + chmod -R +w gmic gmic_qt + ln -s ${CImg} CImg + + cp ${gmic_stdlib} gmic/src/gmic_stdlib.h + + cd gmic_qt + ''; + + nativeBuildInputs = [ + cmake + pkgconfig + ]; + + buildInputs = [ + qtbase + qttools + fftw + zlib + libjpeg + libtiff + libpng + opencv + openexr + graphicsmagick + curl + ] ++ variants.${variant}.extraDeps or []; + + cmakeFlags = [ + "-DGMIC_QT_HOST=${if variant == "standalone" then "none" else variant}" + ]; + + postFixup = lib.optionalString (variant == "gimp") '' + echo "wrapping $out/${gimp.targetPluginDir}/gmic_gimp_qt" + wrapQtApp "$out/${gimp.targetPluginDir}/gmic_gimp_qt" + ''; + + 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 000000000000..ac0600fb76c3 --- /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") + diff --git a/pkgs/tools/graphics/gmic/default.nix b/pkgs/tools/graphics/gmic/default.nix index c487e42329d8..c6781310bdb5 100644 --- a/pkgs/tools/graphics/gmic/default.nix +++ b/pkgs/tools/graphics/gmic/default.nix @@ -1,46 +1,53 @@ -{ stdenv, fetchurl, cmake, ninja, pkgconfig -, opencv, openexr, graphicsmagick, fftw, zlib, libjpeg, libtiff, libpng -, withGimpPlugin ? true, gimp ? null}: +{ stdenv +, fetchurl +, cmake +, ninja +, pkgconfig +, opencv +, openexr +, graphicsmagick +, fftw +, zlib +, libjpeg +, libtiff +, libpng +}: -assert withGimpPlugin -> gimp != null; - -let - version = "2.2.2"; - - # CMakeLists.txt is missing from the tarball and Makefile is terrible - CMakeLists = fetchurl { - url = "https://github.com/dtschump/gmic/raw/v.${version}/CMakeLists.txt"; - sha256 = "0lv5jrg98cpbk13fl4xm7l4sk1axfz054q570bpi741w815d7cpg"; - }; -in stdenv.mkDerivation { +stdenv.mkDerivation rec { pname = "gmic"; - inherit version; + version = "2.7.1"; - outputs = [ "out" "lib" "dev" "man" ] ++ stdenv.lib.optional withGimpPlugin "gimpPlugin"; + outputs = [ "out" "lib" "dev" "man" ]; src = fetchurl { url = "https://gmic.eu/files/source/gmic_${version}.tar.gz"; - sha256 = "0zqfj2ym5nn3ff93xh2wf9ayxqlznabbdi00xw4lm7vw3iwkzqnc"; + sha256 = "1sxgmrxv1px07h5m7dcdg24c6x39ifjbc1fmz8p2ah91pm57h7n7"; }; - nativeBuildInputs = [ cmake ninja pkgconfig ]; + nativeBuildInputs = [ + cmake + ninja + pkgconfig + ]; buildInputs = [ - fftw zlib libjpeg libtiff libpng opencv openexr graphicsmagick - ] ++ stdenv.lib.optionals withGimpPlugin [ gimp gimp.gtk ]; + fftw + zlib + libjpeg + libtiff + libpng + opencv + openexr + graphicsmagick + ]; cmakeFlags = [ "-DBUILD_LIB_STATIC=OFF" - "-DBUILD_PLUGIN=${if withGimpPlugin then "ON" else "OFF"}" "-DENABLE_DYNAMIC_LINKING=ON" - ] ++ stdenv.lib.optional withGimpPlugin "-DPLUGIN_INSTALL_PREFIX=${placeholder "gimpPlugin"}/${gimp.targetPluginDir}"; - - postPatch = '' - cp ${CMakeLists} CMakeLists.txt - ''; + ]; meta = with stdenv.lib; { - description = "G'MIC is an open and full-featured framework for image processing"; + description = "Open and full-featured framework for image processing"; homepage = http://gmic.eu/; license = licenses.cecill20; platforms = platforms.unix; diff --git a/pkgs/tools/graphics/gmic_krita_qt/default.nix b/pkgs/tools/graphics/gmic_krita_qt/default.nix deleted file mode 100644 index e5bdf6f31775..000000000000 --- a/pkgs/tools/graphics/gmic_krita_qt/default.nix +++ /dev/null @@ -1,83 +0,0 @@ -{ stdenv, fetchurl, fetchFromGitHub, cmake, pkgconfig -, opencv, openexr, graphicsmagick, fftw, zlib, libjpeg, libtiff, libpng -, curl, krita, qtbase, qttools -, fetchgit }: - -let - version = "2.3.6"; - -in stdenv.mkDerivation rec { - pname = "gmic_krita_qt"; - inherit version; - - gmic-community = fetchFromGitHub { - owner = "dtschump"; - repo = "gmic-community"; - rev = "3fd528f20a2a7d651e96078c205ff21efb9cdd1a"; - sha256 = "08d37b49qgh5d4rds7hvr5wjj4p1y8cnbidz1cyqsibq0555pwq2"; - }; - - CImg = fetchgit { - url = "https://framagit.org/dtschump/CImg"; - rev = "90f5657d8eab7b549ef945103ef680e747385805"; - sha256 = "1af3dwqq18dkw0lz2gvnlw8y0kc1cw01hnc72rf3pg2wyjcp0pvc"; - }; - - gmic_stdlib = fetchurl { - name = "gmic_stdlib.h"; - # Version should e in sync with gmic. Basically the version string without dots - url = "http://gmic.eu/gmic_stdlib236.h"; - sha256 = "0q5g87dsn9byd2qqsa9xrsggfb9qv055s3l2gc0jrcvpx2qbza4q"; - }; - - gmic = fetchFromGitHub { - owner = "dtschump"; - repo = "gmic"; - rev = "v.${version}"; - sha256 = "1yg9ri3n07drv8gz4x0mn39ryi801ibl26jaza47m19ma893m8fi"; - }; - - gmic_qt = fetchFromGitHub { - owner = "c-koi"; - repo = "gmic-qt"; - rev = "v.${version}"; - sha256= "0j9wqlq67dwzir36yg58xy5lbblwizvgcvlmzcv9d6l901d5ayf3"; - }; - - unpackPhase = '' - cp -r ${gmic} gmic - ln -s ${gmic-community} gmic-community - cp -r ${gmic_qt} gmic_qt - chmod -R +w gmic gmic_qt - ln -s ${CImg} CImg - - cp ${gmic_stdlib} gmic/src/gmic_stdlib.h - - cd gmic_qt - ''; - - preConfigure = '' - make -C ../gmic/src CImg.h gmic_stdlib.h - ''; - - nativeBuildInputs = [ cmake pkgconfig ]; - - buildInputs = [ - qtbase qttools fftw zlib libjpeg libtiff libpng - opencv openexr graphicsmagick curl krita - ]; - - cmakeFlags = [ "-DGMIC_QT_HOST=krita" ]; - - installPhase = '' - mkdir -p $out/bin; - install -Dm755 gmic_krita_qt "$out/bin/gmic_krita_qt" - ''; - - meta = with stdenv.lib; { - description = "Krita plugin for the G'MIC image processing framework"; - homepage = http://gmic.eu/; - license = licenses.gpl3; - platforms = platforms.unix; - }; -} diff --git a/pkgs/top-level/aliases.nix b/pkgs/top-level/aliases.nix index 046c6bc9acc3..4b243fabb3af 100644 --- a/pkgs/top-level/aliases.nix +++ b/pkgs/top-level/aliases.nix @@ -114,6 +114,7 @@ mapAliases ({ git-hub = gitAndTools.git-hub; # added 2016-04-29 glib_networking = glib-networking; # added 2018-02-25 gnome-mpv = celluloid; # added 2019-08-22 + gmic_krita_qt = gmic-qt-krita; # added 2019-09-07 gnome-themes-standard = gnome-themes-extra; # added 2018-03-14 gnome_doc_utils = gnome-doc-utils; # added 2018-02-25 gnome_themes_standard = gnome-themes-standard; # added 2018-02-25 diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 1f440ba56f71..eee4ab705386 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1694,7 +1694,11 @@ in gmic = callPackage ../tools/graphics/gmic { }; - gmic_krita_qt = libsForQt5.callPackage ../tools/graphics/gmic_krita_qt { }; + gmic-qt = libsForQt5.callPackage ../tools/graphics/gmic-qt { }; + + gmic-qt-krita = gmic-qt.override { + variant = "krita"; + }; goa = callPackage ../development/tools/goa { };