gawk.scm 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2012, 2013, 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org>
  3. ;;; Copyright © 2014, 2015 Mark H Weaver <mhw@netris.org>
  4. ;;; Copyright © 2018 Efraim Flashner <efraim@flashner.co.il>
  5. ;;;
  6. ;;; This file is part of GNU Guix.
  7. ;;;
  8. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  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. ;;;
  13. ;;; GNU Guix is distributed in the hope that it will be useful, but
  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
  19. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  20. (define-module (gnu packages gawk)
  21. #:use-module (guix licenses)
  22. #:use-module (gnu packages)
  23. #:use-module (gnu packages bash)
  24. #:use-module (gnu packages libsigsegv)
  25. #:use-module (guix packages)
  26. #:use-module (guix download)
  27. #:use-module (guix build-system gnu))
  28. (define-public gawk
  29. (package
  30. (name "gawk")
  31. (version "5.1.0")
  32. (source (origin
  33. (method url-fetch)
  34. (uri (string-append "mirror://gnu/gawk/gawk-" version
  35. ".tar.xz"))
  36. (sha256
  37. (base32 "1gc2cccqy1x1bf6rhwlmd8q7dz7gnam6nwgl38bxapv6qm5flpyg"))))
  38. (build-system gnu-build-system)
  39. (arguments
  40. `(#:phases (modify-phases %standard-phases
  41. (add-before 'configure 'set-shell-file-name
  42. (lambda* (#:key inputs #:allow-other-keys)
  43. ;; Refer to the right shell.
  44. (let ((bash (assoc-ref inputs "bash")))
  45. (substitute* "io.c"
  46. (("/bin/sh")
  47. (string-append bash "/bin/sh")))
  48. ;; When cross-compiling, remove dependencies on the
  49. ;; `check-for-shared-lib-support' target, which tries
  50. ;; to run the cross-built `gawk'.
  51. ,@(if (%current-target-system)
  52. '((substitute* "extension/Makefile.in"
  53. (("^.*: check-for-shared-lib-support" match)
  54. (string-append "### " match))))
  55. '())
  56. #t)))
  57. (add-before 'check 'adjust-test-infrastructure
  58. (lambda _
  59. ;; Remove dependency on 'more' (from util-linux), which
  60. ;; would needlessly complicate bootstrapping.
  61. (substitute* "test/Makefile"
  62. (("\\| more") ""))
  63. ;; Silence a warning from bash about not being able
  64. ;; to change to an ISO-8859-1 locale. The test itself
  65. ;; works fine, but newer versions of bash give a
  66. ;; locale warning which mangles the test output.
  67. (substitute* "test/localenl.sh"
  68. (("for LC_ALL in")
  69. "for LC in")
  70. (("export LC_ALL\n")
  71. "export LC_ALL=$LC 2>/dev/null\n"))
  72. ;; Adjust the shebang in that file since it is then diff'd
  73. ;; against the actual test output.
  74. (substitute* "test/watchpoint1.ok"
  75. (("#! /usr/bin/gawk")
  76. (string-append "#!" (which "gawk"))))
  77. #t)))))
  78. (inputs `(("libsigsegv" ,libsigsegv)
  79. ,@(if (%current-target-system)
  80. `(("bash" ,bash))
  81. '())))
  82. (home-page "https://www.gnu.org/software/gawk/")
  83. (synopsis "Text scanning and processing language")
  84. (description
  85. "Gawk is the GNU implementation of Awk, a specialized programming
  86. language for the easy manipulation of formatted text, such as tables of data.
  87. Gawk features many extensions beyond the traditional implementation,
  88. including network access, sorting, and large libraries.")
  89. (license gpl3+)))