2022-07-14 12:49:19 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, fetchFromGitHub
|
2020-04-24 23:36:52 +00:00
|
|
|
, fetchurl
|
|
|
|
, cmake
|
|
|
|
, ninja
|
2020-05-29 06:06:01 +00:00
|
|
|
, pkg-config
|
2020-11-24 20:58:05 +00:00
|
|
|
, opencv
|
2020-04-24 23:36:52 +00:00
|
|
|
, openexr
|
|
|
|
, graphicsmagick
|
2022-07-14 12:49:19 +00:00
|
|
|
, cimg
|
2020-04-24 23:36:52 +00:00
|
|
|
, fftw
|
|
|
|
, zlib
|
|
|
|
, libjpeg
|
|
|
|
, libtiff
|
|
|
|
, libpng
|
2022-07-14 12:49:19 +00:00
|
|
|
, writeShellScript
|
|
|
|
, common-updater-scripts
|
|
|
|
, curl
|
|
|
|
, gnugrep
|
|
|
|
, gnused
|
|
|
|
, coreutils
|
|
|
|
, jq
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "gmic";
|
2022-07-14 12:49:19 +00:00
|
|
|
version = "3.1.5";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
outputs = [ "out" "lib" "dev" "man" ];
|
|
|
|
|
2022-07-14 12:49:19 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "dtschump";
|
|
|
|
repo = "gmic";
|
|
|
|
rev = "326ea9b7dc320b3624fe660d7b7d81669ca12e6d";
|
|
|
|
sha256 = "RRCzYMN/IXViiUNnacJV3DNpku3hIHQkHbIrtixExT0=";
|
|
|
|
};
|
|
|
|
|
|
|
|
# TODO: build this from source
|
|
|
|
# https://github.com/dtschump/gmic/blob/b36b2428db5926af5eea5454f822f369c2d9907e/src/Makefile#L675-L729
|
|
|
|
gmic_stdlib = fetchurl {
|
|
|
|
name = "gmic_stdlib.h";
|
|
|
|
url = "http://gmic.eu/gmic_stdlib${lib.replaceStrings ["."] [""] version}.h";
|
|
|
|
sha256 = "FM8RscCrt6jYlwVB2DtpqYrh9B3pO0I6Y69tkf9W1/o=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
|
|
|
ninja
|
2020-05-29 06:06:01 +00:00
|
|
|
pkg-config
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
2022-07-14 12:49:19 +00:00
|
|
|
cimg
|
2020-04-24 23:36:52 +00:00
|
|
|
fftw
|
|
|
|
zlib
|
|
|
|
libjpeg
|
|
|
|
libtiff
|
|
|
|
libpng
|
2020-11-24 20:58:05 +00:00
|
|
|
opencv
|
2020-04-24 23:36:52 +00:00
|
|
|
openexr
|
|
|
|
graphicsmagick
|
|
|
|
];
|
|
|
|
|
|
|
|
cmakeFlags = [
|
|
|
|
"-DBUILD_LIB_STATIC=OFF"
|
2020-05-29 06:06:01 +00:00
|
|
|
"-DENABLE_CURL=OFF"
|
2020-04-24 23:36:52 +00:00
|
|
|
"-DENABLE_DYNAMIC_LINKING=ON"
|
2022-07-14 12:49:19 +00:00
|
|
|
"-DUSE_SYSTEM_CIMG=ON"
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
2022-07-14 12:49:19 +00:00
|
|
|
postPatch = ''
|
|
|
|
# TODO: build from source
|
|
|
|
cp -r ${gmic_stdlib} src/gmic_stdlib.h
|
|
|
|
|
|
|
|
# CMake build files were moved to subdirectory.
|
|
|
|
mv resources/CMakeLists.txt resources/cmake .
|
|
|
|
'';
|
|
|
|
|
|
|
|
passthru = {
|
|
|
|
updateScript = writeShellScript "${pname}-update-script" ''
|
|
|
|
set -o errexit
|
|
|
|
PATH=${lib.makeBinPath [ common-updater-scripts curl gnugrep gnused coreutils 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 [[ "${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 "$(printf '0%.0s' {1..64})"
|
|
|
|
update-source-version "--source-key=$component" "gmic" $latestVersion
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Open and full-featured framework for image processing";
|
2020-05-29 06:06:01 +00:00
|
|
|
homepage = "https://gmic.eu/";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.cecill20;
|
|
|
|
platforms = platforms.unix;
|
|
|
|
};
|
|
|
|
}
|