uboot: (firmwareOdroidC2/C4) don't invoke patch tool, use patches = [] instead
https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh#L948 this can do it nicely. Signed-off-by: Anton Arapov <anton@deadbeef.mx>
This commit is contained in:
commit
56de2bcd43
30691 changed files with 3076956 additions and 0 deletions
36
pkgs/tools/compression/advancecomp/default.nix
Normal file
36
pkgs/tools/compression/advancecomp/default.nix
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
{ lib, stdenv
|
||||
, fetchFromGitHub
|
||||
, autoreconfHook
|
||||
, zlib
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "advancecomp";
|
||||
version = "2.3";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "amadvance";
|
||||
repo = "advancecomp";
|
||||
rev = "v${version}";
|
||||
hash = "sha256-klyTqqZs5TwadgDP8LJ1wUhXlO+/kQPM6qhiSki31Q8=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ autoreconfHook ];
|
||||
buildInputs = [ zlib ];
|
||||
|
||||
# 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";
|
||||
|
||||
};
|
||||
}
|
||||
77
pkgs/tools/compression/brotli/default.nix
Normal file
77
pkgs/tools/compression/brotli/default.nix
Normal file
|
|
@ -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; {
|
||||
homepage = "https://github.com/google/brotli";
|
||||
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;
|
||||
};
|
||||
}
|
||||
33
pkgs/tools/compression/bsc/default.nix
Normal file
33
pkgs/tools/compression/bsc/default.nix
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
{ lib, stdenv, fetchFromGitHub, openmp }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "bsc";
|
||||
version = "3.1.0";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "IlyaGrebnov";
|
||||
repo = "libbsc";
|
||||
rev = version;
|
||||
sha256 = "0c0jmirh9y23kyi1jnrm13sa3xsjn54jazfr84ag45pai279fciz";
|
||||
};
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
buildInputs = lib.optional stdenv.isDarwin openmp;
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace makefile \
|
||||
--replace 'g++' '$(CXX)'
|
||||
'';
|
||||
|
||||
makeFlags = [ "PREFIX=$(out)" ];
|
||||
|
||||
meta = with lib; {
|
||||
description = "High performance block-sorting data compression library";
|
||||
homepage = "http://libbsc.com/";
|
||||
maintainers = with maintainers; [ ];
|
||||
# Later commits changed the licence to Apache2 (no release yet, though)
|
||||
license = with licenses; [ lgpl3Plus ];
|
||||
platforms = platforms.unix;
|
||||
};
|
||||
}
|
||||
384
pkgs/tools/compression/bsdiff/CVE-2020-14315.patch
Normal file
384
pkgs/tools/compression/bsdiff/CVE-2020-14315.patch
Normal file
|
|
@ -0,0 +1,384 @@
|
|||
Description: patch for CVE-2020-14315
|
||||
A memory corruption vulnerability is present in bspatch as shipped in
|
||||
Colin Percival’s bsdiff tools version 4.3. Insufficient checks when
|
||||
handling external inputs allows an attacker to bypass the sanity checks
|
||||
in place and write out of a dynamically allocated buffer boundaries.
|
||||
Source: https://svnweb.freebsd.org/base/head/usr.bin/bsdiff/bspatch/bspatch.c?revision=352742&view=co
|
||||
Author: tony mancill <tmancill@debian.org>
|
||||
Comment: The patch was created by comparing the Debian sources to the
|
||||
"Confirmed Patched Version" [1] documented in the
|
||||
X41 D-SEC GmbH Security Advisory: X41-2020-006 [2].
|
||||
References to FreeBSD capsicum have been dropped. Definitions for
|
||||
TYPE_MINIMUM and TYPE_MAXIMUM have been borrowed from the Debian
|
||||
coreutils package sources but originate in gnulib [3] and are used to
|
||||
define OFF_MIN and OFF_MAX (limits of off_t). Whitespace changes from
|
||||
the confirmed patched version are also included and keep the difference
|
||||
between the Debian sources and the confirmed patched version minimal.
|
||||
.
|
||||
[1] https://svnweb.freebsd.org/base/head/usr.bin/bsdiff/bspatch/bspatch.c?revision=352742&view=co
|
||||
[2] https://www.openwall.com/lists/oss-security/2020/07/09/2
|
||||
[3] https://www.gnu.org/software/gnulib/
|
||||
Last-Update: 2021-04-03
|
||||
Forwarded: not-needed
|
||||
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=964796
|
||||
|
||||
--- a/bspatch.c
|
||||
+++ b/bspatch.c
|
||||
@@ -1,4 +1,6 @@
|
||||
/*-
|
||||
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
|
||||
+ *
|
||||
* Copyright 2003-2005 Colin Percival
|
||||
* All rights reserved
|
||||
*
|
||||
@@ -24,56 +26,148 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
+#include <sys/cdefs.h>
|
||||
#if 0
|
||||
-__FBSDID("$FreeBSD: src/usr.bin/bsdiff/bspatch/bspatch.c,v 1.1 2005/08/06 01:59:06 cperciva Exp $");
|
||||
+__FBSDID("$FreeBSD$");
|
||||
#endif
|
||||
|
||||
#include <bzlib.h>
|
||||
-#include <stdlib.h>
|
||||
+#include <err.h>
|
||||
+#include <fcntl.h>
|
||||
+#include <libgen.h>
|
||||
+#include <limits.h>
|
||||
+#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
#include <string.h>
|
||||
-#include <err.h>
|
||||
#include <unistd.h>
|
||||
-#include <fcntl.h>
|
||||
+
|
||||
+#ifndef O_BINARY
|
||||
+#define O_BINARY 0
|
||||
+#endif
|
||||
+#define HEADER_SIZE 32
|
||||
+
|
||||
+/* TYPE_MINIMUM and TYPE_MAXIMUM taken from coreutils */
|
||||
+#ifndef TYPE_MINIMUM
|
||||
+#define TYPE_MINIMUM(t) \
|
||||
+ ((t) ((t) 0 < (t) -1 ? (t) 0 : ~ TYPE_MAXIMUM (t)))
|
||||
+#endif
|
||||
+#ifndef TYPE_MAXIMUM
|
||||
+#define TYPE_MAXIMUM(t) \
|
||||
+ ((t) ((t) 0 < (t) -1 \
|
||||
+ ? (t) -1 \
|
||||
+ : ((((t) 1 << (sizeof (t) * CHAR_BIT - 2)) - 1) * 2 + 1)))
|
||||
+#endif
|
||||
+
|
||||
+#ifndef OFF_MAX
|
||||
+#define OFF_MAX TYPE_MAXIMUM(off_t)
|
||||
+#endif
|
||||
+
|
||||
+#ifndef OFF_MIN
|
||||
+#define OFF_MIN TYPE_MINIMUM(off_t)
|
||||
+#endif
|
||||
+
|
||||
+static char *newfile;
|
||||
+static int dirfd = -1;
|
||||
+
|
||||
+static void
|
||||
+exit_cleanup(void)
|
||||
+{
|
||||
+
|
||||
+ if (dirfd != -1 && newfile != NULL)
|
||||
+ if (unlinkat(dirfd, newfile, 0))
|
||||
+ warn("unlinkat");
|
||||
+}
|
||||
+
|
||||
+static inline off_t
|
||||
+add_off_t(off_t a, off_t b)
|
||||
+{
|
||||
+ off_t result;
|
||||
+
|
||||
+#if __GNUC__ >= 5
|
||||
+ if (__builtin_add_overflow(a, b, &result))
|
||||
+ errx(1, "Corrupt patch");
|
||||
+#else
|
||||
+ if ((b > 0 && a > OFF_MAX - b) || (b < 0 && a < OFF_MIN - b))
|
||||
+ errx(1, "Corrupt patch");
|
||||
+ result = a + b;
|
||||
+#endif
|
||||
+ return result;
|
||||
+}
|
||||
|
||||
static off_t offtin(u_char *buf)
|
||||
{
|
||||
off_t y;
|
||||
|
||||
- y=buf[7]&0x7F;
|
||||
- y=y*256;y+=buf[6];
|
||||
- y=y*256;y+=buf[5];
|
||||
- y=y*256;y+=buf[4];
|
||||
- y=y*256;y+=buf[3];
|
||||
- y=y*256;y+=buf[2];
|
||||
- y=y*256;y+=buf[1];
|
||||
- y=y*256;y+=buf[0];
|
||||
+ y = buf[7] & 0x7F;
|
||||
+ y = y * 256; y += buf[6];
|
||||
+ y = y * 256; y += buf[5];
|
||||
+ y = y * 256; y += buf[4];
|
||||
+ y = y * 256; y += buf[3];
|
||||
+ y = y * 256; y += buf[2];
|
||||
+ y = y * 256; y += buf[1];
|
||||
+ y = y * 256; y += buf[0];
|
||||
|
||||
- if(buf[7]&0x80) y=-y;
|
||||
+ if (buf[7] & 0x80)
|
||||
+ y = -y;
|
||||
|
||||
- return y;
|
||||
+ return (y);
|
||||
}
|
||||
|
||||
-int main(int argc,char * argv[])
|
||||
+static void
|
||||
+usage(void)
|
||||
{
|
||||
- FILE * f, * cpf, * dpf, * epf;
|
||||
- BZFILE * cpfbz2, * dpfbz2, * epfbz2;
|
||||
+
|
||||
+ fprintf(stderr, "usage: bspatch oldfile newfile patchfile\n");
|
||||
+ exit(1);
|
||||
+}
|
||||
+
|
||||
+int main(int argc, char *argv[])
|
||||
+{
|
||||
+ FILE *f, *cpf, *dpf, *epf;
|
||||
+ BZFILE *cpfbz2, *dpfbz2, *epfbz2;
|
||||
+ char *directory, *namebuf;
|
||||
int cbz2err, dbz2err, ebz2err;
|
||||
- int fd;
|
||||
- ssize_t oldsize,newsize;
|
||||
- ssize_t bzctrllen,bzdatalen;
|
||||
- u_char header[32],buf[8];
|
||||
+ int newfd, oldfd;
|
||||
+ off_t oldsize, newsize;
|
||||
+ off_t bzctrllen, bzdatalen;
|
||||
+ u_char header[HEADER_SIZE], buf[8];
|
||||
u_char *old, *new;
|
||||
- off_t oldpos,newpos;
|
||||
+ off_t oldpos, newpos;
|
||||
off_t ctrl[3];
|
||||
- off_t lenread;
|
||||
- off_t i;
|
||||
+ off_t i, lenread, offset;
|
||||
|
||||
- if(argc!=4) errx(1,"usage: %s oldfile newfile patchfile\n",argv[0]);
|
||||
+ if (argc != 4)
|
||||
+ usage();
|
||||
|
||||
/* Open patch file */
|
||||
- if ((f = fopen(argv[3], "r")) == NULL)
|
||||
+ if ((f = fopen(argv[3], "rb")) == NULL)
|
||||
+ err(1, "fopen(%s)", argv[3]);
|
||||
+ /* Open patch file for control block */
|
||||
+ if ((cpf = fopen(argv[3], "rb")) == NULL)
|
||||
+ err(1, "fopen(%s)", argv[3]);
|
||||
+ /* open patch file for diff block */
|
||||
+ if ((dpf = fopen(argv[3], "rb")) == NULL)
|
||||
err(1, "fopen(%s)", argv[3]);
|
||||
+ /* open patch file for extra block */
|
||||
+ if ((epf = fopen(argv[3], "rb")) == NULL)
|
||||
+ err(1, "fopen(%s)", argv[3]);
|
||||
+ /* open oldfile */
|
||||
+ if ((oldfd = open(argv[1], O_RDONLY | O_BINARY, 0)) < 0)
|
||||
+ err(1, "open(%s)", argv[1]);
|
||||
+ /* open directory where we'll write newfile */
|
||||
+ if ((namebuf = strdup(argv[2])) == NULL ||
|
||||
+ (directory = dirname(namebuf)) == NULL ||
|
||||
+ (dirfd = open(directory, O_DIRECTORY)) < 0)
|
||||
+ err(1, "open %s", argv[2]);
|
||||
+ free(namebuf);
|
||||
+ if ((newfile = basename(argv[2])) == NULL)
|
||||
+ err(1, "basename");
|
||||
+ /* open newfile */
|
||||
+ if ((newfd = openat(dirfd, newfile,
|
||||
+ O_CREAT | O_TRUNC | O_WRONLY | O_BINARY, 0666)) < 0)
|
||||
+ err(1, "open(%s)", argv[2]);
|
||||
+ atexit(exit_cleanup);
|
||||
|
||||
/*
|
||||
File format:
|
||||
@@ -90,104 +185,104 @@
|
||||
*/
|
||||
|
||||
/* Read header */
|
||||
- if (fread(header, 1, 32, f) < 32) {
|
||||
+ if (fread(header, 1, HEADER_SIZE, f) < HEADER_SIZE) {
|
||||
if (feof(f))
|
||||
- errx(1, "Corrupt patch\n");
|
||||
+ errx(1, "Corrupt patch");
|
||||
err(1, "fread(%s)", argv[3]);
|
||||
}
|
||||
|
||||
/* Check for appropriate magic */
|
||||
if (memcmp(header, "BSDIFF40", 8) != 0)
|
||||
- errx(1, "Corrupt patch\n");
|
||||
+ errx(1, "Corrupt patch");
|
||||
|
||||
/* Read lengths from header */
|
||||
- bzctrllen=offtin(header+8);
|
||||
- bzdatalen=offtin(header+16);
|
||||
- newsize=offtin(header+24);
|
||||
- if((bzctrllen<0) || (bzdatalen<0) || (newsize<0))
|
||||
- errx(1,"Corrupt patch\n");
|
||||
+ bzctrllen = offtin(header + 8);
|
||||
+ bzdatalen = offtin(header + 16);
|
||||
+ newsize = offtin(header + 24);
|
||||
+ if (bzctrllen < 0 || bzctrllen > OFF_MAX - HEADER_SIZE ||
|
||||
+ bzdatalen < 0 || bzctrllen + HEADER_SIZE > OFF_MAX - bzdatalen ||
|
||||
+ newsize < 0 || newsize > SSIZE_MAX)
|
||||
+ errx(1, "Corrupt patch");
|
||||
|
||||
/* Close patch file and re-open it via libbzip2 at the right places */
|
||||
if (fclose(f))
|
||||
err(1, "fclose(%s)", argv[3]);
|
||||
- if ((cpf = fopen(argv[3], "r")) == NULL)
|
||||
- err(1, "fopen(%s)", argv[3]);
|
||||
- if (fseeko(cpf, 32, SEEK_SET))
|
||||
- err(1, "fseeko(%s, %lld)", argv[3],
|
||||
- (long long)32);
|
||||
+ offset = HEADER_SIZE;
|
||||
+ if (fseeko(cpf, offset, SEEK_SET))
|
||||
+ err(1, "fseeko(%s, %jd)", argv[3], (intmax_t)offset);
|
||||
if ((cpfbz2 = BZ2_bzReadOpen(&cbz2err, cpf, 0, 0, NULL, 0)) == NULL)
|
||||
errx(1, "BZ2_bzReadOpen, bz2err = %d", cbz2err);
|
||||
- if ((dpf = fopen(argv[3], "r")) == NULL)
|
||||
- err(1, "fopen(%s)", argv[3]);
|
||||
- if (fseeko(dpf, 32 + bzctrllen, SEEK_SET))
|
||||
- err(1, "fseeko(%s, %lld)", argv[3],
|
||||
- (long long)(32 + bzctrllen));
|
||||
+ offset = add_off_t(offset, bzctrllen);
|
||||
+ if (fseeko(dpf, offset, SEEK_SET))
|
||||
+ err(1, "fseeko(%s, %jd)", argv[3], (intmax_t)offset);
|
||||
if ((dpfbz2 = BZ2_bzReadOpen(&dbz2err, dpf, 0, 0, NULL, 0)) == NULL)
|
||||
errx(1, "BZ2_bzReadOpen, bz2err = %d", dbz2err);
|
||||
- if ((epf = fopen(argv[3], "r")) == NULL)
|
||||
- err(1, "fopen(%s)", argv[3]);
|
||||
- if (fseeko(epf, 32 + bzctrllen + bzdatalen, SEEK_SET))
|
||||
- err(1, "fseeko(%s, %lld)", argv[3],
|
||||
- (long long)(32 + bzctrllen + bzdatalen));
|
||||
+ offset = add_off_t(offset, bzdatalen);
|
||||
+ if (fseeko(epf, offset, SEEK_SET))
|
||||
+ err(1, "fseeko(%s, %jd)", argv[3], (intmax_t)offset);
|
||||
if ((epfbz2 = BZ2_bzReadOpen(&ebz2err, epf, 0, 0, NULL, 0)) == NULL)
|
||||
errx(1, "BZ2_bzReadOpen, bz2err = %d", ebz2err);
|
||||
|
||||
- if(((fd=open(argv[1],O_RDONLY,0))<0) ||
|
||||
- ((oldsize=lseek(fd,0,SEEK_END))==-1) ||
|
||||
- ((old=malloc(oldsize+1))==NULL) ||
|
||||
- (lseek(fd,0,SEEK_SET)!=0) ||
|
||||
- (read(fd,old,oldsize)!=oldsize) ||
|
||||
- (close(fd)==-1)) err(1,"%s",argv[1]);
|
||||
- if((new=malloc(newsize+1))==NULL) err(1,NULL);
|
||||
-
|
||||
- oldpos=0;newpos=0;
|
||||
- while(newpos<newsize) {
|
||||
+ if ((oldsize = lseek(oldfd, 0, SEEK_END)) == -1 ||
|
||||
+ oldsize > SSIZE_MAX ||
|
||||
+ (old = malloc(oldsize)) == NULL ||
|
||||
+ lseek(oldfd, 0, SEEK_SET) != 0 ||
|
||||
+ read(oldfd, old, oldsize) != oldsize ||
|
||||
+ close(oldfd) == -1)
|
||||
+ err(1, "%s", argv[1]);
|
||||
+ if ((new = malloc(newsize)) == NULL)
|
||||
+ err(1, NULL);
|
||||
+
|
||||
+ oldpos = 0;
|
||||
+ newpos = 0;
|
||||
+ while (newpos < newsize) {
|
||||
/* Read control data */
|
||||
- for(i=0;i<=2;i++) {
|
||||
+ for (i = 0; i <= 2; i++) {
|
||||
lenread = BZ2_bzRead(&cbz2err, cpfbz2, buf, 8);
|
||||
if ((lenread < 8) || ((cbz2err != BZ_OK) &&
|
||||
(cbz2err != BZ_STREAM_END)))
|
||||
- errx(1, "Corrupt patch\n");
|
||||
- ctrl[i]=offtin(buf);
|
||||
- };
|
||||
+ errx(1, "Corrupt patch");
|
||||
+ ctrl[i] = offtin(buf);
|
||||
+ }
|
||||
|
||||
/* Sanity-check */
|
||||
- if ((ctrl[0] < 0) || (ctrl[1] < 0))
|
||||
- errx(1,"Corrupt patch\n");
|
||||
+ if (ctrl[0] < 0 || ctrl[0] > INT_MAX ||
|
||||
+ ctrl[1] < 0 || ctrl[1] > INT_MAX)
|
||||
+ errx(1, "Corrupt patch");
|
||||
|
||||
/* Sanity-check */
|
||||
- if(newpos+ctrl[0]>newsize)
|
||||
- errx(1,"Corrupt patch\n");
|
||||
+ if (add_off_t(newpos, ctrl[0]) > newsize)
|
||||
+ errx(1, "Corrupt patch");
|
||||
|
||||
/* Read diff string */
|
||||
lenread = BZ2_bzRead(&dbz2err, dpfbz2, new + newpos, ctrl[0]);
|
||||
if ((lenread < ctrl[0]) ||
|
||||
((dbz2err != BZ_OK) && (dbz2err != BZ_STREAM_END)))
|
||||
- errx(1, "Corrupt patch\n");
|
||||
+ errx(1, "Corrupt patch");
|
||||
|
||||
/* Add old data to diff string */
|
||||
- for(i=0;i<ctrl[0];i++)
|
||||
- if((oldpos+i>=0) && (oldpos+i<oldsize))
|
||||
- new[newpos+i]+=old[oldpos+i];
|
||||
+ for (i = 0; i < ctrl[0]; i++)
|
||||
+ if (add_off_t(oldpos, i) < oldsize)
|
||||
+ new[newpos + i] += old[oldpos + i];
|
||||
|
||||
/* Adjust pointers */
|
||||
- newpos+=ctrl[0];
|
||||
- oldpos+=ctrl[0];
|
||||
+ newpos = add_off_t(newpos, ctrl[0]);
|
||||
+ oldpos = add_off_t(oldpos, ctrl[0]);
|
||||
|
||||
/* Sanity-check */
|
||||
- if(newpos+ctrl[1]>newsize)
|
||||
- errx(1,"Corrupt patch\n");
|
||||
+ if (add_off_t(newpos, ctrl[1]) > newsize)
|
||||
+ errx(1, "Corrupt patch");
|
||||
|
||||
/* Read extra string */
|
||||
lenread = BZ2_bzRead(&ebz2err, epfbz2, new + newpos, ctrl[1]);
|
||||
if ((lenread < ctrl[1]) ||
|
||||
((ebz2err != BZ_OK) && (ebz2err != BZ_STREAM_END)))
|
||||
- errx(1, "Corrupt patch\n");
|
||||
+ errx(1, "Corrupt patch");
|
||||
|
||||
/* Adjust pointers */
|
||||
- newpos+=ctrl[1];
|
||||
- oldpos+=ctrl[2];
|
||||
- };
|
||||
+ newpos = add_off_t(newpos, ctrl[1]);
|
||||
+ oldpos = add_off_t(oldpos, ctrl[2]);
|
||||
+ }
|
||||
|
||||
/* Clean up the bzip2 reads */
|
||||
BZ2_bzReadClose(&cbz2err, cpfbz2);
|
||||
@@ -197,12 +292,13 @@
|
||||
err(1, "fclose(%s)", argv[3]);
|
||||
|
||||
/* Write the new file */
|
||||
- if(((fd=open(argv[2],O_CREAT|O_TRUNC|O_WRONLY,0666))<0) ||
|
||||
- (write(fd,new,newsize)!=newsize) || (close(fd)==-1))
|
||||
- err(1,"%s",argv[2]);
|
||||
+ if (write(newfd, new, newsize) != newsize || close(newfd) == -1)
|
||||
+ err(1, "%s", argv[2]);
|
||||
+ /* Disable atexit cleanup */
|
||||
+ newfile = NULL;
|
||||
|
||||
free(new);
|
||||
free(old);
|
||||
|
||||
- return 0;
|
||||
+ return (0);
|
||||
}
|
||||
57
pkgs/tools/compression/bsdiff/default.nix
Normal file
57
pkgs/tools/compression/bsdiff/default.nix
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
{ lib, stdenv, fetchurl, fetchpatch, 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 = [
|
||||
(fetchpatch {
|
||||
url = "https://sources.debian.org/data/main/b/bsdiff/4.3-22/debian/patches/20-CVE-2014-9862.patch";
|
||||
sha256 = "sha256-3UuUfNvShQ8fLqxCKUTb/n4BmjL4+Nl7aEqCxYrrERQ=";
|
||||
})
|
||||
./CVE-2020-14315.patch
|
||||
./include-systypes.patch
|
||||
] ++ lib.optional stdenv.hostPlatform.isLinux [
|
||||
(fetchpatch {
|
||||
url = "https://sources.debian.org/data/main/b/bsdiff/4.3-22/debian/patches/30-bug-632585-mmap-src-file-instead-of-malloc-read-it.patch";
|
||||
sha256 = "sha256-esbhz2/efUiuQDuF7LGfSeEn3/f1WbqCxQpTs2A0ulI=";
|
||||
})
|
||||
(fetchpatch {
|
||||
url = "https://sources.debian.org/data/main/b/bsdiff/4.3-22/debian/patches/31-bug-632585-mmap-dst-file-instead-of-malloc-read-it.patch";
|
||||
sha256 = "sha256-Of4aOcI0rsgdRzPqyw2VRn2p9wQuo3hdlgDTBdXGzoc=";
|
||||
})
|
||||
(fetchpatch {
|
||||
url = "https://sources.debian.org/data/main/b/bsdiff/4.3-22/debian/patches/32-bug-632585-use-int32_t-instead-off_t-for-file-size.patch";
|
||||
sha256 = "sha256-SooFnFK4uKNXvXQb/LEcH8GocnRtkryExI4b3BZTsAY=";
|
||||
})
|
||||
];
|
||||
|
||||
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 = with lib; {
|
||||
description = "An efficient binary diff/patch tool";
|
||||
homepage = "https://www.daemonology.net/bsdiff/";
|
||||
license = licenses.bsd2;
|
||||
platforms = platforms.unix;
|
||||
maintainers = [ maintainers.thoughtpolice ];
|
||||
};
|
||||
}
|
||||
12
pkgs/tools/compression/bsdiff/include-systypes.patch
Normal file
12
pkgs/tools/compression/bsdiff/include-systypes.patch
Normal file
|
|
@ -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>
|
||||
43
pkgs/tools/compression/bzip2/1_1.nix
Normal file
43
pkgs/tools/compression/bzip2/1_1.nix
Normal file
|
|
@ -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 = [];
|
||||
};
|
||||
}
|
||||
12
pkgs/tools/compression/bzip2/CVE-2016-3189.patch
Normal file
12
pkgs/tools/compression/bzip2/CVE-2016-3189.patch
Normal file
|
|
@ -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++;
|
||||
13
pkgs/tools/compression/bzip2/cve-2019-12900.patch
Normal file
13
pkgs/tools/compression/bzip2/cve-2019-12900.patch
Normal file
|
|
@ -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) {
|
||||
60
pkgs/tools/compression/bzip2/default.nix
Normal file
60
pkgs/tools/compression/bzip2/default.nix
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
{ 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=";
|
||||
};
|
||||
|
||||
strictDeps = true;
|
||||
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;
|
||||
|
||||
postInstall = ''
|
||||
ln -s $out/lib/libbz2.so.1.0.* $out/lib/libbz2.so.1.0
|
||||
'';
|
||||
|
||||
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 ];
|
||||
};
|
||||
}
|
||||
41
pkgs/tools/compression/bzip3/default.nix
Normal file
41
pkgs/tools/compression/bzip3/default.nix
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
{ lib
|
||||
, stdenv
|
||||
, fetchFromGitHub
|
||||
, autoreconfHook
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "bzip3";
|
||||
version = "1.1.3";
|
||||
|
||||
outputs = [ "bin" "dev" "out" ];
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "kspalaiologos";
|
||||
repo = "bzip3";
|
||||
rev = version;
|
||||
hash = "sha256-puGtaL76p4BzSiTPf3qFgXN4pz90CDU9dziGIszk3to=";
|
||||
};
|
||||
|
||||
postPatch = ''
|
||||
echo -n "${version}" > .tarball-version
|
||||
patchShebangs build-aux
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [
|
||||
autoreconfHook
|
||||
];
|
||||
|
||||
configureFlags = [
|
||||
"--disable-arch-native"
|
||||
] ++ lib.optionals stdenv.isDarwin [ "--disable-link-time-optimization" ];
|
||||
|
||||
meta = {
|
||||
description = "A better and stronger spiritual successor to BZip2";
|
||||
homepage = "https://github.com/kspalaiologos/bzip3";
|
||||
changelog = "https://github.com/kspalaiologos/bzip3/blob/${src.rev}/NEWS";
|
||||
license = lib.licenses.lgpl3Plus;
|
||||
maintainers = with lib.maintainers; [ dotlambda ];
|
||||
platforms = lib.platforms.unix;
|
||||
};
|
||||
}
|
||||
48
pkgs/tools/compression/crabz/default.nix
Normal file
48
pkgs/tools/compression/crabz/default.nix
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
{ lib
|
||||
, rustPlatform
|
||||
, fetchFromGitHub
|
||||
, cmake
|
||||
, stdenv
|
||||
, libiconv
|
||||
, CoreFoundation
|
||||
, Security
|
||||
}:
|
||||
|
||||
rustPlatform.buildRustPackage rec {
|
||||
pname = "crabz";
|
||||
version = "0.7.2";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "sstadick";
|
||||
repo = pname;
|
||||
rev = "v${version}";
|
||||
sha256 = "0ch9cqarsakihg9ymbdm0ka6wz77z84n4g6cdlcskczc5g3b9gp9";
|
||||
};
|
||||
|
||||
cargoSha256 = "sha256-nrCYlhq/f8gk3NmltAg+xppRJ533ooEpetWvaF2vmP0=";
|
||||
|
||||
nativeBuildInputs = [ cmake ];
|
||||
|
||||
buildInputs = lib.optionals stdenv.isDarwin [
|
||||
libiconv
|
||||
CoreFoundation
|
||||
Security
|
||||
];
|
||||
|
||||
# link System as a dylib instead of a framework on macos
|
||||
postPatch = lib.optionalString stdenv.isDarwin ''
|
||||
core_affinity=../$(stripHash $cargoDeps)/core_affinity
|
||||
oldHash=$(sha256sum $core_affinity/src/lib.rs | cut -d " " -f 1)
|
||||
substituteInPlace $core_affinity/src/lib.rs --replace framework dylib
|
||||
substituteInPlace $core_affinity/.cargo-checksum.json \
|
||||
--replace $oldHash $(sha256sum $core_affinity/src/lib.rs | cut -d " " -f 1)
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "A cross platform, fast, compression and decompression tool";
|
||||
homepage = "https://github.com/sstadick/crabz";
|
||||
changelog = "https://github.com/sstadick/crabz/blob/v${version}/CHANGELOG.md";
|
||||
license = with licenses; [ unlicense /* or */ mit ];
|
||||
maintainers = with maintainers; [ figsoda ];
|
||||
};
|
||||
}
|
||||
30
pkgs/tools/compression/dejsonlz4/default.nix
Normal file
30
pkgs/tools/compression/dejsonlz4/default.nix
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
{ 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;
|
||||
};
|
||||
}
|
||||
52
pkgs/tools/compression/dtrx/default.nix
Normal file
52
pkgs/tools/compression/dtrx/default.nix
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
{ lib
|
||||
, fetchFromGitHub
|
||||
, python3Packages
|
||||
, gnutar
|
||||
, unzip
|
||||
, lhasa
|
||||
, rpm
|
||||
, binutils
|
||||
, cpio
|
||||
, gzip
|
||||
, p7zip
|
||||
, cabextract
|
||||
, unrar
|
||||
, unshield
|
||||
, bzip2
|
||||
, xz
|
||||
, lzip
|
||||
, unzipSupport ? false
|
||||
, unrarSupport ? false
|
||||
}:
|
||||
|
||||
python3Packages.buildPythonApplication rec {
|
||||
pname = "dtrx";
|
||||
version = "8.2.2";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "dtrx-py";
|
||||
repo = "dtrx";
|
||||
rev = version;
|
||||
sha256 = "sha256-thtBVGgKRYHOAFuxDvuFxcIHoyYAI58AiNCx4vuVXGs=";
|
||||
};
|
||||
|
||||
postInstall =
|
||||
let
|
||||
archivers = lib.makeBinPath (
|
||||
[ gnutar lhasa rpm binutils cpio gzip p7zip cabextract unshield bzip2 xz lzip ]
|
||||
++ lib.optional (unzipSupport) unzip
|
||||
++ lib.optional (unrarSupport) unrar
|
||||
);
|
||||
in ''
|
||||
wrapProgram "$out/bin/dtrx" --prefix PATH : "${archivers}"
|
||||
'';
|
||||
|
||||
buildInputs = [ python3Packages.twine ];
|
||||
|
||||
meta = with lib; {
|
||||
description = "Do The Right Extraction: A tool for taking the hassle out of extracting archives";
|
||||
homepage = "https://github.com/dtrx-py/dtrx";
|
||||
license = licenses.gpl3Plus;
|
||||
maintainers = [ maintainers.spwhitt ];
|
||||
};
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
{ lib
|
||||
, stdenv
|
||||
, fetchFromGitHub
|
||||
, boost
|
||||
, cmake
|
||||
, nasm
|
||||
, libpng
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "efficient-compression-tool";
|
||||
version = "0.9.1";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "fhanau";
|
||||
repo = "Efficient-Compression-Tool";
|
||||
rev = "v${version}";
|
||||
sha256 = "sha256-TSV5QXf6GuHAwQrde3Zo9MA1rtpAhtRg0UTzMkBnHB8=";
|
||||
fetchSubmodules = true;
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ cmake nasm ];
|
||||
|
||||
patches = [ ./use-nixpkgs-libpng.patch ];
|
||||
|
||||
buildInputs = [ boost libpng ];
|
||||
|
||||
cmakeDir = "../src";
|
||||
|
||||
cmakeFlags = [ "-DECT_FOLDER_SUPPORT=ON" ];
|
||||
|
||||
meta = with lib; {
|
||||
description = "Fast and effective C++ file optimizer";
|
||||
homepage = "https://github.com/fhanau/Efficient-Compression-Tool";
|
||||
license = licenses.asl20;
|
||||
maintainers = [ maintainers.lunik1 ];
|
||||
platforms = platforms.linux;
|
||||
};
|
||||
}
|
||||
|
|
@ -0,0 +1,108 @@
|
|||
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
|
||||
index d18843c..a9df1fb 100644
|
||||
--- a/src/CMakeLists.txt
|
||||
+++ b/src/CMakeLists.txt
|
||||
@@ -8,11 +8,6 @@ if(NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE Release)
|
||||
endif()
|
||||
|
||||
-# Check that submodules are present only if source was downloaded with git
|
||||
-if(EXISTS "${CMAKE_SOURCE_DIR}/../.git" AND NOT EXISTS "${CMAKE_SOURCE_DIR}/../src/libpng/README")
|
||||
- message (FATAL_ERROR "Submodules are not initialized. Run \n\tgit submodule update --init --recursive\n within the repository")
|
||||
-endif()
|
||||
-
|
||||
add_executable(ect
|
||||
main.cpp
|
||||
gztools.cpp
|
||||
@@ -56,7 +51,6 @@ add_subdirectory(lodepng EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(miniz EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(zlib EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(zopfli EXCLUDE_FROM_ALL)
|
||||
-file(COPY ${CMAKE_SOURCE_DIR}/pngusr.h DESTINATION ${CMAKE_SOURCE_DIR}/libpng/)
|
||||
add_subdirectory(optipng EXCLUDE_FROM_ALL)
|
||||
# Mozjpeg changes the install prefix if it thinks the current is defaulted
|
||||
set(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT FALSE)
|
||||
diff --git a/src/Makefile b/src/Makefile
|
||||
index cc24367..7aa9f0a 100755
|
||||
--- a/src/Makefile
|
||||
+++ b/src/Makefile
|
||||
@@ -18,7 +18,7 @@ CXXSRC = support.cpp zopflipng.cpp zopfli/deflate.cpp zopfli/zopfli_gzip.cpp zop
|
||||
lodepng/lodepng.cpp lodepng/lodepng_util.cpp optipng/codec.cpp optipng/optipng.cpp jpegtran.cpp gztools.cpp \
|
||||
leanify/zip.cpp leanify/leanify.cpp
|
||||
|
||||
-.PHONY: libpng mozjpeg deps bin all install
|
||||
+.PHONY: mozjpeg deps bin all install
|
||||
all: deps bin
|
||||
|
||||
bin: deps
|
||||
@@ -33,9 +33,6 @@ libz.a:
|
||||
cd zlib/; \
|
||||
$(CC) $(UCFLAGS) -c adler32.c crc32.c deflate.c inffast.c inflate.c inftrees.c trees.c zutil.c gzlib.c gzread.c; \
|
||||
ar rcs ../libz.a adler32.o crc32.o deflate.o inffast.o inflate.o inftrees.o trees.o zutil.o gzlib.o gzread.o
|
||||
-libpng:
|
||||
- cp pngusr.h libpng/pngusr.h
|
||||
- make -C libpng/ -f scripts/makefile.linux-opt CC="$(CC)" CFLAGS="$(UCFLAGS) -DPNG_USER_CONFIG -Wno-macro-redefined" libpng.a
|
||||
mozjpeg:
|
||||
cd mozjpeg/; \
|
||||
export CC="$(CC)"; \
|
||||
diff --git a/src/optipng/CMakeLists.txt b/src/optipng/CMakeLists.txt
|
||||
index 1037a20..3c751e9 100644
|
||||
--- a/src/optipng/CMakeLists.txt
|
||||
+++ b/src/optipng/CMakeLists.txt
|
||||
@@ -16,16 +16,14 @@ add_library(optipng
|
||||
add_library(optipng::optipng ALIAS optipng)
|
||||
|
||||
#make sure that we are using custom zlib and custom libpng options
|
||||
-set(PNG_BUILD_ZLIB ON CACHE BOOL "use custom zlib within libpng" FORCE)
|
||||
set(ZLIB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../zlib/ CACHE FILEPATH "custom zlib directory" FORCE)
|
||||
if(NOT WIN32)
|
||||
add_compile_options(-Wno-macro-redefined)
|
||||
endif()
|
||||
add_compile_definitions(PNG_USER_CONFIG)
|
||||
|
||||
-add_subdirectory(../libpng libpng EXCLUDE_FROM_ALL)
|
||||
target_link_libraries(optipng
|
||||
- png_static)
|
||||
+ png)
|
||||
|
||||
# libpng generates some header files that we need to be able to include
|
||||
target_include_directories(optipng
|
||||
diff --git a/src/optipng/image.h b/src/optipng/image.h
|
||||
index c439f84..8255fa0 100755
|
||||
--- a/src/optipng/image.h
|
||||
+++ b/src/optipng/image.h
|
||||
@@ -13,7 +13,7 @@
|
||||
#ifndef OPNGCORE_IMAGE_H
|
||||
#define OPNGCORE_IMAGE_H
|
||||
|
||||
-#include "../libpng/png.h"
|
||||
+#include <png.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
diff --git a/src/optipng/opngreduc/opngreduc.h b/src/optipng/opngreduc/opngreduc.h
|
||||
index a7e6553..06ef956 100755
|
||||
--- a/src/optipng/opngreduc/opngreduc.h
|
||||
+++ b/src/optipng/opngreduc/opngreduc.h
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
-#include "../../libpng/png.h"
|
||||
+#include <png.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
diff --git a/src/optipng/trans.h b/src/optipng/trans.h
|
||||
index a2f7f3e..c0e8dc4 100755
|
||||
--- a/src/optipng/trans.h
|
||||
+++ b/src/optipng/trans.h
|
||||
@@ -13,7 +13,7 @@
|
||||
#ifndef OPNGTRANS_TRANS_H
|
||||
#define OPNGTRANS_TRANS_H
|
||||
|
||||
-#include "../libpng/png.h"
|
||||
+#include <png.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
31
pkgs/tools/compression/flips/default.nix
Normal file
31
pkgs/tools/compression/flips/default.nix
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
{ lib, stdenv, fetchFromGitHub, gtk3, libdivsufsort, pkg-config, wrapGAppsHook }:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
pname = "flips";
|
||||
version = "unstable-2021-10-28";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "Alcaro";
|
||||
repo = "Flips";
|
||||
rev = "3a8733e74c9bdbb6b89da2b45913a0be3d0e1866";
|
||||
sha256 = "1jik580mz2spik5mgh60h93ryaj5x8dffncnr1lwija0v803xld7";
|
||||
};
|
||||
|
||||
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;
|
||||
};
|
||||
}
|
||||
15
pkgs/tools/compression/flips/use-system-libdivsufsort.patch
Normal file
15
pkgs/tools/compression/flips/use-system-libdivsufsort.patch
Normal file
|
|
@ -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
|
||||
64
pkgs/tools/compression/gzip/default.nix
Normal file
64
pkgs/tools/compression/gzip/default.nix
Normal file
|
|
@ -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.12";
|
||||
|
||||
src = fetchurl {
|
||||
url = "mirror://gnu/gzip/${pname}-${version}.tar.xz";
|
||||
sha256 = "sha256-zl4D5Rn2N+H4FAEazjXE+HszwLur7sNbr1+9NHnpGVY=";
|
||||
};
|
||||
|
||||
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;
|
||||
};
|
||||
}
|
||||
27
pkgs/tools/compression/gzrt/default.nix
Normal file
27
pkgs/tools/compression/gzrt/default.nix
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
{ lib, stdenv, fetchurl, zlib }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "gzrt";
|
||||
version = "0.8";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://www.urbanophile.com/arenn/coding/gzrt/gzrt-${version}.tar.gz";
|
||||
sha256 = "1vhzazj47xfpbfhzkwalz27cc0n5gazddmj3kynhk0yxv99xrdxh";
|
||||
};
|
||||
|
||||
buildInputs = [ zlib ];
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
cp gzrecover $out/bin
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
homepage = "https://www.urbanophile.com/arenn/hacking/gzrt/";
|
||||
description = "The gzip Recovery Toolkit";
|
||||
maintainers = with maintainers; [ ];
|
||||
mainProgram = "gzrecover";
|
||||
license = licenses.gpl2Plus;
|
||||
platforms = platforms.unix;
|
||||
};
|
||||
}
|
||||
33
pkgs/tools/compression/hacpack/default.nix
Normal file
33
pkgs/tools/compression/hacpack/default.nix
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
{ 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
|
||||
'';
|
||||
|
||||
makeFlags = [ "CC=${stdenv.cc.targetPrefix}cc" ];
|
||||
enableParallelBuilding = true;
|
||||
|
||||
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;
|
||||
};
|
||||
}
|
||||
35
pkgs/tools/compression/hactool/default.nix
Normal file
35
pkgs/tools/compression/hactool/default.nix
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
{ lib, stdenv, fetchFromGitHub }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "hactool";
|
||||
version = "1.4.0";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "SciresM";
|
||||
repo = "hactool";
|
||||
rev = version;
|
||||
sha256 = "0305ngsnwm8npzgyhyifasi4l802xnfz19r0kbzzniirmcn4082d";
|
||||
};
|
||||
|
||||
patches = [ ./musl-compat.patch ];
|
||||
|
||||
preBuild = ''
|
||||
mv config.mk.template config.mk
|
||||
'';
|
||||
|
||||
makeFlags = [ "CC=${stdenv.cc.targetPrefix}cc" ];
|
||||
enableParallelBuilding = true;
|
||||
|
||||
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;
|
||||
};
|
||||
}
|
||||
13
pkgs/tools/compression/hactool/musl-compat.patch
Normal file
13
pkgs/tools/compression/hactool/musl-compat.patch
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
diff --git a/main.c b/main.c
|
||||
index 07f53cb..f2265df 100644
|
||||
--- a/main.c
|
||||
+++ b/main.c
|
||||
@@ -369,7 +369,7 @@ int main(int argc, char **argv) {
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
nca_ctx.tool_ctx->base_file_type = BASEFILE_FAKE;
|
||||
- nca_ctx.tool_ctx->base_file++; /* Guarantees base_file != NULL. I'm so sorry. */
|
||||
+ if (!nca_ctx.tool_ctx->base_file) nca_ctx.tool_ctx->base_file = (FILE*) 1;
|
||||
break;
|
||||
case 32:
|
||||
tool_ctx.action |= ACTION_ONLYUPDATEDROMFS;
|
||||
37
pkgs/tools/compression/imagelol/default.nix
Normal file
37
pkgs/tools/compression/imagelol/default.nix
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
{ 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;
|
||||
};
|
||||
|
||||
# fix for case-sensitive filesystems
|
||||
# https://github.com/MCredstoner2004/ImageLOL/issues/1
|
||||
postPatch = ''
|
||||
mv imagelol src
|
||||
substituteInPlace CMakeLists.txt \
|
||||
--replace 'add_subdirectory("imagelol")' 'add_subdirectory("src")'
|
||||
'';
|
||||
|
||||
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;
|
||||
};
|
||||
}
|
||||
26
pkgs/tools/compression/kzipmix/default.nix
Normal file
26
pkgs/tools/compression/kzipmix/default.nix
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
{ lib, stdenv, fetchurl }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "kzipmix";
|
||||
version = "20200115";
|
||||
|
||||
src = fetchurl {
|
||||
url = "http://static.jonof.id.au/dl/kenutils/kzipmix-${version}-linux.tar.gz";
|
||||
sha256 = "sha256-ePgye0D6/ED53zx6xffLnYhkjed7SPU4BLOZQr9E3yA=";
|
||||
};
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
cp amd64/{kzip,zipmix} $out/bin
|
||||
|
||||
patchelf --set-interpreter ${stdenv.cc.libc}/lib/ld-linux.so.2 $out/bin/kzip
|
||||
patchelf --set-interpreter ${stdenv.cc.libc}/lib/ld-linux.so.2 $out/bin/zipmix
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "A tool that aggressively optimizes the sizes of Zip archives";
|
||||
license = licenses.unfree;
|
||||
homepage = "http://advsys.net/ken/utils.htm";
|
||||
maintainers = [ maintainers.sander ];
|
||||
};
|
||||
}
|
||||
29
pkgs/tools/compression/lbzip2/default.nix
Normal file
29
pkgs/tools/compression/lbzip2/default.nix
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
{ lib, stdenv, fetchFromGitHub, gnulib, perl, autoconf, automake }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "lbzip2";
|
||||
version = "2.5";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "kjn";
|
||||
repo = "lbzip2";
|
||||
rev = "v${version}";
|
||||
sha256 = "1h321wva6fp6khz6x0i6rqb76xh327nw6v5jhgjpcckwdarj5jv8";
|
||||
};
|
||||
|
||||
buildInputs = [ gnulib perl ];
|
||||
nativeBuildInputs = [ autoconf automake ];
|
||||
|
||||
preConfigure = ''
|
||||
substituteInPlace configure.ac --replace 'AC_PREREQ([2.63])' 'AC_PREREQ(2.64)'
|
||||
./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;
|
||||
};
|
||||
}
|
||||
25
pkgs/tools/compression/lhasa/default.nix
Normal file
25
pkgs/tools/compression/lhasa/default.nix
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
{ lib, stdenv, fetchurl }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "lhasa";
|
||||
version = "0.3.1";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://soulsphere.org/projects/lhasa/lhasa-${version}.tar.gz";
|
||||
sha256 = "092zi9av18ma20c6h9448k0bapvx2plnp292741dvfd9hmgqxc1z";
|
||||
};
|
||||
|
||||
meta = with lib; {
|
||||
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 = licenses.isc;
|
||||
homepage = "http://fragglet.github.io/lhasa";
|
||||
maintainers = [ maintainers.sander ];
|
||||
mainProgram = "lha";
|
||||
platforms = platforms.unix;
|
||||
};
|
||||
}
|
||||
41
pkgs/tools/compression/lrzip/default.nix
Normal file
41
pkgs/tools/compression/lrzip/default.nix
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
{ lib, stdenv, fetchFromGitHub, autoreconfHook, zlib, lzo, bzip2, lz4, nasm, perl }:
|
||||
|
||||
let
|
||||
inherit (stdenv.hostPlatform) isx86;
|
||||
in
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "lrzip";
|
||||
version = "0.651";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "ckolivas";
|
||||
repo = pname;
|
||||
rev = "v${version}";
|
||||
sha256 = "sha256-Mb324ojtLV0S10KhL7Vjf3DhSOtCy1pFMTzvLkTnpXM=";
|
||||
};
|
||||
|
||||
postPatch = lib.optionalString stdenv.isDarwin ''
|
||||
# Building the ASM/x86 directory creates an empty archive,
|
||||
# which fails on darwin, so remove it
|
||||
# https://github.com/ckolivas/lrzip/issues/193
|
||||
# https://github.com/Homebrew/homebrew-core/pull/85360
|
||||
substituteInPlace lzma/Makefile.am --replace "SUBDIRS = C ASM/x86" "SUBDIRS = C"
|
||||
substituteInPlace configure.ac --replace "-f elf64" "-f macho64"
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [ autoreconfHook perl ] ++ lib.optionals isx86 [ nasm ];
|
||||
|
||||
buildInputs = [ zlib lzo bzip2 lz4 ];
|
||||
|
||||
configureFlags = lib.optionals (!isx86) [
|
||||
"--disable-asm"
|
||||
];
|
||||
|
||||
meta = with lib; {
|
||||
homepage = "http://ck.kolivas.org/apps/lrzip/";
|
||||
description = "The CK LRZIP compression program (LZMA + RZIP)";
|
||||
maintainers = with maintainers; [ ];
|
||||
license = licenses.gpl2Plus;
|
||||
platforms = platforms.unix;
|
||||
};
|
||||
}
|
||||
74
pkgs/tools/compression/lz4/default.nix
Normal file
74
pkgs/tools/compression/lz4/default.nix
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
{ 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;
|
||||
};
|
||||
|
||||
patches = [
|
||||
(fetchpatch { # https://github.com/lz4/lz4/pull/972
|
||||
name = "CVE-2021-3520.patch";
|
||||
url = "https://github.com/lz4/lz4/commit/8301a21773ef61656225e264f4f06ae14462bca7.patch";
|
||||
sha256 = "0r1cwpqdkdc8im0pf2r5jp7mwwn69xcw405rrk7rc0mpjcp5ydfk";
|
||||
})
|
||||
(fetchpatch { # https://github.com/lz4/lz4/pull/973
|
||||
name = "avoid-null-pointer-dereference.patch";
|
||||
url = "https://github.com/lz4/lz4/commit/29a6a1f4941e7243241fe00d6c13b749fd6b60c2.patch";
|
||||
sha256 = "0v5yl5hd3qrfm3xm7m06j4b21qwllb4cqkjn2az7x1vnzqgpf8y7";
|
||||
})
|
||||
];
|
||||
|
||||
# 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;
|
||||
};
|
||||
}
|
||||
27
pkgs/tools/compression/lzbench/default.nix
Normal file
27
pkgs/tools/compression/lzbench/default.nix
Normal file
|
|
@ -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;
|
||||
};
|
||||
}
|
||||
28
pkgs/tools/compression/lzfse/default.nix
Normal file
28
pkgs/tools/compression/lzfse/default.nix
Normal file
|
|
@ -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; [ ];
|
||||
};
|
||||
}
|
||||
27
pkgs/tools/compression/lzham/default.nix
Normal file
27
pkgs/tools/compression/lzham/default.nix
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
{ lib, stdenv, fetchFromGitHub, cmake } :
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "lzham";
|
||||
version = "1.0";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "richgel999";
|
||||
repo = "lzham_codec";
|
||||
rev = "v${lib.replaceStrings ["."] ["_"] version}_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;
|
||||
};
|
||||
}
|
||||
39
pkgs/tools/compression/lzip/default.nix
Normal file
39
pkgs/tools/compression/lzip/default.nix
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
{ 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.23";
|
||||
outputs = [ "out" "man" "info" ];
|
||||
|
||||
nativeBuildInputs = [ texinfo ];
|
||||
|
||||
src = fetchurl {
|
||||
url = "mirror://savannah/lzip/${pname}-${version}.tar.gz";
|
||||
sha256 = "sha256-R5LAR93xXvKdVbqOaKGiHgy3aS2H7N9yBEGYZFgvKA0=";
|
||||
};
|
||||
|
||||
configureFlags = [
|
||||
"CPPFLAGS=-DNDEBUG"
|
||||
"CFLAGS=-O3"
|
||||
"CXXFLAGS=-O3"
|
||||
"CXX=${stdenv.cc.targetPrefix}c++"
|
||||
];
|
||||
|
||||
setupHook = ./lzip-setup-hook.sh;
|
||||
|
||||
doCheck = true;
|
||||
enableParallelBuilding = true;
|
||||
|
||||
meta = with lib; {
|
||||
homepage = "https://www.nongnu.org/lzip/lzip.html";
|
||||
description = "A lossless data compressor based on the LZMA algorithm";
|
||||
license = lib.licenses.gpl2Plus;
|
||||
maintainers = with maintainers; [ vlaci ];
|
||||
platforms = lib.platforms.all;
|
||||
};
|
||||
}
|
||||
5
pkgs/tools/compression/lzip/lzip-setup-hook.sh
Normal file
5
pkgs/tools/compression/lzip/lzip-setup-hook.sh
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
lzipUnpackCmdHook() {
|
||||
[[ "$1" = *.tar.lz ]] && tar --lzip -xf "$1"
|
||||
}
|
||||
|
||||
unpackCmdHooks+=(lzipUnpackCmdHook)
|
||||
31
pkgs/tools/compression/lziprecover/default.nix
Normal file
31
pkgs/tools/compression/lziprecover/default.nix
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
{ lib, stdenv, fetchurl, lzip }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "lziprecover";
|
||||
version = "1.23";
|
||||
|
||||
src = fetchurl {
|
||||
url = "mirror://savannah/lzip/lziprecover/${pname}-${version}.tar.gz";
|
||||
sha256 = "sha256-8pgEF38G3VHD+lJhWuGYp2ACts6Nlhw1dVRsN0D0tXI=";
|
||||
};
|
||||
|
||||
configureFlags = [
|
||||
"CPPFLAGS=-DNDEBUG"
|
||||
"CFLAGS=-O3"
|
||||
"CXXFLAGS=-O3"
|
||||
"CXX=${stdenv.cc.targetPrefix}c++"
|
||||
];
|
||||
|
||||
doCheck = true;
|
||||
checkInputs = [ lzip ];
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
meta = with lib; {
|
||||
homepage = "https://www.nongnu.org/lzip/lziprecover.html";
|
||||
description = "Data recovery tool for lzip compressed files";
|
||||
license = lib.licenses.gpl2Plus;
|
||||
maintainers = with maintainers; [ vlaci ];
|
||||
platforms = lib.platforms.all;
|
||||
};
|
||||
}
|
||||
21
pkgs/tools/compression/lzop/default.nix
Normal file
21
pkgs/tools/compression/lzop/default.nix
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
{ lib, stdenv, fetchurl, lzo }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "lzop";
|
||||
version = "1.04";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://www.lzop.org/download/lzop-${version}.tar.gz";
|
||||
sha256 = "0h9gb8q7y54m9mvy3jvsmxf21yx8fc3ylzh418hgbbv0i8mbcwky";
|
||||
};
|
||||
|
||||
buildInputs = [ lzo ];
|
||||
|
||||
meta = with lib; {
|
||||
homepage = "http://www.lzop.org";
|
||||
description = "Fast file compressor";
|
||||
maintainers = with maintainers; [ ];
|
||||
license = licenses.gpl2;
|
||||
platforms = platforms.unix;
|
||||
};
|
||||
}
|
||||
33
pkgs/tools/compression/mozlz4a/default.nix
Normal file
33
pkgs/tools/compression/mozlz4a/default.nix
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
{ 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.lz4 ];
|
||||
|
||||
meta = {
|
||||
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";
|
||||
};
|
||||
}
|
||||
27
pkgs/tools/compression/ncompress/default.nix
Normal file
27
pkgs/tools/compression/ncompress/default.nix
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
{ lib, stdenv, fetchFromGitHub }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "ncompress";
|
||||
version = "5.0";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "vapier";
|
||||
repo = "ncompress";
|
||||
rev = "v${version}";
|
||||
sha256 = "sha256-Yhs3C5/kR7Ve56E84usYJprxIMAIwXVahLi1N9TIfj0=";
|
||||
};
|
||||
|
||||
makeFlags = [ "PREFIX=$(out)" ];
|
||||
installTargets = "install_core";
|
||||
|
||||
postInstall = ''
|
||||
mv $out/bin/uncompress $out/bin/uncompress-ncompress
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
homepage = "http://ncompress.sourceforge.net/";
|
||||
license = licenses.publicDomain;
|
||||
description = "A fast, simple LZW file compressor";
|
||||
platforms = platforms.unix;
|
||||
};
|
||||
}
|
||||
33
pkgs/tools/compression/nx2elf/default.nix
Normal file
33
pkgs/tools/compression/nx2elf/default.nix
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
{ lib, stdenv, fetchFromGitHub, lz4 }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "nx2elf";
|
||||
version = "unstable-2021-11-21";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "shuffle2";
|
||||
repo = "nx2elf";
|
||||
rev = "735aaa0648a5a6c996b48add9465db86524999f6";
|
||||
sha256 = "sha256-cS8FFIEgDWva0j9JXhS+s7Y4Oh+mNhFaKRI7BF2hqvs=";
|
||||
};
|
||||
|
||||
buildInputs = [ lz4 ];
|
||||
|
||||
postPatch = ''
|
||||
# pkg-config is not supported, so we'll manually devendor 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 ];
|
||||
};
|
||||
}
|
||||
48
pkgs/tools/compression/ouch/default.nix
Normal file
48
pkgs/tools/compression/ouch/default.nix
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
{ lib
|
||||
, rustPlatform
|
||||
, fetchFromGitHub
|
||||
, help2man
|
||||
, installShellFiles
|
||||
, pkg-config
|
||||
, bzip2
|
||||
, xz
|
||||
, zlib
|
||||
, zstd
|
||||
}:
|
||||
|
||||
rustPlatform.buildRustPackage rec {
|
||||
pname = "ouch";
|
||||
version = "0.3.1";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "ouch-org";
|
||||
repo = pname;
|
||||
rev = version;
|
||||
sha256 = "sha256-I9CgkYxcK+Ih9UlcYBa8QAZZsPvzPUK5ZUYKPxzgs38=";
|
||||
};
|
||||
|
||||
cargoSha256 = "sha256-jEprWtIl5LihD9fOMYHGGlk0+h4woUlwUWNfSkd2t10=";
|
||||
|
||||
nativeBuildInputs = [ help2man installShellFiles pkg-config ];
|
||||
|
||||
buildInputs = [ bzip2 xz zlib zstd ];
|
||||
|
||||
buildFeatures = [ "zstd/pkg-config" ];
|
||||
|
||||
postInstall = ''
|
||||
help2man $out/bin/ouch > ouch.1
|
||||
installManPage ouch.1
|
||||
|
||||
completions=($releaseDir/build/ouch-*/out/completions)
|
||||
installShellCompletion $completions/ouch.{bash,fish} --zsh $completions/_ouch
|
||||
'';
|
||||
|
||||
GEN_COMPLETIONS = 1;
|
||||
|
||||
meta = with lib; {
|
||||
description = "A command-line utility for easily compressing and decompressing files and directories";
|
||||
homepage = "https://github.com/ouch-org/ouch";
|
||||
license = licenses.mit;
|
||||
maintainers = with maintainers; [ figsoda psibi ];
|
||||
};
|
||||
}
|
||||
30
pkgs/tools/compression/pbzip2/default.nix
Normal file
30
pkgs/tools/compression/pbzip2/default.nix
Normal file
|
|
@ -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;
|
||||
};
|
||||
}
|
||||
26
pkgs/tools/compression/pbzx/default.nix
Normal file
26
pkgs/tools/compression/pbzx/default.nix
Normal file
|
|
@ -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 ];
|
||||
};
|
||||
}
|
||||
37
pkgs/tools/compression/pigz/default.nix
Normal file
37
pkgs/tools/compression/pigz/default.nix
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
{ lib, stdenv, fetchFromGitHub, zlib, util-linux }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "pigz";
|
||||
version = "2.6";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "madler";
|
||||
repo = "${pname}";
|
||||
rev = "refs/tags/v${version}";
|
||||
sha256 = "146qkmzi199xwmmf6bllanqfyl702fm1rnad8cd5r5yyrp5ks115";
|
||||
};
|
||||
|
||||
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 = "https://www.zlib.net/pigz/";
|
||||
description = "A parallel implementation of gzip for multi-core machines";
|
||||
maintainers = with maintainers; [ ];
|
||||
license = licenses.zlib;
|
||||
platforms = platforms.unix;
|
||||
};
|
||||
}
|
||||
51
pkgs/tools/compression/pixz/default.nix
Normal file
51
pkgs/tools/compression/pixz/default.nix
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
{ lib
|
||||
, stdenv
|
||||
, fetchFromGitHub
|
||||
, autoconf
|
||||
, automake
|
||||
, libtool
|
||||
, pkg-config
|
||||
, asciidoc
|
||||
, libxslt
|
||||
, libxml2
|
||||
, docbook_xml_dtd_45
|
||||
, docbook_xsl
|
||||
, libarchive
|
||||
, xz
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "pixz";
|
||||
version = "1.0.7";
|
||||
|
||||
nativeBuildInputs = [ pkg-config autoconf automake ];
|
||||
buildInputs = [
|
||||
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 = pname;
|
||||
rev = "v${version}";
|
||||
sha256 = "163axxs22w7pghr786hda22mnlpvmi50hzhfr9axwyyjl9n41qs2";
|
||||
};
|
||||
preConfigure = ''
|
||||
./autogen.sh
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "A parallel compressor/decompressor for xz format";
|
||||
license = licenses.bsd2;
|
||||
maintainers = [ maintainers.raskin ];
|
||||
platforms = platforms.unix;
|
||||
};
|
||||
}
|
||||
56
pkgs/tools/compression/pxz/default.nix
Normal file
56
pkgs/tools/compression/pxz/default.nix
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
{ lib
|
||||
, stdenv
|
||||
, fetchFromGitHub
|
||||
, testers
|
||||
, pxz
|
||||
, xz
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "pxz";
|
||||
version = "4.999.9beta";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "jnovy";
|
||||
repo = "pxz";
|
||||
rev = "124382a6d0832b13b7c091f72264f8f3f463070a";
|
||||
hash = "sha256-NYhPujm5A0j810IKUZEHru/oLXCW7xZf5FjjKAbatZY=";
|
||||
};
|
||||
|
||||
patches = [ ./flush-stdout-help-version.patch ];
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace Makefile \
|
||||
--replace '`date +%Y%m%d`' '19700101'
|
||||
|
||||
substituteInPlace pxz.c \
|
||||
--replace 'XZ_BINARY "xz"' 'XZ_BINARY "${lib.getBin xz}/bin/xz"'
|
||||
'';
|
||||
|
||||
buildInputs = [ xz ];
|
||||
|
||||
makeFlags = [
|
||||
"BINDIR=${placeholder "out"}/bin"
|
||||
"MANDIR=${placeholder "out"}/share/man"
|
||||
];
|
||||
|
||||
passthru.tests.version = testers.testVersion {
|
||||
package = pxz;
|
||||
};
|
||||
|
||||
meta = with lib; {
|
||||
homepage = "https://jnovy.fedorapeople.org/pxz/";
|
||||
license = licenses.gpl2Plus;
|
||||
maintainers = with maintainers; [ pashev ];
|
||||
description = "compression utility that runs LZMA compression of different parts on multiple cores simultaneously";
|
||||
longDescription = ''
|
||||
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
|
||||
'';
|
||||
mainProgram = "pxz";
|
||||
platforms = with platforms; linux;
|
||||
};
|
||||
}
|
||||
32
pkgs/tools/compression/pxz/flush-stdout-help-version.patch
Normal file
32
pkgs/tools/compression/pxz/flush-stdout-help-version.patch
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
From bba741ccd0f0a65cd9bfdd81504ebe5840fd37ad Mon Sep 17 00:00:00 2001
|
||||
From: Will Dietz <w@wdtz.org>
|
||||
Date: Tue, 22 Mar 2022 08:01:10 -0500
|
||||
Subject: [PATCH] pxz: flush stdout before exec'ing xz, ensure our messages are
|
||||
printed
|
||||
|
||||
Without this, they're presently dropped on my system when pxz
|
||||
is piped to something, as in `pxz --help|less` or `pxz --version|cat`.
|
||||
---
|
||||
pxz.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/pxz.c b/pxz.c
|
||||
index 4240b6e..3b53cfa 100644
|
||||
--- a/pxz.c
|
||||
+++ b/pxz.c
|
||||
@@ -184,10 +184,12 @@ void parse_args( int argc, char **argv, char **envp ) {
|
||||
" -D, --context-size per-thread compression context size as a multiple\n"
|
||||
" of dictionary size. Default is 3.\n\n"
|
||||
"Usage and other options are same as in XZ:\n\n");
|
||||
+ fflush(stdout);
|
||||
run_xz(argv, envp);
|
||||
break;
|
||||
case 'V':
|
||||
printf("Parallel PXZ "PXZ_VERSION" (build "PXZ_BUILD_DATE")\n");
|
||||
+ fflush(stdout);
|
||||
run_xz(argv, envp);
|
||||
break;
|
||||
case 'g':
|
||||
--
|
||||
2.35.1
|
||||
|
||||
28
pkgs/tools/compression/rzip/default.nix
Normal file
28
pkgs/tools/compression/rzip/default.nix
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
{ lib, stdenv, fetchurl, fetchpatch, bzip2 }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "rzip";
|
||||
version = "2.1";
|
||||
|
||||
src = fetchurl {
|
||||
url = "mirror://samba/rzip/rzip-${version}.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 = with lib; {
|
||||
homepage = "https://rzip.samba.org/";
|
||||
description = "Compression program";
|
||||
maintainers = with maintainers; [ ];
|
||||
license = licenses.gpl2Plus;
|
||||
platforms = platforms.unix;
|
||||
};
|
||||
}
|
||||
36
pkgs/tools/compression/upx/default.nix
Normal file
36
pkgs/tools/compression/upx/default.nix
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
{ 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";
|
||||
};
|
||||
|
||||
buildInputs = [ ucl zlib perl ];
|
||||
|
||||
preConfigure = ''
|
||||
export UPX_UCLDIR=${ucl}
|
||||
'';
|
||||
|
||||
makeFlags = [
|
||||
"-C" "src"
|
||||
"CHECK_WHITESPACE=true"
|
||||
|
||||
# Disable blanket -Werror. Triggers failues on minor gcc-11 warnings.
|
||||
"CXXFLAGS_WERROR="
|
||||
];
|
||||
|
||||
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;
|
||||
};
|
||||
}
|
||||
|
|
@ -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
|
||||
|
||||
|
|
@ -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
|
||||
|
||||
46
pkgs/tools/compression/xar/default.nix
Normal file
46
pkgs/tools/compression/xar/default.nix
Normal file
|
|
@ -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;
|
||||
};
|
||||
}
|
||||
62
pkgs/tools/compression/xdelta/default.nix
Normal file
62
pkgs/tools/compression/xdelta/default.nix
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
{ 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;
|
||||
mainProgram = "xdelta3";
|
||||
platforms = platforms.unix;
|
||||
};
|
||||
}
|
||||
66
pkgs/tools/compression/xdelta/unstable.nix
Normal file
66
pkgs/tools/compression/xdelta/unstable.nix
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
{ 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;
|
||||
mainProgram = "xdelta3";
|
||||
platforms = platforms.linux;
|
||||
};
|
||||
}
|
||||
59
pkgs/tools/compression/xz/default.nix
Normal file
59
pkgs/tools/compression/xz/default.nix
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
{ 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 {
|
||||
pname = "xz";
|
||||
version = "5.2.5";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://tukaani.org/xz/xz-${version}.tar.bz2";
|
||||
sha256 = "1ps2i8i212n0f4xpq6clp7h13q7m1y8slqvxha9i8d0bj0qgj5si";
|
||||
};
|
||||
|
||||
strictDeps = true;
|
||||
outputs = [ "bin" "dev" "out" "man" "doc" ];
|
||||
|
||||
configureFlags = lib.optional enableStatic "--disable-shared";
|
||||
|
||||
enableParallelBuilding = true;
|
||||
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;
|
||||
};
|
||||
}
|
||||
24
pkgs/tools/compression/zdelta/default.nix
Normal file
24
pkgs/tools/compression/zdelta/default.nix
Normal file
|
|
@ -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;
|
||||
};
|
||||
}
|
||||
59
pkgs/tools/compression/zfp/default.nix
Normal file
59
pkgs/tools/compression/zfp/default.nix
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
{ cmake, cudatoolkit, fetchFromGitHub, gfortran, lib, llvmPackages, pythonPackages, stdenv, targetPlatform
|
||||
, enableCfp ? true
|
||||
, enableCuda ? false
|
||||
, enableExamples ? true
|
||||
, enableFortran ? builtins.elem targetPlatform.system gfortran.meta.platforms
|
||||
, enableOpenMP ? true
|
||||
, enablePython ? true
|
||||
, enableUtilities ? true }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "zfp";
|
||||
version = "0.5.5";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "LLNL";
|
||||
repo = "zfp";
|
||||
rev = version;
|
||||
sha256 = "19ycflz35qsrzfcvxdyy0mgbykfghfi9y5v684jb4awjp7nf562c";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ cmake ];
|
||||
|
||||
buildInputs = lib.optional enableCuda cudatoolkit
|
||||
++ lib.optional enableFortran gfortran
|
||||
++ lib.optional enableOpenMP llvmPackages.openmp
|
||||
++ lib.optionals enablePython [ pythonPackages.cython pythonPackages.numpy pythonPackages.python ];
|
||||
|
||||
cmakeFlags = [
|
||||
# More tests not enabled by default
|
||||
''-DZFP_BINARY_DIR=${placeholder "out"}''
|
||||
''-DZFP_BUILD_TESTING_LARGE=ON''
|
||||
]
|
||||
++ lib.optionals targetPlatform.isDarwin [
|
||||
"-DCMAKE_INSTALL_BINDIR=bin"
|
||||
"-DCMAKE_INSTALL_LIBDIR=lib"
|
||||
]
|
||||
++ lib.optional enableCfp "-DBUILD_CFP=ON"
|
||||
++ lib.optional enableCuda "-DZFP_WITH_CUDA=ON"
|
||||
++ lib.optional enableExamples "-DBUILD_EXAMPLES=ON"
|
||||
++ lib.optional enableFortran "-DBUILD_ZFORP=ON"
|
||||
++ lib.optional enableOpenMP "-DZFP_WITH_OPENMP=ON"
|
||||
++ lib.optional enablePython "-DBUILD_ZFPY=ON"
|
||||
++ ([ "-DBUILD_UTILITIES=${if enableUtilities then "ON" else "OFF"}" ]);
|
||||
|
||||
preCheck = lib.optional targetPlatform.isDarwin ''
|
||||
export DYLD_LIBRARY_PATH="$out/lib:$DYLD_LIBRARY_PATH"
|
||||
'';
|
||||
|
||||
doCheck = true;
|
||||
|
||||
meta = with lib; {
|
||||
homepage = "https://computing.llnl.gov/projects/zfp";
|
||||
description = "Library for random-access compression of floating-point arrays";
|
||||
license = licenses.bsd3;
|
||||
maintainers = [ maintainers.spease ];
|
||||
# 64-bit only
|
||||
platforms = platforms.aarch64 ++ platforms.x86_64;
|
||||
};
|
||||
}
|
||||
39
pkgs/tools/compression/zopfli/default.nix
Normal file
39
pkgs/tools/compression/zopfli/default.nix
Normal file
|
|
@ -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 ];
|
||||
};
|
||||
}
|
||||
112
pkgs/tools/compression/zstd/default.nix
Normal file
112
pkgs/tools/compression/zstd/default.nix
Normal file
|
|
@ -0,0 +1,112 @@
|
|||
{ lib, stdenv, fetchFromGitHub, cmake, bash, gnugrep
|
||||
, fixDarwinDylibNames
|
||||
, file
|
||||
, fetchpatch
|
||||
, legacySupport ? false
|
||||
, static ? stdenv.hostPlatform.isStatic
|
||||
# these need to be ran on the host, thus disable when cross-compiling
|
||||
, buildContrib ? stdenv.hostPlatform == stdenv.buildPlatform
|
||||
, doCheck ? stdenv.hostPlatform == stdenv.buildPlatform
|
||||
, nix-update-script
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "zstd";
|
||||
version = "1.5.2";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "facebook";
|
||||
repo = "zstd";
|
||||
rev = "v${version}";
|
||||
sha256 = "sha256-yJvhcysxcbUGuDOqe/TQ3Y5xyM2AUw6r1THSHOqmUy0=";
|
||||
};
|
||||
|
||||
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;
|
||||
BUILD_CONTRIB = buildContrib;
|
||||
PROGRAMS_LINK_SHARED = !static;
|
||||
LEGACY_SUPPORT = legacySupport;
|
||||
BUILD_TESTS = doCheck;
|
||||
};
|
||||
|
||||
cmakeDir = "../build/cmake";
|
||||
dontUseCmakeBuildDir = true;
|
||||
preConfigure = ''
|
||||
mkdir -p build_ && cd $_
|
||||
'';
|
||||
|
||||
checkInputs = [ file ];
|
||||
inherit doCheck;
|
||||
checkPhase = ''
|
||||
runHook preCheck
|
||||
# Patch shebangs for playTests
|
||||
patchShebangs ../programs/zstdgrep
|
||||
ctest -R playTests # The only relatively fast test.
|
||||
runHook postCheck
|
||||
'';
|
||||
|
||||
preInstall = ''
|
||||
mkdir -p $bin/bin
|
||||
substituteInPlace ../programs/zstdgrep \
|
||||
--replace ":-grep" ":-${gnugrep}/bin/grep" \
|
||||
--replace ":-zstdcat" ":-$bin/bin/zstdcat"
|
||||
|
||||
substituteInPlace ../programs/zstdless \
|
||||
--replace "zstdcat" "$bin/bin/zstdcat"
|
||||
'' + lib.optionalString buildContrib ''
|
||||
cp contrib/pzstd/pzstd $bin/bin/pzstd
|
||||
'' + lib.optionalString stdenv.isDarwin ''
|
||||
install_name_tool -change @rpath/libzstd.1.dylib $out/lib/libzstd.1.dylib $bin/bin/pzstd
|
||||
'';
|
||||
|
||||
outputs = [ "bin" "dev" ]
|
||||
++ lib.optional stdenv.hostPlatform.isUnix "man"
|
||||
++ [ "out" ];
|
||||
|
||||
passthru = {
|
||||
updateScript = nix-update-script {
|
||||
attrPath = pname;
|
||||
};
|
||||
};
|
||||
|
||||
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 ];
|
||||
};
|
||||
}
|
||||
40
pkgs/tools/compression/zstd/playtests-darwin.patch
Normal file
40
pkgs/tools/compression/zstd/playtests-darwin.patch
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
--- a/tests/playTests.sh
|
||||
+++ b/tests/playTests.sh
|
||||
@@ -112,29 +112,19 @@ 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
|
||||
|
||||
assertSameMTime() {
|
||||
MT1=$($MTIME "$1")
|
||||
MT2=$($MTIME "$2")
|
||||
echo MTIME $MT1 $MT2
|
||||
[ "$MT1" = "$MT2" ] || die "mtime on $1 doesn't match mtime on $2 ($MT1 != $MT2)"
|
||||
}
|
||||
|
||||
GET_PERMS="stat -c %a"
|
||||
-case "$UNAME" in
|
||||
- Darwin | FreeBSD | OpenBSD | NetBSD) GET_PERMS="stat -f %Lp" ;;
|
||||
-esac
|
||||
|
||||
assertFilePermissions() {
|
||||
STAT1=$($GET_PERMS "$1")
|
||||
@@ -967,7 +957,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
|
||||
21
pkgs/tools/compression/zsync/default.nix
Normal file
21
pkgs/tools/compression/zsync/default.nix
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
{ lib, stdenv, fetchurl }:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "zsync";
|
||||
version = "0.6.2";
|
||||
|
||||
src = fetchurl {
|
||||
url = "http://zsync.moria.org.uk/download/${pname}-${version}.tar.bz2";
|
||||
sha256 = "1wjslvfy76szf0mgg2i9y9q30858xyjn6v2acc24zal76d1m778b";
|
||||
};
|
||||
|
||||
makeFlags = [ "AR=${stdenv.cc.bintools.targetPrefix}ar" ];
|
||||
|
||||
meta = with lib; {
|
||||
homepage = "http://zsync.moria.org.uk/";
|
||||
description = "File distribution system using the rsync algorithm";
|
||||
license = licenses.free;
|
||||
maintainers = with maintainers; [ viric ];
|
||||
platforms = with platforms; all;
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue