1{ stdenv, fetchFromGitHub
2, legacySupport ? false }:
3
4stdenv.mkDerivation rec {
5 name = "zstd-${version}";
6 version = "0.7.5";
7
8 src = fetchFromGitHub {
9 sha256 = "07b4gmmkk2b28vmmhcg8h2imzccav1qklgvbdg2k6nl9p88zwzkd";
10 rev = "v${version}";
11 repo = "zstd";
12 owner = "Cyan4973";
13 };
14
15 # The Makefiles don't properly use file targets, but blindly rebuild
16 # all dependencies on every make invocation. So no nice phases. :-(
17 phases = [ "unpackPhase" "installPhase" "fixupPhase" ];
18
19 makeFlags = [
20 "ZSTD_LEGACY_SUPPORT=${if legacySupport then "1" else "0"}"
21 ];
22
23 installFlags = [
24 "PREFIX=$(out)"
25 ];
26
27 meta = with stdenv.lib; {
28 description = "Zstandard real-time compression algorithm";
29 longDescription = ''
30 Zstd, short for Zstandard, is a fast lossless compression algorithm,
31 targeting real-time compression scenarios at zlib-level compression
32 ratio. Zstd can also offer stronger compression ratio at the cost of
33 compression speed. Speed/ratio trade-off is configurable by small
34 increment, to fit different situations. Note however that decompression
35 speed is preserved and remain roughly the same at all settings, a
36 property shared by most LZ compression algorithms, such as zlib.
37 '';
38 homepage = http://www.zstd.net/;
39 # The licence of the CLI programme is GPLv2+, that of the library BSD-2.
40 license = with licenses; [ gpl2Plus bsd2 ];
41
42 platforms = platforms.unix;
43 maintainers = with maintainers; [ nckx ];
44 };
45}