Synchronize package descriptions with the Womb.
[jackhill/guix/guix.git] / gnu / packages / compression.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012, 2013 Ludovic Courtès <ludo@gnu.org>
3 ;;;
4 ;;; This file is part of GNU Guix.
5 ;;;
6 ;;; GNU Guix is free software; you can redistribute it and/or modify it
7 ;;; under the terms of the GNU General Public License as published by
8 ;;; the Free Software Foundation; either version 3 of the License, or (at
9 ;;; your option) any later version.
10 ;;;
11 ;;; GNU Guix is distributed in the hope that it will be useful, but
12 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;;; GNU General Public License for more details.
15 ;;;
16 ;;; You should have received a copy of the GNU General Public License
17 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
18
19 (define-module (gnu packages compression)
20 #:use-module ((guix licenses)
21 #:renamer (symbol-prefix-proc 'license:))
22 #:use-module (guix packages)
23 #:use-module (guix download)
24 #:use-module (guix build-system gnu))
25
26 (define-public zlib
27 (package
28 (name "zlib")
29 (version "1.2.7")
30 (source
31 (origin
32 (method url-fetch)
33 (uri (list (string-append "http://zlib.net/zlib-"
34 version ".tar.gz")
35 (string-append "mirror://sourceforge/libpng/zlib-"
36 version ".tar.gz")))
37 (sha256
38 (base32
39 "1i96gsdvxqb6skp9a58bacf1wxamwi9m9pg4yn7cpf7g7239r77s"))))
40 (build-system gnu-build-system)
41 (arguments
42 `(#:phases (alist-replace
43 'configure
44 (lambda* (#:key outputs #:allow-other-keys)
45 ;; Zlib's home-made `configure' doesn't fails when passed
46 ;; extra flags like `--enable-fast-install', so we need to
47 ;; invoke it with just what it understand.
48 (let ((out (assoc-ref outputs "out")))
49 (zero? (system* "./configure"
50 (string-append "--prefix=" out)))))
51 %standard-phases)))
52 (home-page "http://zlib.net/")
53 (synopsis "The zlib compression library")
54 (description
55 "zlib is designed to be a free, general-purpose, legally unencumbered --
56 that is, not covered by any patents -- lossless data-compression library for
57 use on virtually any computer hardware and operating system. The zlib data
58 format is itself portable across platforms. Unlike the LZW compression method
59 used in Unix compress(1) and in the GIF image format, the compression method
60 currently used in zlib essentially never expands the data. (LZW can double or
61 triple the file size in extreme cases.) zlib's memory footprint is also
62 independent of the input data and can be reduced, if necessary, at some cost
63 in compression.")
64 (license license:zlib)))
65
66 (define-public gzip
67 (package
68 (name "gzip")
69 (version "1.6")
70 (source (origin
71 (method url-fetch)
72 (uri (string-append "mirror://gnu/gzip/gzip-"
73 version ".tar.gz"))
74 (sha256
75 (base32
76 "0zlgdm4v3dndrbiz7b67mbbj25dpwqbmbzjiycssvrfrcfvq7swp"))))
77 (build-system gnu-build-system)
78 (synopsis "General file (de)compression (using lzw)")
79 (arguments
80 ;; FIXME: The test suite wants `less', and optionally Perl.
81 '(#:tests? #f))
82 (description
83 "GNU Gzip is a data compression and decompression program.")
84 (license license:gpl3+)
85 (home-page "http://www.gnu.org/software/gzip/")))
86
87 (define-public bzip2
88 (let ((fix-man-dir
89 ;; Move man pages to $out/share/.
90 '(lambda* (#:key outputs #:allow-other-keys)
91 (with-directory-excursion (assoc-ref outputs "out")
92 (mkdir "share")
93 (rename-file "man" "share"))))
94 (build-shared-lib
95 ;; Build a shared library.
96 '(lambda* (#:key inputs #:allow-other-keys)
97 (patch-makefile-SHELL "Makefile-libbz2_so")
98 (zero? (system* "make" "-f" "Makefile-libbz2_so"))))
99 (install-shared-lib
100 '(lambda* (#:key outputs #:allow-other-keys)
101 (let* ((out (assoc-ref outputs "out"))
102 (libdir (string-append out "/lib")))
103 (for-each (lambda (file)
104 (let ((base (basename file)))
105 (format #t "installing `~a' to `~a'~%"
106 base libdir)
107 (copy-file file
108 (string-append libdir "/" base))))
109 (find-files "." "^libbz2\\.so")))))
110 (set-cross-environment
111 '(lambda* (#:key target #:allow-other-keys)
112 (substitute* (find-files "." "Makefile")
113 (("CC=.*$")
114 (string-append "CC = " target "-gcc\n"))
115 (("AR=.*$")
116 (string-append "AR = " target "-ar\n"))
117 (("RANLIB=.*$")
118 (string-append "RANLIB = " target "-ranlib\n"))
119 (("^all:(.*)test" _ prerequisites)
120 ;; Remove 'all' -> 'test' dependency.
121 (string-append "all:" prerequisites "\n"))))))
122 (package
123 (name "bzip2")
124 (version "1.0.6")
125 (source (origin
126 (method url-fetch)
127 (uri (string-append "http://www.bzip.org/" version "/bzip2-"
128 version ".tar.gz"))
129 (sha256
130 (base32
131 "1kfrc7f0ja9fdn6j1y6yir6li818npy6217hvr3wzmnmzhs8z152"))))
132 (build-system gnu-build-system)
133 (arguments
134 `(#:modules ((guix build gnu-build-system)
135 (guix build utils)
136 (srfi srfi-1))
137 #:phases
138 ,(if (%current-target-system)
139
140 ;; Cross-compilation: use the cross tools.
141 `(alist-cons-before
142 'build 'build-shared-lib ,build-shared-lib
143 (alist-cons-after
144 'install 'fix-man-dir ,fix-man-dir
145 (alist-cons-after
146 'install 'install-shared-lib ,install-shared-lib
147 (alist-replace 'configure ,set-cross-environment
148 %standard-phases))))
149
150 ;; Native compilation: build the shared library.
151 `(alist-cons-before
152 'build 'build-shared-lib ,build-shared-lib
153 (alist-cons-after
154 'install 'fix-man-dir ,fix-man-dir
155 (alist-cons-after
156 'install 'install-shared-lib ,install-shared-lib
157 (alist-delete 'configure %standard-phases)))))
158
159 #:make-flags (list (string-append "PREFIX="
160 (assoc-ref %outputs "out")))
161
162 ;; Don't attempt to run the tests when cross-compiling.
163 ,@(if (%current-target-system)
164 '(#:tests? #f)
165 '())))
166 (synopsis "high-quality data compression program")
167 (description
168 "bzip2 is a freely available, patent free (see below), high-quality data
169 compressor. It typically compresses files to within 10% to 15% of the best
170 available techniques (the PPM family of statistical compressors), whilst
171 being around twice as fast at compression and six times faster at
172 decompression.")
173 (license (license:bsd-style "file://LICENSE"
174 "See LICENSE in the distribution."))
175 (home-page "http://www.bzip.org/"))))
176
177 (define-public xz
178 (package
179 (name "xz")
180 (version "5.0.4")
181 (source (origin
182 (method url-fetch)
183 (uri (string-append "http://tukaani.org/xz/xz-" version
184 ".tar.gz"))
185 (sha256
186 (base32
187 "1dl35ca8fdss9z2d6y234gxh24ixq904xksizrjmjr5dimwhax6n"))))
188 (build-system gnu-build-system)
189 (synopsis
190 "XZ, general-purpose data compression software, successor of LZMA")
191 (description
192 "XZ Utils is free general-purpose data compression software with high
193 compression ratio. XZ Utils were written for POSIX-like systems, but also
194 work on some not-so-POSIX systems. XZ Utils are the successor to LZMA Utils.
195
196 The core of the XZ Utils compression code is based on LZMA SDK, but it has
197 been modified quite a lot to be suitable for XZ Utils. The primary
198 compression algorithm is currently LZMA2, which is used inside the .xz
199 container format. With typical files, XZ Utils create 30 % smaller output
200 than gzip and 15 % smaller output than bzip2.")
201 (license (list license:gpl2+ license:lgpl2.1+)) ; bits of both
202 (home-page "http://tukaani.org/xz/")))
203
204 (define-public lzo
205 (package
206 (name "lzo")
207 (version "2.06")
208 (source
209 (origin
210 (method url-fetch)
211 (uri (string-append "http://www.oberhumer.com/opensource/lzo/download/lzo-"
212 version ".tar.gz"))
213 (sha256
214 (base32
215 "0wryshs446s7cclrbjykyj766znhcpnr7s3cxy33ybfn6vwfcygz"))))
216 (build-system gnu-build-system)
217 (arguments '(#:configure-flags '("--enable-shared")))
218 (home-page "http://www.oberhumer.com/opensource/lzo")
219 (synopsis
220 "A data compresion library suitable for real-time data de-/compression")
221 (description
222 "LZO is a data compression library which is suitable for data
223 de-/compression in real-time. This means it favours speed over
224 compression ratio.
225
226 LZO is written in ANSI C. Both the source code and the compressed data
227 format are designed to be portable across platforms.")
228 (license license:gpl2+)))
229
230 (define-public lzip
231 (package
232 (name "lzip")
233 (version "1.14")
234 (source (origin
235 (method url-fetch)
236 (uri (string-append "mirror://savannah/lzip/lzip-"
237 version ".tar.gz"))
238 (sha256
239 (base32
240 "1rybhk2pxpfh2789ck9mrkdv3bpx7b7miwndlshb5vb02m9crxbz"))))
241 (build-system gnu-build-system)
242 (home-page "http://www.nongnu.org/lzip/lzip.html")
243 (synopsis "Lossless data compressor based on the LZMA algorithm")
244 (description
245 "Lzip is a lossless data compressor with a user interface similar to the
246 one of gzip or bzip2. Lzip decompresses almost as fast as gzip and compresses
247 more than bzip2, which makes it well suited for software distribution and data
248 archiving. Lzip is a clean implementation of the LZMA algorithm.")
249 (license license:gpl3+)))