less.scm 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2012 Nikita Karetnikov <nikita@karetnikov.org>
  3. ;;; Copyright © 2019–2021 Tobias Geerinckx-Rice <me@tobias.gr>
  4. ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
  5. ;;; Copyright © 2020, 2021 Michael Rohleder <mike@rohleder.de>
  6. ;;;
  7. ;;; This file is part of GNU Guix.
  8. ;;;
  9. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  10. ;;; under the terms of the GNU General Public License as published by
  11. ;;; the Free Software Foundation; either version 3 of the License, or (at
  12. ;;; your option) any later version.
  13. ;;;
  14. ;;; GNU Guix is distributed in the hope that it will be useful, but
  15. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  16. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. ;;; GNU General Public License for more details.
  18. ;;;
  19. ;;; You should have received a copy of the GNU General Public License
  20. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  21. (define-module (gnu packages less)
  22. #:use-module (guix licenses)
  23. #:use-module (gnu packages)
  24. #:use-module (gnu packages ncurses)
  25. #:use-module (gnu packages perl)
  26. #:use-module (gnu packages file)
  27. #:use-module (guix packages)
  28. #:use-module (guix download)
  29. #:use-module (guix git-download)
  30. #:use-module (guix build-system gnu))
  31. (define-public less
  32. (package
  33. (name "less")
  34. (version "590")
  35. (source
  36. (origin
  37. (method url-fetch)
  38. (uri (list (string-append "mirror://gnu/less/less-"
  39. version ".tar.gz")
  40. (string-append "http://www.greenwoodsoftware.com/less/less-"
  41. version ".tar.gz")))
  42. (patches (search-patches "less-hurd-path-max.patch"))
  43. (sha256
  44. (base32 "044fl3izmsi8n1vqzsqdp65q0qyyn5kmsg4sk7id0mxzx15zbbba"))))
  45. (build-system gnu-build-system)
  46. (inputs `(("ncurses" ,ncurses)))
  47. (home-page "https://www.gnu.org/software/less/")
  48. (synopsis "Paginator for terminals")
  49. (description
  50. "GNU less is a pager, a program that allows you to view large amounts
  51. of text in page-sized chunks. Unlike traditional pagers, it allows both
  52. backwards and forwards movement through the document. It also does not have
  53. to read the entire input file before starting, so it starts faster than most
  54. text editors.")
  55. (license gpl3+))) ; some files are under GPLv2+
  56. (define-public lesspipe
  57. (package
  58. (name "lesspipe")
  59. (version "1.86")
  60. (source (origin
  61. (method git-fetch)
  62. (uri (git-reference
  63. (url "https://github.com/wofr06/lesspipe")
  64. (commit version)))
  65. (file-name (git-file-name name version))
  66. (sha256
  67. (base32
  68. "14qsfwvsqn6r0najpfh5p68by4jwlg2hj4250cfi1hx3j9i5nhgn"))))
  69. (build-system gnu-build-system)
  70. (arguments
  71. '(#:tests? #f ; no tests
  72. #:phases (modify-phases %standard-phases
  73. (replace 'configure
  74. (lambda* (#:key outputs #:allow-other-keys)
  75. (let ((out (assoc-ref outputs "out")))
  76. (delete-file "Makefile") ; force generating
  77. (invoke "./configure"
  78. (string-append "--prefix=" out)
  79. "--yes")
  80. #t)))
  81. (add-before 'install 'patch-tput-and-file
  82. (lambda* (#:key inputs #:allow-other-keys)
  83. (substitute* "lesspipe.sh"
  84. (("tput colors")
  85. (string-append (search-input-file inputs "/bin/tput")
  86. " colors"))
  87. (("file -")
  88. (string-append (search-input-file inputs "/bin/file")
  89. " -"))))))))
  90. (inputs
  91. `(("file" ,file)
  92. ("ncurses" ,ncurses))) ; for tput
  93. (native-inputs `(("perl" ,perl)))
  94. (home-page "https://github.com/wofr06/lesspipe")
  95. (synopsis "Input filter for less")
  96. (description "To browse files, the excellent viewer @code{less} can be
  97. used. By setting the environment variable @code{LESSOPEN}, less can be
  98. enhanced by external filters to become more powerful. The input filter for
  99. less described here is called @code{lesspipe.sh}. It is able to process a
  100. wide variety of file formats. It enables users to inspect archives and
  101. display their contents without having to unpack them before. The filter is
  102. easily extensible for new formats.")
  103. (license gpl2+)))