nixpkgs/pkgs/development/libraries/libarchive/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

73 lines
2.1 KiB
Nix
Raw Normal View History

{
fetchFromGitHub, lib, stdenv, pkg-config, autoreconfHook,
acl, attr, bzip2, e2fsprogs, libxml2, lzo, openssl, sharutils, xz, zlib, zstd,
2020-10-29 00:38:45 +00:00
# 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
}:
assert xarSupport -> libxml2 != null;
stdenv.mkDerivation rec {
pname = "libarchive";
2022-02-12 07:04:57 +00:00
version = "3.6.0";
src = fetchFromGitHub {
owner = "libarchive";
repo = "libarchive";
rev = "v${version}";
2022-02-12 07:04:57 +00:00
sha256 = "sha256-u6Zeu9yTjhx5U7KZVUkuuUsQPjWN71mE5egG4T+FGfY=";
};
2016-09-19 13:33:25 +01:00
outputs = [ "out" "lib" "dev" ];
nativeBuildInputs = [ pkg-config autoreconfHook ];
2020-10-29 00:38:45 +00:00
buildInputs =
lib.optional stdenv.hostPlatform.isUnix sharutils
2020-10-29 00:38:45 +00:00
++ [ zlib bzip2 openssl xz lzo zstd ]
++ lib.optionals stdenv.isLinux [ e2fsprogs attr acl ]
++ lib.optional xarSupport libxml2;
# Without this, pkg-config-based dependencies are unhappy
propagatedBuildInputs = lib.optionals stdenv.isLinux [ attr acl ];
configureFlags = lib.optional (!xarSupport) "--without-xml2";
2014-10-29 22:45:15 +00:00
preBuild = if stdenv.isCygwin then ''
echo "#include <windows.h>" >> config.h
'' else null;
doCheck = false; # fails
2015-07-28 14:22:40 +01:00
preFixup = ''
2016-09-19 13:33:25 +01:00
sed -i $lib/lib/libarchive.la \
treewide: use lib.getLib for OpenSSL libraries At some point, I'd like to make another attempt at 71f1f4884b5 ("openssl: stop static binaries referencing libs"), which was reverted in 195c7da07df. One problem with my previous attempt is that I moved OpenSSL's libraries to a lib output, but many dependent packages were hardcoding the out output as the location of the libraries. This patch fixes every such case I could find in the tree. It won't have any effect immediately, but will mean these packages will automatically use an OpenSSL lib output if it is reintroduced in future. This patch should cause very few rebuilds, because it shouldn't make any change at all to most packages I'm touching. The few rebuilds that are introduced come from when I've changed a package builder not to use variable names like openssl.out in scripts / substitution patterns, which would be confusing since they don't hardcode the output any more. I started by making the following global replacements: ${pkgs.openssl.out}/lib -> ${lib.getLib pkgs.openssl}/lib ${openssl.out}/lib -> ${lib.getLib openssl}/lib Then I removed the ".out" suffix when part of the argument to lib.makeLibraryPath, since that function uses lib.getLib internally. Then I fixed up cases where openssl was part of the -L flag to the compiler/linker, since that unambigously is referring to libraries. Then I manually investigated and fixed the following packages: - pycurl - citrix-workspace - ppp - wraith - unbound - gambit - acl2 I'm reasonably confindent in my fixes for all of them. For acl2, since the openssl library paths are manually provided above anyway, I don't think openssl is required separately as a build input at all. Removing it doesn't make a difference to the output size, the file list, or the closure. I've tested evaluation with the OfBorg meta checks, to protect against introducing evaluation failures.
2022-03-25 15:33:21 +00:00
-e 's|-lcrypto|-L${lib.getLib openssl}/lib -lcrypto|' \
2015-09-25 13:06:23 +01:00
-e 's|-llzo2|-L${lzo}/lib -llzo2|'
2015-07-28 14:22:40 +01:00
'';
2018-06-04 13:48:39 +01:00
enableParallelBuilding = true;
passthru.tests = {
inherit cmake nix samba;
};
meta = {
2012-10-21 06:17:14 +01:00
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
2016-09-19 13:33:25 +01:00
compressed with gzip, bzip2, lzma, xz, ...
2012-10-21 06:17:14 +01:00
'';
homepage = "http://libarchive.org";
2020-12-02 17:19:06 +00:00
changelog = "https://github.com/libarchive/libarchive/releases/tag/v${version}";
license = lib.licenses.bsd3;
platforms = with lib.platforms; all;
maintainers = with lib.maintainers; [ jcumming ];
};
}