{ lib , stdenv , fetchFromGitHub , 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 }: stdenv.mkDerivation (finalAttrs: { pname = "gmic"; version = "3.2.6"; outputs = [ "out" "lib" "dev" "man" ]; src = fetchFromGitHub { owner = "GreycLab"; repo = "gmic"; rev = "v.${finalAttrs.version}"; hash = "sha256-kaI5rcAz3Cw/xzWgJhMRu/cQwVrvLRAPiB5BhzPMOHY="; }; # 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"; hash = "sha256-7JzFU4HvAtC5Nz5vusKCnJ8VMuKfSi1yFmjj0Hh+vA4="; }; nativeBuildInputs = [ cmake ninja pkg-config ]; buildInputs = [ cimg fftw graphicsmagick libjpeg libpng libtiff opencv openexr zlib ]; cmakeFlags = [ "-DBUILD_LIB_STATIC=OFF" "-DENABLE_CURL=OFF" "-DENABLE_DYNAMIC_LINKING=ON" "-DUSE_SYSTEM_CIMG=ON" ]; 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 '' 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/.+