1{ lib, stdenv, fetchFromGitHub, autoreconfHook, zlib, lzo, bzip2, lz4, nasm, perl }:
2
3let
4 inherit (stdenv.hostPlatform) isx86;
5in
6stdenv.mkDerivation rec {
7 pname = "lrzip";
8 version = "0.651";
9
10 src = fetchFromGitHub {
11 owner = "ckolivas";
12 repo = pname;
13 rev = "v${version}";
14 sha256 = "sha256-Mb324ojtLV0S10KhL7Vjf3DhSOtCy1pFMTzvLkTnpXM=";
15 };
16
17 postPatch = lib.optionalString stdenv.isDarwin ''
18 # Building the ASM/x86 directory creates an empty archive,
19 # which fails on darwin, so remove it
20 # https://github.com/ckolivas/lrzip/issues/193
21 # https://github.com/Homebrew/homebrew-core/pull/85360
22 substituteInPlace lzma/Makefile.am --replace "SUBDIRS = C ASM/x86" "SUBDIRS = C"
23 substituteInPlace configure.ac --replace "-f elf64" "-f macho64"
24 '';
25
26 nativeBuildInputs = [ autoreconfHook perl ] ++ lib.optionals isx86 [ nasm ];
27
28 buildInputs = [ zlib lzo bzip2 lz4 ];
29
30 configureFlags = lib.optionals (!isx86) [
31 "--disable-asm"
32 ];
33
34 meta = with lib; {
35 homepage = "http://ck.kolivas.org/apps/lrzip/";
36 description = "The CK LRZIP compression program (LZMA + RZIP)";
37 maintainers = with maintainers; [ ];
38 license = licenses.gpl2Plus;
39 platforms = platforms.unix;
40 };
41}