1{ lib, stdenv
2, fetchFromGitHub
3, fetchpatch
4, autoreconfHook
5, zlib
6}:
7
8stdenv.mkDerivation rec {
9 pname = "advancecomp";
10 version = "2.1";
11
12 src = fetchFromGitHub {
13 owner = "amadvance";
14 repo = "advancecomp";
15 rev = "v${version}";
16 sha256 = "1pd6czamamrd0ppk5a3a65hcgdlqwja98aandhqiajhnibwldv8x";
17 };
18
19 nativeBuildInputs = [ autoreconfHook ];
20 buildInputs = [ zlib ];
21
22 patches = [
23 (fetchpatch {
24 name = "CVE-2019-9210.patch";
25 url = "https://github.com/amadvance/advancecomp/commit/fcf71a89265c78fc26243574dda3a872574a5c02.patch";
26 sha256 = "0cdv9g87c1y8zwhqkd9ba2zjw4slcvg7yzcqv43idvnwb5fl29n7";
27 excludes = [ "doc/history.d" ];
28 })
29
30 # Pull upstream fix for gcc-11:
31 (fetchpatch {
32 name = "gcc-11.patch";
33 url = "https://github.com/amadvance/advancecomp/commit/7b08f7a2af3f66ab95437e4490499cebb20e5e41.patch";
34 sha256 = "0gpppq6b760m1429g7d808ipdgb4lrqc1b6xk2457y66pbaiwc9s";
35 })
36 ];
37
38 # autover.sh relies on 'git describe', which obviously doesn't work as we're not cloning
39 # the full git repo. so we have to put the version number in `.version`, otherwise
40 # the binaries get built reporting "none" as their version number.
41 postPatch = ''
42 echo "${version}" >.version
43 '';
44
45 meta = with lib; {
46 description = "A set of tools to optimize deflate-compressed files";
47 license = licenses.gpl3 ;
48 maintainers = [ maintainers.raskin ];
49 platforms = platforms.linux ++ platforms.darwin;
50 homepage = "https://github.com/amadvance/advancecomp";
51
52 };
53}