gnu: Some cleanup based on lint checkers.
[jackhill/guix/guix.git] / gnu / packages / compression.scm
CommitLineData
233e7676 1;;; GNU Guix --- Functional package management for GNU
275a7711 2;;; Copyright © 2012, 2013, 2014 Ludovic Courtès <ludo@gnu.org>
b357faac 3;;; Copyright © 2013 Andreas Enge <andreas@enge.fr>
afd1cff1 4;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
a268f085 5;;;
233e7676 6;;; This file is part of GNU Guix.
a268f085 7;;;
233e7676 8;;; GNU Guix is free software; you can redistribute it and/or modify it
a268f085
LC
9;;; under the terms of the GNU General Public License as published by
10;;; the Free Software Foundation; either version 3 of the License, or (at
11;;; your option) any later version.
12;;;
233e7676 13;;; GNU Guix is distributed in the hope that it will be useful, but
a268f085
LC
14;;; WITHOUT ANY WARRANTY; without even the implied warranty of
15;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16;;; GNU General Public License for more details.
17;;;
18;;; You should have received a copy of the GNU General Public License
233e7676 19;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
a268f085 20
1ffa7090 21(define-module (gnu packages compression)
b5b73a82 22 #:use-module ((guix licenses) #:prefix license:)
a268f085 23 #:use-module (guix packages)
87f5d366 24 #:use-module (guix download)
b357faac
AE
25 #:use-module (guix build-system gnu)
26 #:use-module (gnu packages which))
a268f085 27
6a92093d
LC
28(define-public zlib
29 (package
30 (name "zlib")
31 (version "1.2.7")
32 (source
33 (origin
87f5d366 34 (method url-fetch)
a67f97fe
CR
35 (uri (list (string-append "http://zlib.net/zlib-"
36 version ".tar.gz")
37 (string-append "mirror://sourceforge/libpng/zlib-"
38 version ".tar.gz")))
6a92093d
LC
39 (sha256
40 (base32
41 "1i96gsdvxqb6skp9a58bacf1wxamwi9m9pg4yn7cpf7g7239r77s"))))
42 (build-system gnu-build-system)
43 (arguments
44 `(#:phases (alist-replace
45 'configure
46 (lambda* (#:key outputs #:allow-other-keys)
e67253db 47 ;; Zlib's home-made `configure' fails when passed
6a92093d
LC
48 ;; extra flags like `--enable-fast-install', so we need to
49 ;; invoke it with just what it understand.
50 (let ((out (assoc-ref outputs "out")))
e67253db
JD
51 ;; 'configure' doesn't understand '--host'.
52 ,@(if (%current-target-system)
53 `((setenv "CHOST" ,(%current-target-system)))
54 '())
55 (zero?
56 (system* "./configure"
57 (string-append "--prefix=" out)))))
6a92093d
LC
58 %standard-phases)))
59 (home-page "http://zlib.net/")
35b9e423 60 (synopsis "Compression library")
6a92093d
LC
61 (description
62 "zlib is designed to be a free, general-purpose, legally unencumbered --
63that is, not covered by any patents -- lossless data-compression library for
64use on virtually any computer hardware and operating system. The zlib data
35b9e423 65format is itself portable across platforms. Unlike the LZW compression method
6a92093d
LC
66used in Unix compress(1) and in the GIF image format, the compression method
67currently used in zlib essentially never expands the data. (LZW can double or
68triple the file size in extreme cases.) zlib's memory footprint is also
69independent of the input data and can be reduced, if necessary, at some cost
70in compression.")
4a44e743 71 (license license:zlib)))
6a92093d 72
a268f085
LC
73(define-public gzip
74 (package
75 (name "gzip")
2a511f7a 76 (version "1.6")
a268f085 77 (source (origin
87f5d366 78 (method url-fetch)
0db342a5 79 (uri (string-append "mirror://gnu/gzip/gzip-"
a268f085
LC
80 version ".tar.gz"))
81 (sha256
82 (base32
2a511f7a 83 "0zlgdm4v3dndrbiz7b67mbbj25dpwqbmbzjiycssvrfrcfvq7swp"))))
a268f085 84 (build-system gnu-build-system)
f50d2669 85 (synopsis "General file (de)compression (using lzw)")
a268f085
LC
86 (arguments
87 ;; FIXME: The test suite wants `less', and optionally Perl.
88 '(#:tests? #f))
89 (description
79c311b8
LC
90 "GNU Gzip provides data compression and decompression utilities; the
91typical extension is \".gz\". Unlike the \"zip\" format, it compresses a single
92file; as a result, it is often used in conjunction with \"tar\", resulting in
93\".tar.gz\" or \".tgz\", etc.")
4a44e743 94 (license license:gpl3+)
a268f085
LC
95 (home-page "http://www.gnu.org/software/gzip/")))
96
97(define-public bzip2
98 (let ((fix-man-dir
99 ;; Move man pages to $out/share/.
100 '(lambda* (#:key outputs #:allow-other-keys)
101 (with-directory-excursion (assoc-ref outputs "out")
102 (mkdir "share")
afd1cff1 103 (rename-file "man" "share/man"))))
a268f085
LC
104 (build-shared-lib
105 ;; Build a shared library.
106 '(lambda* (#:key inputs #:allow-other-keys)
f678f6d9 107 (patch-makefile-SHELL "Makefile-libbz2_so")
a268f085
LC
108 (zero? (system* "make" "-f" "Makefile-libbz2_so"))))
109 (install-shared-lib
110 '(lambda* (#:key outputs #:allow-other-keys)
111 (let* ((out (assoc-ref outputs "out"))
112 (libdir (string-append out "/lib")))
113 (for-each (lambda (file)
114 (let ((base (basename file)))
115 (format #t "installing `~a' to `~a'~%"
116 base libdir)
117 (copy-file file
118 (string-append libdir "/" base))))
ab4fab19
LC
119 (find-files "." "^libbz2\\.so")))))
120 (set-cross-environment
121 '(lambda* (#:key target #:allow-other-keys)
122 (substitute* (find-files "." "Makefile")
123 (("CC=.*$")
124 (string-append "CC = " target "-gcc\n"))
125 (("AR=.*$")
126 (string-append "AR = " target "-ar\n"))
127 (("RANLIB=.*$")
128 (string-append "RANLIB = " target "-ranlib\n"))
129 (("^all:(.*)test" _ prerequisites)
130 ;; Remove 'all' -> 'test' dependency.
131 (string-append "all:" prerequisites "\n"))))))
a268f085
LC
132 (package
133 (name "bzip2")
134 (version "1.0.6")
135 (source (origin
87f5d366 136 (method url-fetch)
a268f085
LC
137 (uri (string-append "http://www.bzip.org/" version "/bzip2-"
138 version ".tar.gz"))
139 (sha256
140 (base32
141 "1kfrc7f0ja9fdn6j1y6yir6li818npy6217hvr3wzmnmzhs8z152"))))
142 (build-system gnu-build-system)
143 (arguments
144 `(#:modules ((guix build gnu-build-system)
145 (guix build utils)
146 (srfi srfi-1))
147 #:phases
ab4fab19
LC
148 ,(if (%current-target-system)
149
150 ;; Cross-compilation: use the cross tools.
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-replace 'configure ,set-cross-environment
158 %standard-phases))))
159
160 ;; Native compilation: build the shared library.
161 `(alist-cons-before
162 'build 'build-shared-lib ,build-shared-lib
163 (alist-cons-after
164 'install 'fix-man-dir ,fix-man-dir
165 (alist-cons-after
166 'install 'install-shared-lib ,install-shared-lib
167 (alist-delete 'configure %standard-phases)))))
168
a268f085 169 #:make-flags (list (string-append "PREFIX="
ab4fab19
LC
170 (assoc-ref %outputs "out")))
171
172 ;; Don't attempt to run the tests when cross-compiling.
173 ,@(if (%current-target-system)
174 '(#:tests? #f)
175 '())))
35b9e423 176 (synopsis "High-quality data compression program")
a268f085
LC
177 (description
178 "bzip2 is a freely available, patent free (see below), high-quality data
179compressor. It typically compresses files to within 10% to 15% of the best
180available techniques (the PPM family of statistical compressors), whilst
181being around twice as fast at compression and six times faster at
182decompression.")
4a44e743
NK
183 (license (license:bsd-style "file://LICENSE"
184 "See LICENSE in the distribution."))
a268f085
LC
185 (home-page "http://www.bzip.org/"))))
186
187(define-public xz
188 (package
189 (name "xz")
190 (version "5.0.4")
191 (source (origin
87f5d366 192 (method url-fetch)
a268f085
LC
193 (uri (string-append "http://tukaani.org/xz/xz-" version
194 ".tar.gz"))
195 (sha256
196 (base32
197 "1dl35ca8fdss9z2d6y234gxh24ixq904xksizrjmjr5dimwhax6n"))))
198 (build-system gnu-build-system)
35b9e423 199 (synopsis "General-purpose data compression")
a268f085
LC
200 (description
201 "XZ Utils is free general-purpose data compression software with high
202compression ratio. XZ Utils were written for POSIX-like systems, but also
203work on some not-so-POSIX systems. XZ Utils are the successor to LZMA Utils.
204
205The core of the XZ Utils compression code is based on LZMA SDK, but it has
206been modified quite a lot to be suitable for XZ Utils. The primary
207compression algorithm is currently LZMA2, which is used inside the .xz
208container format. With typical files, XZ Utils create 30 % smaller output
209than gzip and 15 % smaller output than bzip2.")
38bbd61d 210 (license (list license:gpl2+ license:lgpl2.1+)) ; bits of both
a268f085 211 (home-page "http://tukaani.org/xz/")))
c6eac761
LC
212
213(define-public lzo
214 (package
215 (name "lzo")
216 (version "2.06")
217 (source
218 (origin
219 (method url-fetch)
220 (uri (string-append "http://www.oberhumer.com/opensource/lzo/download/lzo-"
221 version ".tar.gz"))
222 (sha256
223 (base32
224 "0wryshs446s7cclrbjykyj766znhcpnr7s3cxy33ybfn6vwfcygz"))))
225 (build-system gnu-build-system)
165fd9d5 226 (arguments '(#:configure-flags '("--enable-shared")))
c6eac761
LC
227 (home-page "http://www.oberhumer.com/opensource/lzo")
228 (synopsis
9e771e3b 229 "Data compresion library suitable for real-time data de-/compression")
c6eac761
LC
230 (description
231 "LZO is a data compression library which is suitable for data
232de-/compression in real-time. This means it favours speed over
233compression ratio.
234
235LZO is written in ANSI C. Both the source code and the compressed data
236format are designed to be portable across platforms.")
4a44e743 237 (license license:gpl2+)))
0f323dad 238
a9f48ff0
EB
239(define-public lzop
240 (package
241 (name "lzop")
242 (version "1.03")
243 (source
244 (origin
245 (method url-fetch)
246 (uri (string-append "http://www.lzop.org/download/lzop-"
247 version ".tar.gz"))
248 (sha256
249 (base32
250 "1jdjvc4yjndf7ihmlcsyln2rbnbaxa86q4jskmkmm7ylfy65nhn1"))))
251 (build-system gnu-build-system)
252 (inputs `(("lzo" ,lzo)))
253 (home-page "http://www.lzop.org/")
254 (synopsis "Compress or expand files")
255 (description
256 "Lzop is a file compressor which is very similar to gzip. Lzop uses the
257LZO data compression library for compression services, and its main advantages
258over gzip are much higher compression and decompression speed (at the cost of
259some compression ratio).")
260 (license license:gpl2+)))
261
0f323dad
LC
262(define-public lzip
263 (package
264 (name "lzip")
275a7711 265 (version "1.16")
0f323dad
LC
266 (source (origin
267 (method url-fetch)
268 (uri (string-append "mirror://savannah/lzip/lzip-"
269 version ".tar.gz"))
270 (sha256
271 (base32
275a7711 272 "0l9724rw1l3hg2ldr3n7ihqich4m9nc6y7l302bvdj4jmxdw530j"))))
0f323dad
LC
273 (build-system gnu-build-system)
274 (home-page "http://www.nongnu.org/lzip/lzip.html")
275 (synopsis "Lossless data compressor based on the LZMA algorithm")
276 (description
277 "Lzip is a lossless data compressor with a user interface similar to the
278one of gzip or bzip2. Lzip decompresses almost as fast as gzip and compresses
279more than bzip2, which makes it well suited for software distribution and data
280archiving. Lzip is a clean implementation of the LZMA algorithm.")
281 (license license:gpl3+)))
b357faac
AE
282
283(define-public sharutils
284 (package
285 (name "sharutils")
286 (version "4.14")
287 (source
288 (origin
289 (method url-fetch)
290 (uri (string-append "mirror://gnu/sharutils/sharutils-"
291 version ".tar.xz"))
292 (sha256
293 (base32
294 "033sq1v0cp0bi1mp320xaqwd4fhakqc5747hh6qa1asjrzpqiqza"))))
295 (build-system gnu-build-system)
296 (inputs
297 `(("which" ,which)))
298 (arguments
299 `(#:phases
300 (alist-cons-after
301 'patch-source-shebangs 'unpatch-source-shebang
302 ;; revert the patch-shebang phase on a script which is
303 ;; in fact test data
d4bf49b1 304 (lambda _
b357faac
AE
305 (substitute* "tests/shar-1.ok"
306 (((which "sh")) "/bin/sh")))
307 %standard-phases)))
308 (home-page "http://www.gnu.org/software/sharutils/")
309 (synopsis "Archives in shell scripts, uuencode/uudecode")
310 (description
79c311b8
LC
311 "GNU sharutils is a package for creating and manipulating shell
312archives that can be readily emailed. A shell archive is a file that can be
313processed by a Bourne-type shell to unpack the original collection of files.
314This package is mostly for compatibility and historical interest.")
b357faac 315 (license license:gpl3+)))
28469ab0 316