Merge pull request #146662 from smancill/ZHF-lrzip

lrzip: enable asm on x86 and fix build on darwin
This commit is contained in:
Domen Kožar 2021-11-20 18:45:47 +01:00 committed by GitHub
commit 4dba55aec5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,17 +1,33 @@
{ lib, stdenv, fetchurl, zlib, lzo, bzip2, lz4, nasm, perl }:
{ lib, stdenv, fetchFromGitHub, autoreconfHook, zlib, lzo, bzip2, lz4, nasm, perl }:
let
inherit (stdenv.hostPlatform) isx86;
in
stdenv.mkDerivation rec {
pname = "lrzip";
version = "0.641";
src = fetchurl {
url = "http://ck.kolivas.org/apps/lrzip/${pname}-${version}.tar.xz";
sha256 = "0ziyanspd96dc3lp2qdcylc7aq8dhb511jhqrhxvlp502fjqjqrc";
src = fetchFromGitHub {
owner = "ckolivas";
repo = pname;
rev = "v${version}";
sha256 = "sha256-253CH6TiHWyr13C76y9PXjyB7gj2Bhd2VRgJ5r+cm/g=";
};
buildInputs = [ zlib lzo bzip2 lz4 nasm perl ];
postPatch = lib.optionalString stdenv.isDarwin ''
# Building the ASM/x86 directory creates an empty archive,
# which fails on darwin, so remove it
# https://github.com/ckolivas/lrzip/issues/193
# https://github.com/Homebrew/homebrew-core/pull/85360
substituteInPlace lzma/Makefile.am --replace "SUBDIRS = C ASM/x86" "SUBDIRS = C"
substituteInPlace configure.ac --replace "-f elf64" "-f macho64"
'';
configureFlags = [
nativeBuildInputs = [ autoreconfHook perl ] ++ lib.optionals isx86 [ nasm ];
buildInputs = [ zlib lzo bzip2 lz4 ];
configureFlags = lib.optionals (!isx86) [
"--disable-asm"
];