apngopt: init at 1.4

This commit is contained in:
Francesco Gazzetta 2023-03-30 18:22:49 +02:00
parent 0c77de452c
commit 9f10ac64ef
3 changed files with 95 additions and 0 deletions

View File

@ -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;
};
}

View File

@ -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;
}

View File

@ -17330,6 +17330,8 @@ with pkgs;
gif2apng = callPackage ../tools/graphics/gif2apng { };
apngopt = callPackage ../tools/graphics/apngopt { };
kt = callPackage ../tools/misc/kt { };
argbash = callPackage ../development/tools/misc/argbash { };