git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #146662 from smancill/ZHF-lrzip

lrzip: enable asm on x86 and fix build on darwin

commit4dba55aec572febbf2b0e660b4de4007e0a30a60 authorDomen Kožar <domen@dev.si> dateSat 20 Nov 2021, 18:45 (5 years ago) parent6f8bd3e5c35e91
1 file changed+22−6
pkgs/tools/compression/lrzip/default.nix+22−6
pkgs/tools/compression/lrzip/default.nix+22−6
@@ -1,17 +1,33 @@
1−{ lib, stdenv, fetchurl, zlib, lzo, bzip2, lz4, nasm, perl }:
1+{ lib, stdenv, fetchFromGitHub, autoreconfHook, zlib, lzo, bzip2, lz4, nasm, perl }:
22
3+let
4+ inherit (stdenv.hostPlatform) isx86;
5+in
36stdenv.mkDerivation rec {
47 pname = "lrzip";
58 version = "0.641";
69
7− src = fetchurl {
8− url = "http://ck.kolivas.org/apps/lrzip/${pname}-${version}.tar.xz";
9− sha256 = "0ziyanspd96dc3lp2qdcylc7aq8dhb511jhqrhxvlp502fjqjqrc";
10+ src = fetchFromGitHub {
11+ owner = "ckolivas";
12+ repo = pname;
13+ rev = "v${version}";
14+ sha256 = "sha256-253CH6TiHWyr13C76y9PXjyB7gj2Bhd2VRgJ5r+cm/g=";
1015 };
1116
12− buildInputs = [ zlib lzo bzip2 lz4 nasm perl ];
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+ '';
1325
14− configureFlags = [
26+ nativeBuildInputs = [ autoreconfHook perl ] ++ lib.optionals isx86 [ nasm ];
27+
28+ buildInputs = [ zlib lzo bzip2 lz4 ];
29+
30+ configureFlags = lib.optionals (!isx86) [
1531 "--disable-asm"
1632 ];
1733