projects/guix·blob kernel-updates · refs

131 lines · 5.7 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2012 Nikita Karetnikov <[email protected]>
3;;; Copyright © 2019–2021 Tobias Geerinckx-Rice <[email protected]>
4;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <[email protected]>
5;;; Copyright © 2020, 2021, 2022 Michael Rohleder <[email protected]>
6;;; Copyright © 2022 Hartmut Goebel <[email protected]>
7;;; Copyright © 2022 Efraim Flashner <[email protected]>
8;;; Copyright © 2024, 2025 Artyom V. Poptsov <[email protected]>
9;;;
10;;; This file is part of GNU Guix.
11;;;
12;;; GNU Guix is free software; you can redistribute it and/or modify it
13;;; under the terms of the GNU General Public License as published by
14;;; the Free Software Foundation; either version 3 of the License, or (at
15;;; your option) any later version.
16;;;
17;;; GNU Guix is distributed in the hope that it will be useful, but
18;;; WITHOUT ANY WARRANTY; without even the implied warranty of
19;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20;;; GNU General Public License for more details.
21;;;
22;;; You should have received a copy of the GNU General Public License
23;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
24
25(define-module (gnu packages less)
26 #:use-module (guix gexp)
27 #:use-module (guix licenses)
28 #:use-module (gnu packages)
29 #:use-module (gnu packages base)
30 #:use-module (gnu packages ncurses)
31 #:use-module (gnu packages perl)
32 #:use-module (gnu packages perl-compression)
33 #:use-module (gnu packages file)
34 #:use-module (guix packages)
35 #:use-module (guix download)
36 #:use-module (guix git-download)
37 #:use-module (guix build-system gnu))
38
39(define-public less
40 (package
41 (name "less")
42 (version "608")
43 (source
44 (origin
45 (method url-fetch)
46 (uri (list (string-append "mirror://gnu/less/less-"
47 version ".tar.gz")
48 (string-append "http://www.greenwoodsoftware.com/less/less-"
49 version ".tar.gz")))
50 (patches (search-patches "less-hurd-path-max.patch"))
51 (sha256
52 (base32 "02f2d9d6hyf03va28ip620gjc6rf4aikmdyk47h7frqj18pbx6m6"))))
53 (build-system gnu-build-system)
54 (inputs (list ncurses))
55 (home-page "https://www.gnu.org/software/less/")
56 (synopsis "Paginator for terminals")
57 (description
58 "GNU less is a pager, a program that allows you to view large amounts
59of text in page-sized chunks. Unlike traditional pagers, it allows both
60backwards and forwards movement through the document. It also does not have
61to read the entire input file before starting, so it starts faster than most
62text editors.")
63 (license gpl3+))) ; some files are under GPLv2+
64
65(define-public lesspipe
66 (package
67 (name "lesspipe")
68 (version "2.17")
69 (source (origin
70 (method git-fetch)
71 (uri (git-reference
72 (url "https://github.com/wofr06/lesspipe")
73 (commit (string-append "v" version))))
74 (file-name (git-file-name name version))
75 (sha256
76 (base32
77 "0fc01pb0qps48wi9cw06sraqbxkcx6nik1jsj0xcal463i66xwk9"))))
78 (build-system gnu-build-system)
79 (arguments
80 (list
81 #:tests? #f ; no tests
82 #:phases
83 #~(modify-phases %standard-phases
84 (replace 'configure
85 (lambda* (#:key outputs #:allow-other-keys)
86 ;; configure is a perl script which the standard configure phase
87 ;; fails to execute
88 (invoke "./configure"
89 (string-append "--prefix=" (assoc-ref outputs "out")))))
90 (add-before 'install 'fix-makefile
91 (lambda _
92 (substitute* "Makefile"
93 (("\\$\\(DESTDIR\\)/etc") "$(DESTDIR)$(PREFIX)/etc"))))
94 (add-before 'install 'patch-command-paths
95 ;; Depending on the content of the file to be displayed and some
96 ;; settings, lesspipe tries to use a large variety of external
97 ;; commands, e.g. rpm, dpkg, vimcolor. We only link the
98 ;; essential ones to avoid this package to pull in all these
99 ;; dependencies which might never ever be used.
100 (lambda* (#:key inputs #:allow-other-keys)
101 (let ((file (search-input-file inputs "/bin/file"))
102 (locale (search-input-file inputs "/bin/locale"))
103 (tput (search-input-file inputs "/bin/tput")))
104 (substitute* "sxw2txt"
105 (("^use warnings;" line)
106 (string-append
107 line "\nuse lib '" #$(this-package-input "perl-archive-zip")
108 "/lib/perl5/site_perl';")))
109 (substitute* "lesscomplete"
110 (("file -") (string-append file " -")))
111 (substitute* "lesspipe.sh"
112 (("\\<tput\\>") tput)
113 (("\\<locale\\>") locale)
114 (("file -")
115 (string-append file " -")))))))))
116 (inputs
117 (list file
118 ncurses ; for tput
119 glibc ; for locale
120 perl-archive-zip))
121 (native-inputs (list perl))
122 (home-page "https://github.com/wofr06/lesspipe")
123 (synopsis "Input filter for less")
124 (description "To browse files, the excellent viewer @code{less} can be
125used. By setting the environment variable @code{LESSOPEN}, less can be
126enhanced by external filters to become more powerful. The input filter for
127less described here is called @code{lesspipe.sh}. It is able to process a
128wide variety of file formats. It enables users to inspect archives and
129display their contents without having to unpack them before. The filter is
130easily extensible for new formats.")
131 (license gpl2+)))