pxz: use upstream's Makefile (#165264)
This commit is contained in:
parent
e8aeac7295
commit
4f1949bc59
|
@ -1,31 +1,42 @@
|
||||||
{ lib, stdenv, fetchFromGitHub, xz }:
|
{ lib
|
||||||
|
, stdenv
|
||||||
|
, fetchFromGitHub
|
||||||
|
, testVersion
|
||||||
|
, pxz
|
||||||
|
, xz
|
||||||
|
}:
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
pname = "pxz";
|
pname = "pxz";
|
||||||
version = "4.999.9beta+git";
|
version = "4.999.9beta";
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "jnovy";
|
owner = "jnovy";
|
||||||
repo = "pxz";
|
repo = "pxz";
|
||||||
rev = "124382a6d0832b13b7c091f72264f8f3f463070a";
|
rev = "124382a6d0832b13b7c091f72264f8f3f463070a";
|
||||||
sha256 = "15mmv832iqsqwigidvwnf0nyivxf0y8m22j2szy4h0xr76x4z21m";
|
hash = "sha256-NYhPujm5A0j810IKUZEHru/oLXCW7xZf5FjjKAbatZY=";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
patches = [ ./flush-stdout-help-version.patch ];
|
||||||
|
|
||||||
|
postPatch = ''
|
||||||
|
substituteInPlace Makefile \
|
||||||
|
--replace '`date +%Y%m%d`' '19700101'
|
||||||
|
|
||||||
|
substituteInPlace pxz.c \
|
||||||
|
--replace 'XZ_BINARY "xz"' 'XZ_BINARY "${lib.getBin xz}/bin/xz"'
|
||||||
|
'';
|
||||||
|
|
||||||
buildInputs = [ xz ];
|
buildInputs = [ xz ];
|
||||||
|
|
||||||
buildPhase = ''
|
makeFlags = [
|
||||||
gcc -o pxz pxz.c -llzma \
|
"BINDIR=${placeholder "out"}/bin"
|
||||||
-fopenmp -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -O2 \
|
"MANDIR=${placeholder "out"}/share/man"
|
||||||
-DPXZ_BUILD_DATE=\"nixpkgs\" \
|
];
|
||||||
-DXZ_BINARY=\"${xz.bin}/bin/xz\" \
|
|
||||||
-DPXZ_VERSION=\"${version}\"
|
|
||||||
'';
|
|
||||||
|
|
||||||
installPhase = ''
|
passthru.tests.version = testVersion {
|
||||||
mkdir -p $out/bin $out/share/man/man1
|
package = pxz;
|
||||||
cp pxz $out/bin
|
};
|
||||||
cp pxz.1 $out/share/man/man1
|
|
||||||
'';
|
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
homepage = "https://jnovy.fedorapeople.org/pxz/";
|
homepage = "https://jnovy.fedorapeople.org/pxz/";
|
||||||
|
@ -39,6 +50,7 @@ stdenv.mkDerivation rec {
|
||||||
resources to speed up compression time with minimal possible influence
|
resources to speed up compression time with minimal possible influence
|
||||||
on compression ratio
|
on compression ratio
|
||||||
'';
|
'';
|
||||||
|
mainProgram = "pxz";
|
||||||
platforms = with platforms; linux;
|
platforms = with platforms; linux;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
32
pkgs/tools/compression/pxz/flush-stdout-help-version.patch
Normal file
32
pkgs/tools/compression/pxz/flush-stdout-help-version.patch
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
From bba741ccd0f0a65cd9bfdd81504ebe5840fd37ad Mon Sep 17 00:00:00 2001
|
||||||
|
From: Will Dietz <w@wdtz.org>
|
||||||
|
Date: Tue, 22 Mar 2022 08:01:10 -0500
|
||||||
|
Subject: [PATCH] pxz: flush stdout before exec'ing xz, ensure our messages are
|
||||||
|
printed
|
||||||
|
|
||||||
|
Without this, they're presently dropped on my system when pxz
|
||||||
|
is piped to something, as in `pxz --help|less` or `pxz --version|cat`.
|
||||||
|
---
|
||||||
|
pxz.c | 2 ++
|
||||||
|
1 file changed, 2 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/pxz.c b/pxz.c
|
||||||
|
index 4240b6e..3b53cfa 100644
|
||||||
|
--- a/pxz.c
|
||||||
|
+++ b/pxz.c
|
||||||
|
@@ -184,10 +184,12 @@ void parse_args( int argc, char **argv, char **envp ) {
|
||||||
|
" -D, --context-size per-thread compression context size as a multiple\n"
|
||||||
|
" of dictionary size. Default is 3.\n\n"
|
||||||
|
"Usage and other options are same as in XZ:\n\n");
|
||||||
|
+ fflush(stdout);
|
||||||
|
run_xz(argv, envp);
|
||||||
|
break;
|
||||||
|
case 'V':
|
||||||
|
printf("Parallel PXZ "PXZ_VERSION" (build "PXZ_BUILD_DATE")\n");
|
||||||
|
+ fflush(stdout);
|
||||||
|
run_xz(argv, envp);
|
||||||
|
break;
|
||||||
|
case 'g':
|
||||||
|
--
|
||||||
|
2.35.1
|
||||||
|
|
Loading…
Reference in a new issue