summary refs log tree commit diff
diff options
context:
space:
mode:
authorAndersonTorres <torres.anderson.85@protonmail.com>2022-04-14 01:50:44 -0300
committerAndersonTorres <torres.anderson.85@protonmail.com>2022-04-14 01:50:44 -0300
commit46fe96c68d1d521210afa04e91f4b1d371bb5e2a (patch)
tree273aab7d7e82b3304be66381dc7ac7ac0da1a0cb
parenta1f6164c1d886000780b316b3895d3cec35db113 (diff)
downloadnixpkgs-46fe96c68d1d521210afa04e91f4b1d371bb5e2a.tar
nixpkgs-46fe96c68d1d521210afa04e91f4b1d371bb5e2a.tar.gz
nixpkgs-46fe96c68d1d521210afa04e91f4b1d371bb5e2a.tar.bz2
nixpkgs-46fe96c68d1d521210afa04e91f4b1d371bb5e2a.tar.lz
nixpkgs-46fe96c68d1d521210afa04e91f4b1d371bb5e2a.tar.xz
nixpkgs-46fe96c68d1d521210afa04e91f4b1d371bb5e2a.tar.zst
nixpkgs-46fe96c68d1d521210afa04e91f4b1d371bb5e2a.zip
libarchive: rewriting
-rw-r--r--pkgs/development/libraries/libarchive/default.nix89
1 files changed, 59 insertions, 30 deletions
diff --git a/pkgs/development/libraries/libarchive/default.nix b/pkgs/development/libraries/libarchive/default.nix
index 7ec1b4eaf53..240371917f1 100644
--- a/pkgs/development/libraries/libarchive/default.nix
+++ b/pkgs/development/libraries/libarchive/default.nix
@@ -1,14 +1,27 @@
-{
-  fetchFromGitHub, lib, stdenv, pkg-config, autoreconfHook,
-  acl, attr, bzip2, e2fsprogs, libxml2, lzo, openssl, sharutils, xz, zlib, zstd,
+{ lib
+, stdenv
+, fetchFromGitHub
+, acl
+, attr
+, autoreconfHook
+, bzip2
+, e2fsprogs
+, lzo
+, openssl
+, pkg-config
+, sharutils
+, xz
+, zlib
+, zstd
+# Optional but increases closure only negligibly. Also, while libxml2 builds
+# fine on windows, libarchive has trouble linking windows things it depends on
+# for some reason.
+, xarSupport ? stdenv.hostPlatform.isUnix, libxml2
 
-  # Optional but increases closure only negligibly. Also, while libxml2
-  # builds fine on windows, but libarchive has trouble linking windows
-  # things it depends on for some reason.
-  xarSupport ? stdenv.hostPlatform.isUnix,
-
-  # for passthru.tests
-  cmake, nix, samba
+# for passthru.tests
+, cmake
+, nix
+, samba
 }:
 
 assert xarSupport -> libxml2 != null;
@@ -26,11 +39,20 @@ stdenv.mkDerivation rec {
 
   outputs = [ "out" "lib" "dev" ];
 
-  nativeBuildInputs = [ pkg-config autoreconfHook ];
-  buildInputs =
-    lib.optional stdenv.hostPlatform.isUnix sharutils
-    ++ [ zlib bzip2 openssl xz lzo zstd ]
-    ++ lib.optionals stdenv.isLinux [ e2fsprogs attr acl ]
+  nativeBuildInputs = [
+    autoreconfHook
+    pkg-config
+  ];
+
+  buildInputs =  [
+    bzip2
+    lzo
+    openssl
+    xz
+    zlib
+    zstd
+  ] ++ lib.optional stdenv.hostPlatform.isUnix sharutils
+    ++ lib.optionals stdenv.isLinux [ acl attr e2fsprogs ]
     ++ lib.optional xarSupport libxml2;
 
   # Without this, pkg-config-based dependencies are unhappy
@@ -38,11 +60,17 @@ stdenv.mkDerivation rec {
 
   configureFlags = lib.optional (!xarSupport) "--without-xml2";
 
-  preBuild = if stdenv.isCygwin then ''
+  postPatch = ''
+     substituteInPlace Makefile.am --replace '/bin/pwd' 'pwd'
+  '';
+
+  preBuild = lib.optionalString stdenv.isCygwin ''
     echo "#include <windows.h>" >> config.h
-  '' else null;
+  '';
 
-  doCheck = false; # fails
+  # 484: test_write_disk_perms FAIL
+  # TODO: how to disable it? Should it be reported upstream?
+  doCheck = false;
 
   preFixup = ''
     sed -i $lib/lib/libarchive.la \
@@ -52,21 +80,22 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  passthru.tests = {
-    inherit cmake nix samba;
-  };
-
-  meta = {
+  meta = with lib; {
+    homepage = "http://libarchive.org";
     description = "Multi-format archive and compression library";
     longDescription = ''
-      This library has code for detecting and reading many archive formats and
-      compressions formats including (but not limited to) tar, shar, cpio, zip, and
-      compressed with gzip, bzip2, lzma, xz, ...
+      The libarchive project develops a portable, efficient C library that can
+      read and write streaming archives in a variety of formats. It also
+      includes implementations of the common tar, cpio, and zcat command-line
+      tools that use the libarchive library.
     '';
-    homepage = "http://libarchive.org";
     changelog = "https://github.com/libarchive/libarchive/releases/tag/v${version}";
-    license = lib.licenses.bsd3;
-    platforms = with lib.platforms; all;
-    maintainers = with lib.maintainers; [ jcumming ];
+    license = licenses.bsd3;
+    maintainers = with maintainers; [ jcumming AndersonTorres ];
+    platforms = platforms.all;
+  };
+
+  passthru.tests = {
+    inherit cmake nix samba;
   };
 }