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 Efraim Flashner <efraim@flashner.co.il>
12 ;;; This file is part of GNU Guix.
14 ;;; GNU Guix is free software; you can redistribute it and/or modify it
15 ;;; under the terms of the GNU General Public License as published by
16 ;;; the Free Software Foundation; either version 3 of the License, or (at
17 ;;; your option) any later version.
19 ;;; GNU Guix is distributed in the hope that it will be useful, but
20 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
21 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 ;;; GNU General Public License for more details.
24 ;;; You should have received a copy of the GNU General Public License
25 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
27 (define-module (gnu packages compression)
28 #:use-module ((guix licenses) #:prefix license:)
29 #:use-module (guix utils)
30 #:use-module (guix packages)
31 #:use-module (guix download)
32 #:use-module (guix git-download)
33 #:use-module (guix build-system gnu)
34 #:use-module (guix build-system perl)
35 #:use-module (gnu packages base)
36 #:use-module (gnu packages perl)
37 #:use-module (gnu packages valgrind)
38 #:use-module ((srfi srfi-1) #:select (last)))
47 (uri (list (string-append "http://zlib.net/zlib-"
49 (string-append "mirror://sourceforge/libpng/zlib-"
53 "1i96gsdvxqb6skp9a58bacf1wxamwi9m9pg4yn7cpf7g7239r77s"))))
54 (build-system gnu-build-system)
56 `(#:phases (alist-replace
58 (lambda* (#:key outputs #:allow-other-keys)
59 ;; Zlib's home-made `configure' fails when passed
60 ;; extra flags like `--enable-fast-install', so we need to
61 ;; invoke it with just what it understand.
62 (let ((out (assoc-ref outputs "out")))
63 ;; 'configure' doesn't understand '--host'.
64 ,@(if (%current-target-system)
65 `((setenv "CHOST" ,(%current-target-system)))
68 (system* "./configure"
69 (string-append "--prefix=" out)))))
71 (home-page "http://zlib.net/")
72 (synopsis "Compression library")
74 "zlib is designed to be a free, general-purpose, legally unencumbered --
75 that is, not covered by any patents -- lossless data-compression library for
76 use on virtually any computer hardware and operating system. The zlib data
77 format is itself portable across platforms. Unlike the LZW compression method
78 used in Unix compress(1) and in the GIF image format, the compression method
79 currently used in zlib essentially never expands the data. (LZW can double or
80 triple the file size in extreme cases.) zlib's memory footprint is also
81 independent of the input data and can be reduced, if necessary, at some cost
83 (license license:zlib)))
85 (define-public fastjar
91 (uri (string-append "mirror://savannah/fastjar/fastjar-"
95 "0iginbz2m15hcsa3x4y7v3mhk54gr1r7m3ghx0pg4n46vv2snmpi"))))
96 (build-system gnu-build-system)
97 (inputs `(("zlib" ,zlib)))
98 (home-page "http://savannah.nongnu.org/projects/fastjar")
99 (synopsis "Replacement for Sun's 'jar' utility")
101 "FastJar is an attempt to create a much faster replacement for Sun's 'jar'
102 utility. Instead of being written in Java, FastJar is written in C.")
103 (license license:gpl2+)))
105 (define-public libtar
112 "ftp://ftp.feep.net/pub/software/libtar/libtar-"
116 "1f3vx1wa69a6c5y0z0aakd81gygirdcm0vimazg433q8nyvfybja"))))
117 (build-system gnu-build-system)
118 (arguments `(#:tests? #f)) ;no "check" target
119 (synopsis "C library for manipulating POSIX tar files")
121 "libtar is a C library for manipulating POSIX tar files. It handles
122 adding and extracting files to/from a tar archive.")
123 (home-page "http://www.feep.net/libtar/")
124 (license license:bsd-3)))
132 (uri (string-append "mirror://gnu/gzip/gzip-"
136 "0zlgdm4v3dndrbiz7b67mbbj25dpwqbmbzjiycssvrfrcfvq7swp"))))
137 (build-system gnu-build-system)
138 (synopsis "General file (de)compression (using lzw)")
140 ;; FIXME: The test suite wants `less', and optionally Perl.
143 "GNU Gzip provides data compression and decompression utilities; the
144 typical extension is \".gz\". Unlike the \"zip\" format, it compresses a single
145 file; as a result, it is often used in conjunction with \"tar\", resulting in
146 \".tar.gz\" or \".tgz\", etc.")
147 (license license:gpl3+)
148 (home-page "http://www.gnu.org/software/gzip/")))
151 (let ((build-shared-lib
152 ;; Build a shared library.
153 '(lambda* (#:key inputs #:allow-other-keys)
154 (patch-makefile-SHELL "Makefile-libbz2_so")
155 (zero? (system* "make" "-f" "Makefile-libbz2_so"))))
157 '(lambda* (#:key outputs #:allow-other-keys)
158 (let* ((out (assoc-ref outputs "out"))
159 (libdir (string-append out "/lib")))
160 (for-each (lambda (file)
161 (let ((base (basename file)))
162 (format #t "installing `~a' to `~a'~%"
165 (string-append libdir "/" base))))
166 (find-files "." "^libbz2\\.so")))))
167 (set-cross-environment
168 '(lambda* (#:key target #:allow-other-keys)
169 (substitute* (find-files "." "Makefile")
171 (string-append "CC = " target "-gcc\n"))
173 (string-append "AR = " target "-ar\n"))
175 (string-append "RANLIB = " target "-ranlib\n"))
176 (("^all:(.*)test" _ prerequisites)
177 ;; Remove 'all' -> 'test' dependency.
178 (string-append "all:" prerequisites "\n"))))))
184 (uri (string-append "http://www.bzip.org/" version "/bzip2-"
188 "1kfrc7f0ja9fdn6j1y6yir6li818npy6217hvr3wzmnmzhs8z152"))))
189 (build-system gnu-build-system)
191 `(#:modules ((guix build gnu-build-system)
195 ,(if (%current-target-system)
197 ;; Cross-compilation: use the cross tools.
199 'build 'build-shared-lib ,build-shared-lib
201 'install 'install-shared-lib ,install-shared-lib
202 (alist-replace 'configure ,set-cross-environment
205 ;; Native compilation: build the shared library.
207 'build 'build-shared-lib ,build-shared-lib
209 'install 'install-shared-lib ,install-shared-lib
210 (alist-delete 'configure %standard-phases))))
212 #:make-flags (list (string-append "PREFIX="
213 (assoc-ref %outputs "out")))
215 ;; Don't attempt to run the tests when cross-compiling.
216 ,@(if (%current-target-system)
219 (synopsis "High-quality data compression program")
221 "bzip2 is a freely available, patent free (see below), high-quality data
222 compressor. It typically compresses files to within 10% to 15% of the best
223 available techniques (the PPM family of statistical compressors), whilst
224 being around twice as fast at compression and six times faster at
226 (license (license:non-copyleft "file://LICENSE"
227 "See LICENSE in the distribution."))
228 (home-page "http://www.bzip.org/"))))
230 (define-public pbzip2
236 (uri (string-append "https://launchpad.net/pbzip2/"
237 (version-major+minor version) "/" version
238 "/+download/" name "-" version ".tar.gz"))
241 "1vk6065dv3a47p86vmp8hv3n1ygd9hraz0gq89gvzlx7lmcb6fsp"))))
242 (build-system gnu-build-system)
246 `(#:tests? #f ; no tests
247 #:phases (modify-phases %standard-phases
249 #:make-flags (list (string-append "PREFIX=" %output))))
250 (home-page "http://compression.ca/pbzip2/")
251 (synopsis "Parallel bzip2 implementation")
253 "Pbzip2 is a parallel implementation of the bzip2 block-sorting file
254 compressor that uses pthreads and achieves near-linear speedup on SMP machines.
255 The output of this version is fully compatible with bzip2 v1.0.2 (i.e. anything
256 compressed with pbzip2 can be decompressed with bzip2).")
257 (license (license:non-copyleft "file://COPYING"
258 "See COPYING in the distribution."))))
266 (uri (list (string-append "http://tukaani.org/xz/xz-" version
268 (string-append "http://multiprecision.org/guix/xz-"
272 "18h2k4jndhzjs8ln3a54qdnfv59y6spxiwh9gpaqniph6iflvpvk"))))
273 (build-system gnu-build-system)
274 (synopsis "General-purpose data compression")
276 "XZ Utils is free general-purpose data compression software with high
277 compression ratio. XZ Utils were written for POSIX-like systems, but also
278 work on some not-so-POSIX systems. XZ Utils are the successor to LZMA Utils.
280 The core of the XZ Utils compression code is based on LZMA SDK, but it has
281 been modified quite a lot to be suitable for XZ Utils. The primary
282 compression algorithm is currently LZMA2, which is used inside the .xz
283 container format. With typical files, XZ Utils create 30 % smaller output
284 than gzip and 15 % smaller output than bzip2.")
285 (license (list license:gpl2+ license:lgpl2.1+)) ; bits of both
286 (home-page "http://tukaani.org/xz/")))
295 (uri (string-append "http://www.oberhumer.com/opensource/lzo/download/lzo-"
299 "0k5kpj3jnsjfxqqkblpfpx0mqcy86zs5fhjhgh2kq1hksg7ag57j"))))
300 (build-system gnu-build-system)
301 (arguments '(#:configure-flags '("--enable-shared")))
302 (home-page "http://www.oberhumer.com/opensource/lzo")
304 "Data compression library suitable for real-time data de-/compression")
306 "LZO is a data compression library which is suitable for data
307 de-/compression in real-time. This means it favours speed over
310 LZO is written in ANSI C. Both the source code and the compressed data
311 format are designed to be portable across platforms.")
312 (license license:gpl2+)))
321 (uri (string-append "http://www.lzop.org/download/lzop-"
325 "1jdjvc4yjndf7ihmlcsyln2rbnbaxa86q4jskmkmm7ylfy65nhn1"))))
326 (build-system gnu-build-system)
327 (inputs `(("lzo" ,lzo)))
328 (home-page "http://www.lzop.org/")
329 (synopsis "Compress or expand files")
331 "Lzop is a file compressor which is very similar to gzip. Lzop uses the
332 LZO data compression library for compression services, and its main advantages
333 over gzip are much higher compression and decompression speed (at the cost of
334 some compression ratio).")
335 (license license:gpl2+)))
343 (uri (string-append "mirror://savannah/lzip/lzip-"
347 "0l9724rw1l3hg2ldr3n7ihqich4m9nc6y7l302bvdj4jmxdw530j"))))
348 (build-system gnu-build-system)
349 (home-page "http://www.nongnu.org/lzip/lzip.html")
350 (synopsis "Lossless data compressor based on the LZMA algorithm")
352 "Lzip is a lossless data compressor with a user interface similar to the
353 one of gzip or bzip2. Lzip decompresses almost as fast as gzip and compresses
354 more than bzip2, which makes it well suited for software distribution and data
355 archiving. Lzip is a clean implementation of the LZMA algorithm.")
356 (license license:gpl3+)))
358 (define-public sharutils
365 (uri (string-append "mirror://gnu/sharutils/sharutils-"
369 "16isapn8f39lnffc3dp4dan05b7x6mnc76v6q5nn8ysxvvvwy19b"))))
370 (build-system gnu-build-system)
376 'patch-source-shebangs 'unpatch-source-shebang
377 ;; revert the patch-shebang phase on a script which is
380 (substitute* "tests/shar-1.ok"
381 (((which "sh")) "/bin/sh")))
383 (home-page "http://www.gnu.org/software/sharutils/")
384 (synopsis "Archives in shell scripts, uuencode/uudecode")
386 "GNU sharutils is a package for creating and manipulating shell
387 archives that can be readily emailed. A shell archive is a file that can be
388 processed by a Bourne-type shell to unpack the original collection of files.
389 This package is mostly for compatibility and historical interest.")
390 (license license:gpl3+)))
392 (define-public sfarklib
398 (uri (string-append "https://github.com/raboof/sfArkLib/archive/"
400 (file-name (string-append name "-" version ".tar.gz"))
403 "0bzs2d98rk1xw9qwpnc7gmlbxwmwc3dg1rpn310afy9pq1k9clzi"))))
404 (build-system gnu-build-system)
406 `(#:tests? #f ;no "check" target
408 (modify-phases %standard-phases
410 (lambda* (#:key outputs #:allow-other-keys)
411 (substitute* "Makefile"
412 (("/usr/local") (assoc-ref outputs "out")))
416 (home-page "https://github.com/raboof/sfArkLib")
417 (synopsis "Library for SoundFont decompression")
419 "SfArkLib is a C++ library for decompressing SoundFont files compressed
420 with the sfArk algorithm.")
421 (license license:gpl3+)))
423 (define-public sfarkxtc
426 (version "b5e0a2ba39")
428 ;; There are no release tarballs, so we just fetch the latest
429 ;; commit at this time.
432 (url "https://github.com/raboof/sfarkxtc.git")
436 "0f5x6i46qfl6ry21s7g2p4sd4b2r1g4fb03yqi2vv4kq3saryhvj"))))
437 (build-system gnu-build-system)
439 `(#:tests? #f ;no "check" target
441 (modify-phases %standard-phases
443 (lambda* (#:key outputs #:allow-other-keys)
444 (substitute* "Makefile"
445 (("/usr/local") (assoc-ref outputs "out")))
449 ("sfarklib" ,sfarklib)))
450 (home-page "https://github.com/raboof/sfarkxtc")
451 (synopsis "Basic sfArk decompressor")
452 (description "SfArk extractor converts SoundFonts in the compressed legacy
453 sfArk file format to the uncompressed sf2 format.")
454 (license license:gpl3+)))
456 (define-public libmspack
463 (uri (string-append "http://www.cabextract.org.uk/libmspack/libmspack-"
464 version "alpha.tar.gz"))
466 (base32 "04413hynb7zizxnkgy9riik3612dwirkpr6fcjrnfl2za9sz4rw9"))))
467 (build-system gnu-build-system)
468 (home-page "http://www.cabextract.org.uk/libmspack/")
469 (synopsis "Compression tools for some formats used by Microsoft")
471 "The purpose of libmspack is to provide both compression and
472 decompression of some loosely related file formats used by Microsoft.")
473 (license license:lgpl2.1+)))
475 (define-public perl-compress-raw-bzip2
477 (name "perl-compress-raw-bzip2")
482 (uri (string-append "mirror://cpan/authors/id/P/PM/PMQS/"
483 "Compress-Raw-Bzip2-" version ".tar.gz"))
486 "16hl58xppckldz05zdyid1l5gpaykzwvkq682h3rc3nilbhgjqqg"))))
487 (build-system perl-build-system)
488 ;; TODO: Use our bzip2 package.
489 (home-page "http://search.cpan.org/dist/Compress-Raw-Bzip2")
490 (synopsis "Low-level interface to bzip2 compression library")
491 (description "This module provides a Perl interface to the bzip2
492 compression library.")
493 (license (package-license perl))))
495 (define-public perl-compress-raw-zlib
497 (name "perl-compress-raw-zlib")
502 (uri (string-append "mirror://cpan/authors/id/P/PM/PMQS/"
503 "Compress-Raw-Zlib-" version ".tar.gz"))
506 "06q7n87g26nn5gv4z2p31ca32f6zk124hqxc25rfgkjd3qi5798i"))))
507 (build-system perl-build-system)
511 `(#:phases (modify-phases %standard-phases
513 'configure 'configure-zlib
514 (lambda* (#:key inputs #:allow-other-keys)
515 (call-with-output-file "config.in"
522 GZIP_OS_CODE = AUTO_DETECT"
523 (assoc-ref inputs "zlib")))))))))
524 (home-page "http://search.cpan.org/dist/Compress-Raw-Zlib")
525 (synopsis "Low-level interface to zlib compression library")
526 (description "This module provides a Perl interface to the zlib
527 compression library.")
528 (license (package-license perl))))
530 (define-public perl-io-compress
532 (name "perl-io-compress")
537 (uri (string-append "mirror://cpan/authors/id/P/PM/PMQS/"
538 "IO-Compress-" version ".tar.gz"))
541 "0dy0apjp7j9dfkzfjspjd3z9gh26srx5vac72g59bkkz1jf8s1gs"))))
542 (build-system perl-build-system)
544 `(("perl-compress-raw-zlib" ,perl-compress-raw-zlib) ; >=2.068
545 ("perl-compress-raw-bzip2" ,perl-compress-raw-bzip2))) ; >=2.068
546 (home-page "http://search.cpan.org/dist/IO-Compress")
547 (synopsis "IO Interface to compressed files/buffers")
548 (description "IO-Compress provides a Perl interface to allow reading and
549 writing of compressed data created with the zlib and bzip2 libraries.")
550 (license (package-license perl))))
559 (uri (string-append "https://github.com/Cyan4973/lz4/archive/"
560 "r" version ".tar.gz"))
562 (base32 "1vfg305zvj50hwscad24wan9jar6nqj14gdk2hqyr7bb9mhh0kcx"))
563 (file-name (string-append name "-" version ".tar.gz"))))
564 (build-system gnu-build-system)
565 (native-inputs `(("valgrind" ,valgrind)))
567 `(#:test-target "test"
568 #:parallel-tests? #f ; tests fail if run in parallel
569 #:make-flags (list "CC=gcc"
570 (string-append "PREFIX=" (assoc-ref %outputs "out")))
571 #:phases (modify-phases %standard-phases
572 (delete 'configure))))
573 (home-page "https://github.com/Cyan4973/lz4")
574 (synopsis "Compression algorithm focused on speed")
575 (description "LZ4 is a lossless compression algorithm, providing
576 compression speed at 400 MB/s per core (0.16 Bytes/cycle). It also features an
577 extremely fast decoder, with speed in multiple GB/s per core (0.71 Bytes/cycle).
578 A high compression derivative, called LZ4_HC, is also provided. It trades CPU
579 time for compression ratio.")
580 ;; The libraries (lz4, lz4hc, and xxhash are BSD licenced. The command
581 ;; line interface programs (lz4, fullbench, fuzzer, datagen) are GPL2+.
582 (license (list license:bsd-2 license:gpl2+))))
584 (define-public squashfs-tools
586 (name "squashfs-tools")
590 (uri (string-append "mirror://sourceforge/squashfs/"
591 "squashfs" version ".tar.gz"))
594 "1xpklm0y43nd9i6jw43y2xh5zvlmj9ar2rvknh0bh7kv8c95aq0d"))))
595 (build-system gnu-build-system)
597 '(#:tests? #f ; no check target
603 (string-append "INSTALL_DIR=" %output "/bin"))
605 (modify-phases %standard-phases
608 (chdir "squashfs-tools"))))))
614 (home-page "http://squashfs.sourceforge.net/")
615 (synopsis "Tools to create and extract squashfs filesystems")
617 "Squashfs is a highly compressed read-only filesystem for Linux. It uses
618 zlib to compress files, inodes, and directories. All blocks are packed to
619 minimize the data overhead, and block sizes of between 4K and 1M are supported.
620 It is intended to be used for archival use, for live CDs, and for embedded
621 systems where low overhead is needed. This package allows you to create and
622 extract such filesystems.")
623 (license license:gpl2+)))
631 (uri (string-append "http://zlib.net/pigz/"
632 name "-" version ".tar.gz"))
635 "172hdf26k4zmm7z8md7nl0dph2a7mhf3x7slb9bhfyff6as6g2sf"))))
636 (build-system gnu-build-system)
639 (modify-phases %standard-phases
642 (lambda* (#:key outputs #:allow-other-keys)
643 (let* ((out (assoc-ref outputs "out"))
644 (bin (string-append out "/bin"))
645 (man (string-append out "/share/man/man1")))
646 (install-file "pigz" bin)
647 (symlink "pigz" (string-append bin "/unpigz"))
648 (install-file "pigz.1" man)
650 #:make-flags (list "CC=gcc")
651 #:test-target "tests"))
652 (inputs `(("zlib" ,zlib)))
653 (home-page "http://zlib.net/pigz/")
654 (synopsis "Parallel implementation of gzip")
656 "This package provides a parallel implementation of gzip that exploits
657 multiple processors and multiple cores when compressing data.")
659 ;; Things under zopfli/ are under ASL2.0, but 4 files at the top-level,
660 ;; written by Mark Adler, are under another non-copyleft license.
661 (license license:asl2.0)))