diff options
Diffstat (limited to 'pkgs/tools/graphics')
-rw-r--r-- | pkgs/tools/graphics/apng2gif/default.nix | 41 | ||||
-rw-r--r-- | pkgs/tools/graphics/apngopt/default.nix | 53 | ||||
-rw-r--r-- | pkgs/tools/graphics/apngopt/remove-7z.patch | 40 | ||||
-rw-r--r-- | pkgs/tools/graphics/gif2apng/default.nix | 69 |
4 files changed, 203 insertions, 0 deletions
diff --git a/pkgs/tools/graphics/apng2gif/default.nix b/pkgs/tools/graphics/apng2gif/default.nix new file mode 100644 index 000000000000..d4fdd7d448c4 --- /dev/null +++ b/pkgs/tools/graphics/apng2gif/default.nix @@ -0,0 +1,41 @@ +{ lib +, stdenv +, fetchzip +, libpng +}: + +stdenv.mkDerivation rec { + pname = "apng2gif"; + version = "1.8"; + + src = fetchzip { + url = "mirror://sourceforge/apng2gif/apng2gif-${version}-src.zip"; + stripRoot = false; + hash = "sha256-qX8gmE0Lu2p15kL0y6cmX/bI0uk5Ehfi8ygt07BbgmU="; + }; + + # Remove bundled libs + postPatch = '' + rm -r libpng zlib + ''; + + buildInputs = [ + libpng + ]; + + makeFlags = [ "CC=${stdenv.cc.targetPrefix}c++" ]; + + installPhase = '' + runHook preInstall + install -Dm755 apng2gif $out/bin/apng2gif + runHook postInstall + ''; + + meta = with lib; { + homepage = "https://apng2gif.sourceforge.net/"; + description = "A simple program that converts APNG files to animated GIF format"; + license = licenses.zlib; + maintainers = with maintainers; [ fgaz ]; + platforms = platforms.all; + }; +} diff --git a/pkgs/tools/graphics/apngopt/default.nix b/pkgs/tools/graphics/apngopt/default.nix new file mode 100644 index 000000000000..e0c097732452 --- /dev/null +++ b/pkgs/tools/graphics/apngopt/default.nix @@ -0,0 +1,53 @@ +{ lib +, stdenv +, fetchzip +, libpng +, zlib +, zopfli +}: + +stdenv.mkDerivation rec { + pname = "apngopt"; + version = "1.4"; + + src = fetchzip { + url = "mirror://sourceforge/apng/apngopt-${version}-src.zip"; + stripRoot = false; + hash = "sha256-MAqth5Yt7+SabY6iEgSFcaBmuHvA0ZkNdXSgvhKao1Y="; + }; + + patches = [ + ./remove-7z.patch + ]; + + # Remove bundled libs + postPatch = '' + rm -r 7z libpng zlib zopfli + ''; + + buildInputs = [ + libpng + zlib + zopfli + ]; + + preBuild = '' + buildFlagsArray+=("LIBS=-lzopfli -lstdc++ -lpng -lz") + ''; + + makeFlags = [ "CC=${stdenv.cc.targetPrefix}c++" ]; + + installPhase = '' + runHook preInstall + install -Dm755 apngopt $out/bin/apngopt + runHook postInstall + ''; + + meta = with lib; { + homepage = "https://sourceforge.net/projects/apng/"; + description = "Optimizes APNG animations"; + license = licenses.zlib; + maintainers = with maintainers; [ fgaz ]; + platforms = platforms.all; + }; +} diff --git a/pkgs/tools/graphics/apngopt/remove-7z.patch b/pkgs/tools/graphics/apngopt/remove-7z.patch new file mode 100644 index 000000000000..2a0bc50fb12d --- /dev/null +++ b/pkgs/tools/graphics/apngopt/remove-7z.patch @@ -0,0 +1,40 @@ +Index: b/apngopt.cpp +=================================================================== +--- a/apngopt.cpp ++++ b/apngopt.cpp +@@ -33,7 +33,6 @@ + #include <vector> + #include "png.h" /* original (unpatched) libpng is ok */ + #include "zlib.h" +-#include "7z.h" + extern "C" { + #include "zopfli.h" + } +@@ -958,8 +957,6 @@ void deflate_rect_fin(int deflate_method + if (deflate_method == 1) + { + unsigned size = zbuf_size; +- compress_rfc1950_7z(rows, op[n].h*(rowbytes + 1), zbuf, size, iter<100 ? iter : 100, 255); +- *zsize = size; + } + else + { +@@ -1438,8 +1435,7 @@ int main(int argc, char** argv) + if (argc <= 1) + { + printf("\n\nUsage: apngopt [options] anim.png [anim_opt.png]\n\n" +- "-z0 : zlib compression\n" +- "-z1 : 7zip compression (default)\n" ++ "-z0 : zlib compression (default)\n" + "-z2 : zopfli compression\n" + "-i## : number of iterations, default -i%d\n", iter); + return 1; +@@ -1459,7 +1455,7 @@ int main(int argc, char** argv) + if (szOpt[2] == '0') + deflate_method = 0; + if (szOpt[2] == '1') +- deflate_method = 1; ++ deflate_method = 0; + if (szOpt[2] == '2') + deflate_method = 2; + } diff --git a/pkgs/tools/graphics/gif2apng/default.nix b/pkgs/tools/graphics/gif2apng/default.nix new file mode 100644 index 000000000000..712dc395246f --- /dev/null +++ b/pkgs/tools/graphics/gif2apng/default.nix @@ -0,0 +1,69 @@ +{ lib +, stdenv +, fetchzip +, fetchpatch +, zlib +, zopfli +}: + +stdenv.mkDerivation rec { + pname = "gif2apng"; + version = "1.9"; + + src = fetchzip { + url = "mirror://sourceforge/gif2apng/gif2apng-${version}-src.zip"; + stripRoot = false; + hash = "sha256-rt1Vp4hjeFAVWJOU04BdU2YvBwECe9Q1c7EpNpIN+uE="; + }; + + patches = [ + (fetchpatch { + url = "https://sources.debian.org/data/main/g/gif2apng/1.9%2Bsrconly-3%2Bdeb11u1/debian/patches/10-7z.patch"; + hash = "sha256-zQgSWP/CIGaTUIxP/X92zpAQVSGgVo8gQEoCCMn+XT0="; + }) + (fetchpatch { + url = "https://sources.debian.org/data/main/g/gif2apng/1.9%2Bsrconly-3%2Bdeb11u1/debian/patches/CVE-2021-45909.patch"; + hash = "sha256-ZDN3xgvktgahDEtrEpyVsL+4u+97Fo9vAB1RSKhu8KA="; + }) + (fetchpatch { + url = "https://sources.debian.org/data/main/g/gif2apng/1.9%2Bsrconly-3%2Bdeb11u1/debian/patches/CVE-2021-45910.patch"; + hash = "sha256-MzOUOC7kqH22DmTMXoDu+jZAMBJPndnFNJGAQv5FcdI="; + }) + (fetchpatch { + url = "https://sources.debian.org/data/main/g/gif2apng/1.9%2Bsrconly-3%2Bdeb11u1/debian/patches/CVE-2021-45911.patch"; + hash = "sha256-o2YDHsSaorCx/6bQQfudzkLHo9pakgyvs2Pbafplnek="; + }) + ]; + + # Remove bundled libs + postPatch = '' + rm -r 7z zlib zopfli + ''; + + buildInputs = [ + zlib + zopfli + ]; + + preBuild = '' + buildFlagsArray+=("LIBS=-lzopfli -lstdc++ -lz") + ''; + + makeFlags = [ "CC=${stdenv.cc.targetPrefix}c++" ]; + + NIX_CFLAGS_COMPILE="-DENABLE_LOCAL_ZOPFLI"; + + installPhase = '' + runHook preInstall + install -Dm755 gif2apng $out/bin/gif2apng + runHook postInstall + ''; + + meta = with lib; { + homepage = "https://gif2apng.sourceforge.net/"; + description = "A simple program that converts animations from GIF to APNG format"; + license = licenses.zlib; + maintainers = with maintainers; [ fgaz ]; + platforms = platforms.all; + }; +} |