2020-04-24 23:36:52 +00:00
|
|
|
{ lib
|
|
|
|
, mkDerivation
|
|
|
|
, variant ? "standalone"
|
|
|
|
, fetchFromGitHub
|
2023-01-20 10:41:00 +00:00
|
|
|
, fetchpatch
|
2020-04-24 23:36:52 +00:00
|
|
|
, cmake
|
2021-02-05 17:12:51 +00:00
|
|
|
, pkg-config
|
2022-07-14 12:49:19 +00:00
|
|
|
, ninja
|
2020-04-24 23:36:52 +00:00
|
|
|
, opencv3
|
|
|
|
, openexr
|
|
|
|
, graphicsmagick
|
|
|
|
, fftw
|
|
|
|
, zlib
|
|
|
|
, libjpeg
|
|
|
|
, libtiff
|
|
|
|
, libpng
|
|
|
|
, curl
|
|
|
|
, krita ? null
|
|
|
|
, gimp ? null
|
2022-07-14 12:49:19 +00:00
|
|
|
, gmic
|
|
|
|
, cimg
|
2020-04-24 23:36:52 +00:00
|
|
|
, qtbase
|
|
|
|
, qttools
|
2022-01-19 23:45:15 +00:00
|
|
|
, writeShellScript
|
|
|
|
, common-updater-scripts
|
|
|
|
, gnugrep
|
|
|
|
, gnused
|
|
|
|
, coreutils
|
|
|
|
, jq
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
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 {
|
2021-02-05 17:12:51 +00:00
|
|
|
pname = "gmic-qt${lib.optionalString (variant != "standalone") "-${variant}"}";
|
2022-09-14 18:05:37 +00:00
|
|
|
version = "3.1.6";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-07-14 12:49:19 +00:00
|
|
|
src = fetchFromGitHub {
|
2020-04-24 23:36:52 +00:00
|
|
|
owner = "c-koi";
|
|
|
|
repo = "gmic-qt";
|
|
|
|
rev = "v.${version}";
|
2022-09-14 18:05:37 +00:00
|
|
|
sha256 = "sha256-/5wDHvJSMgEheg8YV4W40wUiHz25emIoFnGdfO8i92g=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
2021-02-05 17:12:51 +00:00
|
|
|
pkg-config
|
2022-07-14 12:49:19 +00:00
|
|
|
ninja
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
2022-07-14 12:49:19 +00:00
|
|
|
gmic
|
|
|
|
cimg
|
2020-04-24 23:36:52 +00:00
|
|
|
qtbase
|
|
|
|
qttools
|
|
|
|
fftw
|
|
|
|
zlib
|
|
|
|
libjpeg
|
|
|
|
libtiff
|
|
|
|
libpng
|
|
|
|
opencv3
|
|
|
|
openexr
|
|
|
|
graphicsmagick
|
|
|
|
curl
|
|
|
|
] ++ variants.${variant}.extraDeps or [];
|
|
|
|
|
|
|
|
cmakeFlags = [
|
|
|
|
"-DGMIC_QT_HOST=${if variant == "standalone" then "none" else variant}"
|
2022-07-14 12:49:19 +00:00
|
|
|
"-DENABLE_SYSTEM_GMIC:BOOL=ON"
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
2023-01-20 10:41:00 +00:00
|
|
|
patches = [
|
|
|
|
# NOTE: this should be removed when a new version is released.
|
|
|
|
(fetchpatch {
|
|
|
|
name = "fix_filter_translation_scripts.patch";
|
|
|
|
url = "https://github.com/c-koi/gmic-qt/commit/ccb9f29eda239d0c80663593cd90a6548c935b39.patch";
|
|
|
|
sha256 = "sha256-OzuJ6yGuDJweQ+1uin/pmJqZV79bN9E1Zuo+0iciwzg=";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2022-07-14 12:49:19 +00:00
|
|
|
postPatch = ''
|
|
|
|
patchShebangs \
|
|
|
|
translations/filters/csv2ts.sh \
|
|
|
|
translations/lrelease.sh
|
2022-01-19 23:45:15 +00:00
|
|
|
'';
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
postFixup = lib.optionalString (variant == "gimp") ''
|
2022-01-19 23:45:15 +00:00
|
|
|
echo "wrapping $out/${gimp.targetPluginDir}/gmic_gimp_qt/gmic_gimp_qt"
|
|
|
|
wrapQtApp "$out/${gimp.targetPluginDir}/gmic_gimp_qt/gmic_gimp_qt"
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = variants.${variant}.description;
|
|
|
|
homepage = "http://gmic.eu/";
|
2022-01-19 23:45:15 +00:00
|
|
|
license = licenses.gpl3Plus;
|
2020-04-24 23:36:52 +00:00
|
|
|
platforms = platforms.unix;
|
|
|
|
};
|
|
|
|
}
|