lol
1{ stdenv, lib, fetchpatch, fetchFromGitHub, fixDarwinDylibNames, pkgsStatic }:
2
3stdenv.mkDerivation rec {
4 pname = "libdeflate";
5 version = "1.8";
6
7 src = fetchFromGitHub {
8 owner = "ebiggers";
9 repo = "libdeflate";
10 rev = "v${version}";
11 sha256 = "sha256-P7YbuhP2/zJCpE9dxZev1yy5oda8WKAHY84ZLTL8gVs=";
12 };
13
14 patches = [
15 (fetchpatch {
16 url = "https://github.com/ebiggers/libdeflate/commit/ee4d18872bfe09a32cfd031c716b9069a04a50a0.diff";
17 sha256 = "0d2lllg60zbbbch0w0qrcqijrgski8xlsy5llg3i684d66ci538a";
18 })
19 ];
20
21 postPatch = ''
22 substituteInPlace Makefile --replace /usr/local $out
23 '';
24
25 makeFlags = lib.optionals stdenv.hostPlatform.isStatic [ "DISABLE_SHARED=1"];
26
27 nativeBuildInputs = lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames;
28
29 configurePhase = ''
30 make programs/config.h
31 '';
32
33 enableParallelBuilding = true;
34
35 passthru.tests.static = pkgsStatic.libdeflate;
36 meta = with lib; {
37 description = "Fast DEFLATE/zlib/gzip compressor and decompressor";
38 license = licenses.mit;
39 homepage = "https://github.com/ebiggers/libdeflate";
40 platforms = platforms.unix;
41 maintainers = with maintainers; [ orivej kaction ];
42 };
43}