1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012, 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2013 Andreas Enge <andreas@enge.fr>
4 ;;; Copyright © 2014, 2015 Mark H Weaver <mhw@netris.org>
5 ;;; Copyright © 2015 Taylan Ulrich Bayırlı/Kammer <taylanbayirli@gmail.com>
6 ;;; Copyright © 2015 Eric Bavier <bavier@member.fsf.org>
7 ;;; Copyright © 2015 Ricardo Wurmus <rekado@elephly.net>
8 ;;; Copyright © 2015 Leo Famulari <leo@famulari.name>
9 ;;; Copyright © 2015 Jeff Mickey <j@codemac.net>
10 ;;; Copyright © 2015, 2016 Efraim Flashner <efraim@flashner.co.il>
11 ;;; Copyright © 2016 Ben Woodcroft <donttrustben@gmail.com>
13 ;;; This file is part of GNU Guix.
15 ;;; GNU Guix is free software; you can redistribute it and/or modify it
16 ;;; under the terms of the GNU General Public License as published by
17 ;;; the Free Software Foundation; either version 3 of the License, or (at
18 ;;; your option) any later version.
20 ;;; GNU Guix is distributed in the hope that it will be useful, but
21 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
22 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 ;;; GNU General Public License for more details.
25 ;;; You should have received a copy of the GNU General Public License
26 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
28 (define-module (gnu packages compression)
29 #:use-module ((guix licenses) #:prefix license:)
30 #:use-module (guix utils)
31 #:use-module (guix packages)
32 #:use-module (guix download)
33 #:use-module (guix git-download)
34 #:use-module (guix build-system gnu)
35 #:use-module (guix build-system perl)
36 #:use-module (gnu packages backup)
37 #:use-module (gnu packages base)
38 #:use-module (gnu packages perl)
39 #:use-module (gnu packages pkg-config)
40 #:use-module (gnu packages valgrind)
41 #:use-module ((srfi srfi-1) #:select (last)))
50 (uri (list (string-append "http://zlib.net/zlib-"
52 (string-append "mirror://sourceforge/libpng/zlib-"
56 "039agw5rqvqny92cpkrfn243x2gd4xn13hs3xi6isk55d2vqqr9n"))))
57 (build-system gnu-build-system)
59 `(#:phases (alist-replace
61 (lambda* (#:key outputs #:allow-other-keys)
62 ;; Zlib's home-made `configure' fails when passed
63 ;; extra flags like `--enable-fast-install', so we need to
64 ;; invoke it with just what it understand.
65 (let ((out (assoc-ref outputs "out")))
66 ;; 'configure' doesn't understand '--host'.
67 ,@(if (%current-target-system)
68 `((setenv "CHOST" ,(%current-target-system)))
71 (system* "./configure"
72 (string-append "--prefix=" out)))))
74 (home-page "http://zlib.net/")
75 (synopsis "Compression library")
77 "zlib is designed to be a free, general-purpose, legally unencumbered --
78 that is, not covered by any patents -- lossless data-compression library for
79 use on virtually any computer hardware and operating system. The zlib data
80 format is itself portable across platforms. Unlike the LZW compression method
81 used in Unix compress(1) and in the GIF image format, the compression method
82 currently used in zlib essentially never expands the data. (LZW can double or
83 triple the file size in extreme cases.) zlib's memory footprint is also
84 independent of the input data and can be reduced, if necessary, at some cost
86 (license license:zlib)))
88 (define-public fastjar
94 (uri (string-append "mirror://savannah/fastjar/fastjar-"
98 "0iginbz2m15hcsa3x4y7v3mhk54gr1r7m3ghx0pg4n46vv2snmpi"))))
99 (build-system gnu-build-system)
100 (inputs `(("zlib" ,zlib)))
101 (home-page "http://savannah.nongnu.org/projects/fastjar")
102 (synopsis "Replacement for Sun's 'jar' utility")
104 "FastJar is an attempt to create a much faster replacement for Sun's 'jar'
105 utility. Instead of being written in Java, FastJar is written in C.")
106 (license license:gpl2+)))
108 (define-public libtar
115 "ftp://ftp.feep.net/pub/software/libtar/libtar-"
119 "1f3vx1wa69a6c5y0z0aakd81gygirdcm0vimazg433q8nyvfybja"))))
120 (build-system gnu-build-system)
121 (arguments `(#:tests? #f)) ;no "check" target
122 (synopsis "C library for manipulating POSIX tar files")
124 "libtar is a C library for manipulating POSIX tar files. It handles
125 adding and extracting files to/from a tar archive.")
126 (home-page "http://www.feep.net/libtar/")
127 (license license:bsd-3)))
135 (uri (string-append "mirror://gnu/gzip/gzip-"
139 "0zlgdm4v3dndrbiz7b67mbbj25dpwqbmbzjiycssvrfrcfvq7swp"))))
140 (build-system gnu-build-system)
141 (synopsis "General file (de)compression (using lzw)")
143 ;; FIXME: The test suite wants `less', and optionally Perl.
146 "GNU Gzip provides data compression and decompression utilities; the
147 typical extension is \".gz\". Unlike the \"zip\" format, it compresses a single
148 file; as a result, it is often used in conjunction with \"tar\", resulting in
149 \".tar.gz\" or \".tgz\", etc.")
150 (license license:gpl3+)
151 (home-page "http://www.gnu.org/software/gzip/")))
154 (let ((build-shared-lib
155 ;; Build a shared library.
156 '(lambda* (#:key inputs #:allow-other-keys)
157 (patch-makefile-SHELL "Makefile-libbz2_so")
158 (zero? (system* "make" "-f" "Makefile-libbz2_so"))))
160 '(lambda* (#:key outputs #:allow-other-keys)
161 (let* ((out (assoc-ref outputs "out"))
162 (libdir (string-append out "/lib")))
163 (for-each (lambda (file)
164 (let ((base (basename file)))
165 (format #t "installing `~a' to `~a'~%"
168 (string-append libdir "/" base))))
169 (find-files "." "^libbz2\\.so")))))
170 (set-cross-environment
171 '(lambda* (#:key target #:allow-other-keys)
172 (substitute* (find-files "." "Makefile")
174 (string-append "CC = " target "-gcc\n"))
176 (string-append "AR = " target "-ar\n"))
178 (string-append "RANLIB = " target "-ranlib\n"))
179 (("^all:(.*)test" _ prerequisites)
180 ;; Remove 'all' -> 'test' dependency.
181 (string-append "all:" prerequisites "\n"))))))
187 (uri (string-append "http://www.bzip.org/" version "/bzip2-"
191 "1kfrc7f0ja9fdn6j1y6yir6li818npy6217hvr3wzmnmzhs8z152"))))
192 (build-system gnu-build-system)
194 `(#:modules ((guix build gnu-build-system)
198 ,(if (%current-target-system)
200 ;; Cross-compilation: use the cross tools.
202 'build 'build-shared-lib ,build-shared-lib
204 'install 'install-shared-lib ,install-shared-lib
205 (alist-replace 'configure ,set-cross-environment
208 ;; Native compilation: build the shared library.
210 'build 'build-shared-lib ,build-shared-lib
212 'install 'install-shared-lib ,install-shared-lib
213 (alist-delete 'configure %standard-phases))))
215 #:make-flags (list (string-append "PREFIX="
216 (assoc-ref %outputs "out")))
218 ;; Don't attempt to run the tests when cross-compiling.
219 ,@(if (%current-target-system)
222 (synopsis "High-quality data compression program")
224 "bzip2 is a freely available, patent free (see below), high-quality data
225 compressor. It typically compresses files to within 10% to 15% of the best
226 available techniques (the PPM family of statistical compressors), whilst
227 being around twice as fast at compression and six times faster at
229 (license (license:non-copyleft "file://LICENSE"
230 "See LICENSE in the distribution."))
231 (home-page "http://www.bzip.org/"))))
233 (define-public pbzip2
239 (uri (string-append "https://launchpad.net/pbzip2/"
240 (version-major+minor version) "/" version
241 "/+download/" name "-" version ".tar.gz"))
244 "1vk6065dv3a47p86vmp8hv3n1ygd9hraz0gq89gvzlx7lmcb6fsp"))))
245 (build-system gnu-build-system)
249 `(#:tests? #f ; no tests
250 #:phases (modify-phases %standard-phases
252 #:make-flags (list (string-append "PREFIX=" %output))))
253 (home-page "http://compression.ca/pbzip2/")
254 (synopsis "Parallel bzip2 implementation")
256 "Pbzip2 is a parallel implementation of the bzip2 block-sorting file
257 compressor that uses pthreads and achieves near-linear speedup on SMP machines.
258 The output of this version is fully compatible with bzip2 v1.0.2 (i.e. anything
259 compressed with pbzip2 can be decompressed with bzip2).")
260 (license (license:non-copyleft "file://COPYING"
261 "See COPYING in the distribution."))))
269 (uri (list (string-append "http://tukaani.org/xz/xz-" version
271 (string-append "http://multiprecision.org/guix/xz-"
275 "18h2k4jndhzjs8ln3a54qdnfv59y6spxiwh9gpaqniph6iflvpvk"))))
276 (build-system gnu-build-system)
277 (synopsis "General-purpose data compression")
279 "XZ Utils is free general-purpose data compression software with high
280 compression ratio. XZ Utils were written for POSIX-like systems, but also
281 work on some not-so-POSIX systems. XZ Utils are the successor to LZMA Utils.
283 The core of the XZ Utils compression code is based on LZMA SDK, but it has
284 been modified quite a lot to be suitable for XZ Utils. The primary
285 compression algorithm is currently LZMA2, which is used inside the .xz
286 container format. With typical files, XZ Utils create 30 % smaller output
287 than gzip and 15 % smaller output than bzip2.")
288 (license (list license:gpl2+ license:lgpl2.1+)) ; bits of both
289 (home-page "http://tukaani.org/xz/")))
298 (uri (string-append "http://www.oberhumer.com/opensource/lzo/download/lzo-"
302 "0k5kpj3jnsjfxqqkblpfpx0mqcy86zs5fhjhgh2kq1hksg7ag57j"))))
303 (build-system gnu-build-system)
304 (arguments '(#:configure-flags '("--enable-shared")))
305 (home-page "http://www.oberhumer.com/opensource/lzo")
307 "Data compression library suitable for real-time data de-/compression")
309 "LZO is a data compression library which is suitable for data
310 de-/compression in real-time. This means it favours speed over
313 LZO is written in ANSI C. Both the source code and the compressed data
314 format are designed to be portable across platforms.")
315 (license license:gpl2+)))
324 (uri (string-append "http://www.lzop.org/download/lzop-"
328 "1jdjvc4yjndf7ihmlcsyln2rbnbaxa86q4jskmkmm7ylfy65nhn1"))))
329 (build-system gnu-build-system)
330 (inputs `(("lzo" ,lzo)))
331 (home-page "http://www.lzop.org/")
332 (synopsis "Compress or expand files")
334 "Lzop is a file compressor which is very similar to gzip. Lzop uses the
335 LZO data compression library for compression services, and its main advantages
336 over gzip are much higher compression and decompression speed (at the cost of
337 some compression ratio).")
338 (license license:gpl2+)))
346 (uri (string-append "mirror://savannah/lzip/lzip-"
350 "0l9724rw1l3hg2ldr3n7ihqich4m9nc6y7l302bvdj4jmxdw530j"))))
351 (build-system gnu-build-system)
352 (home-page "http://www.nongnu.org/lzip/lzip.html")
353 (synopsis "Lossless data compressor based on the LZMA algorithm")
355 "Lzip is a lossless data compressor with a user interface similar to the
356 one of gzip or bzip2. Lzip decompresses almost as fast as gzip and compresses
357 more than bzip2, which makes it well suited for software distribution and data
358 archiving. Lzip is a clean implementation of the LZMA algorithm.")
359 (license license:gpl3+)))
361 (define-public sharutils
368 (uri (string-append "mirror://gnu/sharutils/sharutils-"
372 "16isapn8f39lnffc3dp4dan05b7x6mnc76v6q5nn8ysxvvvwy19b"))))
373 (build-system gnu-build-system)
379 'patch-source-shebangs 'unpatch-source-shebang
380 ;; revert the patch-shebang phase on a script which is
383 (substitute* "tests/shar-1.ok"
384 (((which "sh")) "/bin/sh")))
386 (home-page "http://www.gnu.org/software/sharutils/")
387 (synopsis "Archives in shell scripts, uuencode/uudecode")
389 "GNU sharutils is a package for creating and manipulating shell
390 archives that can be readily emailed. A shell archive is a file that can be
391 processed by a Bourne-type shell to unpack the original collection of files.
392 This package is mostly for compatibility and historical interest.")
393 (license license:gpl3+)))
395 (define-public sfarklib
401 (uri (string-append "https://github.com/raboof/sfArkLib/archive/"
403 (file-name (string-append name "-" version ".tar.gz"))
406 "0bzs2d98rk1xw9qwpnc7gmlbxwmwc3dg1rpn310afy9pq1k9clzi"))))
407 (build-system gnu-build-system)
409 `(#:tests? #f ;no "check" target
411 (modify-phases %standard-phases
413 (lambda* (#:key outputs #:allow-other-keys)
414 (substitute* "Makefile"
415 (("/usr/local") (assoc-ref outputs "out")))
419 (home-page "https://github.com/raboof/sfArkLib")
420 (synopsis "Library for SoundFont decompression")
422 "SfArkLib is a C++ library for decompressing SoundFont files compressed
423 with the sfArk algorithm.")
424 (license license:gpl3+)))
426 (define-public sfarkxtc
429 (version "b5e0a2ba39")
431 ;; There are no release tarballs, so we just fetch the latest
432 ;; commit at this time.
435 (url "https://github.com/raboof/sfarkxtc.git")
439 "0f5x6i46qfl6ry21s7g2p4sd4b2r1g4fb03yqi2vv4kq3saryhvj"))))
440 (build-system gnu-build-system)
442 `(#:tests? #f ;no "check" target
444 (modify-phases %standard-phases
446 (lambda* (#:key outputs #:allow-other-keys)
447 (substitute* "Makefile"
448 (("/usr/local") (assoc-ref outputs "out")))
452 ("sfarklib" ,sfarklib)))
453 (home-page "https://github.com/raboof/sfarkxtc")
454 (synopsis "Basic sfArk decompressor")
455 (description "SfArk extractor converts SoundFonts in the compressed legacy
456 sfArk file format to the uncompressed sf2 format.")
457 (license license:gpl3+)))
459 (define-public libmspack
466 (uri (string-append "http://www.cabextract.org.uk/libmspack/libmspack-"
467 version "alpha.tar.gz"))
469 (base32 "04413hynb7zizxnkgy9riik3612dwirkpr6fcjrnfl2za9sz4rw9"))))
470 (build-system gnu-build-system)
471 (home-page "http://www.cabextract.org.uk/libmspack/")
472 (synopsis "Compression tools for some formats used by Microsoft")
474 "The purpose of libmspack is to provide both compression and
475 decompression of some loosely related file formats used by Microsoft.")
476 (license license:lgpl2.1+)))
478 (define-public perl-compress-raw-bzip2
480 (name "perl-compress-raw-bzip2")
485 (uri (string-append "mirror://cpan/authors/id/P/PM/PMQS/"
486 "Compress-Raw-Bzip2-" version ".tar.gz"))
489 "16hl58xppckldz05zdyid1l5gpaykzwvkq682h3rc3nilbhgjqqg"))))
490 (build-system perl-build-system)
491 ;; TODO: Use our bzip2 package.
492 (home-page "http://search.cpan.org/dist/Compress-Raw-Bzip2")
493 (synopsis "Low-level interface to bzip2 compression library")
494 (description "This module provides a Perl interface to the bzip2
495 compression library.")
496 (license (package-license perl))))
498 (define-public perl-compress-raw-zlib
500 (name "perl-compress-raw-zlib")
505 (uri (string-append "mirror://cpan/authors/id/P/PM/PMQS/"
506 "Compress-Raw-Zlib-" version ".tar.gz"))
509 "06q7n87g26nn5gv4z2p31ca32f6zk124hqxc25rfgkjd3qi5798i"))))
510 (build-system perl-build-system)
514 `(#:phases (modify-phases %standard-phases
516 'configure 'configure-zlib
517 (lambda* (#:key inputs #:allow-other-keys)
518 (call-with-output-file "config.in"
525 GZIP_OS_CODE = AUTO_DETECT"
526 (assoc-ref inputs "zlib")))))))))
527 (home-page "http://search.cpan.org/dist/Compress-Raw-Zlib")
528 (synopsis "Low-level interface to zlib compression library")
529 (description "This module provides a Perl interface to the zlib
530 compression library.")
531 (license (package-license perl))))
533 (define-public perl-io-compress
535 (name "perl-io-compress")
540 (uri (string-append "mirror://cpan/authors/id/P/PM/PMQS/"
541 "IO-Compress-" version ".tar.gz"))
544 "0dy0apjp7j9dfkzfjspjd3z9gh26srx5vac72g59bkkz1jf8s1gs"))))
545 (build-system perl-build-system)
547 `(("perl-compress-raw-zlib" ,perl-compress-raw-zlib) ; >=2.068
548 ("perl-compress-raw-bzip2" ,perl-compress-raw-bzip2))) ; >=2.068
549 (home-page "http://search.cpan.org/dist/IO-Compress")
550 (synopsis "IO Interface to compressed files/buffers")
551 (description "IO-Compress provides a Perl interface to allow reading and
552 writing of compressed data created with the zlib and bzip2 libraries.")
553 (license (package-license perl))))
562 (uri (string-append "https://github.com/Cyan4973/lz4/archive/"
563 "r" version ".tar.gz"))
565 (base32 "1vfg305zvj50hwscad24wan9jar6nqj14gdk2hqyr7bb9mhh0kcx"))
566 (file-name (string-append name "-" version ".tar.gz"))))
567 (build-system gnu-build-system)
568 (native-inputs `(("valgrind" ,valgrind)))
570 `(#:test-target "test"
571 #:parallel-tests? #f ; tests fail if run in parallel
572 #:make-flags (list "CC=gcc"
573 (string-append "PREFIX=" (assoc-ref %outputs "out")))
574 #:phases (modify-phases %standard-phases
575 (delete 'configure))))
576 (home-page "https://github.com/Cyan4973/lz4")
577 (synopsis "Compression algorithm focused on speed")
578 (description "LZ4 is a lossless compression algorithm, providing
579 compression speed at 400 MB/s per core (0.16 Bytes/cycle). It also features an
580 extremely fast decoder, with speed in multiple GB/s per core (0.71 Bytes/cycle).
581 A high compression derivative, called LZ4_HC, is also provided. It trades CPU
582 time for compression ratio.")
583 ;; The libraries (lz4, lz4hc, and xxhash are BSD licenced. The command
584 ;; line interface programs (lz4, fullbench, fuzzer, datagen) are GPL2+.
585 (license (list license:bsd-2 license:gpl2+))))
587 (define-public squashfs-tools
589 (name "squashfs-tools")
593 (uri (string-append "mirror://sourceforge/squashfs/"
594 "squashfs" version ".tar.gz"))
597 "1xpklm0y43nd9i6jw43y2xh5zvlmj9ar2rvknh0bh7kv8c95aq0d"))))
598 (build-system gnu-build-system)
600 '(#:tests? #f ; no check target
606 (string-append "INSTALL_DIR=" %output "/bin"))
608 (modify-phases %standard-phases
611 (chdir "squashfs-tools"))))))
617 (home-page "http://squashfs.sourceforge.net/")
618 (synopsis "Tools to create and extract squashfs filesystems")
620 "Squashfs is a highly compressed read-only filesystem for Linux. It uses
621 zlib to compress files, inodes, and directories. All blocks are packed to
622 minimize the data overhead, and block sizes of between 4K and 1M are supported.
623 It is intended to be used for archival use, for live CDs, and for embedded
624 systems where low overhead is needed. This package allows you to create and
625 extract such filesystems.")
626 (license license:gpl2+)))
634 (uri (string-append "http://zlib.net/pigz/"
635 name "-" version ".tar.gz"))
638 "172hdf26k4zmm7z8md7nl0dph2a7mhf3x7slb9bhfyff6as6g2sf"))))
639 (build-system gnu-build-system)
642 (modify-phases %standard-phases
645 (lambda* (#:key outputs #:allow-other-keys)
646 (let* ((out (assoc-ref outputs "out"))
647 (bin (string-append out "/bin"))
648 (man (string-append out "/share/man/man1")))
649 (install-file "pigz" bin)
650 (symlink "pigz" (string-append bin "/unpigz"))
651 (install-file "pigz.1" man)
653 #:make-flags (list "CC=gcc")
654 #:test-target "tests"))
655 (inputs `(("zlib" ,zlib)))
656 (home-page "http://zlib.net/pigz/")
657 (synopsis "Parallel implementation of gzip")
659 "This package provides a parallel implementation of gzip that exploits
660 multiple processors and multiple cores when compressing data.")
662 ;; Things under zopfli/ are under ASL2.0, but 4 files at the top-level,
663 ;; written by Mark Adler, are under another non-copyleft license.
664 (license license:asl2.0)))
673 "https://github.com/vasi/pixz/releases/download/v" version
674 "/pixz-" version ".tar.xz"))
677 "1s3j7zw6j5zi3fhdxg287ndr3wf6swac7z21mqd1pyiln530gi82"))))
678 (build-system gnu-build-system)
680 `(("pkg-config" ,pkg-config)
681 ("libarchive" ,libarchive)))
682 (home-page "https://github.com/vasi/pixz")
683 (synopsis "Parallel indexing implementation of LZMA")
685 "The existing XZ Utils provide great compression in the .xz file format,
686 but they produce just one big block of compressed data. Pixz instead produces
687 a collection of smaller blocks which makes random access to the original data
688 possible and can compress in parallel. This is especially useful for large
690 (license license:bsd-2)))