diff options
Diffstat (limited to 'nixpkgs/pkgs/tools/compression')
53 files changed, 1925 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/tools/compression/advancecomp/default.nix b/nixpkgs/pkgs/tools/compression/advancecomp/default.nix new file mode 100644 index 000000000000..7f8733b9b4ec --- /dev/null +++ b/nixpkgs/pkgs/tools/compression/advancecomp/default.nix @@ -0,0 +1,46 @@ +{ lib, stdenv +, fetchFromGitHub +, fetchpatch +, autoreconfHook +, zlib +}: + +stdenv.mkDerivation rec { + pname = "advancecomp"; + version = "2.1"; + + src = fetchFromGitHub { + owner = "amadvance"; + repo = "advancecomp"; + rev = "v${version}"; + sha256 = "1pd6czamamrd0ppk5a3a65hcgdlqwja98aandhqiajhnibwldv8x"; + }; + + nativeBuildInputs = [ autoreconfHook ]; + buildInputs = [ zlib ]; + + patches = [ + (fetchpatch { + name = "CVE-2019-9210.patch"; + url = "https://github.com/amadvance/advancecomp/commit/fcf71a89265c78fc26243574dda3a872574a5c02.patch"; + sha256 = "0cdv9g87c1y8zwhqkd9ba2zjw4slcvg7yzcqv43idvnwb5fl29n7"; + excludes = [ "doc/history.d" ]; + }) + ]; + + # autover.sh relies on 'git describe', which obviously doesn't work as we're not cloning + # the full git repo. so we have to put the version number in `.version`, otherwise + # the binaries get built reporting "none" as their version number. + postPatch = '' + echo "${version}" >.version + ''; + + meta = with lib; { + description = "A set of tools to optimize deflate-compressed files"; + license = licenses.gpl3 ; + maintainers = [ maintainers.raskin ]; + platforms = platforms.linux ++ platforms.darwin; + homepage = "https://github.com/amadvance/advancecomp"; + + }; +} diff --git a/nixpkgs/pkgs/tools/compression/brotli/default.nix b/nixpkgs/pkgs/tools/compression/brotli/default.nix new file mode 100644 index 000000000000..af0cbc4fe22e --- /dev/null +++ b/nixpkgs/pkgs/tools/compression/brotli/default.nix @@ -0,0 +1,77 @@ +{ lib, stdenv, fetchFromGitHub, cmake, fetchpatch +, staticOnly ? stdenv.hostPlatform.isStatic +}: + +# ?TODO: there's also python lib in there + +stdenv.mkDerivation rec { + pname = "brotli"; + version = "1.0.9"; + + src = fetchFromGitHub { + owner = "google"; + repo = "brotli"; + rev = "v" + version; + sha256 = "z6Dhrabav1MDQ4rAcXaDv0aN+qOoh9cvoXZqEWBB13c="; + }; + + nativeBuildInputs = [ cmake ]; + + patches = lib.optional staticOnly (fetchpatch { + # context from https://github.com/google/brotli/pull/655 + # updated patch from https://github.com/google/brotli/pull/655 + url = "https://github.com/google/brotli/commit/47a554804ceabb899ae924aaee54df806053d0d1.patch"; + sha256 = "sOeXNVsCaBSD9i82GRUDrkyreGeQ7qaJWjjy/uLL0/0="; + }); + + cmakeFlags = [] + ++ lib.optional staticOnly "-DBUILD_SHARED_LIBS=OFF"; + + outputs = [ "out" "dev" "lib" ]; + + doCheck = true; + + checkTarget = "test"; + + # This breaks on Darwin because our cmake hook tries to make a build folder + # and the wonderful bazel BUILD file is already there (yay case-insensitivity?) + prePatch = '' + rm BUILD + + # Upstream fixed this reference to runtime-path after the release + # and with this references g++ complains about invalid option -R + sed -i 's/ -R''${libdir}//' scripts/libbrotli*.pc.in + cat scripts/libbrotli*.pc.in + ''; + + # Don't bother with "man" output for now, + # it currently only makes the manpages hard to use. + postInstall = '' + mkdir -p $out/share/man/man{1,3} + cp ../docs/*.1 $out/share/man/man1/ + cp ../docs/*.3 $out/share/man/man3/ + ''; + + meta = with lib; { + inherit (src.meta) homepage; + + description = "A generic-purpose lossless compression algorithm and tool"; + + longDescription = + '' Brotli is a generic-purpose lossless compression algorithm that + compresses data using a combination of a modern variant of the LZ77 + algorithm, Huffman coding and 2nd order context modeling, with a + compression ratio comparable to the best currently available + general-purpose compression methods. It is similar in speed with + deflate but offers more dense compression. + + The specification of the Brotli Compressed Data Format is defined + in the following internet draft: + http://www.ietf.org/id/draft-alakuijala-brotli + ''; + + license = licenses.mit; + maintainers = with maintainers; [ freezeboy ]; + platforms = platforms.all; + }; +} diff --git a/nixpkgs/pkgs/tools/compression/bsc/default.nix b/nixpkgs/pkgs/tools/compression/bsc/default.nix new file mode 100644 index 000000000000..ac0c0544f017 --- /dev/null +++ b/nixpkgs/pkgs/tools/compression/bsc/default.nix @@ -0,0 +1,32 @@ +{ lib, stdenv, fetchurl, openmp ? null }: + +stdenv.mkDerivation rec { + pname = "bsc"; + version = "3.1.0"; + + src = fetchurl { + url = "https://github.com/IlyaGrebnov/libbsc/archive/${version}.tar.gz"; + sha256 = "01yhizaf6qjv1plyrx0fcib264maa5qwvgfvvid9rzlzj9fxjib6"; + }; + + enableParallelBuilding = true; + + buildInputs = lib.optional stdenv.isDarwin openmp; + + prePatch = '' + substituteInPlace makefile \ + --replace 'g++' '$(CXX)' + ''; + + preInstall = '' + makeFlagsArray+=("PREFIX=$out") + ''; + + meta = with lib; { + description = "High performance block-sorting data compression library"; + homepage = "http://libbsc.com/"; + # Later commits changed the licence to Apache2 (no release yet, though) + license = with licenses; [ lgpl3Plus ]; + platforms = platforms.unix; + }; +} diff --git a/nixpkgs/pkgs/tools/compression/bsdiff/default.nix b/nixpkgs/pkgs/tools/compression/bsdiff/default.nix new file mode 100644 index 000000000000..8b5dfe919c7d --- /dev/null +++ b/nixpkgs/pkgs/tools/compression/bsdiff/default.nix @@ -0,0 +1,37 @@ +{ lib, stdenv, fetchurl, bzip2 }: + +stdenv.mkDerivation rec { + pname = "bsdiff"; + version = "4.3"; + + src = fetchurl { + url = "https://www.daemonology.net/bsdiff/${pname}-${version}.tar.gz"; + sha256 = "0j2zm3z271x5aw63mwhr3vymzn45p2vvrlrpm9cz2nywna41b0hq"; + }; + + buildInputs = [ bzip2 ]; + patches = [ ./include-systypes.patch ]; + + buildPhase = '' + $CC -O3 -lbz2 bspatch.c -o bspatch + $CC -O3 -lbz2 bsdiff.c -o bsdiff + ''; + + installPhase = '' + mkdir -p $out/bin + mkdir -p $out/share/man/man1 + + cp bsdiff $out/bin + cp bspatch $out/bin + cp bsdiff.1 $out/share/man/man1 + cp bspatch.1 $out/share/man/man1 + ''; + + meta = { + description = "An efficient binary diff/patch tool"; + homepage = "http://www.daemonology.net/bsdiff"; + license = lib.licenses.bsd2; + platforms = lib.platforms.unix; + maintainers = [ lib.maintainers.thoughtpolice ]; + }; +} diff --git a/nixpkgs/pkgs/tools/compression/bsdiff/include-systypes.patch b/nixpkgs/pkgs/tools/compression/bsdiff/include-systypes.patch new file mode 100644 index 000000000000..d070a8bb0f85 --- /dev/null +++ b/nixpkgs/pkgs/tools/compression/bsdiff/include-systypes.patch @@ -0,0 +1,12 @@ +diff --git a/bspatch.c b/bspatch.c +index 643c60b..543379c 100644 +--- a/bspatch.c ++++ b/bspatch.c +@@ -28,6 +28,7 @@ + __FBSDID("$FreeBSD: src/usr.bin/bsdiff/bspatch/bspatch.c,v 1.1 2005/08/06 01:59:06 cperciva Exp $"); + #endif + ++#include <sys/types.h> + #include <bzlib.h> + #include <stdlib.h> + #include <stdio.h> diff --git a/nixpkgs/pkgs/tools/compression/bzip2/1_1.nix b/nixpkgs/pkgs/tools/compression/bzip2/1_1.nix new file mode 100644 index 000000000000..ca5670a2e512 --- /dev/null +++ b/nixpkgs/pkgs/tools/compression/bzip2/1_1.nix @@ -0,0 +1,43 @@ +{ lib, stdenv +, fetchFromGitLab +, meson +, python3 +, ninja +}: + +stdenv.mkDerivation rec { + pname = "bzip2-unstable"; + version = "2020-08-11"; + + src = fetchFromGitLab { + owner = "federicomenaquintero"; + repo = "bzip2"; + rev = "15255b553e7c095fb7a26d4dc5819a11352ebba1"; + sha256 = "sha256-BAyz35D62LWi47B/gNcCSKpdaECHBGSpt21vtnk3fKs="; + }; + + postPatch = '' + patchShebangs install_links.py + ''; + + nativeBuildInputs = [ + meson + python3 + ninja + ]; + + outputs = [ "bin" "dev" "out" "man" ]; + + mesonFlags = [ + "-Ddocs=disabled" + ]; + + strictDeps = true; + + meta = with lib; { + description = "High-quality data compression program"; + license = licenses.bsdOriginal; + platforms = platforms.all; + maintainers = []; + }; +} diff --git a/nixpkgs/pkgs/tools/compression/bzip2/CVE-2016-3189.patch b/nixpkgs/pkgs/tools/compression/bzip2/CVE-2016-3189.patch new file mode 100644 index 000000000000..eff324b32503 --- /dev/null +++ b/nixpkgs/pkgs/tools/compression/bzip2/CVE-2016-3189.patch @@ -0,0 +1,12 @@ +diff --git a/bzip2recover.c b/bzip2recover.c +index f9de049..252c1b7 100644 +--- a/bzip2recover.c ++++ b/bzip2recover.c +@@ -457,6 +457,7 @@ Int32 main ( Int32 argc, Char** argv ) + bsPutUChar ( bsWr, 0x50 ); bsPutUChar ( bsWr, 0x90 ); + bsPutUInt32 ( bsWr, blockCRC ); + bsClose ( bsWr ); ++ outFile = NULL; + } + if (wrBlock >= rbCtr) break; + wrBlock++; diff --git a/nixpkgs/pkgs/tools/compression/bzip2/cve-2019-12900.patch b/nixpkgs/pkgs/tools/compression/bzip2/cve-2019-12900.patch new file mode 100644 index 000000000000..bf3d13a7a691 --- /dev/null +++ b/nixpkgs/pkgs/tools/compression/bzip2/cve-2019-12900.patch @@ -0,0 +1,13 @@ +https://gitlab.com/federicomenaquintero/bzip2/commit/74de1e2e6ffc9d +diff --git a/decompress.c b/decompress.c +--- a/decompress.c ++++ b/decompress.c +@@ -287,7 +287,7 @@ + GET_BITS(BZ_X_SELECTOR_1, nGroups, 3); + if (nGroups < 2 || nGroups > 6) RETURN(BZ_DATA_ERROR); + GET_BITS(BZ_X_SELECTOR_2, nSelectors, 15); +- if (nSelectors < 1) RETURN(BZ_DATA_ERROR); ++ if (nSelectors < 1 || nSelectors > BZ_MAX_SELECTORS) RETURN(BZ_DATA_ERROR); + for (i = 0; i < nSelectors; i++) { + j = 0; + while (True) { diff --git a/nixpkgs/pkgs/tools/compression/bzip2/default.nix b/nixpkgs/pkgs/tools/compression/bzip2/default.nix new file mode 100644 index 000000000000..da37cf9fbd8c --- /dev/null +++ b/nixpkgs/pkgs/tools/compression/bzip2/default.nix @@ -0,0 +1,55 @@ +{ lib, stdenv, fetchurl +, linkStatic ? with stdenv.hostPlatform; isStatic || isCygwin +, autoreconfHook +}: + +# Note: this package is used for bootstrapping fetchurl, and thus +# cannot use fetchpatch! All mutable patches (generated by GitHub or +# cgit) that are needed here should be included directly in Nixpkgs as +# files. + +stdenv.mkDerivation rec { + pname = "bzip2"; + version = "1.0.6.0.2"; + + /* We use versions patched to use autotools style properly, + saving lots of trouble. */ + src = fetchurl { + urls = map + (prefix: prefix + "/people/sbrabec/bzip2/tarballs/${pname}-${version}.tar.gz") + [ + "http://ftp.uni-kl.de/pub/linux/suse" + "ftp://ftp.hs.uni-hamburg.de/pub/mirrors/suse" + "ftp://ftp.mplayerhq.hu/pub/linux/suse" + "http://ftp.suse.com/pub" # the original patched version but slow + ]; + sha256 = "sha256-FnhwNy4OHe8d5M6iYCClkxzcB/EHXg0veXwv43ZlxbA="; + }; + + nativeBuildInputs = [ autoreconfHook ]; + + patches = [ + ./CVE-2016-3189.patch + ./cve-2019-12900.patch + ]; + + postPatch = '' + sed -i -e '/<sys\\stat\.h>/s|\\|/|' bzip2.c + ''; + + outputs = [ "bin" "dev" "out" "man" ]; + + configureFlags = + lib.optionals linkStatic [ "--enable-static" "--disable-shared" ]; + + enableParallelBuilding = true; + + meta = with lib; { + description = "High-quality data compression program"; + homepage = "https://www.sourceware.org/bzip2"; + changelog = "https://sourceware.org/git/?p=bzip2.git;a=blob;f=CHANGES;hb=HEAD"; + license = licenses.bsdOriginal; + platforms = platforms.all; + maintainers = with maintainers; [ mic92 ]; + }; +} diff --git a/nixpkgs/pkgs/tools/compression/dejsonlz4/default.nix b/nixpkgs/pkgs/tools/compression/dejsonlz4/default.nix new file mode 100644 index 000000000000..07b6a5979a4f --- /dev/null +++ b/nixpkgs/pkgs/tools/compression/dejsonlz4/default.nix @@ -0,0 +1,28 @@ +{ lib, stdenv, fetchFromGitHub }: +stdenv.mkDerivation rec { + pname = "dejsonlz4"; + version = "1.1"; + src = fetchFromGitHub { + owner = "avih"; + repo = pname; + rev = "v${version}"; + sha256 = "0ggs69qamaama5mid07mhp95m1x42wljdb953lrwfr7p8p6f8czh"; + }; + + buildPhase = '' + ${stdenv.cc.targetPrefix}cc -o dejsonlz4 src/dejsonlz4.c src/lz4.c + ''; + + installPhase = '' + mkdir -p $out/bin/ + cp dejsonlz4 $out/bin/ + ''; + + meta = with lib; { + description = "Decompress Mozilla Firefox bookmarks backup files"; + homepage = "https://github.com/avih/dejsonlz4"; + license = licenses.bsd2; + maintainers = with maintainers; [ mt-caret ]; + platforms = platforms.all; + }; + } diff --git a/nixpkgs/pkgs/tools/compression/dtrx/default.nix b/nixpkgs/pkgs/tools/compression/dtrx/default.nix new file mode 100644 index 000000000000..6c4f2f6e854e --- /dev/null +++ b/nixpkgs/pkgs/tools/compression/dtrx/default.nix @@ -0,0 +1,45 @@ +{ lib, fetchurl, python2Packages +, gnutar, unzip, lhasa, rpm, binutils, cpio, gzip, p7zip, cabextract, unrar, unshield +, bzip2, xz, lzip +# unzip is handled by p7zip +, unzipSupport ? false +, unrarSupport ? false }: + +let + archivers = lib.makeBinPath ([ gnutar lhasa rpm binutils cpio gzip p7zip cabextract unshield ] + ++ lib.optional (unzipSupport) unzip + ++ lib.optional (unrarSupport) unrar + ++ [ bzip2 xz lzip ]); + +in python2Packages.buildPythonApplication rec { + pname = "dtrx"; + version = "7.1"; + + src = fetchurl { + url = "https://brettcsmith.org/2007/dtrx/dtrx-${version}.tar.gz"; + sha256 = "15yf4n27zbhvv0byfv3i89wl5zn6jc2wbc69lk5a3m6rx54gx6hw"; + }; + + postInstall = '' + wrapProgram "$out/bin/dtrx" --prefix PATH : "${archivers}" + ''; + + checkPhase = '' + python2 tests/compare.py + ''; + + checkInputs = with python2Packages; [ + pyyaml + ]; + + # custom test suite fails + doCheck = false; + + meta = with lib; { + description = "Do The Right Extraction: A tool for taking the hassle out of extracting archives"; + homepage = "https://brettcsmith.org/2007/dtrx/"; + license = licenses.gpl3Plus; + maintainers = [ maintainers.spwhitt ]; + platforms = platforms.all; + }; +} diff --git a/nixpkgs/pkgs/tools/compression/flips/default.nix b/nixpkgs/pkgs/tools/compression/flips/default.nix new file mode 100644 index 000000000000..b4a79aac2127 --- /dev/null +++ b/nixpkgs/pkgs/tools/compression/flips/default.nix @@ -0,0 +1,31 @@ +{ lib, stdenv, fetchFromGitHub, gtk3, libdivsufsort, pkg-config, wrapGAppsHook }: + +stdenv.mkDerivation { + pname = "flips"; + version = "unstable-2021-05-18"; + + src = fetchFromGitHub { + owner = "Alcaro"; + repo = "Flips"; + rev = "3476e5e46fc6f10df475f0cad1714358ba04c756"; + sha256 = "0s13qrmqfmlb2vy0smpgw39vjkl8vzsmpzk52jnc9r7b4hisii39"; + }; + + nativeBuildInputs = [ pkg-config wrapGAppsHook ]; + buildInputs = [ gtk3 libdivsufsort ]; + patches = [ ./use-system-libdivsufsort.patch ]; + makeFlags = [ "PREFIX=${placeholder "out"}" ]; + buildPhase = '' + runHook preBuild + ./make.sh + runHook postBuild + ''; + + meta = with lib; { + description = "A patcher for IPS and BPS files"; + homepage = "https://github.com/Alcaro/Flips"; + license = licenses.gpl3Plus; + maintainers = [ maintainers.xfix ]; + platforms = platforms.linux; + }; +} diff --git a/nixpkgs/pkgs/tools/compression/flips/use-system-libdivsufsort.patch b/nixpkgs/pkgs/tools/compression/flips/use-system-libdivsufsort.patch new file mode 100644 index 000000000000..aa741decb019 --- /dev/null +++ b/nixpkgs/pkgs/tools/compression/flips/use-system-libdivsufsort.patch @@ -0,0 +1,15 @@ +diff --git a/Makefile b/Makefile +index c9d8b6d..9d66b0b 100644 +--- a/Makefile ++++ b/Makefile +@@ -79,9 +79,7 @@ endif + MOREFLAGS := $(CFLAGS_$(TARGET)) + + +-DIVSUF := libdivsufsort-2.0.1 +-SOURCES += $(DIVSUF)/lib/divsufsort.c $(DIVSUF)/lib/sssort.c $(DIVSUF)/lib/trsort.c +-MOREFLAGS += -I$(DIVSUF)/include -DHAVE_CONFIG_H -D__STDC_FORMAT_MACROS ++MOREFLAGS += -ldivsufsort + + ifeq ($(TARGET),gtk) + CFLAGS_G += -fopenmp diff --git a/nixpkgs/pkgs/tools/compression/gzip/default.nix b/nixpkgs/pkgs/tools/compression/gzip/default.nix new file mode 100644 index 000000000000..6bcd5ae0c427 --- /dev/null +++ b/nixpkgs/pkgs/tools/compression/gzip/default.nix @@ -0,0 +1,64 @@ +{ lib, stdenv +, fetchurl +, xz +, writeText +}: + +# Note: this package is used for bootstrapping fetchurl, and thus +# cannot use fetchpatch! All mutable patches (generated by GitHub or +# cgit) that are needed here should be included directly in Nixpkgs as +# files. + +stdenv.mkDerivation rec { + pname = "gzip"; + version = "1.10"; + + src = fetchurl { + url = "mirror://gnu/gzip/${pname}-${version}.tar.xz"; + sha256 = "1h6p374d3j8d4cdfydzls021xa2yby8myc0h8d6m8bc7k6ncq9c4"; + }; + + outputs = [ "out" "man" "info" ]; + + enableParallelBuilding = true; + + nativeBuildInputs = [ xz.bin ]; + + makeFlags = [ "SHELL=/bin/sh" "GREP=grep" ]; + + # Many gzip executables are shell scripts that depend upon other gzip + # executables being in $PATH. Rather than try to re-write all the + # internal cross-references, just add $out/bin to PATH at the top of + # all the executables that are shell scripts. + preFixup = '' + sed -i '1{;/#!\/bin\/sh/aPATH="'$out'/bin:$PATH" + }' $out/bin/* + ''; + + # set GZIP env variable to "-n" to stop gzip from adding timestamps + # to archive headers: https://github.com/NixOS/nixpkgs/issues/86348 + setupHook = writeText "setup-hook" '' + export GZIP="-n" + ''; + + meta = { + homepage = "https://www.gnu.org/software/gzip/"; + description = "GNU zip compression program"; + + longDescription = + ''gzip (GNU zip) is a popular data compression program written by + Jean-loup Gailly for the GNU project. Mark Adler wrote the + decompression part. + + We developed this program as a replacement for compress because of + the Unisys and IBM patents covering the LZW algorithm used by + compress. These patents made it impossible for us to use compress, + and we needed a replacement. The superior compression ratio of gzip + is just a bonus. + ''; + + platforms = lib.platforms.all; + + license = lib.licenses.gpl3Plus; + }; +} diff --git a/nixpkgs/pkgs/tools/compression/gzrt/default.nix b/nixpkgs/pkgs/tools/compression/gzrt/default.nix new file mode 100644 index 000000000000..18efc1b64c28 --- /dev/null +++ b/nixpkgs/pkgs/tools/compression/gzrt/default.nix @@ -0,0 +1,24 @@ +{ lib, stdenv, fetchurl, zlib }: + +stdenv.mkDerivation rec { + name = "gzrt-0.8"; + + src = fetchurl { + url = "https://www.urbanophile.com/arenn/coding/gzrt/${name}.tar.gz"; + sha256 = "1vhzazj47xfpbfhzkwalz27cc0n5gazddmj3kynhk0yxv99xrdxh"; + }; + + buildInputs = [ zlib ]; + + installPhase = '' + mkdir -p $out/bin + cp gzrecover $out/bin + ''; + + meta = { + homepage = "https://www.urbanophile.com/arenn/hacking/gzrt/"; + description = "The gzip Recovery Toolkit"; + license = lib.licenses.gpl2Plus; + platforms = lib.platforms.unix; + }; +} diff --git a/nixpkgs/pkgs/tools/compression/hacpack/default.nix b/nixpkgs/pkgs/tools/compression/hacpack/default.nix new file mode 100644 index 000000000000..e60d483574bd --- /dev/null +++ b/nixpkgs/pkgs/tools/compression/hacpack/default.nix @@ -0,0 +1,30 @@ +{ lib, stdenv, fetchFromGitHub }: + +stdenv.mkDerivation rec { + pname = "hacpack"; + version = "1.36"; + + src = fetchFromGitHub { + owner = "The-4n"; + repo = "hacpack"; + rev = "v${version}"; + sha256 = "0d846l36w1n9rxv79fbyhl2zdbqhlgrvk21b9vzr9x77yki89ygs"; + }; + + preConfigure = '' + mv config.mk.template config.mk + ''; + + installPhase = '' + mkdir -p $out/bin + cp ./hacpack $out/bin + ''; + + meta = with lib; { + homepage = "https://github.com/The-4n/hacPack"; + description = "Make and repack Nintendo Switch NCAs/NSPs"; + license = licenses.gpl2Only; + maintainers = [ maintainers.ivar ]; + platforms = platforms.linux; + }; +} diff --git a/nixpkgs/pkgs/tools/compression/hactool/default.nix b/nixpkgs/pkgs/tools/compression/hactool/default.nix new file mode 100644 index 000000000000..c6e0a3a2851b --- /dev/null +++ b/nixpkgs/pkgs/tools/compression/hactool/default.nix @@ -0,0 +1,32 @@ +{ lib, stdenv, fetchFromGitHub }: + +stdenv.mkDerivation rec { + pname = "hactool"; + version = "1.4.0"; + + src = fetchFromGitHub { + owner = "SciresM"; + repo = "hactool"; + rev = version; + sha256 = "0305ngsnwm8npzgyhyifasi4l802xnfz19r0kbzzniirmcn4082d"; + }; + + preBuild = '' + mv config.mk.template config.mk + ''; + + makeFlags = [ "CC=${stdenv.cc.targetPrefix}cc" ]; + + installPhase = '' + install -D hactool $out/bin/hactool + ''; + + meta = with lib; { + homepage = "https://github.com/SciresM/hactool"; + description = "A tool to manipulate common file formats for the Nintendo Switch"; + longDescription = "A tool to view information about, decrypt, and extract common file formats for the Nintendo Switch, especially Nintendo Content Archives"; + license = licenses.isc; + maintainers = with maintainers; [ ivar ]; + platforms = platforms.unix; + }; +} diff --git a/nixpkgs/pkgs/tools/compression/imagelol/default.nix b/nixpkgs/pkgs/tools/compression/imagelol/default.nix new file mode 100644 index 000000000000..d54d2da2f90e --- /dev/null +++ b/nixpkgs/pkgs/tools/compression/imagelol/default.nix @@ -0,0 +1,29 @@ +{ lib, stdenv, fetchFromGitHub, cmake }: + +stdenv.mkDerivation rec { + pname = "imagelol"; + version = "0.2"; + + src = fetchFromGitHub { + owner = "MCRedstoner2004"; + repo = pname; + rev = "v${version}"; + sha256 = "0978zdrfj41jsqm78afyyd1l64iki9nwjvhd8ynii1b553nn4dmd"; + fetchSubmodules = true; + }; + + nativeBuildInputs = [ cmake ]; + + installPhase = '' + mkdir -p $out/bin + cp ./ImageLOL $out/bin + ''; + + meta = with lib; { + homepage = "https://github.com/MCredstoner2004/ImageLOL"; + description = "Simple program to store a file into a PNG image"; + license = licenses.mit; + maintainers = [ maintainers.ivar ]; + platforms = platforms.unix; + }; +} diff --git a/nixpkgs/pkgs/tools/compression/kzipmix/default.nix b/nixpkgs/pkgs/tools/compression/kzipmix/default.nix new file mode 100644 index 000000000000..73931f6bcaea --- /dev/null +++ b/nixpkgs/pkgs/tools/compression/kzipmix/default.nix @@ -0,0 +1,25 @@ +{lib, stdenv, fetchurl}: + +stdenv.mkDerivation { + name = "kzipmix-20091108"; + + src = fetchurl { + url = "http://static.jonof.id.au/dl/kenutils/kzipmix-20091108-linux.tar.gz"; + sha256 = "19gyn8pblffdz1bf3xkbpzx8a8wn3xb0v411pqzmz5g5l6pm5gph"; + }; + + installPhase = '' + mkdir -p $out/bin + cp kzip zipmix $out/bin + + patchelf --set-interpreter ${stdenv.glibc.out}/lib/ld-linux.so.2 $out/bin/kzip + patchelf --set-interpreter ${stdenv.glibc.out}/lib/ld-linux.so.2 $out/bin/zipmix + ''; + + meta = { + description = "A tool that aggressively optimizes the sizes of Zip archives"; + license = lib.licenses.unfree; + homepage = "http://advsys.net/ken/utils.htm"; + maintainers = [ lib.maintainers.sander ]; + }; +} diff --git a/nixpkgs/pkgs/tools/compression/lbzip2/default.nix b/nixpkgs/pkgs/tools/compression/lbzip2/default.nix new file mode 100644 index 000000000000..4072dd43aef1 --- /dev/null +++ b/nixpkgs/pkgs/tools/compression/lbzip2/default.nix @@ -0,0 +1,28 @@ +{ lib, stdenv, fetchFromGitHub, gnulib, perl, autoconf, automake }: + +stdenv.mkDerivation rec { + version = "2.5"; + name = "lbzip2-${version}"; + + src = fetchFromGitHub { + owner = "kjn"; + repo = "lbzip2"; + sha256 = "1h321wva6fp6khz6x0i6rqb76xh327nw6v5jhgjpcckwdarj5jv8"; + rev = "v${version}"; + }; + + buildInputs = [ gnulib perl ]; + nativeBuildInputs = [ autoconf automake ]; + + preConfigure = '' + ./build-aux/autogen.sh + ''; + + meta = with lib; { + homepage = "https://github.com/kjn/lbzip2"; # Formerly http://lbzip2.org/ + description = "Parallel bzip2 compression utility"; + license = licenses.gpl3; + maintainers = with maintainers; [ abbradar ]; + platforms = platforms.unix; + }; +} diff --git a/nixpkgs/pkgs/tools/compression/lhasa/default.nix b/nixpkgs/pkgs/tools/compression/lhasa/default.nix new file mode 100644 index 000000000000..77df84879b8d --- /dev/null +++ b/nixpkgs/pkgs/tools/compression/lhasa/default.nix @@ -0,0 +1,21 @@ +{lib, stdenv, fetchurl}: + +stdenv.mkDerivation { + name = "lhasa-0.3.1"; + src = fetchurl { + url = "https://soulsphere.org/projects/lhasa/lhasa-0.3.1.tar.gz"; + sha256 = "092zi9av18ma20c6h9448k0bapvx2plnp292741dvfd9hmgqxc1z"; + }; + meta = { + description = "Free Software replacement for the Unix LHA tool"; + longDescription = '' + Lhasa is a Free Software replacement for the Unix LHA tool, for + decompressing .lzh (LHA / LHarc) and .lzs (LArc) archives. The backend for + the tool is a library, so that it can be reused for other purposes. + ''; + license = lib.licenses.isc; + homepage = "http://fragglet.github.io/lhasa"; + maintainers = with lib; [ maintainers.sander ]; + platforms = with lib.platforms; linux ++ darwin; + }; +} diff --git a/nixpkgs/pkgs/tools/compression/lrzip/default.nix b/nixpkgs/pkgs/tools/compression/lrzip/default.nix new file mode 100644 index 000000000000..9f4f66521f66 --- /dev/null +++ b/nixpkgs/pkgs/tools/compression/lrzip/default.nix @@ -0,0 +1,25 @@ +{lib, stdenv, fetchurl, zlib, lzo, bzip2, lz4, nasm, perl}: + +stdenv.mkDerivation rec { + version = "0.641"; + pname = "lrzip"; + + src = fetchurl { + url = "http://ck.kolivas.org/apps/lrzip/${pname}-${version}.tar.xz"; + sha256 = "0ziyanspd96dc3lp2qdcylc7aq8dhb511jhqrhxvlp502fjqjqrc"; + }; + + buildInputs = [ zlib lzo bzip2 lz4 nasm perl ]; + + configureFlags = [ + "--disable-asm" + ]; + + meta = { + homepage = "http://ck.kolivas.org/apps/lrzip/"; + description = "The CK LRZIP compression program (LZMA + RZIP)"; + license = lib.licenses.gpl2Plus; + inherit version; + platforms = lib.platforms.unix; + }; +} diff --git a/nixpkgs/pkgs/tools/compression/lrzip/default.upstream b/nixpkgs/pkgs/tools/compression/lrzip/default.upstream new file mode 100644 index 000000000000..1b8345986374 --- /dev/null +++ b/nixpkgs/pkgs/tools/compression/lrzip/default.upstream @@ -0,0 +1,8 @@ +url http://ck.kolivas.org/apps/lrzip/ +version_link '[.]tar[.]bz2$' + +do_overwrite () { + ensure_hash + set_var_value version "$CURRENT_VERSION" + set_var_value sha256 "$CURRENT_HASH" +} diff --git a/nixpkgs/pkgs/tools/compression/lz4/default.nix b/nixpkgs/pkgs/tools/compression/lz4/default.nix new file mode 100644 index 000000000000..e2bb98a4b805 --- /dev/null +++ b/nixpkgs/pkgs/tools/compression/lz4/default.nix @@ -0,0 +1,61 @@ +{ lib, stdenv, fetchFromGitHub, valgrind, fetchpatch +, enableStatic ? stdenv.hostPlatform.isStatic +, enableShared ? !stdenv.hostPlatform.isStatic +}: + +stdenv.mkDerivation rec { + pname = "lz4"; + version = "1.9.3"; + + src = fetchFromGitHub { + sha256 = "1w02kazh1fps3sji2sn89fz862j1199c5ajrqcgl1bnlxj09kcbz"; + rev = "v${version}"; + repo = pname; + owner = pname; + }; + + # TODO(@Ericson2314): Separate binaries and libraries + outputs = [ "bin" "out" "dev" ]; + + buildInputs = lib.optional doCheck valgrind; + + enableParallelBuilding = true; + + makeFlags = [ + "PREFIX=$(out)" + "INCLUDEDIR=$(dev)/include" + "BUILD_STATIC=${if enableStatic then "yes" else "no"}" + "BUILD_SHARED=${if enableShared then "yes" else "no"}" + "WINDRES:=${stdenv.cc.bintools.targetPrefix}windres" + ] + # TODO make full dictionary + ++ lib.optional stdenv.hostPlatform.isMinGW "TARGET_OS=MINGW" + ; + + doCheck = false; # tests take a very long time + checkTarget = "test"; + + # TODO(@Ericson2314): Make resusable setup hook for this issue on Windows. + postInstall = + lib.optionalString stdenv.hostPlatform.isWindows '' + mv $out/bin/*.dll $out/lib + ln -s $out/lib/*.dll + '' + + '' + moveToOutput bin "$bin" + ''; + + meta = with lib; { + description = "Extremely fast compression algorithm"; + longDescription = '' + Very fast lossless compression algorithm, providing compression speed + at 400 MB/s per core, with near-linear scalability for multi-threaded + applications. It also features an extremely fast decoder, with speed in + multiple GB/s per core, typically reaching RAM speed limits on + multi-core systems. + ''; + homepage = "https://lz4.github.io/lz4/"; + license = with licenses; [ bsd2 gpl2Plus ]; + platforms = platforms.all; + }; +} diff --git a/nixpkgs/pkgs/tools/compression/lzbench/default.nix b/nixpkgs/pkgs/tools/compression/lzbench/default.nix new file mode 100644 index 000000000000..93ccc67f7d14 --- /dev/null +++ b/nixpkgs/pkgs/tools/compression/lzbench/default.nix @@ -0,0 +1,27 @@ +{ lib, stdenv, fetchFromGitHub }: + +stdenv.mkDerivation rec { + pname = "lzbench"; + version = "1.8.1"; + + src = fetchFromGitHub { + owner = "inikep"; + repo = pname; + rev = "v${version}"; + sha256 = "19zlvcjb1qg4fx30rrp6m650660y35736j8szvdxmqh9ipkisyia"; + }; + + enableParallelBuilding = true; + + installPhase = '' + mkdir -p $out/bin + cp lzbench $out/bin + ''; + + meta = with lib; { + inherit (src.meta) homepage; + description = "In-memory benchmark of open-source LZ77/LZSS/LZMA compressors"; + license = licenses.free; + platforms = platforms.all; + }; +} diff --git a/nixpkgs/pkgs/tools/compression/lzfse/default.nix b/nixpkgs/pkgs/tools/compression/lzfse/default.nix new file mode 100644 index 000000000000..13764971bb51 --- /dev/null +++ b/nixpkgs/pkgs/tools/compression/lzfse/default.nix @@ -0,0 +1,28 @@ +{ lib, stdenv, fetchFromGitHub, cmake }: + +stdenv.mkDerivation rec { + pname = "lzfse"; + version = "1.0"; + + src = fetchFromGitHub { + owner = "lzfse"; + repo = "lzfse"; + rev = "lzfse-${version}"; + sha256 = "1mfh6y6vpvxsdwmqmfbkqkwvxc0pz2dqqc72c6fk9sbsrxxaghd5"; + }; + + nativeBuildInputs = [ cmake ]; + + meta = with lib; { + homepage = "https://github.com/lzfse/lzfse"; + description = "a reference C implementation of the LZFSE compressor"; + longDescription = '' + This is a reference C implementation of the LZFSE compressor introduced in the Compression library with OS X 10.11 and iOS 9. + LZFSE is a Lempel-Ziv style data compression algorithm using Finite State Entropy coding. + It targets similar compression rates at higher compression and decompression speed compared to deflate using zlib. + ''; + platforms = platforms.unix; + license = licenses.bsd3; + maintainers = with maintainers; [ ]; + }; +} diff --git a/nixpkgs/pkgs/tools/compression/lzham/default.nix b/nixpkgs/pkgs/tools/compression/lzham/default.nix new file mode 100644 index 000000000000..7f4273163a3e --- /dev/null +++ b/nixpkgs/pkgs/tools/compression/lzham/default.nix @@ -0,0 +1,26 @@ +{ lib, stdenv, fetchFromGitHub, cmake } : + +stdenv.mkDerivation { + name = "lzham-1.0"; + + src = fetchFromGitHub { + owner = "richgel999"; + repo = "lzham_codec"; + rev = "v1_0_release"; + sha256 = "14c1zvzmp1ylp4pgayfdfk1kqjb23xj4f7ll1ra7b18wjxc9ja1v"; + }; + + nativeBuildInputs = [ cmake ]; + + installPhase = '' + mkdir -p $out/bin + cp ../bin_linux/lzhamtest $out/bin + ''; + + meta = with lib; { + description = "Lossless data compression codec with LZMA-like ratios but 1.5x-8x faster decompression speed"; + homepage = "https://github.com/richgel999/lzham_codec"; + license = with licenses; [ mit ]; + platforms = platforms.linux; + }; +} diff --git a/nixpkgs/pkgs/tools/compression/lzip/default.nix b/nixpkgs/pkgs/tools/compression/lzip/default.nix new file mode 100644 index 000000000000..aa6b6d31a897 --- /dev/null +++ b/nixpkgs/pkgs/tools/compression/lzip/default.nix @@ -0,0 +1,37 @@ +{ lib, stdenv, fetchurl, texinfo }: + +# Note: this package is used for bootstrapping fetchurl, and thus +# cannot use fetchpatch! All mutable patches (generated by GitHub or +# cgit) that are needed here should be included directly in Nixpkgs as +# files. + +stdenv.mkDerivation rec { + pname = "lzip"; + version = "1.22"; + + nativeBuildInputs = [ texinfo ]; + + src = fetchurl { + url = "mirror://savannah/lzip/${pname}-${version}.tar.gz"; + sha256 = "sha256-wzQtQuZxOcFluLEo0DO1yWiToTrF8lkzGQMVIU6HqUg="; + }; + + configureFlags = [ + "CPPFLAGS=-DNDEBUG" + "CFLAGS=-O3" + "CXXFLAGS=-O3" + ] ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) + "CXX=${stdenv.cc.targetPrefix}c++"; + + setupHook = ./lzip-setup-hook.sh; + + doCheck = true; + enableParallelBuilding = true; + + meta = { + homepage = "https://www.nongnu.org/lzip/lzip.html"; + description = "A lossless data compressor based on the LZMA algorithm"; + license = lib.licenses.gpl3Plus; + platforms = lib.platforms.all; + }; +} diff --git a/nixpkgs/pkgs/tools/compression/lzip/lzip-setup-hook.sh b/nixpkgs/pkgs/tools/compression/lzip/lzip-setup-hook.sh new file mode 100644 index 000000000000..092ad7737dd1 --- /dev/null +++ b/nixpkgs/pkgs/tools/compression/lzip/lzip-setup-hook.sh @@ -0,0 +1,5 @@ +lzipUnpackCmdHook() { + [[ "$1" = *.tar.lz ]] && tar --lzip -xf "$1" +} + +unpackCmdHooks+=(lzipUnpackCmdHook) diff --git a/nixpkgs/pkgs/tools/compression/lzop/default.nix b/nixpkgs/pkgs/tools/compression/lzop/default.nix new file mode 100644 index 000000000000..be31048c2186 --- /dev/null +++ b/nixpkgs/pkgs/tools/compression/lzop/default.nix @@ -0,0 +1,18 @@ +{lib, stdenv, fetchurl, lzo}: + +stdenv.mkDerivation rec { + name = "lzop-1.04"; + src = fetchurl { + url = "https://www.lzop.org/download/${name}.tar.gz"; + sha256 = "0h9gb8q7y54m9mvy3jvsmxf21yx8fc3ylzh418hgbbv0i8mbcwky"; + }; + + buildInputs = [ lzo ]; + + meta = with lib; { + homepage = "http://www.lzop.org"; + description = "Fast file compressor"; + license = licenses.gpl2; + platforms = platforms.unix; + }; +} diff --git a/nixpkgs/pkgs/tools/compression/mozlz4a/default.nix b/nixpkgs/pkgs/tools/compression/mozlz4a/default.nix new file mode 100644 index 000000000000..dabde674d2eb --- /dev/null +++ b/nixpkgs/pkgs/tools/compression/mozlz4a/default.nix @@ -0,0 +1,34 @@ +{ lib, stdenv, fetchurl, python3, runtimeShell }: + +stdenv.mkDerivation rec { + pname = "mozlz4a"; + version = "2018-08-23"; + # or fetchFromGitHub(owner,repo,rev) or fetchgit(rev) + src = fetchurl { + url = "https://gist.githubusercontent.com/kaefer3000/73febe1eec898cd50ce4de1af79a332a/raw/a266410033455d6b4af515d7a9d34f5afd35beec/mozlz4a.py"; + sha256 = "1d1ai062kdms34bya9dlykkx011rj8d8nh5l7d76xj8k9kv4ssq6"; + }; + + dontUnpack = true; + + installPhase = '' + mkdir -p "$out/bin" "$out/${python3.sitePackages}/" + cp "${src}" "$out/${python3.sitePackages}/mozlz4a.py" + + echo "#!${runtimeShell}" >> "$out/bin/mozlz4a" + echo "export PYTHONPATH='$PYTHONPATH'" >> "$out/bin/mozlz4a" + echo "'${python3}/bin/python' '$out/${python3.sitePackages}/mozlz4a.py' \"\$@\"" >> "$out/bin/mozlz4a" + chmod a+x "$out/bin/mozlz4a" + ''; + + buildInputs = [ python3 python3.pkgs.python-lz4 ]; + + meta = { + inherit version; + description = "A script to handle Mozilla's mozlz4 files"; + license = lib.licenses.bsd2; + maintainers = [lib.maintainers.raskin]; + platforms = lib.platforms.linux; + homepage = "https://gist.githubusercontent.com/Tblue/62ff47bef7f894e92ed5"; + }; +} diff --git a/nixpkgs/pkgs/tools/compression/ncompress/builder.sh b/nixpkgs/pkgs/tools/compression/ncompress/builder.sh new file mode 100644 index 000000000000..7a3f34aae469 --- /dev/null +++ b/nixpkgs/pkgs/tools/compression/ncompress/builder.sh @@ -0,0 +1,15 @@ +source $stdenv/setup +installFlags="PREFIX=$out" + +preBuild() { + cp Makefile.def Makefile + sed -i GNUmakefile -e 's/compress %/%/g' +} + +postInstall() { + rm $out/bin/uncompress* $out/bin/zcat* + ln -s compress $out/bin/uncompress + ln -s compress $out/bin/zcat +} + +genericBuild diff --git a/nixpkgs/pkgs/tools/compression/ncompress/default.nix b/nixpkgs/pkgs/tools/compression/ncompress/default.nix new file mode 100644 index 000000000000..f580709495ed --- /dev/null +++ b/nixpkgs/pkgs/tools/compression/ncompress/default.nix @@ -0,0 +1,20 @@ +{lib, stdenv, fetchurl}: + +stdenv.mkDerivation rec { + pname = "ncompress"; + version = "5.0"; + + builder = ./builder.sh; + + src = fetchurl { + url = "mirror://sourceforge/project/ncompress/${pname}-${version}.tar.gz"; + sha256 = "004r086c11sw9vg2j3srgxpz98w8pycjl33bk3pgqnd0s92igrn4"; + }; + + meta = { + homepage = "http://ncompress.sourceforge.net/"; + license = lib.licenses.publicDomain; + description = "A fast, simple LZW file compressor"; + platforms = lib.platforms.unix; + }; +} diff --git a/nixpkgs/pkgs/tools/compression/nx2elf/default.nix b/nixpkgs/pkgs/tools/compression/nx2elf/default.nix new file mode 100644 index 000000000000..8b7f094bf39a --- /dev/null +++ b/nixpkgs/pkgs/tools/compression/nx2elf/default.nix @@ -0,0 +1,37 @@ +{ lib, stdenv, fetchFromGitHub, lz4 }: + +stdenv.mkDerivation rec { + pname = "nx2elf"; + version = "unstable-2020-05-26"; + + src = fetchFromGitHub { + owner = "shuffle2"; + repo = "nx2elf"; + rev = "7212e82a77b84fcc18ef2d050970350dbf63649b"; + sha256 = "1j4k5s86c6ixa3wdqh4cfm31fxabwn6jcjc6pippx8mii98ac806"; + }; + + buildInputs = [ lz4 ]; + + postPatch = '' + # This project does not comply with C++14 standards, and compilation on that fails. + # This does however succesfully compile with the gnu++20 standard. + substituteInPlace Makefile --replace "c++14" "gnu++20" + + # pkg-config is not supported, so we'll manually use a non-ancient version of lz4 + cp ${lz4.src}/lib/lz4.{h,c} . + ''; + + installPhase = '' + mkdir -p $out/bin + install -D nx2elf $out/bin/nx2elf + ''; + + meta = with lib; { + homepage = "https://github.com/shuffle2/nx2elf"; + description = "Convert Nintendo Switch executable files to ELFs"; + license = licenses.unfree; # No license specified upstream + platforms = [ "x86_64-linux" ]; # Should work on Darwin as well, but this is untested. aarch64-linux fails. + maintainers = [ maintainers.ivar ]; + }; +} diff --git a/nixpkgs/pkgs/tools/compression/pbzip2/default.nix b/nixpkgs/pkgs/tools/compression/pbzip2/default.nix new file mode 100644 index 000000000000..6d27b84e8c4c --- /dev/null +++ b/nixpkgs/pkgs/tools/compression/pbzip2/default.nix @@ -0,0 +1,30 @@ +{ lib, stdenv, fetchurl, bzip2 }: + +let major = "1.1"; + version = "${major}.13"; +in +stdenv.mkDerivation rec { + pname = "pbzip2"; + inherit version; + + src = fetchurl { + url = "https://launchpad.net/pbzip2/${major}/${version}/+download/${pname}-${version}.tar.gz"; + sha256 = "1rnvgcdixjzbrmcr1nv9b6ccrjfrhryaj7jwz28yxxv6lam3xlcg"; + }; + + buildInputs = [ bzip2 ]; + + preBuild = "substituteInPlace Makefile --replace g++ c++"; + + installFlags = [ "PREFIX=$(out)" ]; + + NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang "-Wno-error=reserved-user-defined-literal"; + + meta = with lib; { + homepage = "http://compression.ca/pbzip2/"; + description = "A parallel implementation of bzip2 for multi-core machines"; + license = licenses.bsd2; + maintainers = with maintainers; [viric]; + platforms = platforms.unix; + }; +} diff --git a/nixpkgs/pkgs/tools/compression/pbzx/default.nix b/nixpkgs/pkgs/tools/compression/pbzx/default.nix new file mode 100644 index 000000000000..03b984bb6435 --- /dev/null +++ b/nixpkgs/pkgs/tools/compression/pbzx/default.nix @@ -0,0 +1,26 @@ +{stdenv, lib, fetchFromGitHub, xz, xar}: + +stdenv.mkDerivation rec { + pname = "pbzx"; + version = "1.0.2"; + src = fetchFromGitHub { + owner = "NiklasRosenstein"; + repo = "pbzx"; + rev = "v${version}"; + sha256 = "0bwd7wmnhpz1n5p39mh6asfyccj4cm06hwigslcwbb3pdwmvxc90"; + }; + buildInputs = [ xz xar ]; + buildPhase = '' + ${stdenv.cc.targetPrefix}cc pbzx.c -llzma -lxar -o pbzx + ''; + installPhase = '' + mkdir -p $out/bin + cp pbzx $out/bin + ''; + meta = with lib; { + description = "Stream parser of Apple's pbzx compression format"; + platforms = platforms.unix; + license = licenses.gpl3; + maintainers = [ maintainers.matthewbauer ]; + }; +} diff --git a/nixpkgs/pkgs/tools/compression/pigz/default.nix b/nixpkgs/pkgs/tools/compression/pigz/default.nix new file mode 100644 index 000000000000..a4cdcc08549e --- /dev/null +++ b/nixpkgs/pkgs/tools/compression/pigz/default.nix @@ -0,0 +1,37 @@ +{ lib, stdenv, fetchurl, zlib, util-linux }: + +let name = "pigz"; + version = "2.6"; +in +stdenv.mkDerivation { + name = name + "-" + version; + + src = fetchurl { + url = "https://www.zlib.net/${name}/${name}-${version}.tar.gz"; + sha256 = "sha256-Lu17DXRJ0dcJA/KmLNYAXSYus6jJ6YaHvIy7WAnbKn0="; + }; + + enableParallelBuilding = true; + + buildInputs = [zlib] ++ lib.optional stdenv.isLinux util-linux; + + makeFlags = [ "CC=${stdenv.cc}/bin/${stdenv.cc.targetPrefix}cc" ]; + + doCheck = stdenv.isLinux; + checkTarget = "tests"; + installPhase = + '' + install -Dm755 pigz "$out/bin/pigz" + ln -s pigz "$out/bin/unpigz" + install -Dm755 pigz.1 "$out/share/man/man1/pigz.1" + ln -s pigz.1 "$out/share/man/man1/unpigz.1" + install -Dm755 pigz.pdf "$out/share/doc/pigz/pigz.pdf" + ''; + + meta = with lib; { + homepage = "http://www.zlib.net/pigz/"; + description = "A parallel implementation of gzip for multi-core machines"; + license = licenses.zlib; + platforms = platforms.unix; + }; +} diff --git a/nixpkgs/pkgs/tools/compression/pixz/default.nix b/nixpkgs/pkgs/tools/compression/pixz/default.nix new file mode 100644 index 000000000000..d0418ffdd60d --- /dev/null +++ b/nixpkgs/pkgs/tools/compression/pixz/default.nix @@ -0,0 +1,37 @@ +{ + lib, stdenv, fetchFromGitHub, autoconf, automake, libtool, pkg-config + , asciidoc, libxslt, libxml2, docbook_xml_dtd_45, docbook_xsl + , libarchive, xz +}: +stdenv.mkDerivation rec { + baseName = "pixz"; + version = "1.0.7"; + name = "${baseName}-${version}"; + + nativeBuildInputs = [ pkg-config ]; + buildInputs = [ + autoconf automake libtool asciidoc libxslt libxml2 + docbook_xml_dtd_45 docbook_xsl + libarchive xz + ]; + preBuild = '' + echo "XML_CATALOG_FILES='$XML_CATALOG_FILES'" + ''; + src = fetchFromGitHub { + owner = "vasi"; + repo = baseName; + rev = "v${version}"; + sha256 = "163axxs22w7pghr786hda22mnlpvmi50hzhfr9axwyyjl9n41qs2"; + }; + preConfigure = '' + ./autogen.sh + ''; + + meta = { + inherit version; + description = "A parallel compressor/decompressor for xz format"; + license = lib.licenses.bsd2; + maintainers = [lib.maintainers.raskin]; + platforms = lib.platforms.unix; + }; +} diff --git a/nixpkgs/pkgs/tools/compression/pxz/_SC_ARG_MAX.patch b/nixpkgs/pkgs/tools/compression/pxz/_SC_ARG_MAX.patch new file mode 100644 index 000000000000..fac8f1fc147c --- /dev/null +++ b/nixpkgs/pkgs/tools/compression/pxz/_SC_ARG_MAX.patch @@ -0,0 +1,36 @@ +From b8f9827fc4de9296c7a6f5e6fdac46e070cd6cb4 Mon Sep 17 00:00:00 2001 +From: Igor Pashev <pashev.igor@gmail.com> +Date: Sat, 1 Nov 2014 18:10:05 +0300 +Subject: [PATCH] Fixed crash on Linux when stack size is unlimited + +--- + pxz.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/pxz.c b/pxz.c +index 9cb843e..52713e2 100644 +--- a/pxz.c ++++ b/pxz.c +@@ -65,7 +65,7 @@ FILE **ftemp; + char str[0x100]; + char buf[BUFFSIZE]; + char *xzcmd; +-size_t xzcmd_max; ++const size_t xzcmd_max = 10240; + + unsigned opt_complevel = 6, opt_stdout, opt_keep, opt_threads, opt_verbose; + unsigned opt_force, opt_stdout; +@@ -243,9 +243,12 @@ int main( int argc, char **argv ) { + lzma_filter filters[LZMA_FILTERS_MAX + 1]; + lzma_options_lzma lzma_options; + +- xzcmd_max = sysconf(_SC_ARG_MAX); + page_size = sysconf(_SC_PAGE_SIZE); + xzcmd = malloc(xzcmd_max); ++ if (!xzcmd) { ++ fprintf(stderr, "Failed to allocate %lu bytes for xz command.\n", xzcmd_max); ++ return -1; ++ } + snprintf(xzcmd, xzcmd_max, XZ_BINARY); + + parse_args(argc, argv); diff --git a/nixpkgs/pkgs/tools/compression/pxz/default.nix b/nixpkgs/pkgs/tools/compression/pxz/default.nix new file mode 100644 index 000000000000..eb1f5d3570b1 --- /dev/null +++ b/nixpkgs/pkgs/tools/compression/pxz/default.nix @@ -0,0 +1,44 @@ +{ lib, stdenv, fetchgit, xz }: + +let name = "pxz"; + version = "4.999.9beta+git"; +in +stdenv.mkDerivation { + name = name + "-" + version; + + src = fetchgit { + url = "https://github.com/jnovy/pxz.git"; + rev = "ae808463c2950edfdedb8fb49f95006db0a18667"; + sha256 = "0na2kw8cf0qd8l1aywlv9m3xrxnqlcwxfdwp3f7x9vxwqx3k32kc"; + }; + + buildInputs = [ xz ]; + + patches = [ ./_SC_ARG_MAX.patch ]; + + buildPhase = '' + gcc -o pxz pxz.c -llzma \ + -fopenmp -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -O2 \ + -DPXZ_BUILD_DATE=\"nixpkgs\" \ + -DXZ_BINARY=\"${xz.bin}/bin/xz\" \ + -DPXZ_VERSION=\"${version}\" + ''; + + installPhase = '' + mkdir -p $out/bin $out/share/man/man1 + cp pxz $out/bin + cp pxz.1 $out/share/man/man1 + ''; + + meta = { + homepage = "https://jnovy.fedorapeople.org/pxz/"; + license = lib.licenses.gpl2Plus; + maintainers = with lib.maintainers; [pashev]; + description = ''Parallel XZ is a compression utility that takes advantage of + running LZMA compression of different parts of an input file on multiple + cores and processors simultaneously. Its primary goal is to utilize all + resources to speed up compression time with minimal possible influence + on compression ratio''; + platforms = with lib.platforms; linux; + }; +} diff --git a/nixpkgs/pkgs/tools/compression/rzip/default.nix b/nixpkgs/pkgs/tools/compression/rzip/default.nix new file mode 100644 index 000000000000..60364afa9f30 --- /dev/null +++ b/nixpkgs/pkgs/tools/compression/rzip/default.nix @@ -0,0 +1,25 @@ +{lib, stdenv, fetchurl, fetchpatch, bzip2}: + +stdenv.mkDerivation { + name = "rzip-2.1"; + src = fetchurl { + url = "mirror://samba/rzip/rzip-2.1.tar.gz"; + sha256 = "4bb96f4d58ccf16749ed3f836957ce97dbcff3e3ee5fd50266229a48f89815b7"; + }; + buildInputs = [ bzip2 ]; + + patches = [ + (fetchpatch { + name = "CVE-2017-8364-fill-buffer.patch"; + url = "https://sources.debian.net/data/main/r/rzip/2.1-4.1/debian/patches/80-CVE-2017-8364-fill-buffer.patch"; + sha256 = "0jcjlx9ksdvxvjyxmyzscx9ar9992iy5icw0sc3n0p09qi4d6x1r"; + }) + ]; + + meta = { + homepage = "https://rzip.samba.org/"; + description = "Compression program"; + license = lib.licenses.gpl2Plus; + platforms = lib.platforms.unix; + }; +} diff --git a/nixpkgs/pkgs/tools/compression/upx/default.nix b/nixpkgs/pkgs/tools/compression/upx/default.nix new file mode 100644 index 000000000000..10e02626c017 --- /dev/null +++ b/nixpkgs/pkgs/tools/compression/upx/default.nix @@ -0,0 +1,32 @@ +{ lib, stdenv, fetchurl, ucl, zlib, perl }: + +stdenv.mkDerivation rec { + pname = "upx"; + version = "3.96"; + src = fetchurl { + url = "https://github.com/upx/upx/releases/download/v${version}/${pname}-${version}-src.tar.xz"; + sha256 = "051pk5jk8fcfg5mpgzj43z5p4cn7jy5jbyshyn78dwjqr7slsxs7"; + }; + + CXXFLAGS = "-Wno-unused-command-line-argument"; + + buildInputs = [ ucl zlib perl ]; + + preConfigure = '' + export UPX_UCLDIR=${ucl} + ''; + + makeFlags = [ "-C" "src" "CHECK_WHITESPACE=true" ]; + + installPhase = '' + mkdir -p $out/bin + cp src/upx.out $out/bin/upx + ''; + + meta = with lib; { + homepage = "https://upx.github.io/"; + description = "The Ultimate Packer for eXecutables"; + license = licenses.gpl2Plus; + platforms = platforms.unix; + }; +} diff --git a/nixpkgs/pkgs/tools/compression/xar/0001-Add-useless-descriptions-to-AC_DEFINE.patch b/nixpkgs/pkgs/tools/compression/xar/0001-Add-useless-descriptions-to-AC_DEFINE.patch new file mode 100644 index 000000000000..a605d2db1708 --- /dev/null +++ b/nixpkgs/pkgs/tools/compression/xar/0001-Add-useless-descriptions-to-AC_DEFINE.patch @@ -0,0 +1,95 @@ +From a14be07c0aae3bf6f732d1ca5f625ba375702121 Mon Sep 17 00:00:00 2001 +From: Andrew Childs <andrew.childs@bibo.com.ph> +Date: Sun, 15 Nov 2020 19:12:33 +0900 +Subject: [PATCH 1/2] Add useless descriptions to AC_DEFINE + +Removes autoheader warnings. +--- + configure.ac | 42 +++++++++++++++++++++--------------------- + 1 file changed, 21 insertions(+), 21 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 812b5ff..358ab89 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -210,48 +210,48 @@ AC_CHECK_MEMBERS([struct stat.st_flags]) + + AC_CHECK_SIZEOF(uid_t) + if test $ac_cv_sizeof_uid_t = "4"; then +-AC_DEFINE(UID_STRING, RId32) +-AC_DEFINE(UID_CAST, (uint32_t)) ++AC_DEFINE([UID_STRING], RId32, [UID_STRING]) ++AC_DEFINE([UID_CAST], (uint32_t), [UID_CAST]) + elif test $ac_cv_sizeof_uid_t = "8"; then +-AC_DEFINE(UID_STRING, PRId64) +-AC_DEFINE(UID_CAST, (uint64_t)) ++AC_DEFINE([UID_STRING], PRId64, [UID_STRING]) ++AC_DEFINE([UID_CAST], (uint64_t), [UID_CAST]) + else + AC_ERROR(can not detect the size of your system's uid_t type) + fi + + AC_CHECK_SIZEOF(gid_t) + if test $ac_cv_sizeof_gid_t = "4"; then +-AC_DEFINE(GID_STRING, PRId32) +-AC_DEFINE(GID_CAST, (uint32_t)) ++AC_DEFINE([GID_STRING], PRId32, [GID_STRING]) ++AC_DEFINE([GID_CAST], (uint32_t), [GID_CAST]) + elif test $ac_cv_sizeof_gid_t = "8"; then +-AC_DEFINE(GID_STRING, PRId64) +-AC_DEFINE(GID_CAST, (uint64_t)) ++AC_DEFINE([GID_STRING], PRId64, [GID_STRING]) ++AC_DEFINE([GID_CAST], (uint64_t), [GID_CAST]) + else + AC_ERROR(can not detect the size of your system's gid_t type) + fi + + AC_CHECK_SIZEOF(ino_t) + if test $ac_cv_sizeof_ino_t = "4"; then +-AC_DEFINE(INO_STRING, PRId32) +-AC_DEFINE(INO_HEXSTRING, PRIx32) +-AC_DEFINE(INO_CAST, (uint32_t)) ++AC_DEFINE([INO_STRING], PRId32, [INO_STRING]) ++AC_DEFINE([INO_HEXSTRING], PRIx32, [INO_HEXSTRING]) ++AC_DEFINE([INO_CAST], (uint32_t), [INO_CAST]) + elif test $ac_cv_sizeof_ino_t = "8"; then +-AC_DEFINE(INO_STRING, PRId64) +-AC_DEFINE(INO_HEXSTRING, PRIx64) +-AC_DEFINE(INO_CAST, (uint64_t)) ++AC_DEFINE([INO_STRING], PRId64, [INO_STRING]) ++AC_DEFINE([INO_HEXSTRING], PRIx64, [INO_HEXSTRING]) ++AC_DEFINE([INO_CAST], (uint64_t), [INO_CAST]) + else + AC_ERROR(can not detect the size of your system's ino_t type) + fi + + AC_CHECK_SIZEOF(dev_t) + if test $ac_cv_sizeof_dev_t = "4"; then +-AC_DEFINE(DEV_STRING, PRId32) +-AC_DEFINE(DEV_HEXSTRING, PRIx32) +-AC_DEFINE(DEV_CAST, (uint32_t)) ++AC_DEFINE([DEV_STRING], PRId32, [DEV_STRING]) ++AC_DEFINE([DEV_HEXSTRING], PRIx32, [DEV_HEXSTRING]) ++AC_DEFINE([DEV_CAST], (uint32_t), [DEV_CAST]) + elif test $ac_cv_sizeof_dev_t = "8"; then +-AC_DEFINE(DEV_STRING, PRId64) +-AC_DEFINE(DEV_HEXSTRING, PRIx64) +-AC_DEFINE(DEV_CAST, (uint64_t)) ++AC_DEFINE([DEV_STRING], PRId64, [DEV_STRING]) ++AC_DEFINE([DEV_HEXSTRING], PRIx64, [DEV_HEXSTRING]) ++AC_DEFINE([DEV_CAST], (uint64_t), [DEV_CAST]) + else + AC_ERROR(can not detect the size of your system's dev_t type) + fi +@@ -261,7 +261,7 @@ AC_CHECK_LIB(acl, acl_get_file) + dnl Check for paths + AC_PREFIX_DEFAULT(/usr/local) + +-AC_CHECK_FUNC([asprintf], AC_DEFINE([HAVE_ASPRINTF])) ++AC_CHECK_FUNC([asprintf], AC_DEFINE([HAVE_ASPRINTF], [], [HAVE_ASPRINTF])) + + dnl + dnl Configure libxml2. +-- +2.28.0 + diff --git a/nixpkgs/pkgs/tools/compression/xar/0002-Use-pkg-config-for-libxml2.patch b/nixpkgs/pkgs/tools/compression/xar/0002-Use-pkg-config-for-libxml2.patch new file mode 100644 index 000000000000..d71ad4b753c1 --- /dev/null +++ b/nixpkgs/pkgs/tools/compression/xar/0002-Use-pkg-config-for-libxml2.patch @@ -0,0 +1,89 @@ +From 276833851657c85651c053ee16b8e1a8dc768a50 Mon Sep 17 00:00:00 2001 +From: Andrew Childs <andrew.childs@bibo.com.ph> +Date: Sun, 15 Nov 2020 19:12:56 +0900 +Subject: [PATCH 2/2] Use pkg-config for libxml2 + +--- + configure.ac | 66 +++++++++------------------------------------------- + 1 file changed, 11 insertions(+), 55 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 358ab89..984a694 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -268,61 +268,17 @@ dnl Configure libxml2. + dnl + LIBXML2_VERSION_MIN=2.6.11 + +-have_libxml2="1" +- +-AC_ARG_WITH([xml2-config], [ --with-xml2-config libxml2 config program], +-if test "x${with_xml2_config}" = "xno" ; then +- XML2_CONFIG= +-else +- XML2_CONFIG="${with_xml2_config}" +-fi +-, +- XML2_CONFIG= +-) +-if test "x${XML2_CONFIG}" != "x" ; then +- if test ! -x "${XML2_CONFIG}" ; then +- AC_MSG_ERROR([Unusable or missing xml2-config: ${XML2_CONFIG}]) +- fi +-else +- AC_PATH_PROG([XML2_CONFIG], [xml2-config], , [${PATH}]) +- if test "x${XML2_CONFIG}" = "x" ; then +- AC_MSG_ERROR([Cannot configure without xml2-config]) +- fi +-fi +- +-dnl Make sure the version of libxml2 found is sufficient. +-AC_MSG_CHECKING([for libxml >= ${LIBXML2_VERSION_MIN}]) +-LIBXML2_FOUND=`2>&1 ${XML2_CONFIG} --version` +-LIBXML2_MAJOR=`echo ${LIBXML2_FOUND} | tr . " " | awk '{print $1}'` +-LIBXML2_MINOR=`echo ${LIBXML2_FOUND} | tr . " " | awk '{print $2}' | tr a-z " " |awk '{print $1}'` +-LIBXML2_BRANCH=`echo ${LIBXML2_FOUND} | tr . " " | awk '{print $3}' | tr a-z " " |awk '{print $1}'` +-if test "x${LIBXML2_BRANCH}" = "x" ; then +- LIBXML2_BRANCH=0 +-fi +-LIBXML2_MAJOR_MIN=`echo ${LIBXML2_VERSION_MIN} | tr . " " | awk '{print $1}'` +-LIBXML2_MINOR_MIN=`echo ${LIBXML2_VERSION_MIN} | tr . " " | awk '{print $2}'` +-LIBXML2_BRANCH_MIN=`echo ${LIBXML2_VERSION_MIN} | tr . " " | awk '{print $3}'` +-if test ${LIBXML2_MAJOR} -gt ${LIBXML2_MAJOR_MIN} \ +- -o ${LIBXML2_MAJOR} -eq ${LIBXML2_MAJOR_MIN} \ +- -a ${LIBXML2_MINOR} -gt ${LIBXML2_MINOR_MIN} \ +- -o ${LIBXML2_MAJOR} -eq ${LIBXML2_MAJOR_MIN} \ +- -a ${LIBXML2_MINOR} -eq ${LIBXML2_MINOR_MIN} \ +- -a ${LIBXML2_BRANCH} -ge $LIBXML2_BRANCH_MIN ; then +- AC_MSG_RESULT([${LIBXML2_MAJOR}.${LIBXML2_MINOR}.${LIBXML2_BRANCH}]) +- have_libxml2="1" +- CPPFLAGS="${CPPFLAGS} `${XML2_CONFIG} --cflags`" +- LIBS="${LIBS} `${XML2_CONFIG} --libs`" +-else +- AC_MSG_RESULT([no]) +- have_libxml2="0" +-fi +-if test "x${have_libxml2}" = "x1" ; then +- dnl Final sanity check, to make sure that xmlwriter is present. +- AC_CHECK_HEADER([libxml/xmlwriter.h], , [have_libxml2="0"]) +-fi +-if test "x${have_libxml2}" = "x0" ; then +- AC_MSG_ERROR([Cannot build without libxml2]) +-fi ++PKG_PROG_PKG_CONFIG ++ ++PKG_CHECK_MODULES(LIBXML2_PKGCONFIG, [libxml-2.0 >= ${LIBXML2_VERSION_MIN}], ++ [ ++ have_libxml2=1 ++ CPPFLAGS="${CPPFLAGS} ${LIBXML2_PKGCONFIG_CFLAGS}" ++ LIBS="${LIBS} ${LIBXML2_PKGCONFIG_LIBS}" ++ ], ++ [ ++ have_libxml2=0 ++ ]) + + dnl + dnl Configure libcrypto (part of OpenSSL). +-- +2.28.0 + diff --git a/nixpkgs/pkgs/tools/compression/xar/default.nix b/nixpkgs/pkgs/tools/compression/xar/default.nix new file mode 100644 index 000000000000..d4baab17b91f --- /dev/null +++ b/nixpkgs/pkgs/tools/compression/xar/default.nix @@ -0,0 +1,46 @@ +{ lib, stdenv, fetchurl, pkg-config, libxml2, xz, openssl, zlib, bzip2, fts, autoreconfHook }: + +stdenv.mkDerivation rec { + version = "1.6.1"; + pname = "xar"; + + src = fetchurl { + url = "https://github.com/downloads/mackyle/xar/${pname}-${version}.tar.gz"; + sha256 = "0ghmsbs6xwg1092v7pjcibmk5wkyifwxw6ygp08gfz25d2chhipf"; + }; + + nativeBuildInputs = [ autoreconfHook pkg-config ]; + buildInputs = [ libxml2 xz openssl zlib bzip2 fts ]; + + patches = [ + ./0001-Add-useless-descriptions-to-AC_DEFINE.patch + ./0002-Use-pkg-config-for-libxml2.patch + ]; + + postPatch = '' + substituteInPlace configure.ac \ + --replace 'OpenSSL_add_all_ciphers' 'OPENSSL_init_crypto' \ + --replace 'openssl/evp.h' 'openssl/crypto.h' + ''; + + meta = { + homepage = "https://mackyle.github.io/xar/"; + description = "Extensible Archiver"; + + longDescription = + '' The XAR project aims to provide an easily extensible archive format. + Important design decisions include an easily extensible XML table of + contents for random access to archived files, storing the toc at the + beginning of the archive to allow for efficient handling of streamed + archives, the ability to handle files of arbitrarily large sizes, the + ability to choose independent encodings for individual files in the + archive, the ability to store checksums for individual files in both + compressed and uncompressed form, and the ability to query the table + of content's rich meta-data. + ''; + + license = lib.licenses.bsd3; + maintainers = with lib.maintainers; [ copumpkin ]; + platforms = lib.platforms.all; + }; +} diff --git a/nixpkgs/pkgs/tools/compression/xdelta/default.nix b/nixpkgs/pkgs/tools/compression/xdelta/default.nix new file mode 100644 index 000000000000..ee52f35c9790 --- /dev/null +++ b/nixpkgs/pkgs/tools/compression/xdelta/default.nix @@ -0,0 +1,61 @@ +{ lib, stdenv, fetchFromGitHub, autoreconfHook +, lzmaSupport ? true, xz ? null +}: + +assert lzmaSupport -> xz != null; + +let + mkWith = flag: name: if flag + then "--with-${name}" + else "--without-${name}"; +in stdenv.mkDerivation rec { + pname = "xdelta"; + version = "3.1.0"; + + src = fetchFromGitHub { + sha256 = "09mmsalc7dwlvgrda56s2k927rpl3a5dzfa88aslkqcjnr790wjy"; + rev = "v${version}"; + repo = "xdelta-devel"; + owner = "jmacd"; + }; + + nativeBuildInputs = [ autoreconfHook ]; + buildInputs = [] + ++ lib.optionals lzmaSupport [ xz ]; + + postPatch = '' + cd xdelta3 + ''; + + configureFlags = [ + (mkWith lzmaSupport "liblzma") + ]; + + enableParallelBuilding = true; + + doCheck = true; + checkPhase = '' + mkdir $PWD/tmp + for i in testing/file.h xdelta3-test.h; do + substituteInPlace $i --replace /tmp $PWD/tmp + done + ./xdelta3regtest + ''; + + installPhase = '' + install -D -m755 xdelta3 $out/bin/xdelta3 + install -D -m644 xdelta3.1 $out/share/man/man1/xdelta3.1 + ''; + + meta = with lib; { + description = "Binary differential compression in VCDIFF (RFC 3284) format"; + longDescription = '' + xdelta is a command line program for delta encoding, which generates two + file differences. This is similar to diff and patch, but it is targeted + for binary files and does not generate human readable output. + ''; + homepage = "http://xdelta.org/"; + license = licenses.gpl2Plus; + platforms = platforms.linux; + }; +} diff --git a/nixpkgs/pkgs/tools/compression/xdelta/unstable.nix b/nixpkgs/pkgs/tools/compression/xdelta/unstable.nix new file mode 100644 index 000000000000..03366e5b1ce3 --- /dev/null +++ b/nixpkgs/pkgs/tools/compression/xdelta/unstable.nix @@ -0,0 +1,65 @@ +{ lib, stdenv, fetchFromGitHub, autoreconfHook +, lzmaSupport ? true, xz ? null +}: + +assert lzmaSupport -> xz != null; + +let + mkWith = flag: name: if flag + then "--with-${name}" + else "--without-${name}"; +in stdenv.mkDerivation rec { + pname = "xdelta"; + version = "3.1.0"; + + src = fetchFromGitHub { + sha256 = "09mmsalc7dwlvgrda56s2k927rpl3a5dzfa88aslkqcjnr790wjy"; + rev = "v${version}"; + repo = "xdelta-devel"; + owner = "jmacd"; + }; + + nativeBuildInputs = [ autoreconfHook ]; + buildInputs = [] + ++ lib.optionals lzmaSupport [ xz ]; + + postPatch = '' + cd xdelta3 + + substituteInPlace Makefile.am --replace \ + "common_CFLAGS =" \ + "common_CFLAGS = -DXD3_USE_LARGESIZET=1" + ''; + + configureFlags = [ + (mkWith lzmaSupport "liblzma") + ]; + + enableParallelBuilding = true; + + doCheck = true; + checkPhase = '' + mkdir $PWD/tmp + for i in testing/file.h xdelta3-test.h; do + substituteInPlace $i --replace /tmp $PWD/tmp + done + ./xdelta3regtest + ''; + + installPhase = '' + install -D -m755 xdelta3 $out/bin/xdelta3 + install -D -m644 xdelta3.1 $out/share/man/man1/xdelta3.1 + ''; + + meta = with lib; { + description = "Binary differential compression in VCDIFF (RFC 3284) format"; + longDescription = '' + xdelta is a command line program for delta encoding, which generates two + file differences. This is similar to diff and patch, but it is targeted + for binary files and does not generate human readable output. + ''; + homepage = "http://xdelta.org/"; + license = licenses.gpl2Plus; + platforms = platforms.linux; + }; +} diff --git a/nixpkgs/pkgs/tools/compression/xz/default.nix b/nixpkgs/pkgs/tools/compression/xz/default.nix new file mode 100644 index 000000000000..cc021a1ef051 --- /dev/null +++ b/nixpkgs/pkgs/tools/compression/xz/default.nix @@ -0,0 +1,56 @@ +{ lib, stdenv, fetchurl +, enableStatic ? stdenv.hostPlatform.isStatic +}: + +# Note: this package is used for bootstrapping fetchurl, and thus +# cannot use fetchpatch! All mutable patches (generated by GitHub or +# cgit) that are needed here should be included directly in Nixpkgs as +# files. + +stdenv.mkDerivation rec { + name = "xz-5.2.5"; + + src = fetchurl { + url = "https://tukaani.org/xz/${name}.tar.bz2"; + sha256 = "1ps2i8i212n0f4xpq6clp7h13q7m1y8slqvxha9i8d0bj0qgj5si"; + }; + + outputs = [ "bin" "dev" "out" "man" "doc" ]; + + configureFlags = lib.optional enableStatic "--disable-shared"; + + doCheck = true; + + preCheck = '' + # Tests have a /bin/sh dependency... + patchShebangs tests + ''; + + # In stdenv-linux, prevent a dependency on bootstrap-tools. + preConfigure = "CONFIG_SHELL=/bin/sh"; + + postInstall = "rm -rf $out/share/doc"; + + meta = with lib; { + homepage = "https://tukaani.org/xz/"; + description = "A general-purpose data compression software, successor of LZMA"; + + longDescription = + '' XZ Utils is free general-purpose data compression software with high + compression ratio. XZ Utils were written for POSIX-like systems, + but also work on some not-so-POSIX systems. XZ Utils are the + successor to LZMA Utils. + + The core of the XZ Utils compression code is based on LZMA SDK, but + it has been modified quite a lot to be suitable for XZ Utils. The + primary compression algorithm is currently LZMA2, which is used + inside the .xz container format. With typical files, XZ Utils + create 30 % smaller output than gzip and 15 % smaller output than + bzip2. + ''; + + license = with licenses; [ gpl2Plus lgpl21Plus ]; + maintainers = with maintainers; [ sander ]; + platforms = platforms.all; + }; +} diff --git a/nixpkgs/pkgs/tools/compression/zdelta/default.nix b/nixpkgs/pkgs/tools/compression/zdelta/default.nix new file mode 100644 index 000000000000..b30a43f33c13 --- /dev/null +++ b/nixpkgs/pkgs/tools/compression/zdelta/default.nix @@ -0,0 +1,24 @@ +{ lib, stdenv, fetchurl }: + +stdenv.mkDerivation rec { + pname = "zdelta"; + version = "2.1"; + + src = fetchurl { + url = "https://web.archive.org/web/20160316212948/http://cis.poly.edu/zdelta/downloads/zdelta-2.1.tar.gz"; + sha256 = "sha256-WiQKWxJkINIwRBcdiuVLMDiupQ8gOsiXOEZvHDa5iFg="; + }; + + makeFlags = [ "CC=${stdenv.cc.targetPrefix}cc" ]; + + installPhase = '' + mkdir -p $out/bin + cp -p zdc zdu $out/bin + ''; + + meta = with lib; { + homepage = "https://web.archive.org/web/20160316212948/http://cis.poly.edu/zdelta/"; + platforms = platforms.all; + license = licenses.zlib; + }; +} diff --git a/nixpkgs/pkgs/tools/compression/zopfli/default.nix b/nixpkgs/pkgs/tools/compression/zopfli/default.nix new file mode 100644 index 000000000000..753368b70b97 --- /dev/null +++ b/nixpkgs/pkgs/tools/compression/zopfli/default.nix @@ -0,0 +1,39 @@ +{ lib, stdenv, fetchFromGitHub, fetchpatch, cmake }: + +stdenv.mkDerivation rec { + pname = "zopfli"; + version = "1.0.3"; + outputs = [ "out" "lib" "dev" ]; + + src = fetchFromGitHub { + owner = "google"; + repo = "zopfli"; + rev = "${pname}-${version}"; + name = "${pname}-${version}-src"; + sha256 = "0dr8n4j5nj2h9n208jns56wglw59gg4qm3s7c6y3hs75d0nnkhm4"; + }; + + nativeBuildInputs = [ cmake ]; + + cmakeFlags = [ "-DBUILD_SHARED_LIBS=ON" "-DCMAKE_BUILD_WITH_INSTALL_RPATH=ON" ]; + + postInstall = '' + install -Dm444 -t $out/share/doc/zopfli ../README* + cp $src/src/zopfli/*.h $dev/include/ + ''; + + meta = with lib; { + inherit (src.meta) homepage; + description = "Very good, but slow, deflate or zlib compression"; + longDescription = '' + Zopfli Compression Algorithm is a compression library programmed + in C to perform very good, but slow, deflate or zlib compression. + + This library can only compress, not decompress. Existing zlib or + deflate libraries can decompress the data. + ''; + platforms = platforms.unix; + license = licenses.asl20; + maintainers = with maintainers; [ bobvanderlinden edef ]; + }; +} diff --git a/nixpkgs/pkgs/tools/compression/zstd/default.nix b/nixpkgs/pkgs/tools/compression/zstd/default.nix new file mode 100644 index 000000000000..e890518a45a9 --- /dev/null +++ b/nixpkgs/pkgs/tools/compression/zstd/default.nix @@ -0,0 +1,95 @@ +{ lib, stdenv, fetchFromGitHub, cmake, bash, gnugrep +, fixDarwinDylibNames +, file +, legacySupport ? false +, static ? stdenv.hostPlatform.isStatic +}: + +stdenv.mkDerivation rec { + pname = "zstd"; + version = "1.4.9"; + + src = fetchFromGitHub { + owner = "facebook"; + repo = "zstd"; + rev = "v${version}"; + sha256 = "18alxnym54gswsmsr5ra82q4k1q5fyzsyx0jykb2sk2nkpvx7334"; + }; + + nativeBuildInputs = [ cmake ] + ++ lib.optional stdenv.isDarwin fixDarwinDylibNames; + buildInputs = lib.optional stdenv.hostPlatform.isUnix bash; + + patches = [ + # This patches makes sure we do not attempt to use the MD5 implementation + # of the host platform when running the tests + ./playtests-darwin.patch + ]; + + postPatch = lib.optionalString (!static) '' + substituteInPlace build/cmake/CMakeLists.txt \ + --replace 'message(SEND_ERROR "You need to build static library to build tests")' "" + substituteInPlace build/cmake/tests/CMakeLists.txt \ + --replace 'libzstd_static' 'libzstd_shared' + sed -i \ + "1aexport ${lib.optionalString stdenv.isDarwin "DY"}LD_LIBRARY_PATH=$PWD/build_/lib" \ + tests/playTests.sh + ''; + + cmakeFlags = lib.attrsets.mapAttrsToList + (name: value: "-DZSTD_${name}:BOOL=${if value then "ON" else "OFF"}") { + BUILD_SHARED = !static; + BUILD_STATIC = static; + PROGRAMS_LINK_SHARED = !static; + LEGACY_SUPPORT = legacySupport; + BUILD_TESTS = doCheck; + }; + + cmakeDir = "../build/cmake"; + dontUseCmakeBuildDir = true; + preConfigure = '' + mkdir -p build_ && cd $_ + ''; + + checkInputs = [ file ]; + doCheck = stdenv.hostPlatform == stdenv.buildPlatform; + checkPhase = '' + runHook preCheck + # Patch shebangs for playTests + patchShebangs ../programs/zstdgrep + ctest -R playTests # The only relatively fast test. + runHook postCheck + ''; + + preInstall = '' + substituteInPlace ../programs/zstdgrep \ + --replace ":-grep" ":-${gnugrep}/bin/grep" \ + --replace ":-zstdcat" ":-$bin/bin/zstdcat" + + substituteInPlace ../programs/zstdless \ + --replace "zstdcat" "$bin/bin/zstdcat" + ''; + + outputs = [ "bin" "dev" ] + ++ lib.optional stdenv.hostPlatform.isUnix "man" + ++ [ "out" ]; + + meta = with lib; { + description = "Zstandard real-time compression algorithm"; + longDescription = '' + Zstd, short for Zstandard, is a fast lossless compression algorithm, + targeting real-time compression scenarios at zlib-level compression + ratio. Zstd can also offer stronger compression ratio at the cost of + compression speed. Speed/ratio trade-off is configurable by small + increment, to fit different situations. Note however that decompression + speed is preserved and remain roughly the same at all settings, a + property shared by most LZ compression algorithms, such as zlib. + ''; + homepage = "https://facebook.github.io/zstd/"; + changelog = "https://github.com/facebook/zstd/blob/v${version}/CHANGELOG"; + license = with licenses; [ bsd3 ]; # Or, at your opinion, GPL-2.0-only. + + platforms = platforms.all; + maintainers = with maintainers; [ orivej ]; + }; +} diff --git a/nixpkgs/pkgs/tools/compression/zstd/playtests-darwin.patch b/nixpkgs/pkgs/tools/compression/zstd/playtests-darwin.patch new file mode 100644 index 000000000000..f829c93c7059 --- /dev/null +++ b/nixpkgs/pkgs/tools/compression/zstd/playtests-darwin.patch @@ -0,0 +1,28 @@ +--- a/tests/playTests.sh ++++ b/tests/playTests.sh +@@ -112,17 +112,10 @@ case "$OS" in + esac + + case "$UNAME" in +- Darwin) MD5SUM="md5 -r" ;; +- FreeBSD) MD5SUM="gmd5sum" ;; +- NetBSD) MD5SUM="md5 -n" ;; +- OpenBSD) MD5SUM="md5" ;; + *) MD5SUM="md5sum" ;; + esac + + MTIME="stat -c %Y" +-case "$UNAME" in +- Darwin | FreeBSD | OpenBSD | NetBSD) MTIME="stat -f %m" ;; +-esac + + DIFF="diff" + case "$UNAME" in +@@ -842,7 +835,6 @@ $MD5SUM dirTestDict/* > tmph1 + zstd -f --rm dirTestDict/* -D tmpDictC + zstd -d --rm dirTestDict/*.zst -D tmpDictC # note : use internal checksum by default + case "$UNAME" in +- Darwin) println "md5sum -c not supported on OS-X : test skipped" ;; # not compatible with OS-X's md5 + *) $MD5SUM -c tmph1 ;; + esac + rm -rf dirTestDict \ No newline at end of file diff --git a/nixpkgs/pkgs/tools/compression/zsync/default.nix b/nixpkgs/pkgs/tools/compression/zsync/default.nix new file mode 100644 index 000000000000..94921397e303 --- /dev/null +++ b/nixpkgs/pkgs/tools/compression/zsync/default.nix @@ -0,0 +1,20 @@ +{lib, stdenv, fetchurl}: + +stdenv.mkDerivation rec { + name = "zsync-0.6.2"; + + src = fetchurl { + url = "http://zsync.moria.org.uk/download/${name}.tar.bz2"; + sha256 = "1wjslvfy76szf0mgg2i9y9q30858xyjn6v2acc24zal76d1m778b"; + }; + + makeFlags = [ "AR=${stdenv.cc.bintools.targetPrefix}ar" ]; + + meta = { + homepage = "http://zsync.moria.org.uk/"; + description = "File distribution system using the rsync algorithm"; + license = lib.licenses.free; + maintainers = with lib.maintainers; [viric]; + platforms = with lib.platforms; all; + }; +} |