summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Hoeg <peter@hoeg.com>2021-11-12 10:57:14 +0800
committerGitHub <noreply@github.com>2021-11-12 10:57:14 +0800
commit0437e90238b64b0267b5dc1f62eb0bc042e8a9c0 (patch)
treed27a2aad43b5dac834138a9f5afac7d148813f33
parent77e7d796b838eae999b7649495770345b54825d2 (diff)
downloadnixpkgs-0437e90238b64b0267b5dc1f62eb0bc042e8a9c0.tar
nixpkgs-0437e90238b64b0267b5dc1f62eb0bc042e8a9c0.tar.gz
nixpkgs-0437e90238b64b0267b5dc1f62eb0bc042e8a9c0.tar.bz2
nixpkgs-0437e90238b64b0267b5dc1f62eb0bc042e8a9c0.tar.lz
nixpkgs-0437e90238b64b0267b5dc1f62eb0bc042e8a9c0.tar.xz
nixpkgs-0437e90238b64b0267b5dc1f62eb0bc042e8a9c0.tar.zst
nixpkgs-0437e90238b64b0267b5dc1f62eb0bc042e8a9c0.zip
7zz: 21.01 -> 21.04 (#145031)
* 7zz: 21.01 -> 21.04

Also build from source instead of using the binaries.

We cannot (yet) build the fully optimized version as it requires the
ASMC assembler which currently doesn't build with GCC.
-rw-r--r--pkgs/tools/archivers/7zz/default.nix61
1 files changed, 31 insertions, 30 deletions
diff --git a/pkgs/tools/archivers/7zz/default.nix b/pkgs/tools/archivers/7zz/default.nix
index 63e60335340..8d23b3a5c3c 100644
--- a/pkgs/tools/archivers/7zz/default.nix
+++ b/pkgs/tools/archivers/7zz/default.nix
@@ -1,47 +1,48 @@
-{ lib, stdenv, fetchurl, autoPatchelfHook }:
+{ stdenv, lib, fetchurl, p7zip }:
 
-let platform =       if stdenv.isi686    then "x86"
-                else if stdenv.isx86_64  then "x64"
-                else if stdenv.isAarch32 then "arm"
-                else if stdenv.isAarch64 then "arm64"
-                else throw "Unsupported architecture";
+# https://sourceforge.net/p/sevenzip/discussion/45797/thread/7fe6c21efa/
+stdenv.mkDerivation rec {
+  pname = "7zz";
+  version = "21.04";
 
-    url = "https://7-zip.org/a/7z2101-linux-${platform}.tar.xz";
+  src = fetchurl {
+    url = "https://7-zip.org/a/7z${lib.replaceStrings ["." ] [""] version}-src.7z";
+    sha256 = "sha256-XmuEyIJAJQM0ZbgrW02lQ2rp4KFDBjLXKRaTfY+VCOg=";
+  };
 
-    hashes = {
-      x86 = "0k6vg85ld8i2pcv5sv3xbvf3swqh9qj8hf2jcpadssys3yyidqyj";
-      x64 = "1yfanx98fizj8d2s87yxgsy30zydx7h5w9wf4wy3blgsp0vkbjb3";
-      arm = "04iah9vijm86r8rbkhxig86fx3lpag4xi7i3vq7gfrlwkymclhm1";
-      arm64 = "0a26ginpb22aydcyvffxpbi7lxh4sgs9gb6cj96qqx7cnf7bk2ri";
-    };
-    sha256 = hashes."${platform}";
+  sourceRoot = "CPP/7zip/Bundles/Alone2";
 
-in stdenv.mkDerivation {
-  pname = "7zz";
-  version = "21.01";
+  # we need https://github.com/nidud/asmc/tree/master/source/asmc/linux in order
+  # to build with the optimized assembler but that doesn't support building with
+  # GCC: https://github.com/nidud/asmc/issues/8
+  makefile = "../../cmpl_gcc.mak"; # "../../cmpl_gcc_x64.mak";
 
-  src = fetchurl { inherit url sha256; };
-  sourceRoot = ".";
+  NIX_CFLAGS_COMPILE = [ "-Wno-error=maybe-uninitialized" ];
 
-  nativeBuildInputs = [ autoPatchelfHook ];
-  buildInputs = [ stdenv.cc.cc.lib ];
+  nativeBuildInputs = [ p7zip ];
 
-  dontBuild = true;
+  enableParallelBuilding = true;
 
   installPhase = ''
     runHook preInstall
-    install -D -t $out/bin 7zz
+
+    install -Dm555 -t $out/bin b/g/7zz
+    install -Dm444 -t $out/share/doc/${pname} ../../../../DOC/*.txt
+
     runHook postInstall
   '';
 
-  meta = with lib; {
-    description = "Command line archiver utility";
-    homepage = "https://www.7-zip.org";
+  doInstallCheck = true;
 
-    # source not released yet. will be under LGPL 2.1+ with RAR exception
-    license = licenses.unfree;
+  installCheckPhase = ''
+    $out/bin/7zz --help | grep ${version}
+  '';
 
-    platforms = [ "i686-linux" "x86_64-linux" "aarch64-linux" "armv7l-linux" ];
-    maintainers = with maintainers; [ anna328p ];
+  meta = with lib; {
+    description = "Command line archiver utility";
+    homepage = "https://7zip.org";
+    license = licenses.lgpl21Plus;
+    maintainers = with maintainers; [ anna328p peterhoeg ];
+    platforms = platforms.linux;
   };
 }