2019-09-07 10:33:56 +00:00
|
|
|
{ lib
|
2023-03-17 18:42:02 +00:00
|
|
|
, stdenv
|
2023-02-26 12:13:09 +00:00
|
|
|
, fetchzip
|
2023-05-03 01:23:58 +00:00
|
|
|
, cimg
|
2019-09-07 10:22:02 +00:00
|
|
|
, cmake
|
2023-05-03 01:23:58 +00:00
|
|
|
, curl
|
2019-09-07 10:22:02 +00:00
|
|
|
, fftw
|
2023-05-03 01:23:58 +00:00
|
|
|
, gimp
|
|
|
|
, gimpPlugins
|
|
|
|
, gmic
|
|
|
|
, graphicsmagick
|
2019-09-07 10:22:02 +00:00
|
|
|
, libjpeg
|
|
|
|
, libpng
|
2023-05-03 01:23:58 +00:00
|
|
|
, libtiff
|
|
|
|
, ninja
|
|
|
|
, nix-update-script
|
|
|
|
, opencv3
|
|
|
|
, openexr
|
|
|
|
, pkg-config
|
2019-09-07 10:22:02 +00:00
|
|
|
, qtbase
|
|
|
|
, qttools
|
2023-05-03 01:23:58 +00:00
|
|
|
, wrapQtAppsHook
|
|
|
|
, zlib
|
|
|
|
, variant ? "standalone"
|
2019-09-07 10:22:02 +00:00
|
|
|
}:
|
2018-09-27 17:28:23 +00:00
|
|
|
|
|
|
|
let
|
2019-09-07 10:33:56 +00:00
|
|
|
variants = {
|
|
|
|
gimp = {
|
|
|
|
extraDeps = [
|
|
|
|
gimp
|
|
|
|
gimp.gtk
|
|
|
|
];
|
|
|
|
description = "GIMP plugin for the G'MIC image processing framework";
|
|
|
|
};
|
|
|
|
|
|
|
|
standalone = {
|
|
|
|
description = "Versatile front-end to the image processing framework G'MIC";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
in
|
|
|
|
|
2023-05-03 01:23:58 +00:00
|
|
|
assert lib.assertMsg
|
|
|
|
(builtins.hasAttr variant variants)
|
|
|
|
"gmic-qt variant \"${variant}\" is not supported. Please use one of ${lib.concatStringsSep ", " (builtins.attrNames variants)}.";
|
2019-09-07 10:33:56 +00:00
|
|
|
|
2023-05-03 01:23:58 +00:00
|
|
|
assert lib.assertMsg
|
|
|
|
(builtins.all (d: d != null) variants.${variant}.extraDeps or [])
|
|
|
|
"gmic-qt variant \"${variant}\" is missing one of its dependencies.";
|
2019-09-07 10:33:56 +00:00
|
|
|
|
2023-05-03 01:23:58 +00:00
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
2021-01-24 09:19:10 +00:00
|
|
|
pname = "gmic-qt${lib.optionalString (variant != "standalone") "-${variant}"}";
|
2023-05-03 01:17:55 +00:00
|
|
|
version = "3.2.4";
|
2018-09-27 17:28:23 +00:00
|
|
|
|
2023-02-26 12:13:09 +00:00
|
|
|
src = fetchzip {
|
2023-05-03 01:23:58 +00:00
|
|
|
url = "https://gmic.eu/files/source/gmic_${finalAttrs.version}.tar.gz";
|
2023-05-03 01:17:55 +00:00
|
|
|
hash = "sha256-FJ2zlsah/3Jf5ie4UhQsPvMoxDMc6iHl3AkhKsZSuqE=";
|
2018-09-27 20:41:26 +00:00
|
|
|
};
|
2018-09-27 17:28:23 +00:00
|
|
|
|
2019-09-07 10:22:02 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
2021-01-17 09:17:16 +00:00
|
|
|
pkg-config
|
2022-06-29 19:34:35 +00:00
|
|
|
ninja
|
2023-03-17 18:42:02 +00:00
|
|
|
wrapQtAppsHook
|
2019-09-07 10:22:02 +00:00
|
|
|
];
|
2018-09-27 17:28:23 +00:00
|
|
|
|
|
|
|
buildInputs = [
|
2022-06-29 19:34:35 +00:00
|
|
|
gmic
|
2019-09-07 10:22:02 +00:00
|
|
|
qtbase
|
|
|
|
qttools
|
|
|
|
fftw
|
|
|
|
zlib
|
|
|
|
libjpeg
|
|
|
|
libtiff
|
|
|
|
libpng
|
2019-11-27 01:07:57 +00:00
|
|
|
opencv3
|
2019-09-07 10:22:02 +00:00
|
|
|
openexr
|
|
|
|
graphicsmagick
|
|
|
|
curl
|
2019-09-07 10:33:56 +00:00
|
|
|
] ++ variants.${variant}.extraDeps or [];
|
2018-09-27 17:28:23 +00:00
|
|
|
|
2023-05-03 01:23:58 +00:00
|
|
|
preConfigure = ''
|
|
|
|
cd gmic-qt
|
|
|
|
'';
|
2018-09-27 17:28:23 +00:00
|
|
|
|
2022-06-29 19:34:35 +00:00
|
|
|
postPatch = ''
|
|
|
|
patchShebangs \
|
|
|
|
translations/filters/csv2ts.sh \
|
|
|
|
translations/lrelease.sh
|
2021-12-31 06:05:51 +00:00
|
|
|
'';
|
|
|
|
|
2023-05-03 01:23:58 +00:00
|
|
|
cmakeFlags = [
|
|
|
|
"-DGMIC_QT_HOST=${if variant == "standalone" then "none" else variant}"
|
|
|
|
"-DENABLE_SYSTEM_GMIC=ON"
|
|
|
|
"-DENABLE_DYNAMIC_LINKING=ON"
|
|
|
|
];
|
|
|
|
|
2019-09-07 10:33:56 +00:00
|
|
|
postFixup = lib.optionalString (variant == "gimp") ''
|
2021-12-31 06:11:12 +00:00
|
|
|
echo "wrapping $out/${gimp.targetPluginDir}/gmic_gimp_qt/gmic_gimp_qt"
|
|
|
|
wrapQtApp "$out/${gimp.targetPluginDir}/gmic_gimp_qt/gmic_gimp_qt"
|
2018-09-27 17:28:23 +00:00
|
|
|
'';
|
|
|
|
|
2023-02-19 16:34:52 +00:00
|
|
|
passthru = {
|
2023-02-19 16:48:56 +00:00
|
|
|
tests = {
|
|
|
|
gimp-plugin = gimpPlugins.gmic;
|
2023-05-03 01:23:58 +00:00
|
|
|
# Needs to update them all in lockstep.
|
|
|
|
inherit cimg gmic;
|
2023-02-19 16:48:56 +00:00
|
|
|
};
|
|
|
|
|
2023-02-19 16:34:52 +00:00
|
|
|
updateScript = nix-update-script { };
|
|
|
|
};
|
|
|
|
|
2023-05-03 01:23:58 +00:00
|
|
|
meta = {
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "http://gmic.eu/";
|
2023-05-03 01:23:58 +00:00
|
|
|
inherit (variants.${variant}) description;
|
|
|
|
license = lib.licenses.gpl3Plus;
|
|
|
|
maintainers = [ lib.maintainers.lilyinstarlight ];
|
|
|
|
platforms = lib.platforms.unix;
|
2023-04-24 22:15:57 +00:00
|
|
|
mainProgram = "gmic_qt";
|
2018-09-27 17:28:23 +00:00
|
|
|
};
|
2023-05-03 01:23:58 +00:00
|
|
|
})
|