Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at release-19.03 73 lines 2.4 kB view raw
1{ 2 fetchurl, fetchpatch, stdenv, pkgconfig, 3 acl, attr, bzip2, e2fsprogs, libxml2, lzo, openssl, sharutils, xz, zlib, 4 5 # Optional but increases closure only negligibly. 6 xarSupport ? true, 7}: 8 9assert xarSupport -> libxml2 != null; 10 11stdenv.mkDerivation rec { 12 name = "libarchive-${version}"; 13 version = "3.3.3"; 14 15 src = fetchurl { 16 url = "${meta.homepage}/downloads/${name}.tar.gz"; 17 sha256 = "0bhfncid058p7n1n8v29l6wxm3mhdqfassscihbsxfwz3iwb2zms"; 18 }; 19 20 patches = [ 21 (fetchpatch { 22 # details: https://github.com/libarchive/libarchive/pull/1105 23 name = "cve-2018-1000877.diff"; # CVE-2018-1000877..80 24 url = "https://github.com/libarchive/libarchive/pull/1105.diff"; 25 sha256 = "0mxcawfdy9m40mykzwhkl39a6vnh4ypgy0ipcz74qm4bi72x0gyf"; 26 }) 27 (fetchpatch { 28 # details: https://github.com/libarchive/libarchive/pull/1120 29 name = "cve-2019-1000019_cve-2019-1000020.diff"; 30 url = "https://github.com/libarchive/libarchive/pull/1120.diff"; 31 sha256 = "1mgx92v8hm7hw9j34nbfriqfkxshh3cy25rhavr7kl7lz4x5a6g4"; 32 }) 33 ]; 34 35 outputs = [ "out" "lib" "dev" ]; 36 37 nativeBuildInputs = [ pkgconfig ]; 38 buildInputs = [ sharutils zlib bzip2 openssl xz lzo ] 39 ++ stdenv.lib.optionals stdenv.isLinux [ e2fsprogs attr acl ] 40 ++ stdenv.lib.optional xarSupport libxml2; 41 42 # Without this, pkgconfig-based dependencies are unhappy 43 propagatedBuildInputs = stdenv.lib.optionals stdenv.isLinux [ attr acl ]; 44 45 configureFlags = stdenv.lib.optional (!xarSupport) "--without-xml2"; 46 47 preBuild = if stdenv.isCygwin then '' 48 echo "#include <windows.h>" >> config.h 49 '' else null; 50 51 doCheck = false; # fails 52 53 preFixup = '' 54 sed -i $lib/lib/libarchive.la \ 55 -e 's|-lcrypto|-L${openssl.out}/lib -lcrypto|' \ 56 -e 's|-llzo2|-L${lzo}/lib -llzo2|' 57 ''; 58 59 enableParallelBuilding = true; 60 61 meta = { 62 description = "Multi-format archive and compression library"; 63 longDescription = '' 64 This library has code for detecting and reading many archive formats and 65 compressions formats including (but not limited to) tar, shar, cpio, zip, and 66 compressed with gzip, bzip2, lzma, xz, ... 67 ''; 68 homepage = http://libarchive.org; 69 license = stdenv.lib.licenses.bsd3; 70 platforms = with stdenv.lib.platforms; all; 71 maintainers = with stdenv.lib.maintainers; [ jcumming ]; 72 }; 73}