mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-23 06:03:40 +00:00
7319edcda5
Use uasm to compile the optimized code instead of generic C code for faster operations. Before: ``` 7zz x 10.83s user 0.40s system 98% cpu 11.439 total ``` After: ``` 7zz x 6.87s user 0.40s system 98% cpu 7.395 total ```
54 lines
1.3 KiB
Nix
54 lines
1.3 KiB
Nix
{ stdenv, lib, fetchurl, p7zip, uasm, useUasm ? stdenv.isx86_64 }:
|
|
|
|
let
|
|
inherit (stdenv.hostPlatform) system;
|
|
platformSuffix =
|
|
if useUasm then
|
|
{
|
|
x86_64-linux = "_x64";
|
|
}.${system} or (throw "`useUasm` is not supported for system ${system}")
|
|
else "";
|
|
in
|
|
stdenv.mkDerivation rec {
|
|
pname = "7zz";
|
|
version = "21.07";
|
|
|
|
src = fetchurl {
|
|
url = "https://7-zip.org/a/7z${lib.replaceStrings [ "." ] [ "" ] version}-src.7z";
|
|
sha256 = "sha256-0QdNVvQVqrmdmeWXp7ZtxFXbpjSa6KTInfdkdbahKEw=";
|
|
};
|
|
|
|
sourceRoot = "CPP/7zip/Bundles/Alone2";
|
|
|
|
makeFlags = lib.optionals useUasm [ "MY_ASM=uasm" ];
|
|
|
|
makefile = "../../cmpl_gcc${platformSuffix}.mak";
|
|
|
|
nativeBuildInputs = [ p7zip ] ++ lib.optionals useUasm [ uasm ];
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
|
|
install -Dm555 -t $out/bin b/g${platformSuffix}/7zz
|
|
install -Dm444 -t $out/share/doc/${pname} ../../../../DOC/*.txt
|
|
|
|
runHook postInstall
|
|
'';
|
|
|
|
doInstallCheck = true;
|
|
|
|
installCheckPhase = ''
|
|
$out/bin/7zz --help | grep ${version}
|
|
'';
|
|
|
|
meta = with lib; {
|
|
description = "Command line archiver utility";
|
|
homepage = "https://7-zip.org";
|
|
license = licenses.lgpl21Plus;
|
|
maintainers = with maintainers; [ anna328p peterhoeg ];
|
|
platforms = platforms.linux;
|
|
};
|
|
}
|