about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/libarchive
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2022-12-06 19:57:55 +0000
committerAlyssa Ross <hi@alyssa.is>2023-02-08 13:48:30 +0000
commitbf3aadfdd39aa197e18bade671fab6726349ffa4 (patch)
tree698567af766ed441d757b57a7b21e68d4a342a2b /nixpkgs/pkgs/development/libraries/libarchive
parentf4afc5a01d9539ce09e47494e679c51f80723d07 (diff)
parent99665eb45f58d959d2cb9e49ddb960c79d596f33 (diff)
downloadnixlib-bf3aadfdd39aa197e18bade671fab6726349ffa4.tar
nixlib-bf3aadfdd39aa197e18bade671fab6726349ffa4.tar.gz
nixlib-bf3aadfdd39aa197e18bade671fab6726349ffa4.tar.bz2
nixlib-bf3aadfdd39aa197e18bade671fab6726349ffa4.tar.lz
nixlib-bf3aadfdd39aa197e18bade671fab6726349ffa4.tar.xz
nixlib-bf3aadfdd39aa197e18bade671fab6726349ffa4.tar.zst
nixlib-bf3aadfdd39aa197e18bade671fab6726349ffa4.zip
Merge commit '99665eb45f58d959d2cb9e49ddb960c79d596f33'
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/libarchive')
-rw-r--r--nixpkgs/pkgs/development/libraries/libarchive/default.nix111
1 files changed, 78 insertions, 33 deletions
diff --git a/nixpkgs/pkgs/development/libraries/libarchive/default.nix b/nixpkgs/pkgs/development/libraries/libarchive/default.nix
index 2c8faaf93e8b..066ea8b60ddc 100644
--- a/nixpkgs/pkgs/development/libraries/libarchive/default.nix
+++ b/nixpkgs/pkgs/development/libraries/libarchive/default.nix
@@ -1,36 +1,79 @@
-{
-  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;
 
 stdenv.mkDerivation rec {
   pname = "libarchive";
-  version = "3.6.0";
+  version = "3.6.1";
 
   src = fetchFromGitHub {
     owner = "libarchive";
     repo = "libarchive";
     rev = "v${version}";
-    sha256 = "sha256-u6Zeu9yTjhx5U7KZVUkuuUsQPjWN71mE5egG4T+FGfY=";
+    hash = "sha256-G4wL5DDbX0FqaA4cnOlVLZ25ObN8dNsRtxyas29tpDA=";
   };
 
+  postPatch = ''
+    substituteInPlace Makefile.am --replace '/bin/pwd' "$(type -P pwd)"
+
+    declare -a skip_test_paths=(
+      # test won't work in nix sandbox
+      'libarchive/test/test_write_disk_perms.c'
+      # can't be sure builder will have sparse-capable fs
+      'libarchive/test/test_sparse_basic.c'
+      # can't even be sure builder will have hardlink-capable fs
+      'libarchive/test/test_write_disk_hardlink.c'
+      # access-time-related tests flakey on some systems
+      'cpio/test/test_option_a.c'
+      'cpio/test/test_option_t.c'
+    )
+
+    for test_path in "''${skip_test_paths[@]}" ; do
+      substituteInPlace Makefile.am --replace "$test_path" ""
+      rm "$test_path"
+    done
+  '';
+
   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,35 +81,37 @@ stdenv.mkDerivation rec {
 
   configureFlags = lib.optional (!xarSupport) "--without-xml2";
 
-  preBuild = if stdenv.isCygwin then ''
+  preBuild = lib.optionalString stdenv.isCygwin ''
     echo "#include <windows.h>" >> config.h
-  '' else null;
+  '';
 
-  doCheck = false; # fails
+  # https://github.com/libarchive/libarchive/issues/1475
+  doCheck = !stdenv.hostPlatform.isMusl;
 
   preFixup = ''
     sed -i $lib/lib/libarchive.la \
-      -e 's|-lcrypto|-L${openssl.out}/lib -lcrypto|' \
+      -e 's|-lcrypto|-L${lib.getLib openssl}/lib -lcrypto|' \
       -e 's|-llzo2|-L${lzo}/lib -llzo2|'
   '';
 
   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;
   };
 }