vuls: init at 0.27.0 (#348530)
[NixPkgs.git] / pkgs / tools / graphics / gif2apng / default.nix
blob1a824e14a5a3e3f1ebbd1b35c277ff33a86523f9
1 { lib
2 , stdenv
3 , fetchzip
4 , fetchpatch
5 , zlib
6 , zopfli
7 }:
9 stdenv.mkDerivation rec {
10   pname = "gif2apng";
11   version = "1.9";
13   src = fetchzip {
14     url = "mirror://sourceforge/gif2apng/gif2apng-${version}-src.zip";
15     stripRoot = false;
16     hash = "sha256-rt1Vp4hjeFAVWJOU04BdU2YvBwECe9Q1c7EpNpIN+uE=";
17   };
19   patches = [
20     (fetchpatch {
21       url = "https://sources.debian.org/data/main/g/gif2apng/1.9%2Bsrconly-3%2Bdeb11u1/debian/patches/10-7z.patch";
22       hash = "sha256-zQgSWP/CIGaTUIxP/X92zpAQVSGgVo8gQEoCCMn+XT0=";
23     })
24     (fetchpatch {
25       url = "https://sources.debian.org/data/main/g/gif2apng/1.9%2Bsrconly-3%2Bdeb11u1/debian/patches/CVE-2021-45909.patch";
26       hash = "sha256-ZDN3xgvktgahDEtrEpyVsL+4u+97Fo9vAB1RSKhu8KA=";
27     })
28     (fetchpatch {
29       url = "https://sources.debian.org/data/main/g/gif2apng/1.9%2Bsrconly-3%2Bdeb11u1/debian/patches/CVE-2021-45910.patch";
30       hash = "sha256-MzOUOC7kqH22DmTMXoDu+jZAMBJPndnFNJGAQv5FcdI=";
31     })
32     (fetchpatch {
33       url = "https://sources.debian.org/data/main/g/gif2apng/1.9%2Bsrconly-3%2Bdeb11u1/debian/patches/CVE-2021-45911.patch";
34       hash = "sha256-o2YDHsSaorCx/6bQQfudzkLHo9pakgyvs2Pbafplnek=";
35     })
36   ];
38   # Remove bundled libs
39   postPatch = ''
40     rm -r 7z zlib zopfli
41   '';
43   buildInputs = [
44     zlib
45     zopfli
46   ];
48   preBuild = ''
49     buildFlagsArray+=("LIBS=-lzopfli -lstdc++ -lz")
50   '';
52   makeFlags = [ "CC=${stdenv.cc.targetPrefix}c++" ];
54   NIX_CFLAGS_COMPILE="-DENABLE_LOCAL_ZOPFLI";
56   installPhase = ''
57     runHook preInstall
58     install -Dm755 gif2apng $out/bin/gif2apng
59     runHook postInstall
60   '';
62   meta = with lib; {
63     homepage = "https://gif2apng.sourceforge.net/";
64     description = "Simple program that converts animations from GIF to APNG format";
65     license = licenses.zlib;
66     maintainers = with maintainers; [ fgaz ];
67     platforms = platforms.all;
68   };