aboutsummaryrefslogtreecommitdiff
path: root/gnu/compression.scm
blob: 0418e80a15879225a9f87915711213395e0ecafa (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2022 Mathieu Othacehe <othacehe@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (gnu compression)
  #:use-module (guix gexp)
  #:use-module (guix ui)
  #:use-module ((gnu packages compression) #:hide (zip))
  #:use-module (srfi srfi-1)
  #:use-module (srfi srfi-9)
  #:use-module (ice-9 match)
  #:export (compressor
            compressor?
            compressor-name
            compressor-extension
            compressor-command
            %compressors
            lookup-compressor))

;; Type of a compression tool.
(define-record-type <compressor>
  (compressor name extension command)
  compressor?
  (name       compressor-name)      ;string (e.g., "gzip")
  (extension  compressor-extension) ;string (e.g., ".lz")
  (command    compressor-command))  ;gexp (e.g., #~(list "/gnu/store/…/gzip"
                                    ;                    "-9n" ))

(define %compressors
  ;; Available compression tools.
  (list (compressor "gzip"  ".gz"
                    #~(list #+(file-append gzip "/bin/gzip") "-9n"))
        (compressor "lzip"  ".lz"
                    #~(list #+(file-append lzip "/bin/lzip") "-9"))
        (compressor "xz"    ".xz"
                    #~(append (list #+(file-append xz "/bin/xz")
                                    "-e")
                              (%xz-parallel-args)))
        (compressor "bzip2" ".bz2"
                    #~(list #+(file-append bzip2 "/bin/bzip2") "-9"))
        (compressor "zstd" ".zst"
                    ;; The default level 3 compresses better than gzip in a
                    ;; fraction of the time, while the highest level 19
                    ;; (de)compresses more slowly and worse than xz.
                    #~(list #+(file-append zstd "/bin/zstd") "-3"))
        (compressor "none" "" #f)))

(define (lookup-compressor name)
  "Return the compressor object called NAME.  Error out if it could not be
found."
  (or (find (match-lambda
              (($ <compressor> name*)
               (string=? name* name)))
            %compressors)
      (leave (G_ "~a: compressor not found~%") name)))
g.scm, gnu/packages/vnc.scm, gnu/packages/vpn.scm, gnu/packages/web-browsers.scm, gnu/packages/web.scm, gnu/packages/wireservice.scm, gnu/packages/wm.scm, gnu/packages/wxwidgets.scm, gnu/packages/xdisorg.scm, gnu/packages/xml.scm, gnu/packages/xorg.scm, tests/lint.scm: Remove trailing ".git" from 'git-reference' URL. Ludovic Courtès 2020-05-25gnu: colordiff: Update to 1.0.19....* gnu/packages/patchutils.scm (colordiff): Update to 1.0.19. Tobias Geerinckx-Rice 2020-04-04gnu: Replace uses of 'gettext' with 'gettext-minimal'....* gnu/packages/cdrom.scm (dvdstyler)[native-inputs]: Change from GNU-GETTEXT to GETTEXT-MINIMAL. * gnu/packages/emulators.scm (dolphin-emu)[native-inputs]: Likewise. * gnu/packages/engineering.scm (lepton-eda, kicad, kicad-i18l)[native-inputs]: Likewise. * gnu/packages/games.scm (quadrapassel, edgar)[native-inputs]: Likewise. * gnu/packages/gnome.scm (eog-plugins, workrave, geary)[native-inputs]: Likewise. * gnu/packages/guile-xyz.scm (guile-gi, emacsy)[native-inputs]: Likewise. * gnu/packages/image.scm (gpick)[native-inputs]: Likewise. * gnu/packages/messaging.scm (telegram-purple)[native-inputs]: Likewise. * gnu/packages/music.scm (fmit)[native-inputs]: Likewise. * gnu/packages/package-management.scm (flatpak)[native-inputs]: Likewise. * gnu/packages/patchutils.scm (quilt)[native-inputs]: Likewise. * gnu/packages/photo.scm (hugin)[native-inputs]: Likewise. * gnu/packages/security-token.scm (eid-mw)[native-inputs]: Likewise. * gnu/packages/telephony.scm (jami)[native-inputs]: Likewise. * gnu/packages/texinfo.scm (pinfo)[native-inputs]: Likewise. * gnu/packages/vulkan.scm (vkd3d)[native-inputs]: Likewise. * gnu/packages/web.scm (cadaver)[native-inputs]: Likewise. Marius Bakke 2020-03-04gnu: meld: Update to 3.20.2....* gnu/packages/patchutils.scm (meld): Update to 3.20.2. Tobias Geerinckx-Rice 2020-02-09gnu: patchwork: Update to 2.1.5....* gnu/packages/patchutils.scm (patchwork): Update to 2.1.5. Christopher Baines