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.

125 lines
2.9 KiB
Nix
Raw Normal View History

{ lib
, stdenv
, fetchFromGitHub
2019-09-07 12:09:23 +00: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 12:09:23 +00:00
}:
stdenv.mkDerivation (finalAttrs: {
2019-08-13 21:52:01 +00:00
pname = "gmic";
2023-10-09 14:20:44 +00:00
version = "3.3.1";
2019-09-07 12:09:23 +00:00
outputs = [ "out" "lib" "dev" "man" ];
2015-07-16 20:01:43 +00:00
src = fetchFromGitHub {
owner = "GreycLab";
repo = "gmic";
rev = "v.${finalAttrs.version}";
2023-10-09 14:20:44 +00:00
hash = "sha256-HagGabJ1jkg5SkMlr0Y5rGFw64jPW8QLuR0I2idM1N0=";
};
# TODO: build this from source
# Reference: src/Makefile, directive gmic_stdlib.h
gmic_stdlib = fetchurl {
name = "gmic_stdlib.h";
url = "http://gmic.eu/gmic_stdlib${lib.replaceStrings ["."] [""] finalAttrs.version}.h";
2023-07-01 17:33:22 +00:00
hash = "sha256-7JzFU4HvAtC5Nz5vusKCnJ8VMuKfSi1yFmjj0Hh+vA4=";
2015-07-16 20:01:43 +00:00
};
2019-09-07 12:09:23 +00:00
nativeBuildInputs = [
cmake
ninja
pkg-config
2019-09-07 12:09:23 +00:00
];
2016-11-16 22:50:44 +00:00
buildInputs = [
cimg
2019-09-07 12:09:23 +00:00
fftw
graphicsmagick
2019-09-07 12:09:23 +00:00
libjpeg
libpng
libtiff
2020-11-21 08:39:46 +00:00
opencv
2019-09-07 12:09:23 +00:00
openexr
zlib
2019-09-07 12:09:23 +00:00
];
2015-07-16 20:01:43 +00:00
cmakeFlags = [
2023-09-25 21:13:01 +00: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 12:09:23 +00:00
];
2015-07-16 20:01:43 +00:00
postPatch = ''
cp -r ${finalAttrs.gmic_stdlib} src/gmic_stdlib.h
# CMake build files were moved to subdirectory.
mv resources/CMakeLists.txt resources/cmake .
''
+ lib.optionalString stdenv.isDarwin ''
2022-10-24 12:52:01 +00: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";
license = lib.licenses.cecill21;
2023-09-25 21:13:01 +00:00
maintainers = [
lib.maintainers.AndersonTorres
lib.maintainers.lilyinstarlight
];
platforms = lib.platforms.unix;
2015-07-16 20:01:43 +00:00
};
})