@@ -1,47 +1,48 @@
1−{ lib, stdenv, fetchurl, autoPatchelfHook }:
1+{ stdenv, lib, fetchurl, p7zip }:
22
3−let platform = if stdenv.isi686 then "x86"
4− else if stdenv.isx86_64 then "x64"
5− else if stdenv.isAarch32 then "arm"
6− else if stdenv.isAarch64 then "arm64"
7− else throw "Unsupported architecture";
3+# https://sourceforge.net/p/sevenzip/discussion/45797/thread/7fe6c21efa/
4+stdenv.mkDerivation rec {
5+ pname = "7zz";
6+ version = "21.04";
87
9− url = "https://7-zip.org/a/7z2101-linux-${platform}.tar.xz";
8+ src = fetchurl {
9+ url = "https://7-zip.org/a/7z${lib.replaceStrings ["." ] [""] version}-src.7z";
10+ sha256 = "sha256-XmuEyIJAJQM0ZbgrW02lQ2rp4KFDBjLXKRaTfY+VCOg=";
11+ };
1012
11− hashes = {
12− x86 = "0k6vg85ld8i2pcv5sv3xbvf3swqh9qj8hf2jcpadssys3yyidqyj";
13− x64 = "1yfanx98fizj8d2s87yxgsy30zydx7h5w9wf4wy3blgsp0vkbjb3";
14− arm = "04iah9vijm86r8rbkhxig86fx3lpag4xi7i3vq7gfrlwkymclhm1";
15− arm64 = "0a26ginpb22aydcyvffxpbi7lxh4sgs9gb6cj96qqx7cnf7bk2ri";
16− };
17− sha256 = hashes."${platform}";
13+ sourceRoot = "CPP/7zip/Bundles/Alone2";
1814
19−in stdenv.mkDerivation {
20− pname = "7zz";
21− version = "21.01";
15+ # we need https://github.com/nidud/asmc/tree/master/source/asmc/linux in order
16+ # to build with the optimized assembler but that doesn't support building with
17+ # GCC: https://github.com/nidud/asmc/issues/8
18+ makefile = "../../cmpl_gcc.mak"; # "../../cmpl_gcc_x64.mak";
2219
23− src = fetchurl { inherit url sha256; };
24− sourceRoot = ".";
20+ NIX_CFLAGS_COMPILE = [ "-Wno-error=maybe-uninitialized" ];
2521
26− nativeBuildInputs = [ autoPatchelfHook ];
27− buildInputs = [ stdenv.cc.cc.lib ];
22+ nativeBuildInputs = [ p7zip ];
2823
29− dontBuild = true;
24+ enableParallelBuilding = true;
3025
3126 installPhase = ''
3227 runHook preInstall
33− install -D -t $out/bin 7zz
28+
29+ install -Dm555 -t $out/bin b/g/7zz
30+ install -Dm444 -t $out/share/doc/${pname} ../../../../DOC/*.txt
31+
3432 runHook postInstall
3533 '';
3634
37− meta = with lib; {
38− description = "Command line archiver utility";
39− homepage = "https://www.7-zip.org";
35+ doInstallCheck = true;
4036
41− # source not released yet. will be under LGPL 2.1+ with RAR exception
42− license = licenses.unfree;
37+ installCheckPhase = ''
38+ $out/bin/7zz --help | grep ${version}
39+ '';
4340
44− platforms = [ "i686-linux" "x86_64-linux" "aarch64-linux" "armv7l-linux" ];
45− maintainers = with maintainers; [ anna328p ];
41+ meta = with lib; {
42+ description = "Command line archiver utility";
43+ homepage = "https://7zip.org";
44+ license = licenses.lgpl21Plus;
45+ maintainers = with maintainers; [ anna328p peterhoeg ];
46+ platforms = platforms.linux;
4647 };
4748}