nixpkgs/pkgs/by-name/gm/gmic/package.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

123 lines
2.9 KiB
Nix
Raw Normal View History

{ lib
, stdenv
, fetchFromGitHub
2019-09-07 15:09:23 +03:00
, fetchurl
, cimg
, cmake
, common-updater-scripts
, coreutils
, curl
, fftw
, gmic-qt
, gnugrep
, gnused
, graphicsmagick
, jq
, libjpeg
, libpng
, libtiff
, ninja
, opencv
, openexr
, pkg-config
, writeShellScript
, zlib
2019-09-07 15:09:23 +03:00
}:
stdenv.mkDerivation (finalAttrs: {
2019-08-14 00:52:01 +03:00
pname = "gmic";
2024-05-20 22:49:29 +03:00
version = "3.3.6";
2019-09-07 15:09:23 +03:00
outputs = [ "out" "lib" "dev" "man" ];
2015-07-16 23:01:43 +03:00
src = fetchFromGitHub {
owner = "GreycLab";
repo = "gmic";
rev = "v.${finalAttrs.version}";
2024-05-20 22:49:29 +03:00
hash = "sha256-gyQP+ulXLMVkNn1Bss7zlQINcTunwbP+MAsftADqtOk=";
};
# TODO: build this from source
2024-03-14 00:45:35 +03:00
# Reference: src/Makefile, directive gmic_stdlib_community.h
gmic_stdlib = fetchurl {
2024-03-14 00:45:35 +03:00
name = "gmic_stdlib_community.h";
url = "http://gmic.eu/gmic_stdlib_community${lib.replaceStrings ["."] [""] finalAttrs.version}.h";
2024-05-20 22:49:29 +03:00
hash = "sha256-mj6yOGc+CGY6oFDv9PJ7y9KABdn9DG32m2IVlLAhrsc=";
2015-07-16 23:01:43 +03:00
};
2019-09-07 15:09:23 +03:00
nativeBuildInputs = [
cmake
ninja
pkg-config
2019-09-07 15:09:23 +03:00
];
2016-11-17 01:50:44 +03:00
buildInputs = [
cimg
2019-09-07 15:09:23 +03:00
fftw
graphicsmagick
2019-09-07 15:09:23 +03:00
libjpeg
libpng
libtiff
2020-11-21 11:39:46 +03:00
opencv
2019-09-07 15:09:23 +03:00
openexr
zlib
2019-09-07 15:09:23 +03:00
];
2015-07-16 23:01:43 +03:00
cmakeFlags = [
2023-09-26 00:13:01 +03:00
(lib.cmakeBool "BUILD_LIB_STATIC" false)
(lib.cmakeBool "ENABLE_CURL" false)
(lib.cmakeBool "ENABLE_DYNAMIC_LINKING" true)
(lib.cmakeBool "USE_SYSTEM_CIMG" true)
2019-09-07 15:09:23 +03:00
];
2015-07-16 23:01:43 +03:00
postPatch = ''
2024-03-14 00:45:35 +03:00
cp -r ${finalAttrs.gmic_stdlib} src/gmic_stdlib_community.h
''
+ lib.optionalString stdenv.isDarwin ''
2022-10-24 15:52:01 +03:00
substituteInPlace CMakeLists.txt \
--replace "LD_LIBRARY_PATH" "DYLD_LIBRARY_PATH"
'';
passthru = {
tests = {
# Needs to update them all in lockstep.
inherit cimg gmic-qt;
};
updateScript = writeShellScript "gmic-update-script" ''
set -o errexit
PATH=${lib.makeBinPath [ common-updater-scripts coreutils curl gnugrep gnused jq ]}
latestVersion=$(curl 'https://gmic.eu/files/source/' \
| grep -E 'gmic_[^"]+\.tar\.gz' \
| sed -E 's/.+<a href="gmic_([^"]+)\.tar\.gz".+/\1/g' \
| sort --numeric-sort --reverse | head -n1)
if [[ "${finalAttrs.version}" = "$latestVersion" ]]; then
echo "The new version same as the old version."
exit 0
fi
for component in src gmic_stdlib; do
# The script will not perform an update when the version attribute is
# up to date from previous platform run; we need to clear it before
# each run
update-source-version "--source-key=$component" "gmic" 0 "${lib.fakeHash}"
update-source-version "--source-key=$component" "gmic" $latestVersion
done
'';
};
meta = {
homepage = "https://gmic.eu/";
description = "Open and full-featured framework for image processing";
mainProgram = "gmic";
license = lib.licenses.cecill21;
2023-09-26 00:13:01 +03:00
maintainers = [
lib.maintainers.AndersonTorres
lib.maintainers.lilyinstarlight
];
platforms = lib.platforms.unix;
2015-07-16 23:01:43 +03:00
};
})