Merge branch 'master' into core-updates
[jackhill/guix/guix.git] / gnu / packages / compression.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012, 2013, 2014, 2015, 2017 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2013 Andreas Enge <andreas@enge.fr>
4 ;;; Copyright © 2014, 2015, 2018 Mark H Weaver <mhw@netris.org>
5 ;;; Copyright © 2015 Taylan Ulrich Bayırlı/Kammer <taylanbayirli@gmail.com>
6 ;;; Copyright © 2015, 2016 Eric Bavier <bavier@member.fsf.org>
7 ;;; Copyright © 2015, 2016, 2017, 2018 Ricardo Wurmus <rekado@elephly.net>
8 ;;; Copyright © 2015, 2017, 2018 Leo Famulari <leo@famulari.name>
9 ;;; Copyright © 2015 Jeff Mickey <j@codemac.net>
10 ;;; Copyright © 2015, 2016, 2017 Efraim Flashner <efraim@flashner.co.il>
11 ;;; Copyright © 2016 Ben Woodcroft <donttrustben@gmail.com>
12 ;;; Copyright © 2016 Danny Milosavljevic <dannym@scratchpost.org>
13 ;;; Copyright © 2016, 2017, 2018 Tobias Geerinckx-Rice <me@tobias.gr>
14 ;;; Copyright © 2016 David Craven <david@craven.ch>
15 ;;; Copyright © 2016 Kei Kebreau <kkebreau@posteo.net>
16 ;;; Copyright © 2016, 2018 Marius Bakke <mbakke@fastmail.com>
17 ;;; Copyright © 2017 Nils Gillmann <ng0@n0.is>
18 ;;; Copyright © 2017 Manolis Fragkiskos Ragkousis <manolis837@gmail.com>
19 ;;; Copyright © 2017 Theodoros Foradis <theodoros@foradis.org>
20 ;;; Copyright © 2017 Stefan Reichör <stefan@xsteve.at>
21 ;;; Copyright © 2017 Petter <petter@mykolab.ch>
22 ;;; Copyright © 2017 Julien Lepiller <julien@lepiller.eu>
23 ;;; Copyright © 2018 Rutger Helling <rhelling@mykolab.com>
24 ;;; Copyright © 2018 Joshua Sierles, Nextjournal <joshua@nextjournal.com>
25 ;;; Copyright © 2018 Pierre Neidhardt <ambrevar@gmail.com>
26 ;;;
27 ;;; This file is part of GNU Guix.
28 ;;;
29 ;;; GNU Guix is free software; you can redistribute it and/or modify it
30 ;;; under the terms of the GNU General Public License as published by
31 ;;; the Free Software Foundation; either version 3 of the License, or (at
32 ;;; your option) any later version.
33 ;;;
34 ;;; GNU Guix is distributed in the hope that it will be useful, but
35 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
36 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
37 ;;; GNU General Public License for more details.
38 ;;;
39 ;;; You should have received a copy of the GNU General Public License
40 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
41
42 (define-module (gnu packages compression)
43 #:use-module ((guix licenses) #:prefix license:)
44 #:use-module (guix utils)
45 #:use-module (guix packages)
46 #:use-module (guix download)
47 #:use-module (guix git-download)
48 #:use-module (guix build-system ant)
49 #:use-module (guix build-system cmake)
50 #:use-module (guix build-system gnu)
51 #:use-module (guix build-system perl)
52 #:use-module (guix build-system python)
53 #:use-module (gnu packages)
54 #:use-module (gnu packages assembly)
55 #:use-module (gnu packages autotools)
56 #:use-module (gnu packages backup)
57 #:use-module (gnu packages base)
58 #:use-module (gnu packages boost)
59 #:use-module (gnu packages check)
60 #:use-module (gnu packages curl)
61 #:use-module (gnu packages file)
62 #:use-module (gnu packages java)
63 #:use-module (gnu packages maths)
64 #:use-module (gnu packages perl)
65 #:use-module (gnu packages perl-check)
66 #:use-module (gnu packages pkg-config)
67 #:use-module (gnu packages python)
68 #:use-module (gnu packages tls)
69 #:use-module (gnu packages valgrind)
70 #:use-module (ice-9 match)
71 #:use-module ((srfi srfi-1) #:select (last)))
72
73 (define-public zlib
74 (package
75 (name "zlib")
76 (version "1.2.11")
77 (source
78 (origin
79 (method url-fetch)
80 (uri (list (string-append "http://zlib.net/zlib-"
81 version ".tar.gz")
82 (string-append "mirror://sourceforge/libpng/zlib/"
83 version "/zlib-" version ".tar.gz")))
84 (sha256
85 (base32
86 "18dighcs333gsvajvvgqp8l4cx7h1x7yx9gd5xacnk80spyykrf3"))))
87 (build-system gnu-build-system)
88 (arguments
89 `(#:phases
90 (modify-phases %standard-phases
91 (replace 'configure
92 (lambda* (#:key outputs #:allow-other-keys)
93 ;; Zlib's home-made `configure' fails when passed
94 ;; extra flags like `--enable-fast-install', so we need to
95 ;; invoke it with just what it understand.
96 (let ((out (assoc-ref outputs "out")))
97 ;; 'configure' doesn't understand '--host'.
98 ,@(if (%current-target-system)
99 `((setenv "CHOST" ,(%current-target-system)))
100 '())
101 (invoke "./configure"
102 (string-append "--prefix=" out))))))))
103 (home-page "https://zlib.net/")
104 (synopsis "Compression library")
105 (description
106 "zlib is designed to be a free, general-purpose, legally unencumbered --
107 that is, not covered by any patents -- lossless data-compression library for
108 use on virtually any computer hardware and operating system. The zlib data
109 format is itself portable across platforms. Unlike the LZW compression method
110 used in Unix compress(1) and in the GIF image format, the compression method
111 currently used in zlib essentially never expands the data. (LZW can double or
112 triple the file size in extreme cases.) zlib's memory footprint is also
113 independent of the input data and can be reduced, if necessary, at some cost
114 in compression.")
115 (license license:zlib)))
116
117 (define-public minizip
118 (package
119 (name "minizip")
120 (version (package-version zlib))
121 (source (package-source zlib))
122 (build-system gnu-build-system)
123 (arguments
124 `(#:phases
125 (modify-phases %standard-phases
126 (add-after 'unpack 'enter-source
127 (lambda _ (chdir "contrib/minizip") #t))
128 (add-after 'enter-source 'autoreconf
129 (lambda _
130 (invoke "autoreconf" "-vif"))))))
131 (native-inputs
132 `(("autoconf" ,autoconf)
133 ("automake" ,automake)
134 ("libtool" ,libtool)))
135 (propagated-inputs `(("zlib" ,zlib)))
136 (home-page (package-home-page zlib))
137 (synopsis "Zip Compression library")
138 (description
139 "Minizip is a minimalistic library that supports compressing,
140 extracting and viewing ZIP archives. This version is extracted from
141 the @code{zlib} source.")
142 (license (package-license zlib))))
143
144 (define-public fastjar
145 (package
146 (name "fastjar")
147 (version "0.98")
148 (source (origin
149 (method url-fetch)
150 (uri (string-append "mirror://savannah/fastjar/fastjar-"
151 version ".tar.gz"))
152 (sha256
153 (base32
154 "0iginbz2m15hcsa3x4y7v3mhk54gr1r7m3ghx0pg4n46vv2snmpi"))))
155 (build-system gnu-build-system)
156 (inputs `(("zlib" ,zlib)))
157 (home-page "https://savannah.nongnu.org/projects/fastjar")
158 (synopsis "Replacement for Sun's 'jar' utility")
159 (description
160 "FastJar is an attempt to create a much faster replacement for Sun's 'jar'
161 utility. Instead of being written in Java, FastJar is written in C.")
162 (license license:gpl2+)))
163
164 (define-public libtar
165 (package
166 (name "libtar")
167 (version "1.2.20")
168 (source (origin
169 (method url-fetch)
170 (uri (list
171 (string-append
172 "ftp://ftp.feep.net/pub/software/libtar/libtar-"
173 version ".tar.gz")
174 (string-append
175 "mirror://debian/pool/main/libt/libtar/libtar_"
176 version ".orig.tar.gz")))
177 (sha256
178 (base32
179 "02cihzl77ia0dcz7z2cga2412vyhhs5pa2355q4wpwbyga2lrwjh"))
180 (patches (search-patches "libtar-CVE-2013-4420.patch"))))
181 (build-system gnu-build-system)
182 (arguments
183 `(#:tests? #f ;no "check" target
184 #:phases
185 (modify-phases %standard-phases
186 (add-after 'unpack 'autoconf
187 (lambda _ (invoke "sh" "autoreconf" "-vfi"))))))
188 (native-inputs
189 `(("autoconf" ,autoconf)
190 ("automake" ,automake)
191 ("libtool" ,libtool)))
192 (inputs
193 `(("zlib" ,zlib)))
194 (synopsis "C library for manipulating POSIX tar files")
195 (description
196 "libtar is a C library for manipulating POSIX tar files. It handles
197 adding and extracting files to/from a tar archive.")
198 (home-page "https://repo.or.cz/libtar.git")
199 (license license:bsd-3)))
200
201 (define-public gzip
202 (package
203 (name "gzip")
204 (version "1.9")
205 (source (origin
206 (method url-fetch)
207 (uri (string-append "mirror://gnu/gzip/gzip-"
208 version ".tar.xz"))
209 (sha256
210 (base32
211 "16h8g4acy7fgfxcjacr3wijjsnixwsfd2jhz3zwdi2qrzi262l5f"))))
212 (build-system gnu-build-system)
213 (synopsis "General file (de)compression (using lzw)")
214 (arguments
215 ;; FIXME: The test suite wants `less', and optionally Perl.
216 '(#:tests? #f
217 #:phases
218 (modify-phases %standard-phases
219 (add-after 'unpack 'use-absolute-name-of-gzip
220 (lambda* (#:key outputs #:allow-other-keys)
221 (substitute* "gunzip.in"
222 (("exec gzip")
223 (string-append "exec " (assoc-ref outputs "out")
224 "/bin/gzip")))
225 #t)))))
226 (description
227 "GNU Gzip provides data compression and decompression utilities; the
228 typical extension is \".gz\". Unlike the \"zip\" format, it compresses a single
229 file; as a result, it is often used in conjunction with \"tar\", resulting in
230 \".tar.gz\" or \".tgz\", etc.")
231 (license license:gpl3+)
232 (home-page "https://www.gnu.org/software/gzip/")))
233
234 (define-public bzip2
235 (package
236 (name "bzip2")
237 (version "1.0.6")
238 (source (origin
239 (method url-fetch)
240 (uri (string-append "http://www.bzip.org/" version "/bzip2-"
241 version ".tar.gz"))
242 (sha256
243 (base32
244 "1kfrc7f0ja9fdn6j1y6yir6li818npy6217hvr3wzmnmzhs8z152"))))
245 (build-system gnu-build-system)
246 (arguments
247 `(#:modules ((guix build gnu-build-system)
248 (guix build utils)
249 (srfi srfi-1))
250 #:phases
251 (modify-phases %standard-phases
252 (replace 'configure
253 (lambda* (#:key target #:allow-other-keys)
254 (when ,(%current-target-system)
255 ;; Cross-compilation: use the cross tools.
256 (substitute* (find-files "." "Makefile")
257 (("CC=.*$")
258 (string-append "CC = " target "-gcc\n"))
259 (("AR=.*$")
260 (string-append "AR = " target "-ar\n"))
261 (("RANLIB=.*$")
262 (string-append "RANLIB = " target "-ranlib\n"))
263 (("^all:(.*)test" _ prerequisites)
264 ;; Remove 'all' -> 'test' dependency.
265 (string-append "all:" prerequisites "\n"))))
266 #t))
267 (add-before 'build 'build-shared-lib
268 (lambda* (#:key inputs #:allow-other-keys)
269 (patch-makefile-SHELL "Makefile-libbz2_so")
270 (invoke "make" "-f" "Makefile-libbz2_so")))
271 (add-after 'install 'install-shared-lib
272 (lambda* (#:key outputs #:allow-other-keys)
273 ;; The Makefile above does not have an 'install' target, nor does
274 ;; it create all the (un)versioned symlinks, so we handle it here.
275 (let* ((out (assoc-ref outputs "out"))
276 (libdir (string-append out "/lib"))
277 ;; Find the actual library (e.g. "libbz2.so.1.0.6").
278 (lib (string-drop
279 (car (find-files
280 "."
281 (lambda (file stat)
282 (and (string-prefix? "./libbz2.so" file)
283 (eq? 'regular (stat:type stat))))))
284 2))
285 (soversion (string-drop lib (string-length "libbz2.so."))))
286 (install-file lib libdir)
287 (with-directory-excursion libdir
288 ;; Create symlinks libbz2.so.1 -> libbz2.so.1.0, etc.
289 (let loop ((base "libbz2.so")
290 (numbers (string-split soversion #\.)))
291 (unless (null? numbers)
292 (let ((so-file (string-append base "." (car numbers))))
293 (symlink so-file base)
294 (loop so-file (cdr numbers))))))
295 #t)))
296 (add-after 'install-shared-lib 'patch-scripts
297 (lambda* (#:key outputs inputs #:allow-other-keys)
298 (let* ((out (assoc-ref outputs "out")))
299 (substitute* (string-append out "/bin/bzdiff")
300 (("/bin/rm") "rm")))
301 #t)))
302
303 #:make-flags (list (string-append "PREFIX="
304 (assoc-ref %outputs "out")))
305
306 ;; Don't attempt to run the tests when cross-compiling.
307 ,@(if (%current-target-system)
308 '(#:tests? #f)
309 '())))
310 (synopsis "High-quality data compression program")
311 (description
312 "bzip2 is a freely available, patent free (see below), high-quality data
313 compressor. It typically compresses files to within 10% to 15% of the best
314 available techniques (the PPM family of statistical compressors), whilst
315 being around twice as fast at compression and six times faster at
316 decompression.")
317 (license (license:non-copyleft "file://LICENSE"
318 "See LICENSE in the distribution."))
319 (home-page "http://www.bzip.org/")))
320
321 (define-public lbzip2
322 (package
323 (name "lbzip2")
324 (version "2.5")
325 (source (origin
326 (method url-fetch)
327 (uri (string-append "http://archive.lbzip2.org/lbzip2-"
328 version ".tar.gz"))
329 (sha256
330 (base32
331 "1sahaqc5bw4i0iyri05syfza4ncf5cml89an033fspn97klmxis6"))))
332 (build-system gnu-build-system)
333 (synopsis "Parallel bzip2 compression utility")
334 (description
335 "lbzip2 is a multi-threaded compression utility with support for the
336 bzip2 compressed file format. lbzip2 can process standard bz2 files in
337 parallel. It uses POSIX threading model (pthreads), which allows it to take
338 full advantage of symmetric multiprocessing (SMP) systems. It has been proven
339 to scale linearly, even to over one hundred processor cores. lbzip2 is fully
340 compatible with bzip2 – both at file format and command line level.")
341 (home-page "http://www.lbzip2.org/")
342 (license license:gpl3+)))
343
344 (define-public pbzip2
345 (package
346 (name "pbzip2")
347 (version "1.1.13")
348 (source (origin
349 (method url-fetch)
350 (uri (string-append "https://launchpad.net/pbzip2/"
351 (version-major+minor version) "/" version
352 "/+download/" name "-" version ".tar.gz"))
353 (sha256
354 (base32
355 "1rnvgcdixjzbrmcr1nv9b6ccrjfrhryaj7jwz28yxxv6lam3xlcg"))))
356 (build-system gnu-build-system)
357 (inputs
358 `(("bzip2" ,bzip2)))
359 (arguments
360 `(#:tests? #f ; no tests
361 #:phases (modify-phases %standard-phases
362 (delete 'configure)) ; no configure script
363 #:make-flags (list (string-append "PREFIX=" %output))))
364 (home-page "http://compression.ca/pbzip2/")
365 (synopsis "Parallel bzip2 implementation")
366 (description
367 "Pbzip2 is a parallel implementation of the bzip2 block-sorting file
368 compressor that uses pthreads and achieves near-linear speedup on SMP machines.
369 The output of this version is fully compatible with bzip2 v1.0.2 (i.e. anything
370 compressed with pbzip2 can be decompressed with bzip2).")
371 (license (license:non-copyleft "file://COPYING"
372 "See COPYING in the distribution."))))
373
374 (define-public xz
375 (package
376 (name "xz")
377 (version "5.2.3")
378 (source (origin
379 (method url-fetch)
380 (uri (list (string-append "http://tukaani.org/xz/xz-" version
381 ".tar.gz")
382 (string-append "http://multiprecision.org/guix/xz-"
383 version ".tar.gz")))
384 (sha256
385 (base32
386 "1jr8pxnz55ifc8cvp3ivgl79ph9iik5aypsc9cma228aglsqp4ki"))))
387 (build-system gnu-build-system)
388 (synopsis "General-purpose data compression")
389 (description
390 "XZ Utils is free general-purpose data compression software with high
391 compression ratio. XZ Utils were written for POSIX-like systems, but also
392 work on some not-so-POSIX systems. XZ Utils are the successor to LZMA Utils.
393
394 The core of the XZ Utils compression code is based on LZMA SDK, but it has
395 been modified quite a lot to be suitable for XZ Utils. The primary
396 compression algorithm is currently LZMA2, which is used inside the .xz
397 container format. With typical files, XZ Utils create 30 % smaller output
398 than gzip and 15 % smaller output than bzip2.")
399 (license (list license:gpl2+ license:lgpl2.1+)) ; bits of both
400 (home-page "https://tukaani.org/xz/")))
401
402 (define-public lzo
403 (package
404 (name "lzo")
405 (version "2.10")
406 (source
407 (origin
408 (method url-fetch)
409 (uri (string-append "http://www.oberhumer.com/opensource/lzo/download/lzo-"
410 version ".tar.gz"))
411 (sha256
412 (base32
413 "0wm04519pd3g8hqpjqhfr72q8qmbiwqaxcs3cndny9h86aa95y60"))))
414 (build-system gnu-build-system)
415 (arguments '(#:configure-flags '("--enable-shared")))
416 (home-page "http://www.oberhumer.com/opensource/lzo")
417 (synopsis
418 "Data compression library suitable for real-time data de-/compression")
419 (description
420 "LZO is a data compression library which is suitable for data
421 de-/compression in real-time. This means it favours speed over
422 compression ratio.
423
424 LZO is written in ANSI C. Both the source code and the compressed data
425 format are designed to be portable across platforms.")
426 (license license:gpl2+)))
427
428 (define-public python-lzo
429 (package
430 (name "python-lzo")
431 (version "1.11")
432 (source
433 (origin
434 (method url-fetch)
435 (uri (pypi-uri "python-lzo" version))
436 (sha256
437 (base32
438 "11p3ifg14p086byhhin6azx5svlkg8dzw2b5abixik97xd6fm81q"))))
439 (build-system python-build-system)
440 (arguments
441 `(#:test-target "check"
442 #:phases
443 (modify-phases %standard-phases
444 (add-after 'unpack 'patch-setuppy
445 (lambda _
446 (substitute* "setup.py"
447 (("include_dirs.append\\(.*\\)")
448 (string-append "include_dirs.append('"
449 (assoc-ref %build-inputs "lzo")
450 "/include/lzo"
451 "')")))
452 #t)))))
453 (inputs
454 `(("lzo" ,lzo)))
455 (home-page "https://github.com/jd-boyd/python-lzo")
456 (synopsis "Python bindings for the LZO data compression library")
457 (description
458 "Python-LZO provides Python bindings for LZO, i.e. you can access
459 the LZO library from your Python scripts thereby compressing ordinary
460 Python strings.")
461 (license license:gpl2+)))
462
463 (define-public python2-lzo
464 (package-with-python2 python-lzo))
465
466 (define-public lzop
467 (package
468 (name "lzop")
469 (version "1.04")
470 (source
471 (origin
472 (method url-fetch)
473 (uri (string-append "http://www.lzop.org/download/lzop-"
474 version ".tar.gz"))
475 (sha256
476 (base32
477 "0h9gb8q7y54m9mvy3jvsmxf21yx8fc3ylzh418hgbbv0i8mbcwky"))))
478 (build-system gnu-build-system)
479 (inputs `(("lzo" ,lzo)))
480 (home-page "https://www.lzop.org/")
481 (synopsis "Compress or expand files")
482 (description
483 "Lzop is a file compressor which is very similar to gzip. Lzop uses the
484 LZO data compression library for compression services, and its main advantages
485 over gzip are much higher compression and decompression speed (at the cost of
486 some compression ratio).")
487 (license license:gpl2+)))
488
489 (define-public lzip
490 (package
491 (name "lzip")
492 (version "1.20")
493 (source (origin
494 (method url-fetch)
495 (uri (string-append "mirror://savannah/lzip/lzip-"
496 version ".tar.gz"))
497 (sha256
498 (base32
499 "0319q59kb8g324wnj7xzbr7vvlx5bcs13lr34j0zb3kqlyjq2fy9"))))
500 (build-system gnu-build-system)
501 (home-page "https://www.nongnu.org/lzip/lzip.html")
502 (synopsis "Lossless data compressor based on the LZMA algorithm")
503 (description
504 "Lzip is a lossless data compressor with a user interface similar to the
505 one of gzip or bzip2. Lzip decompresses almost as fast as gzip and compresses
506 more than bzip2, which makes it well-suited for software distribution and data
507 archiving. Lzip is a clean implementation of the LZMA algorithm.")
508 (license license:gpl3+)))
509
510 (define-public lziprecover
511 (package
512 (name "lziprecover")
513 (version "1.20")
514 (source (origin
515 (method url-fetch)
516 (uri (string-append "mirror://savannah/lzip/" name "/"
517 name "-" version ".tar.gz"))
518 (sha256
519 (base32
520 "0fpnmdxayvd1ff0rk9606dvr431ji6b1v71km4ww244rih1rmmzz"))))
521 (build-system gnu-build-system)
522 (home-page "https://www.nongnu.org/lzip/lziprecover.html")
523 (synopsis "Recover and decompress data from damaged lzip files")
524 (description
525 "Lziprecover is a data recovery tool and decompressor for files in the lzip
526 compressed data format (.lz). It can test the integrity of lzip files, extract
527 data from damaged ones, and repair most files with small errors (up to one
528 single-byte error per member) entirely.
529
530 Lziprecover is not a replacement for regular backups, but a last line of defence
531 when even the backups are corrupt. It can recover files by merging the good
532 parts of two or more damaged copies, such as can be easily produced by running
533 @command{ddrescue} on a failing device.
534
535 This package also includes @command{unzcrash}, a tool to test the robustness of
536 decompressors when faced with corrupted input.")
537 (license (list license:bsd-2 ; arg_parser.{cc,h}
538 license:gpl2+)))) ; everything else
539
540 (define-public sharutils
541 (package
542 (name "sharutils")
543 (version "4.15.2")
544 (source
545 (origin
546 (method url-fetch)
547 (uri (string-append "mirror://gnu/sharutils/sharutils-"
548 version ".tar.xz"))
549 (patches (search-patches "sharutils-CVE-2018-1000097.patch"))
550 (sha256
551 (base32
552 "16isapn8f39lnffc3dp4dan05b7x6mnc76v6q5nn8ysxvvvwy19b"))))
553 (build-system gnu-build-system)
554 (inputs
555 `(("which" ,which)))
556 (arguments
557 `(#:phases
558 (modify-phases %standard-phases
559 (add-after 'patch-source-shebangs 'unpatch-source-shebang
560 ;; revert the patch-shebang phase on a script which is
561 ;; in fact test data
562 (lambda _
563 (substitute* "tests/shar-1.ok"
564 (((which "sh")) "/bin/sh"))
565 #t)))))
566 (home-page "https://www.gnu.org/software/sharutils/")
567 (synopsis "Archives in shell scripts, uuencode/uudecode")
568 (description
569 "GNU sharutils is a package for creating and manipulating shell
570 archives that can be readily emailed. A shell archive is a file that can be
571 processed by a Bourne-type shell to unpack the original collection of files.
572 This package is mostly for compatibility and historical interest.")
573 (license license:gpl3+)))
574
575 (define-public sfarklib
576 (package
577 (name "sfarklib")
578 (version "2.24")
579 (source (origin
580 (method url-fetch)
581 (uri (string-append "https://github.com/raboof/sfArkLib/archive/"
582 version ".tar.gz"))
583 (file-name (string-append name "-" version ".tar.gz"))
584 (sha256
585 (base32
586 "0bzs2d98rk1xw9qwpnc7gmlbxwmwc3dg1rpn310afy9pq1k9clzi"))))
587 (build-system gnu-build-system)
588 (arguments
589 `(#:tests? #f ;no "check" target
590 #:phases
591 (modify-phases %standard-phases
592 (replace 'configure
593 (lambda* (#:key outputs #:allow-other-keys)
594 (substitute* "Makefile"
595 (("/usr/local") (assoc-ref outputs "out")))
596 #t)))))
597 (inputs
598 `(("zlib" ,zlib)))
599 (home-page "https://github.com/raboof/sfArkLib")
600 (synopsis "Library for SoundFont decompression")
601 (description
602 "SfArkLib is a C++ library for decompressing SoundFont files compressed
603 with the sfArk algorithm.")
604 (license license:gpl3+)))
605
606 (define-public sfarkxtc
607 (let ((commit "b5e0a2ba3921f019d74d4b92bd31c36dd19d2cf1"))
608 (package
609 (name "sfarkxtc")
610 (version (string-take commit 10))
611 (source (origin
612 ;; There are no release tarballs, so we just fetch the latest
613 ;; commit at this time.
614 (method git-fetch)
615 (uri (git-reference
616 (url "https://github.com/raboof/sfarkxtc.git")
617 (commit commit)))
618 (file-name (git-file-name name version))
619 (sha256
620 (base32
621 "0f5x6i46qfl6ry21s7g2p4sd4b2r1g4fb03yqi2vv4kq3saryhvj"))))
622 (build-system gnu-build-system)
623 (arguments
624 `(#:tests? #f ;no "check" target
625 #:phases
626 (modify-phases %standard-phases
627 (replace 'configure
628 (lambda* (#:key outputs #:allow-other-keys)
629 (substitute* "Makefile"
630 (("/usr/local") (assoc-ref outputs "out")))
631 #t)))))
632 (inputs
633 `(("zlib" ,zlib)
634 ("sfarklib" ,sfarklib)))
635 (home-page "https://github.com/raboof/sfarkxtc")
636 (synopsis "Basic sfArk decompressor")
637 (description "SfArk extractor converts SoundFonts in the compressed legacy
638 sfArk file format to the uncompressed sf2 format.")
639 (license license:gpl3+))))
640
641 (define-public libmspack
642 (package
643 (name "libmspack")
644 (version "0.6")
645 (source
646 (origin
647 (method url-fetch)
648 (uri (string-append "http://www.cabextract.org.uk/libmspack/libmspack-"
649 version "alpha.tar.gz"))
650 (sha256
651 (base32 "08gr2pcinas6bdqz3k0286g5cnksmcx813skmdwyca6bmj1fxnqy"))))
652 (build-system gnu-build-system)
653 (home-page "http://www.cabextract.org.uk/libmspack/")
654 (synopsis "Compression tools for some formats used by Microsoft")
655 (description
656 "The purpose of libmspack is to provide both compression and
657 decompression of some loosely related file formats used by Microsoft.")
658 (license license:lgpl2.1+)))
659
660 (define-public perl-compress-raw-bzip2
661 (package
662 (name "perl-compress-raw-bzip2")
663 (version "2.081")
664 (source
665 (origin
666 (method url-fetch)
667 (uri (string-append "mirror://cpan/authors/id/P/PM/PMQS/"
668 "Compress-Raw-Bzip2-" version ".tar.gz"))
669 (sha256
670 (base32
671 "081mpkjy688lg48997fqh3d7ja12vazmz02fw84495civg4vb4l6"))))
672 (build-system perl-build-system)
673 ;; TODO: Use our bzip2 package.
674 (home-page "http://search.cpan.org/dist/Compress-Raw-Bzip2")
675 (synopsis "Low-level interface to bzip2 compression library")
676 (description "This module provides a Perl interface to the bzip2
677 compression library.")
678 (license license:perl-license)))
679
680 (define-public perl-compress-raw-zlib
681 (package
682 (name "perl-compress-raw-zlib")
683 (version "2.081")
684 (source
685 (origin
686 (method url-fetch)
687 (uri (string-append "mirror://cpan/authors/id/P/PM/PMQS/"
688 "Compress-Raw-Zlib-" version ".tar.gz"))
689 (sha256
690 (base32
691 "06rsm9ahp20xfyvd3jc69sd0k8vqysryxc6apzdbn96jbcsdwmp1"))))
692 (build-system perl-build-system)
693 (inputs
694 `(("zlib" ,zlib)))
695 (arguments
696 `(#:phases (modify-phases %standard-phases
697 (add-before
698 'configure 'configure-zlib
699 (lambda* (#:key inputs #:allow-other-keys)
700 (call-with-output-file "config.in"
701 (lambda (port)
702 (format port "
703 BUILD_ZLIB = False
704 INCLUDE = ~a/include
705 LIB = ~:*~a/lib
706 OLD_ZLIB = False
707 GZIP_OS_CODE = AUTO_DETECT"
708 (assoc-ref inputs "zlib")))))))))
709 (home-page "http://search.cpan.org/dist/Compress-Raw-Zlib")
710 (synopsis "Low-level interface to zlib compression library")
711 (description "This module provides a Perl interface to the zlib
712 compression library.")
713 (license license:perl-license)))
714
715 (define-public perl-io-compress
716 (package
717 (name "perl-io-compress")
718 (version "2.081")
719 (source
720 (origin
721 (method url-fetch)
722 (uri (string-append "mirror://cpan/authors/id/P/PM/PMQS/"
723 "IO-Compress-" version ".tar.gz"))
724 (sha256
725 (base32
726 "1na66ns1g3nni0m9q5494ym4swr21hfgpv88mw8wbj2daiswf4aj"))))
727 (build-system perl-build-system)
728 (propagated-inputs
729 `(("perl-compress-raw-zlib" ,perl-compress-raw-zlib) ; >=2.081
730 ("perl-compress-raw-bzip2" ,perl-compress-raw-bzip2))) ; >=2.081
731 (home-page "http://search.cpan.org/dist/IO-Compress")
732 (synopsis "IO Interface to compressed files/buffers")
733 (description "IO-Compress provides a Perl interface to allow reading and
734 writing of compressed data created with the zlib and bzip2 libraries.")
735 (license license:perl-license)))
736
737 (define-public lz4
738 (package
739 (name "lz4")
740 (version "1.8.1.2")
741 (source
742 (origin
743 (method url-fetch)
744 (uri (string-append "https://github.com/lz4/lz4/archive/"
745 "v" version ".tar.gz"))
746 (sha256
747 (base32
748 "1y93h6dyi3026gvpzdv310ldcylnnhwf32n75mdjf8x9fvkskwqj"))
749 (file-name (string-append name "-" version ".tar.gz"))))
750 (build-system gnu-build-system)
751 (native-inputs `(("valgrind" ,valgrind))) ; for tests
752 (arguments
753 `(#:test-target "test"
754 #:make-flags (list "CC=gcc"
755 (string-append "prefix=" (assoc-ref %outputs "out")))
756 #:phases (modify-phases %standard-phases
757 (delete 'configure)))) ; no configure script
758 (home-page "https://www.lz4.org")
759 (synopsis "Compression algorithm focused on speed")
760 (description "LZ4 is a lossless compression algorithm, providing
761 compression speed at 400 MB/s per core (0.16 Bytes/cycle). It also features an
762 extremely fast decoder, with speed in multiple GB/s per core (0.71 Bytes/cycle).
763 A high compression derivative, called LZ4_HC, is also provided. It trades CPU
764 time for compression ratio.")
765 ;; The libraries (lz4, lz4hc, and xxhash) are BSD licenced. The command
766 ;; line interface programs (lz4, fullbench, fuzzer, datagen) are GPL2+.
767 (license (list license:bsd-2 license:gpl2+))))
768
769 (define-public python-lz4
770 (package
771 (name "python-lz4")
772 (version "0.10.1")
773 (source
774 (origin
775 (method url-fetch)
776 (uri (pypi-uri "lz4" version))
777 (sha256
778 (base32
779 "0ghv1xbaq693kgww1x9c22bplz479ls9szjsaa4ig778ls834hm0"))))
780 (build-system python-build-system)
781 (native-inputs
782 `(("python-nose" ,python-nose)
783 ("python-setuptools-scm" ,python-setuptools-scm)))
784 (home-page "https://github.com/python-lz4/python-lz4")
785 (synopsis "LZ4 bindings for Python")
786 (description
787 "This package provides python bindings for the lz4 compression library
788 by Yann Collet. The project contains bindings for the LZ4 block format and
789 the LZ4 frame format.")
790 (license license:bsd-3)))
791
792 (define-public python2-lz4
793 (package-with-python2 python-lz4))
794
795 (define-public python-lzstring
796 (package
797 (name "python-lzstring")
798 (version "1.0.3")
799 (source
800 (origin
801 (method url-fetch)
802 (uri (pypi-uri "lzstring" version))
803 (sha256
804 (base32
805 "1d3ck454y41mii0gcjabpmp2skb7n0f9zk232gycqdv8z2jxakfm"))))
806 (build-system python-build-system)
807 (propagated-inputs
808 `(("python-future" ,python-future)))
809 (home-page "https://github.com/gkovacs/lz-string-python")
810 (synopsis "String compression")
811 (description "Lz-string is a string compressor library for Python.")
812 (license license:expat)))
813
814 (define-public python2-lzstring
815 (package-with-python2 python-lzstring))
816
817 (define-public squashfs-tools
818 (package
819 (name "squashfs-tools")
820 (version "4.3")
821 (source (origin
822 (method url-fetch)
823 (uri (string-append "mirror://sourceforge/squashfs/squashfs/"
824 "squashfs" version "/"
825 "squashfs" version ".tar.gz"))
826 (sha256
827 (base32
828 "1xpklm0y43nd9i6jw43y2xh5zvlmj9ar2rvknh0bh7kv8c95aq0d"))))
829 (build-system gnu-build-system)
830 (arguments
831 '(#:tests? #f ; no check target
832 #:make-flags
833 (list "CC=gcc"
834 "XZ_SUPPORT=1"
835 "LZO_SUPPORT=1"
836 "LZ4_SUPPORT=1"
837 (string-append "INSTALL_DIR=" %output "/bin"))
838 #:phases
839 (modify-phases %standard-phases
840 (replace 'configure
841 (lambda _
842 (chdir "squashfs-tools"))))))
843 (inputs
844 `(("lz4" ,lz4)
845 ("lzo" ,lzo)
846 ("xz" ,xz)
847 ("zlib" ,zlib)))
848 (home-page "http://squashfs.sourceforge.net/")
849 (synopsis "Tools to create and extract squashfs file systems")
850 (description
851 "Squashfs is a highly compressed read-only file system for Linux. It uses
852 zlib to compress files, inodes, and directories. All blocks are packed to
853 minimize the data overhead, and block sizes of between 4K and 1M are supported.
854 It is intended to be used for archival use, for live CDs, and for embedded
855 systems where low overhead is needed. This package allows you to create and
856 extract such file systems.")
857 (license license:gpl2+)))
858
859 ;; We need this for building squashfs images with symlinks.
860 (define-public squashfs-tools-next
861 (let ((commit "fb33dfc32b131a1162dcf0e35bd88254ae10e265")
862 (revision "1"))
863 (package (inherit squashfs-tools)
864 (name "squashfs-tools-next")
865 (version (string-append "4.3-" revision (string-take commit 7)))
866 (source (origin
867 (method git-fetch)
868 (uri (git-reference
869 (url "https://github.com/plougher/squashfs-tools.git")
870 (commit commit)))
871 (file-name (git-file-name name version))
872 (sha256
873 (base32
874 "1x2skf8hxzfch978nzx5mh46d4hhi6gl22270hiarjszsjk3bnsx")))))))
875
876 (define-public pigz
877 (package
878 (name "pigz")
879 (version "2.4")
880 (source (origin
881 (method url-fetch)
882 (uri (string-append "http://zlib.net/pigz/"
883 name "-" version ".tar.gz"))
884 (sha256
885 (base32
886 "0wsgw5vwl23jrnpsvd8v3xcp5k4waw5mk0164fynjhkv58i1dy54"))))
887 (build-system gnu-build-system)
888 (arguments
889 `(#:phases
890 (modify-phases %standard-phases
891 (delete 'configure)
892 (replace 'install
893 (lambda* (#:key outputs #:allow-other-keys)
894 (let* ((out (assoc-ref outputs "out"))
895 (bin (string-append out "/bin"))
896 (man (string-append out "/share/man/man1")))
897 (install-file "pigz" bin)
898 (symlink "pigz" (string-append bin "/unpigz"))
899 (install-file "pigz.1" man)
900 #t))))
901 #:make-flags (list "CC=gcc")
902 #:test-target "tests"))
903 (inputs `(("zlib" ,zlib)))
904 (home-page "https://zlib.net/pigz/")
905 (synopsis "Parallel implementation of gzip")
906 (description
907 "This package provides a parallel implementation of gzip that exploits
908 multiple processors and multiple cores when compressing data.")
909
910 ;; Things under zopfli/ are under ASL2.0, but 4 files at the top-level,
911 ;; written by Mark Adler, are under another non-copyleft license.
912 (license license:asl2.0)))
913
914 (define-public pixz
915 (package
916 (name "pixz")
917 (version "1.0.6")
918 (source (origin
919 (method url-fetch)
920 (uri (string-append
921 "https://github.com/vasi/pixz/releases/download/v" version
922 "/pixz-" version ".tar.xz"))
923 (sha256
924 (base32
925 "1s3j7zw6j5zi3fhdxg287ndr3wf6swac7z21mqd1pyiln530gi82"))))
926 (build-system gnu-build-system)
927 (native-inputs
928 `(("pkg-config" ,pkg-config)
929 ("libarchive" ,libarchive)))
930 (home-page "https://github.com/vasi/pixz")
931 (synopsis "Parallel indexing implementation of LZMA")
932 (description
933 "The existing XZ Utils provide great compression in the .xz file format,
934 but they produce just one big block of compressed data. Pixz instead produces
935 a collection of smaller blocks which makes random access to the original data
936 possible and can compress in parallel. This is especially useful for large
937 tarballs.")
938 (license license:bsd-2)))
939
940 (define-public brotli
941 (let ((commit "e992cce7a174d6e2b3486616499d26bb0bad6448")
942 (revision "1"))
943 (package
944 (name "brotli")
945 (version (string-append "0.1-" revision "."
946 (string-take commit 7)))
947 (source (origin
948 (method git-fetch)
949 (uri (git-reference
950 (url "https://github.com/bagder/libbrotli.git")
951 (commit commit)
952 (recursive? #t)))
953 (file-name (string-append name "-" version ".tar.xz"))
954 (sha256
955 (base32
956 "1qxxsasvwbbbh6dl3138y9h3fg0q2v7xdk5jjc690bdg7g1wrj6n"))
957 (modules '((guix build utils)))
958 (snippet '(begin
959 ;; This is a recursive submodule that is
960 ;; unnecessary for this package, so delete it.
961 (delete-file-recursively "brotli/terryfy")
962 #t))))
963 (build-system gnu-build-system)
964 (native-inputs
965 `(("autoconf" ,autoconf)
966 ("automake" ,automake)
967 ("libtool" ,libtool)))
968 (arguments
969 `(#:phases (modify-phases %standard-phases
970 (add-after 'unpack 'autogen
971 (lambda _
972 (mkdir "m4")
973 (invoke "autoreconf" "-vfi"))))))
974 (home-page "https://github.com/bagder/libbrotli/")
975 (synopsis "Implementation of the Brotli compression algorithm")
976 (description
977 "Brotli is a general-purpose lossless compression algorithm. It is
978 similar in speed to deflate but offers denser compression. This package
979 provides encoder and a decoder libraries: libbrotlienc and libbrotlidec,
980 respectively, based on the reference implementation from Google.")
981 (license license:expat))))
982
983 (define-public cabextract
984 (package
985 (name "cabextract")
986 (version "1.6")
987 (source (origin
988 (method url-fetch)
989 (uri (string-append
990 "http://cabextract.org.uk/cabextract-" version ".tar.gz"))
991 (sha256
992 (base32
993 "1ysmmz25fjghq7mxb2anyyvr1ljxqxzi4piwjhk0sdamcnsn3rnf"))))
994 (build-system gnu-build-system)
995 (arguments '(#:configure-flags '("--with-external-libmspack")))
996 (native-inputs
997 `(("pkg-config" ,pkg-config)))
998 (inputs
999 `(("libmspack" ,libmspack)))
1000 (home-page "http://www.cabextract.org.uk/")
1001 (synopsis "Tool to unpack Cabinet archives")
1002 (description "Extracts files out of Microsoft Cabinet (.cab) archives")
1003 ;; Some source files specify gpl2+, lgpl2+, however COPYING is gpl3.
1004 (license license:gpl3+)))
1005
1006 (define-public xdelta
1007 (package
1008 (name "xdelta")
1009 (version "3.1.0")
1010 (source
1011 (origin
1012 (method url-fetch)
1013 (uri (string-append "https://github.com/jmacd/xdelta/archive/v"
1014 version ".tar.gz"))
1015 (sha256
1016 (base32
1017 "17g2pbbqy6h20qgdjq7ykib7kg5ajh8fwbsfgyjqg8pwg19wy5bm"))
1018 (file-name (string-append name "-" version ".tar.gz"))
1019 (snippet
1020 ;; This file isn't freely distributable and has no effect on building.
1021 '(begin
1022 (delete-file "xdelta3/draft-korn-vcdiff.txt")
1023 #t))))
1024 (build-system gnu-build-system)
1025 (native-inputs
1026 `(("autoconf" ,autoconf)
1027 ("automake" ,automake)))
1028 (arguments
1029 `(#:phases
1030 (modify-phases %standard-phases
1031 (add-after 'unpack 'enter-build-directory
1032 (lambda _ (chdir "xdelta3") #t))
1033 (add-after 'enter-build-directory 'autoconf
1034 (lambda _ (invoke "autoreconf" "-vfi"))))))
1035 (home-page "http://xdelta.org")
1036 (synopsis "Delta encoder for binary files")
1037 (description "xdelta encodes only the differences between two binary files
1038 using the VCDIFF algorithm and patch file format described in RFC 3284. It can
1039 also be used to apply such patches. xdelta is similar to @command{diff} and
1040 @command{patch}, but is not limited to plain text and does not generate
1041 human-readable output.")
1042 (license license:asl2.0)))
1043
1044 (define-public lrzip
1045 (package
1046 (name "lrzip")
1047 (version "0.631")
1048 (source
1049 (origin
1050 (method url-fetch)
1051 (uri (string-append
1052 "http://ck.kolivas.org/apps/lrzip/lrzip-" version ".tar.bz2"))
1053 (sha256
1054 (base32
1055 "0mb449vmmwpkalq732jdyginvql57nxyd31sszb108yps1lf448d"))
1056 (patches (search-patches "lrzip-CVE-2017-8842.patch"))))
1057 (build-system gnu-build-system)
1058 (native-inputs
1059 `(;; nasm is only required when building for 32-bit x86 platforms
1060 ,@(if (string-prefix? "i686" (or (%current-target-system)
1061 (%current-system)))
1062 `(("nasm" ,nasm))
1063 '())
1064 ("perl" ,perl)))
1065 (inputs
1066 `(("bzip2" ,bzip2)
1067 ("lzo" ,lzo)
1068 ("zlib" ,zlib)))
1069 (home-page "http://ck.kolivas.org/apps/lrzip/")
1070 (synopsis "Large file compressor with a very high compression ratio")
1071 (description "lrzip is a compression utility that uses long-range
1072 redundancy reduction to improve the subsequent compression ratio of
1073 larger files. It can then further compress the result with the ZPAQ or
1074 LZMA algorithms for maximum compression, or LZO for maximum speed. This
1075 choice between size or speed allows for either better compression than
1076 even LZMA can provide, or a higher speed than gzip while compressing as
1077 well as bzip2.")
1078 (license (list license:gpl3+
1079 license:public-domain)))) ; most files in lzma/
1080
1081 (define-public bitshuffle
1082 (package
1083 (name "bitshuffle")
1084 (version "0.3.4")
1085 (source (origin
1086 (method url-fetch)
1087 (uri (pypi-uri "bitshuffle" version))
1088 (sha256
1089 (base32
1090 "0ydawb01ghsvmw0lraczhrgvkjj97bpg98f1qqs1cnfp953mdd5v"))))
1091 (build-system python-build-system)
1092 (arguments
1093 `(#:tests? #f)) ; fail: https://github.com/h5py/h5py/issues/769
1094 (inputs
1095 `(("numpy" ,python-numpy)
1096 ("h5py" ,python-h5py)
1097 ("hdf5" ,hdf5)))
1098 (native-inputs
1099 `(("cython" ,python-cython)))
1100 (home-page "https://github.com/kiyo-masui/bitshuffle")
1101 (synopsis "Filter for improving compression of typed binary data")
1102 (description "Bitshuffle is an algorithm that rearranges typed, binary data
1103 for improving compression, as well as a python/C package that implements this
1104 algorithm within the Numpy framework.")
1105 (license license:expat)))
1106
1107 (define-public snappy
1108 (package
1109 (name "snappy")
1110 (version "1.1.7")
1111 (source (origin
1112 (method url-fetch)
1113 (uri (string-append "https://github.com/google/snappy/archive/"
1114 version ".tar.gz"))
1115 (file-name (string-append "snappy-" version ".tar.gz"))
1116 (sha256
1117 (base32
1118 "1m7rcdqzkys5lspj8jcsaah8w33zh28s771bw0ga2lgzfgl05yix"))))
1119 (build-system cmake-build-system)
1120 (arguments
1121 `(#:configure-flags '("-DBUILD_SHARED_LIBS=ON")))
1122 (home-page "https://github.com/google/snappy")
1123 (synopsis "Fast compressor/decompressor")
1124 (description "Snappy is a compression/decompression library. It does not
1125 aim for maximum compression, or compatibility with any other compression library;
1126 instead, it aims for very high speeds and reasonable compression. For instance,
1127 compared to the fastest mode of zlib, Snappy is an order of magnitude faster
1128 for most inputs, but the resulting compressed files are anywhere from 20% to
1129 100% bigger.")
1130 (license license:asl2.0)))
1131
1132 (define bitshuffle-for-snappy
1133 (package
1134 (inherit bitshuffle)
1135 (name "bitshuffle-for-snappy")
1136 (build-system gnu-build-system)
1137 (arguments
1138 `(#:tests? #f
1139 #:phases
1140 (modify-phases %standard-phases
1141 (replace 'configure
1142 (lambda* (#:key outputs #:allow-other-keys)
1143 (with-output-to-file "Makefile"
1144 (lambda _
1145 (format #t "\
1146 libbitshuffle.so: src/bitshuffle.o src/bitshuffle_core.o src/iochain.o lz4/lz4.o
1147 \tgcc -O3 -ffast-math -std=c99 -o $@ -shared -fPIC $^
1148
1149 %.o: %.c
1150 \tgcc -O3 -ffast-math -std=c99 -fPIC -Isrc -Ilz4 -c $< -o $@
1151
1152 PREFIX:=~a
1153 LIBDIR:=$(PREFIX)/lib
1154 INCLUDEDIR:=$(PREFIX)/include
1155
1156 install: libbitshuffle.so
1157 \tinstall -dm755 $(LIBDIR)
1158 \tinstall -dm755 $(INCLUDEDIR)
1159 \tinstall -m755 libbitshuffle.so $(LIBDIR)
1160 \tinstall -m644 src/bitshuffle.h $(INCLUDEDIR)
1161 \tinstall -m644 src/bitshuffle_core.h $(INCLUDEDIR)
1162 \tinstall -m644 src/iochain.h $(INCLUDEDIR)
1163 \tinstall -m644 lz4/lz4.h $(INCLUDEDIR)
1164 " (assoc-ref outputs "out"))))
1165 #t)))))
1166 (inputs '())
1167 (native-inputs '())))
1168
1169 (define-public java-snappy
1170 (package
1171 (name "java-snappy")
1172 (version "1.1.7")
1173 (source (origin
1174 (method url-fetch)
1175 (uri (string-append "https://github.com/xerial/snappy-java/archive/"
1176 version ".tar.gz"))
1177 (file-name (string-append name "-" version ".tar.gz"))
1178 (sha256
1179 (base32
1180 "0q4kxz2n97czf6g5gzq0d8yz22cgiaj7wp51rzsswh3bi99bpgg5"))))
1181 (build-system ant-build-system)
1182 (arguments
1183 `(#:jar-name "snappy.jar"
1184 #:source-dir "src/main/java"
1185 #:phases
1186 (modify-phases %standard-phases
1187 (add-before 'build 'remove-binaries
1188 (lambda _
1189 (delete-file "lib/org/xerial/snappy/OSInfo.class")
1190 (delete-file-recursively "src/main/resources/org/xerial/snappy/native")
1191 #t))
1192 (add-before 'build 'build-jni
1193 (lambda _
1194 ;; Rebuild one of the binaries we removed earlier
1195 (invoke "javac" "src/main/java/org/xerial/snappy/OSInfo.java"
1196 "-d" "lib")
1197 ;; Link to the dynamic bitshuffle and snappy, not the static ones
1198 (substitute* "Makefile.common"
1199 (("-shared")
1200 "-shared -lbitshuffle -lsnappy"))
1201 (substitute* "Makefile"
1202 ;; Don't try to use git, don't download bitshuffle source
1203 ;; and don't build it.
1204 (("\\$\\(SNAPPY_GIT_UNPACKED\\) ")
1205 "")
1206 ((": \\$\\(SNAPPY_GIT_UNPACKED\\)")
1207 ":")
1208 (("\\$\\(BITSHUFFLE_UNPACKED\\) ")
1209 "")
1210 ((": \\$\\(SNAPPY_SOURCE_CONFIGURED\\)") ":")
1211 ;; What we actually want to build
1212 (("SNAPPY_OBJ:=.*")
1213 "SNAPPY_OBJ:=$(addprefix $(SNAPPY_OUT)/, \
1214 SnappyNative.o BitShuffleNative.o)\n")
1215 ;; Since we removed the directory structure in "native" during
1216 ;; the previous phase, we need to recreate it.
1217 (("NAME\\): \\$\\(SNAPPY_OBJ\\)")
1218 "NAME): $(SNAPPY_OBJ)\n\t@mkdir -p $(@D)"))
1219 ;; Finally we can run the Makefile to build the dynamic library.
1220 ;; Use the -nocmake target to avoid a dependency on cmake,
1221 ;; which in turn requires the "git_unpacked" directory.
1222 (invoke "make" "native-nocmake")))
1223 ;; Once we have built the shared library, we need to place it in the
1224 ;; "build" directory so it can be added to the jar file.
1225 (add-after 'build-jni 'copy-jni
1226 (lambda _
1227 (copy-recursively "src/main/resources/org/xerial/snappy/native"
1228 "build/classes/org/xerial/snappy/native")))
1229 (add-before 'check 'fix-failing
1230 (lambda _
1231 (with-directory-excursion "src/test/java/org/xerial/snappy"
1232 ;; This package assumes maven build, which puts results in "target".
1233 ;; We put them in "build" instead, so fix that.
1234 (substitute* "SnappyLoaderTest.java"
1235 (("target/classes") "build/classes"))
1236 ;; This requires Hadoop, which is not in Guix yet.
1237 (delete-file "SnappyHadoopCompatibleOutputStreamTest.java"))
1238 #t)))))
1239 (inputs
1240 `(("osgi-framework" ,java-osgi-framework)))
1241 (propagated-inputs
1242 `(("bitshuffle" ,bitshuffle-for-snappy)
1243 ("snappy" ,snappy)))
1244 (native-inputs
1245 `(("junit" ,java-junit)
1246 ("hamcrest" ,java-hamcrest-core)
1247 ("xerial-core" ,java-xerial-core)
1248 ("classworlds" ,java-plexus-classworlds)
1249 ("commons-lang" ,java-commons-lang)
1250 ("commons-io" ,java-commons-io)
1251 ("perl" ,perl)))
1252 (home-page "https://github.com/xerial/snappy-java")
1253 (synopsis "Compression/decompression algorithm in Java")
1254 (description "Snappy-java is a Java port of the snappy, a fast C++
1255 compresser/decompresser.")
1256 (license license:asl2.0)))
1257
1258 (define-public java-snappy-1
1259 (package
1260 (inherit java-snappy)
1261 (version "1.0.3-rc3")
1262 (source (origin
1263 (method url-fetch)
1264 (uri (string-append "https://github.com/xerial/snappy-java/archive/"
1265 "snappy-java-" version ".tar.gz"))
1266 (sha256
1267 (base32
1268 "08hsxlqidiqck0q57fshwyv3ynyxy18vmhrai9fyc8mz17m7gsa3"))))
1269 (arguments
1270 `(#:jar-name "snappy.jar"
1271 #:source-dir "src/main/java"
1272 #:phases
1273 (modify-phases %standard-phases
1274 (add-before 'build 'remove-binaries
1275 (lambda _
1276 (delete-file "lib/org/xerial/snappy/OSInfo.class")
1277 (delete-file-recursively "src/main/resources/org/xerial/snappy/native")
1278 #t))
1279 (add-before 'build 'build-jni
1280 (lambda _
1281 ;; Rebuild one of the binaries we removed earlier
1282 (invoke "javac" "src/main/java/org/xerial/snappy/OSInfo.java"
1283 "-d" "lib")
1284 ;; Link to the dynamic snappy, not the static ones
1285 (substitute* "Makefile.common"
1286 (("-shared") "-shared -lsnappy"))
1287 (substitute* "Makefile"
1288 ;; Don't download the sources here.
1289 (("\\$\\(SNAPPY_UNPACKED\\) ") "")
1290 ((": \\$\\(SNAPPY_UNPACKED\\) ") ":")
1291 ;; What we actually want to build
1292 (("SNAPPY_OBJ:=.*")
1293 "SNAPPY_OBJ:=$(addprefix $(SNAPPY_OUT)/, SnappyNative.o)\n")
1294 ;; Since we removed the directory structure in "native" during
1295 ;; the previous phase, we need to recreate it.
1296 (("NAME\\): \\$\\(SNAPPY_OBJ\\)")
1297 "NAME): $(SNAPPY_OBJ)\n\t@mkdir -p $(@D)"))
1298 ;; Finally we can run the Makefile to build the dynamic library.
1299 (invoke "make" "native")))
1300 ;; Once we have built the shared library, we need to place it in the
1301 ;; "build" directory so it can be added to the jar file.
1302 (add-after 'build-jni 'copy-jni
1303 (lambda _
1304 (copy-recursively "src/main/resources/org/xerial/snappy/native"
1305 "build/classes/org/xerial/snappy/native")
1306 #t))
1307 (add-before 'check 'fix-tests
1308 (lambda _
1309 (mkdir-p "src/test/resources/org/xerial/snappy/")
1310 (copy-recursively "src/test/java/org/xerial/snappy/testdata"
1311 "src/test/resources/org/xerial/snappy/testdata")
1312 (install-file "src/test/java/org/xerial/snappy/alice29.txt"
1313 "src/test/resources/org/xerial/snappy/")
1314 #t)))))))
1315
1316 (define-public java-iq80-snappy
1317 (package
1318 (name "java-iq80-snappy")
1319 (version "0.4")
1320 (source (origin
1321 (method url-fetch)
1322 (uri (string-append "https://github.com/dain/snappy/archive/snappy-"
1323 version ".tar.gz"))
1324 (sha256
1325 (base32
1326 "0rb3zhci7w9wzd65lfnk7p3ip0n6gb58a9qpx8n7r0231gahyamf"))))
1327 (build-system ant-build-system)
1328 (arguments
1329 `(#:jar-name "iq80-snappy.jar"
1330 #:source-dir "src/main/java"
1331 #:test-dir "src/test"
1332 #:jdk ,icedtea-8
1333 #:phases
1334 (modify-phases %standard-phases
1335 (replace 'check
1336 (lambda _
1337 (define (test class)
1338 (invoke "java" "-cp" (string-append (getenv "CLASSPATH")
1339 ":build/classes"
1340 ":build/test-classes")
1341 "-Dtest.resources.dir=src/test/resources"
1342 "org.testng.TestNG" "-testclass"
1343 class))
1344 (invoke "ant" "compile-tests")
1345 (test "org.iq80.snappy.SnappyFramedStreamTest")
1346 (test "org.iq80.snappy.SnappyStreamTest")))
1347 (add-before 'build 'remove-hadoop-dependency
1348 (lambda _
1349 ;; We don't have hadoop
1350 (delete-file "src/main/java/org/iq80/snappy/HadoopSnappyCodec.java")
1351 (delete-file "src/test/java/org/iq80/snappy/TestHadoopSnappyCodec.java")
1352 #t)))))
1353 (home-page "https://github.com/dain/snappy")
1354 (native-inputs
1355 `(("guava" ,java-guava)
1356 ("java-snappy" ,java-snappy)
1357 ("hamcrest" ,java-hamcrest-core)
1358 ("testng" ,java-testng)))
1359 (synopsis "Java port of the Snappy (de)compressor")
1360 (description
1361 "Iq80-snappy is a port of the Snappy compressor and decompressor rewritten
1362 in pure Java. This compression code produces a byte-for-byte exact copy of the
1363 output created by the original C++ code, and is extremely fast.")
1364 (license license:asl2.0)))
1365
1366 (define-public java-jbzip2
1367 (package
1368 (name "java-jbzip2")
1369 (version "0.9.1")
1370 (source (origin
1371 (method url-fetch)
1372 (uri (string-append "https://storage.googleapis.com/"
1373 "google-code-archive-source/v2/"
1374 "code.google.com/jbzip2/"
1375 "source-archive.zip"))
1376 (file-name (string-append name "-" version ".zip"))
1377 (sha256
1378 (base32
1379 "0ncmhlqmrfmj96nqf6p77b9ws35lcfsvpfxzwxi2asissc83z1l3"))))
1380 (build-system ant-build-system)
1381 (native-inputs
1382 `(("unzip" ,unzip)
1383 ("java-junit" ,java-junit)))
1384 (arguments
1385 `(#:tests? #f ; no tests
1386 #:jar-name "jbzip2.jar"
1387 #:source-dir "tags/release-0.9.1/src"
1388 #:phases
1389 (modify-phases %standard-phases
1390 (add-after 'unpack 'fix-encoding-problems
1391 (lambda _
1392 ;; Some of the files we're patching are
1393 ;; ISO-8859-1-encoded, so choose it as the default
1394 ;; encoding so the byte encoding is preserved.
1395 (with-fluids ((%default-port-encoding #f))
1396 (substitute* "tags/release-0.9.1/src/org/itadaki/bzip2/HuffmanAllocator.java"
1397 (("Milidi.") "Milidiu")))
1398 #t)))))
1399 (home-page "https://code.google.com/archive/p/jbzip2/")
1400 (synopsis "Java bzip2 compression/decompression library")
1401 (description "Jbzip2 is a Java bzip2 compression/decompression library.
1402 It can be used as a replacement for the Apache @code{CBZip2InputStream} /
1403 @code{CBZip2OutputStream} classes.")
1404 (license license:expat)))
1405
1406 (define-public p7zip
1407 (package
1408 (name "p7zip")
1409 (version "16.02")
1410 (source (origin
1411 (method url-fetch)
1412 (uri (string-append "mirror://sourceforge/" name "/" name "/"
1413 version "/" name "_" version
1414 "_src_all.tar.bz2"))
1415 (sha256
1416 (base32
1417 "07rlwbbgszq8i7m8jh3x6j2w2hc9a72dc7fmqawnqkwlwb00mcjy"))
1418 (modules '((guix build utils)))
1419 (snippet
1420 '(begin
1421 ;; Remove non-free source files
1422 (for-each delete-file
1423 (append
1424 (find-files "CPP/7zip/Compress" "Rar.*")
1425 (find-files "CPP/7zip/Crypto" "Rar.*")
1426 (find-files "DOC/unRarLicense.txt")
1427 (find-files "Utils/file_Codecs_Rar_so.py")))
1428 (delete-file-recursively "CPP/7zip/Archive/Rar")
1429 (delete-file-recursively "CPP/7zip/Compress/Rar")
1430 #t))
1431 (patches (search-patches "p7zip-CVE-2016-9296.patch"
1432 "p7zip-CVE-2017-17969.patch"
1433 "p7zip-remove-unused-code.patch"))))
1434 (build-system gnu-build-system)
1435 (arguments
1436 `(#:make-flags
1437 (list (string-append "DEST_HOME=" (assoc-ref %outputs "out")) "all3")
1438 #:phases
1439 (modify-phases %standard-phases
1440 (replace 'configure
1441 (lambda* (#:key system outputs #:allow-other-keys)
1442 (invoke "cp"
1443 (let ((system ,(or (%current-target-system)
1444 (%current-system))))
1445 (cond
1446 ((string-prefix? "x86_64" system)
1447 "makefile.linux_amd64_asm")
1448 ((string-prefix? "i686" system)
1449 "makefile.linux_x86_asm_gcc_4.X")
1450 (else
1451 "makefile.linux_any_cpu_gcc_4.X")))
1452 "makefile.machine")))
1453 (replace 'check
1454 (lambda _
1455 (invoke "make" "test")
1456 (invoke "make" "test_7z")
1457 (invoke "make" "test_7zr"))))))
1458 (inputs
1459 (let ((system (or (%current-target-system)
1460 (%current-system))))
1461 `(,@(cond ((string-prefix? "x86_64" system)
1462 `(("yasm" ,yasm)))
1463 ((string-prefix? "i686" system)
1464 `(("nasm" ,nasm)))
1465 (else '())))))
1466 (home-page "http://p7zip.sourceforge.net/")
1467 (synopsis "Command-line file archiver with high compression ratio")
1468 (description "p7zip is a command-line port of 7-Zip, a file archiver that
1469 handles the 7z format which features very high compression ratios.")
1470 (license (list license:lgpl2.1+
1471 license:gpl2+
1472 license:public-domain))))
1473
1474 (define-public gzstream
1475 (package
1476 (name "gzstream")
1477 (version "1.5")
1478 (source (origin
1479 (method url-fetch)
1480 (uri
1481 ;; No versioned URL, but last release was in 2003.
1482 "http://www.cs.unc.edu/Research/compgeom/gzstream/gzstream.tgz")
1483 (file-name (string-append name "-" version ".tgz"))
1484 (sha256
1485 (base32
1486 "00y19pqjsdj5zcrx4p9j56pl73vayfwnb7y2hvp423nx0cwv5b4r"))
1487 (modules '((guix build utils)))
1488 (snippet
1489 ;; Remove pre-compiled object.
1490 '(begin
1491 (delete-file "gzstream.o")
1492 #t))))
1493 (build-system gnu-build-system)
1494 (arguments
1495 `(#:test-target "test"
1496 #:phases
1497 (modify-phases %standard-phases
1498 (delete 'configure)
1499 (replace 'install
1500 (lambda* (#:key outputs #:allow-other-keys)
1501 (let* ((out (assoc-ref outputs "out"))
1502 (lib (string-append out "/lib"))
1503 (include (string-append out "/include")))
1504 (install-file "libgzstream.a" lib)
1505 (install-file "gzstream.h" include)
1506 #t))))))
1507 (propagated-inputs `(("zlib" ,zlib)))
1508 (home-page "http://www.cs.unc.edu/Research/compgeom/gzstream/")
1509 (synopsis "Compressed C++ iostream")
1510 (description "gzstream is a small library for providing zlib
1511 functionality in a C++ iostream.")
1512 (license license:lgpl2.1+)))
1513
1514 (define-public zpaq
1515 (package
1516 (name "zpaq")
1517 (version "7.15")
1518 (source
1519 (origin
1520 (method url-fetch/zipbomb)
1521 (uri (string-append "http://mattmahoney.net/dc/zpaq"
1522 (string-delete #\. version) ".zip"))
1523 (sha256
1524 (base32
1525 "066l94yyladlfzri877nh2dhkvspagjn3m5bmv725fmhkr9c4pp8"))
1526 (modules '((guix build utils)))
1527 (snippet
1528 ;; Delete irrelevant pre-compiled binaries.
1529 '(begin
1530 (for-each delete-file (find-files "." "\\.exe$"))
1531 #t))))
1532 (build-system gnu-build-system)
1533 (arguments
1534 `(#:phases
1535 (modify-phases %standard-phases
1536 (delete 'configure)) ; no ‘configure’ script
1537 #:make-flags
1538 (list
1539 (string-append "CPPFLAGS=-Dunix"
1540 ,(match (or (%current-target-system)
1541 (%current-system))
1542 ("x86_64-linux" "")
1543 ("i686-linux" "")
1544 (_ " -DNOJIT")))
1545 ;; These should be safe, lowest-common-denominator instruction sets,
1546 ;; allowing for some optimisation while remaining reproducible.
1547 (string-append "CXXFLAGS=-O3 -DNDEBUG"
1548 ,(match (or (%current-target-system)
1549 (%current-system))
1550 ("x86_64-linux" " -march=nocona -mtune=generic")
1551 ("i686-linux" " -march=i686 -mtune=generic")
1552 ("armhf-linux" " -mtune=generic-armv7-a")
1553 (_ "")))
1554 (string-append "PREFIX="
1555 (assoc-ref %outputs "out")))))
1556 (native-inputs
1557 `(("perl" ,perl))) ; for pod2man
1558 (home-page "http://mattmahoney.net/dc/zpaq.html")
1559 (synopsis "Incremental journaling archiver")
1560 (description "ZPAQ is a command-line archiver for realistic situations with
1561 many duplicate and already compressed files. It backs up only those files
1562 modified since the last update. All previous versions remain untouched and can
1563 be independently recovered. Identical files are only stored once (known as
1564 @dfn{de-duplication}). Archives can also be encrypted.
1565
1566 ZPAQ is intended to back up user data, not entire operating systems. It ignores
1567 owner and group IDs, ACLs, extended attributes, or special file types like
1568 devices, sockets, or named pipes. It does not follow or restore symbolic links
1569 or junctions, and always follows hard links.")
1570 (license (list license:public-domain
1571 ;; libzpaq.cpp contains a mix of public-domain and
1572 ;; expat-licenced (or ‘MIT’) code.
1573 license:expat))))
1574
1575 (define-public unshield
1576 (package
1577 (name "unshield")
1578 (version "1.4.2")
1579 (source
1580 (origin (method url-fetch)
1581 (uri (string-append "http://github.com/twogood/unshield/archive/"
1582 version ".tar.gz"))
1583 (file-name (string-append name "-" version ".tar.gz"))
1584 (sha256
1585 (base32
1586 "0x7ps644yp5dka2zhb8w0ifqmw3d255jafpzfwv8xbcpgq6fmm2x"))))
1587 (build-system cmake-build-system)
1588 (inputs
1589 `(("zlib" ,zlib)
1590 ("openssl" ,openssl)
1591 ;; test data that is otherwise downloaded with curl
1592 ("unshield-avigomanager11b22.zip"
1593 ,(origin
1594 (method url-fetch)
1595 (uri (string-append "https://www.dropbox.com/s/8r4b6752swe3nhu/"
1596 "unshield-avigomanager11b22.zip?dl=1"))
1597 (sha256
1598 (base32 "0fwq7lih04if68wpwpsk5wjqyvh32db76a41sq6gbx4dn1lc3ddn"))
1599 (file-name "unshield-avigomanager11b22.zip")))
1600 ("unshield-the-feeble-files-spanish.zip"
1601 ,(origin
1602 (method url-fetch)
1603 (uri (string-append "https://www.dropbox.com/s/1ng0z9kfxc7eb1e/"
1604 "unshield-the-feeble-files-spanish.zip?dl=1"))
1605 (sha256
1606 (base32 "1k5cw6vnpja8yjlnhx5124xrw9i8s1l539hfdqqrqz3l5gn0bnyd"))
1607 (file-name "unshield-the-feeble-files-spanish.zip")))))
1608 (native-inputs
1609 `(("unzip" ,unzip)))
1610 (arguments
1611 `(#:out-of-source? #f
1612 #:phases
1613 (modify-phases %standard-phases
1614 (add-before 'check 'pre-check
1615 (lambda* (#:key inputs #:allow-other-keys)
1616 (for-each (lambda (i)
1617 (copy-file (assoc-ref inputs i)
1618 (string-append "test/v0/" i)))
1619 '("unshield-avigomanager11b22.zip"
1620 "unshield-the-feeble-files-spanish.zip"))
1621 (substitute* (find-files "test/" "/*\\.sh")
1622 ;; Tests expect the unshield binary in a specific
1623 ;; location.
1624 (("/var/tmp/unshield/bin/unshield")
1625 (string-append (getcwd) "/src/unshield"))
1626 ;; We no longer need to download the data.
1627 ((".?URL=.*$") "")
1628 (("curl -(|f)sSL -o test.zip .*") ""))
1629 (substitute* "test/v0/avigomanager.sh"
1630 (("test.zip")
1631 (string-append (getcwd)
1632 "/test/v0/unshield-avigomanager11b22.zip")))
1633 (substitute* "test/v0/the-feeble-files-spanish.sh"
1634 (("test.zip")
1635 (string-append (getcwd)
1636 "/test/v0/unshield-the-feeble-files-spanish.zip")))
1637 #t))
1638 (replace 'check
1639 (lambda _
1640 (invoke "./run-tests.sh"))))))
1641 (home-page "https://github.com/twogood/unshield")
1642 (synopsis "Extract CAB files from InstallShield installers")
1643 (description
1644 "@command{unshield} is a tool and library for extracting @file{.cab}
1645 archives from InstallShield installers.")
1646 (license license:expat)))
1647
1648 (define-public zstd
1649 (package
1650 (name "zstd")
1651 (version "1.3.4")
1652 (source (origin
1653 (method url-fetch)
1654 (uri (string-append "https://github.com/facebook/zstd/archive/v"
1655 version ".tar.gz"))
1656 (file-name (string-append name "-" version ".tar.gz"))
1657 (sha256
1658 (base32
1659 "1a85sqk4z5b2jfp7fqkr38ibql8mdzca32lf4i3bssyjimp1pr4j"))))
1660 (build-system gnu-build-system)
1661 (arguments
1662 `(#:phases
1663 (modify-phases %standard-phases
1664 (delete 'configure)) ; no configure script
1665 #:make-flags
1666 (list "CC=gcc"
1667 (string-append "PREFIX=" (assoc-ref %outputs "out"))
1668 ;; Skip auto-detection of, and creating a dependency on, the build
1669 ;; environment's ‘xz’ for what amounts to a dubious feature anyway.
1670 "HAVE_LZMA=0"
1671 ;; Not currently detected, but be explicit & avoid surprises later.
1672 "HAVE_LZ4=0"
1673 "HAVE_ZLIB=0")))
1674 (home-page "http://zstd.net/")
1675 (synopsis "Zstandard real-time compression algorithm")
1676 (description "Zstandard (@command{zstd}) is a lossless compression algorithm
1677 that combines very fast operation with a compression ratio comparable to that of
1678 zlib. In most scenarios, both compression and decompression can be performed in
1679 ‘real time’. The compressor can be configured to provide the most suitable
1680 trade-off between compression ratio and speed, without affecting decompression
1681 speed.")
1682 (license (list license:bsd-3 ; the main top-level LICENSE file
1683 license:bsd-2 ; many files explicitly state 2-Clause
1684 license:gpl2 ; the main top-level COPYING file
1685 license:gpl3+ ; tests/gzip/*.sh
1686 license:expat ; lib/dictBuilder/divsufsort.[ch]
1687 license:public-domain ; zlibWrapper/examples/fitblk*
1688 license:zlib)))) ; zlibWrapper/{gz*.c,gzguts.h}
1689
1690 (define-public pzstd
1691 (package
1692 (name "pzstd")
1693 (version (package-version zstd))
1694 (source (package-source zstd))
1695 (build-system gnu-build-system)
1696 (native-inputs
1697 `(("googletest" ,googletest)))
1698 (arguments
1699 `(#:phases
1700 (modify-phases %standard-phases
1701 (add-after 'unpack 'enter-subdirectory
1702 (lambda _ (chdir "contrib/pzstd")))
1703 (delete 'configure) ; no configure script
1704 (add-before 'check 'compile-tests
1705 (lambda* (#:key make-flags #:allow-other-keys)
1706 (apply invoke "make" "tests" make-flags)))
1707 (add-after 'install 'install-documentation
1708 (lambda* (#:key outputs #:allow-other-keys)
1709 (let* ((out (assoc-ref outputs "out"))
1710 (doc (string-append out "/share/doc/" ,name)))
1711 (mkdir-p doc)
1712 (install-file "README.md" doc)
1713 #t))))
1714 #:make-flags
1715 (list "CC=gcc"
1716 (string-append "PREFIX=" (assoc-ref %outputs "out")))))
1717 (home-page (package-home-page zstd))
1718 (synopsis "Threaded implementation of the Zstandard compression algorithm")
1719 (description "Parallel Zstandard (PZstandard or @command{pzstd}) is a
1720 multi-threaded implementation of the @uref{http://zstd.net/, Zstandard
1721 compression algorithm}. It is fully compatible with the original Zstandard file
1722 format and command-line interface, and can be used as a drop-in replacement.
1723
1724 Compression is distributed over multiple processor cores to improve performance,
1725 as is the decompression of data compressed in this manner. Data compressed by
1726 other implementations will only be decompressed by two threads: one performing
1727 the actual decompression, the other input and output.")
1728 (license (package-license zstd))))
1729
1730 (define-public zip
1731 (package
1732 (name "zip")
1733 (version "3.0")
1734 (source
1735 (origin
1736 (method url-fetch)
1737 (uri (string-append "mirror://sourceforge/infozip"
1738 "/Zip%203.x%20%28latest%29/3.0/zip30.tar.gz"))
1739 (sha256
1740 (base32
1741 "0sb3h3067pzf3a7mlxn1hikpcjrsvycjcnj9hl9b1c3ykcgvps7h"))))
1742 (build-system gnu-build-system)
1743 (inputs `(("bzip2" ,bzip2)))
1744 (arguments
1745 `(#:tests? #f ; no test target
1746 #:make-flags (let ((out (assoc-ref %outputs "out")))
1747 (list "-f" "unix/Makefile"
1748 (string-append "prefix=" out)
1749 (string-append "MANDIR=" out "/share/man/man1")))
1750 #:phases
1751 (modify-phases %standard-phases
1752 (replace 'build
1753 (lambda* (#:key (make-flags '()) #:allow-other-keys)
1754 (apply invoke "make" "generic_gcc" make-flags)))
1755 (delete 'configure))))
1756 (home-page "http://www.info-zip.org/Zip.html")
1757 (synopsis "Compression and file packing utility")
1758 (description
1759 "Zip is a compression and file packaging/archive utility. Zip is useful
1760 for packaging a set of files for distribution, for archiving files, and for
1761 saving disk space by temporarily compressing unused files or directories.
1762 Zip puts one or more compressed files into a single ZIP archive, along with
1763 information about the files (name, path, date, time of last modification,
1764 protection, and check information to verify file integrity). An entire
1765 directory structure can be packed into a ZIP archive with a single command.
1766
1767 Zip has one compression method (deflation) and can also store files without
1768 compression. Zip automatically chooses the better of the two for each file.
1769 Compression ratios of 2:1 to 3:1 are common for text files.")
1770 (license (license:non-copyleft "file://LICENSE"
1771 "See LICENSE in the distribution."))))
1772
1773 (define-public unzip
1774 (package (inherit zip)
1775 (name "unzip")
1776 (version "6.0")
1777 (source
1778 (origin
1779 (method url-fetch)
1780 (uri (string-append "mirror://sourceforge/infozip"
1781 "/UnZip%206.x%20%28latest%29/UnZip%206.0/unzip60.tar.gz"))
1782 (sha256
1783 (base32
1784 "0dxx11knh3nk95p2gg2ak777dd11pr7jx5das2g49l262scrcv83"))
1785 (patches (search-patches "unzip-CVE-2014-8139.patch"
1786 "unzip-CVE-2014-8140.patch"
1787 "unzip-CVE-2014-8141.patch"
1788 "unzip-CVE-2014-9636.patch"
1789 "unzip-CVE-2015-7696.patch"
1790 "unzip-CVE-2015-7697.patch"
1791 "unzip-allow-greater-hostver-values.patch"
1792 "unzip-initialize-symlink-flag.patch"
1793 "unzip-remove-build-date.patch"
1794 "unzip-attribs-overflow.patch"
1795 "unzip-overflow-on-invalid-input.patch"
1796 "unzip-format-secure.patch"
1797 "unzip-overflow-long-fsize.patch"))))
1798 (build-system gnu-build-system)
1799 ;; no inputs; bzip2 is not supported, since not compiled with BZ_NO_STDIO
1800 (arguments
1801 `(#:phases (modify-phases %standard-phases
1802 (delete 'configure)
1803 (add-after 'unpack 'fortify
1804 (lambda _
1805 ;; Mitigate CVE-2018-1000035, an exploitable buffer overflow.
1806 ;; This environment variable is recommended in 'unix/Makefile'
1807 ;; for passing flags to the C compiler.
1808 (setenv "LOCAL_UNZIP" "-D_FORTIFY_SOURCE=1")
1809 #t))
1810 (replace 'build
1811 (lambda* (#:key make-flags #:allow-other-keys)
1812 (apply invoke "make"
1813 `("-j" ,(number->string
1814 (parallel-job-count))
1815 ,@make-flags
1816 "generic_gcc")))))
1817 #:make-flags (list "-f" "unix/Makefile"
1818 (string-append "prefix=" %output)
1819 (string-append "MANDIR=" %output "/share/man/man1"))))
1820 (home-page "http://www.info-zip.org/UnZip.html")
1821 (synopsis "Decompression and file extraction utility")
1822 (description
1823 "UnZip is an extraction utility for archives compressed in .zip format,
1824 also called \"zipfiles\".
1825
1826 UnZip lists, tests, or extracts files from a .zip archive. The default
1827 behaviour (with no options) is to extract into the current directory, and
1828 subdirectories below it, all files from the specified zipfile. UnZip
1829 recreates the stored directory structure by default.")
1830 (license (license:non-copyleft "file://LICENSE"
1831 "See LICENSE in the distribution."))))
1832
1833 (define-public zziplib
1834 (package
1835 (name "zziplib")
1836 (version "0.13.69")
1837 (home-page "https://github.com/gdraheim/zziplib")
1838 (source
1839 (origin
1840 (method url-fetch)
1841 (uri (string-append home-page "/archive/v" version ".tar.gz"))
1842 (sha256
1843 (base32
1844 "0i052a7shww0fzsxrdp3rd7g4mbzx7324a8ysbc0br7frpblcql4"))))
1845 (build-system gnu-build-system)
1846 (inputs
1847 `(("zlib" ,zlib)))
1848 (native-inputs `(("perl" ,perl) ; for the documentation
1849 ("pkg-config" ,pkg-config)
1850 ;; for the documentation; Python 3 not supported,
1851 ;; http://forums.gentoo.org/viewtopic-t-863161-start-0.html
1852 ("python" ,python-2)
1853 ("zip" ,zip))) ; to create test files
1854 (synopsis "Library for accessing zip files")
1855 (description
1856 "ZZipLib is a library based on zlib for accessing zip files.")
1857 ;; zziplib is dual licensed under LGPL2.0+ and MPL1.1. Some example source
1858 ;; files carry the Zlib license; see "docs/copying.html" for details.
1859 (license (list license:lgpl2.0+ license:mpl1.1))))
1860
1861 (define-public perl-archive-zip
1862 (package
1863 (name "perl-archive-zip")
1864 (version "1.60")
1865 (source
1866 (origin
1867 (method url-fetch)
1868 (uri (string-append
1869 "mirror://cpan/authors/id/P/PH/PHRED/Archive-Zip-"
1870 version ".tar.gz"))
1871 (sha256
1872 (base32
1873 "02y2ylq83hy9kgj57sc0239x65br9sm98c0chsm61s08yc2mpiza"))))
1874 (build-system perl-build-system)
1875 (native-inputs
1876 ;; For tests.
1877 `(("perl-test-mockmodule" ,perl-test-mockmodule)))
1878 (synopsis "Provides an interface to Zip archive files")
1879 (description "The @code{Archive::Zip} module allows a Perl program to
1880 create, manipulate, read, and write Zip archive files.")
1881 (home-page "http://search.cpan.org/dist/Archive-Zip/")
1882 (license license:perl-license)))
1883
1884 (define-public libzip
1885 (package
1886 (name "libzip")
1887 (version "1.3.2")
1888 (source (origin
1889 (method url-fetch)
1890 (uri (string-append
1891 "https://libzip.org/download/" name "-" version ".tar.xz"))
1892 (sha256
1893 (base32
1894 "11g1hvm2bxa2v5plakfzcwyk5hb5fz4kgrkp38l0xhnv21888xv2"))))
1895 (native-inputs
1896 `(("perl" ,perl)))
1897 (inputs
1898 `(("zlib" ,zlib)))
1899 (build-system gnu-build-system)
1900 (home-page "https://libzip.org")
1901 (synopsis "C library for reading, creating, and modifying zip archives")
1902 (description "Libzip is a C library for reading, creating, and modifying
1903 zip archives. Files can be added from data buffers, files, or compressed data
1904 copied directly from other zip archives. Changes made without closing the
1905 archive can be reverted.")
1906 (license license:bsd-3)))
1907
1908 (define-public atool
1909 (package
1910 (name "atool")
1911 (version "0.39.0")
1912 (source
1913 (origin
1914 (method url-fetch)
1915 (uri (string-append "http://savannah.nongnu.org/download/atool/atool-"
1916 version ".tar.gz"))
1917 (sha256
1918 (base32
1919 "0fvhzip2v08jgnlfpyj6rapan39xlsl1ksgq4lp8gfsai2ah1xma"))))
1920 (build-system gnu-build-system)
1921 (arguments
1922 `(#:phases
1923 (modify-phases %standard-phases
1924 (add-after 'unpack 'embed-absolute-file-name
1925 (lambda* (#:key inputs #:allow-other-keys)
1926 (substitute* "atool"
1927 (("(^\\$::cfg_path_file.*= )'file'" _ pre)
1928 (string-append pre "'" (assoc-ref inputs "file")
1929 "/bin/file'")))
1930 #t)))))
1931 (inputs
1932 `(("perl" ,perl)
1933 ("file" ,file)))
1934 (home-page "https://www.nongnu.org/atool/")
1935 (synopsis "Universal tool to manage file archives of various types")
1936 (description "The main command is @command{aunpack} which extracts files
1937 from an archive. The other commands provided are @command{apack} (to create
1938 archives), @command{als} (to list files in archives), and @command{acat} (to
1939 extract files to standard out). As @command{atool} invokes external programs
1940 to handle the archives, not all commands may be supported for a certain type
1941 of archives.")
1942 (license license:gpl2+)))
1943
1944 (define-public perl-archive-extract
1945 (package
1946 (name "perl-archive-extract")
1947 (version "0.80")
1948 (source
1949 (origin
1950 (method url-fetch)
1951 (uri (string-append "mirror://cpan/authors/id/B/BI/BINGOS/Archive-Extract-"
1952 version ".tar.gz"))
1953 (sha256
1954 (base32
1955 "1x15j1q6w6z8hqyqgap0lz4qbq2174wfhksy1fdd653ccbaw5jr5"))))
1956 (build-system perl-build-system)
1957 (home-page "http://search.cpan.org/dist/Archive-Extract/")
1958 (synopsis "Generic archive extracting mechanism")
1959 (description "It allows you to extract any archive file of the type .tar,
1960 .tar.gz, .gz, .Z, tar.bz2, .tbz, .bz2, .zip, .xz,, .txz, .tar.xz or .lzma
1961 without having to worry how it does so, or use different interfaces for each
1962 type by using either Perl modules, or command-line tools on your system.")
1963 (license license:perl-license)))
1964
1965 (define-public java-tukaani-xz
1966 (package
1967 (name "java-tukaani-xz")
1968 (version "1.6")
1969 (source (origin
1970 (method url-fetch)
1971 (uri (string-append "https://tukaani.org/xz/xz-java-" version ".zip"))
1972 (sha256
1973 (base32
1974 "1z3p1ri1gvl07inxn0agx44ck8n7wrzfmvkz8nbq3njn8r9wba8x"))))
1975 (build-system ant-build-system)
1976 (arguments
1977 `(#:tests? #f; no tests
1978 #:phases
1979 (modify-phases %standard-phases
1980 (add-after 'unpack 'chdir
1981 (lambda _
1982 ;; Our build system enters the first directory in the archive, but
1983 ;; the package is not contained in a subdirectory
1984 (chdir "..")))
1985 (replace 'install
1986 (lambda* (#:key outputs #:allow-other-keys)
1987 ;; Do we want to install *Demo.jar?
1988 (install-file "build/jar/xz.jar"
1989 (string-append
1990 (assoc-ref outputs "out")
1991 "/share/java/xz.jar")))))))
1992 (native-inputs
1993 `(("unzip" ,unzip)))
1994 (home-page "https://tukaani.org")
1995 (synopsis "XZ in Java")
1996 (description "Tukaani-xz is an implementation of xz compression/decompression
1997 algorithms in Java.")
1998 (license license:public-domain)))
1999
2000 (define-public lunzip
2001 (package
2002 (name "lunzip")
2003 (version "1.10")
2004 (source
2005 (origin
2006 (method url-fetch)
2007 (uri (string-append "mirror://savannah/lzip/"
2008 name "/" name "-" version ".tar.gz"))
2009 (sha256
2010 (base32 "1iw59br6nsxs7l1p875h8w3vxwr04xfhg5zyal64crvamhxkj5kl"))))
2011 (build-system gnu-build-system)
2012 (arguments
2013 `(#:configure-flags
2014 (list "CC=gcc")))
2015 (home-page "https://www.nongnu.org/lzip/lunzip.html")
2016 (synopsis "Small, stand-alone lzip decompressor")
2017 (description
2018 "Lunzip is a decompressor for files in the lzip compression format (.lz),
2019 written as a single small C tool with no dependencies. This makes it
2020 well-suited to embedded and other systems without a C++ compiler, or for use in
2021 applications such as software installers that need only to decompress files,
2022 not compress them.
2023 Lunzip is intended to be fully compatible with the regular lzip package.")
2024 (license (list license:bsd-2 ; carg_parser.[ch]
2025 license:gpl2+)))) ; everything else
2026
2027 (define-public clzip
2028 (package
2029 (name "clzip")
2030 (version "1.10")
2031 (source
2032 (origin
2033 (method url-fetch)
2034 (uri (string-append "mirror://savannah/lzip/"
2035 name "/" name "-" version ".tar.gz"))
2036 (sha256
2037 (base32 "03xcmhl3dya4jrwmsqh09ikimpb36fr3vkh2bwfzz1sbcns0cdg3"))))
2038 (build-system gnu-build-system)
2039 (arguments
2040 `(#:configure-flags
2041 (list "CC=gcc")))
2042 (home-page "https://www.nongnu.org/lzip/clzip.html")
2043 (synopsis "Small, stand-alone lzip compressor and decompressor")
2044 (description
2045 "Clzip is a compressor and decompressor for files in the lzip compression
2046 format (.lz), written as a single small C tool with no dependencies. This makes
2047 it well-suited to embedded and other systems without a C++ compiler, or for use
2048 in other applications like package managers.
2049 Clzip is intended to be fully compatible with the regular lzip package.")
2050 (license (list license:bsd-2 ; carg_parser.[ch], lzd in clzip.texi
2051 license:gpl2+))))
2052
2053 (define-public lzlib
2054 (package
2055 (name "lzlib")
2056 (version "1.10")
2057 (source
2058 (origin
2059 (method url-fetch)
2060 (uri (string-append "mirror://savannah/lzip/"
2061 name "/" name "-" version ".tar.gz"))
2062 (sha256
2063 (base32 "0hqhnj2lzqacdbmmnpy91lsm1rd9zlngs1q6s9pyahsv1a0bfshx"))))
2064 (build-system gnu-build-system)
2065 ;; The included minilzip binary is only ~16 smaller than the ‘real’ lzip.
2066 ;; It's used during the test suite, but don't be tempted to install it.
2067 (arguments
2068 `(#:configure-flags
2069 (list "CC=gcc"
2070 "--enable-shared"))) ; only static (.a) is built by default
2071 (home-page "https://www.nongnu.org/lzip/lzlib.html")
2072 (synopsis "Lzip data compression C library")
2073 (description
2074 "Lzlib is a C library for in-memory LZMA compression and decompression in
2075 the lzip format. It supports integrity checking of the decompressed data, and
2076 all functions are thread-safe. The library should never crash, even in case of
2077 corrupted input.")
2078 (license (list license:bsd-2 ; the library itself
2079 license:gpl2+)))) ; main.c (i.e. minilzip used by tests)
2080
2081 (define-public plzip
2082 (package
2083 (name "plzip")
2084 (version "1.7")
2085 (source
2086 (origin
2087 (method url-fetch)
2088 (uri (string-append "mirror://savannah/lzip/"
2089 name "/" name "-" version ".tar.gz"))
2090 (sha256
2091 (base32 "1dzjp9r7krwpsn224bhcqbzd5aj5b4556sdi9yzl2bzbk3fjrqlm"))))
2092 (build-system gnu-build-system)
2093 (inputs
2094 `(("lzlib" ,lzlib)))
2095 (home-page "https://www.nongnu.org/lzip/plzip.html")
2096 (synopsis "Parallel lossless data compressor for the lzip format")
2097 (description
2098 "Plzip is a massively parallel (multi-threaded) lossless data compressor
2099 and decompressor that uses the lzip file format (.lz). Files produced by plzip
2100 are fully compatible with lzip and can be rescued with lziprecover.
2101 On multiprocessor machines, plzip can compress and decompress large files much
2102 faster than lzip, at the cost of a slightly reduced compression ratio (0.4% to
2103 2%). The number of usable threads is limited by file size: on files of only a
2104 few MiB, plzip is no faster than lzip.
2105 Files that were compressed with regular lzip will also not be decompressed
2106 faster by plzip, unless the @code{-b} option was used: lzip usually produces
2107 single-member files which can't be decompressed in parallel.")
2108 (license (list license:bsd-2 ; arg_parser.{cc,h}
2109 license:gpl2+)))) ; everything else
2110
2111 (define-public innoextract
2112 (package
2113 (name "innoextract")
2114 (version "1.6")
2115 (source
2116 (origin
2117 (method url-fetch)
2118 (uri (string-append "https://github.com/dscharrer/innoextract/archive/"
2119 version ".tar.gz"))
2120 (sha256
2121 (base32
2122 "08sp5vbfjvq1irhhraqkn5m2x1z209r4axhx7laf1adcw30ccapi"))
2123 (file-name (string-append name "-" version ".tar.gz"))))
2124 (build-system cmake-build-system)
2125 (arguments
2126 `(#:tests? #f)) ;; No tests available.
2127 (inputs `(("boost" ,boost)
2128 ("libiconv" ,libiconv)
2129 ("xz" ,xz)))
2130 (native-inputs `(("pkg-config" ,pkg-config)))
2131 (home-page "https://constexpr.org/innoextract/")
2132 (synopsis "Tool for extracting Inno Setup installers")
2133 (description "innoextract allows extracting Inno Setup installers under
2134 non-Windows systems without running the actual installer using wine.")
2135 (license license:zlib)))
2136
2137 (define-public google-brotli
2138 (package
2139 (name "google-brotli")
2140 (version "1.0.4")
2141 (source (origin
2142 (method url-fetch)
2143 (uri (string-append "https://github.com/google/brotli/archive/v"
2144 version ".tar.gz"))
2145 (sha256
2146 (base32
2147 "1hrpmz162k4x3xm6vmbpm443jlfr1kp536p8962y2dncy7gs6s12"))))
2148 (build-system cmake-build-system)
2149 (arguments
2150 `(#:phases
2151 (modify-phases %standard-phases
2152 (add-after 'install 'rename-static-libraries
2153 ;; The build tools put a 'static' suffix on the static libraries, but
2154 ;; other applications don't know how to find these.
2155 (lambda* (#:key outputs #:allow-other-keys)
2156 (let ((lib (string-append (assoc-ref %outputs "out") "/lib/")))
2157 (rename-file (string-append lib "libbrotlicommon-static.a")
2158 (string-append lib "libbrotlicommon.a"))
2159 (rename-file (string-append lib "libbrotlidec-static.a")
2160 (string-append lib "libbrotlidec.a"))
2161 (rename-file (string-append lib "libbrotlienc-static.a")
2162 (string-append lib "libbrotlienc.a"))
2163 #t))))
2164 #:configure-flags
2165 (list ;; Defaults to "lib64" on 64-bit archs.
2166 (string-append "-DCMAKE_INSTALL_LIBDIR="
2167 (assoc-ref %outputs "out") "/lib"))))
2168 (home-page "https://github.com/google/brotli")
2169 (synopsis "General-purpose lossless compression")
2170 (description "This package provides the reference implementation of Brotli,
2171 a generic-purpose lossless compression algorithm that compresses data using a
2172 combination of a modern variant of the LZ77 algorithm, Huffman coding and 2nd
2173 order context modeling, with a compression ratio comparable to the best
2174 currently available general-purpose compression methods. It is similar in speed
2175 with @code{deflate} but offers more dense compression.
2176
2177 The specification of the Brotli Compressed Data Format is defined in RFC 7932.")
2178 (license license:expat)))
2179
2180 (define-public ucl
2181 (package
2182 (name "ucl")
2183 (version "1.03")
2184 (source (origin
2185 (method url-fetch)
2186 (uri (string-append "http://www.oberhumer.com/opensource/"
2187 name "/download/" name "-" version ".tar.gz"))
2188 (sha256
2189 (base32
2190 "0j036lkwsxvm15gr29n8wn07cqq79dswjs9k54939ms5zngjjrdq"))))
2191 (build-system gnu-build-system)
2192 (home-page "http://www.oberhumer.com/opensource/ucl/")
2193 (synopsis "Portable lossless data compression library")
2194 (description "UCL implements a number of compression algorithms that
2195 achieve an excellent compression ratio while allowing fast decompression.
2196 Decompression requires no additional memory.
2197
2198 Compared to LZO, the UCL algorithms achieve a better compression ratio but
2199 decompression is a little bit slower.")
2200 (license license:gpl2+)))
2201
2202 (define-public upx
2203 (package
2204 (name "upx")
2205 (version "3.94")
2206 (source (origin
2207 (method url-fetch)
2208 (uri (string-append "https://github.com/upx/upx/releases/download/v"
2209 version "/" name "-" version "-src.tar.xz"))
2210 (sha256
2211 (base32
2212 "08anybdliqsbsl6x835iwzljahnm9i7v26icdjkcv33xmk6p5vw1"))))
2213 (build-system gnu-build-system)
2214 (native-inputs `(("perl" ,perl)
2215 ("ucl" ,ucl)))
2216 (inputs `(("zlib" ,zlib)))
2217 (arguments
2218 `(#:make-flags
2219 (list "all"
2220 ;; CHECK_WHITESPACE does not seem to work.
2221 ;; See https://git.archlinux.org/svntogit/community.git/tree/trunk/PKGBUILD?h=packages/upx.
2222 "CHECK_WHITESPACE=true")
2223 #:phases
2224 (modify-phases %standard-phases
2225 (delete 'configure)
2226 (delete 'check)
2227 (delete 'install)
2228 (add-before 'build 'patch-exec-bin-sh
2229 (lambda _
2230 (substitute* (find-files "Makefile")
2231 (("/bin/sh") (which "sh")))
2232 (substitute* "src/Makefile"
2233 (("/bin/sh") (which "sh")))
2234 #t))
2235 (add-after 'build 'install-upx
2236 (lambda* (#:key outputs #:allow-other-keys)
2237 (let* ((out (assoc-ref outputs "out"))
2238 (bin (string-append out "/bin")))
2239 (mkdir-p bin)
2240 (copy-file "src/upx.out" (string-append bin "/upx")))
2241 #t))
2242 )))
2243 (home-page "https://upx.github.io/")
2244 (synopsis "Compression tool for executables")
2245 (description
2246 "The Ultimate Packer for eXecutables (UPX) is an executable file
2247 compressor. UPX typically reduces the file size of programs and shared
2248 libraries by around 50%--70%, thus reducing disk space, network load times,
2249 download times, and other distribution and storage costs.")
2250 (license license:gpl2+)))