| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 | |
| 23 |
|
| 24 | (define-module (gnu packages gawk)
|
| 25 | #:use-module ((guix licenses) #:prefix license:)
|
| 26 | #:use-module (gnu packages)
|
| 27 | #:use-module (gnu packages base)
|
| 28 | #:use-module (gnu packages bash)
|
| 29 | #:use-module (gnu packages bison)
|
| 30 | #:use-module (gnu packages gcc)
|
| 31 | #:use-module (gnu packages libsigsegv)
|
| 32 | #:use-module (gnu packages multiprecision)
|
| 33 | #:use-module (guix packages)
|
| 34 | #:use-module (guix gexp)
|
| 35 | #:use-module (guix download)
|
| 36 | #:use-module (guix git-download)
|
| 37 | #:use-module (guix utils)
|
| 38 | #:use-module (guix build-system copy)
|
| 39 | #:use-module (guix build-system gnu))
|
| 40 |
|
| 41 | (define-public gawk
|
| 42 | (package
|
| 43 | (name "gawk")
|
| 44 | (version "5.3.0")
|
| 45 | (source (origin
|
| 46 | (method url-fetch)
|
| 47 | (uri (string-append "mirror://gnu/gawk/gawk-" version
|
| 48 | ".tar.xz"))
|
| 49 | (sha256
|
| 50 | (base32 "02x97iyl9v84as4rkdrrkfk2j4vy4r3hpp3rkp3gh3qxs79id76a"))))
|
| 51 | (build-system gnu-build-system)
|
| 52 | (arguments
|
| 53 | (list #:phases
|
| 54 | #~(modify-phases %standard-phases
|
| 55 | (add-before 'configure 'set-shell-file-name
|
| 56 | (lambda* (#:key inputs #:allow-other-keys)
|
| 57 | |
| 58 | (let ((/bin/sh (search-input-file inputs "bin/sh")))
|
| 59 | (substitute* "io.c"
|
| 60 | (("/bin/sh") /bin/sh))
|
| 61 |
|
| 62 | |
| 63 | |
| 64 | |
| 65 | #$@(if (%current-target-system)
|
| 66 | '((substitute* "extension/Makefile.in"
|
| 67 | (("^.*: check-for-shared-lib-support" match)
|
| 68 | (string-append "### " match))))
|
| 69 | '()))))
|
| 70 |
|
| 71 | (add-before 'check 'adjust-test-infrastructure
|
| 72 | (lambda _
|
| 73 | |
| 74 | |
| 75 | (substitute* "test/Makefile"
|
| 76 | (("\\| more") ""))
|
| 77 |
|
| 78 | |
| 79 | |
| 80 | (substitute* "test/watchpoint1.ok"
|
| 81 | (("#! /usr/bin/gawk")
|
| 82 | (string-append "#!" (which "gawk")))))))))
|
| 83 |
|
| 84 | |
| 85 | |
| 86 | (native-inputs (list (libc-utf8-locales-for-target)))
|
| 87 |
|
| 88 | (inputs (list libsigsegv
|
| 89 | |
| 90 | |
| 91 | bash))
|
| 92 |
|
| 93 | (search-paths
|
| 94 | (list (search-path-specification
|
| 95 | (variable "AWKPATH")
|
| 96 | (files (list "share/awk")))
|
| 97 | (search-path-specification
|
| 98 | (variable "AWKLIBPATH")
|
| 99 | (files (list "lib/gawk")))))
|
| 100 | (home-page "https://www.gnu.org/software/gawk/")
|
| 101 | (synopsis "Text scanning and processing language")
|
| 102 | (description
|
| 103 | "Gawk is the GNU implementation of Awk, a specialized programming
|
| 104 | language for the easy manipulation of formatted text, such as tables of data.
|
| 105 | Gawk features many extensions beyond the traditional implementation,
|
| 106 | including network access, sorting, and large libraries.")
|
| 107 | (license license:gpl3+)))
|
| 108 |
|
| 109 | |
| 110 | (define-public gawk-mpfr
|
| 111 | (package/inherit gawk
|
| 112 | (name "gawk-mpfr")
|
| 113 | (inputs
|
| 114 | (modify-inputs inputs
|
| 115 | (prepend mpfr)))))
|
| 116 |
|
| 117 | |
| 118 | |
| 119 | |
| 120 | |
| 121 | (define-public egawk-next
|
| 122 | (let ((commit "f00e74ffc73f6ba6fe74fb7a26319770b8c3792c")
|
| 123 | (revision "0"))
|
| 124 | (package
|
| 125 | (inherit gawk-mpfr)
|
| 126 | (name "egawk-next")
|
| 127 | (version (git-version "5.1.60" revision commit))
|
| 128 | (source
|
| 129 | (origin
|
| 130 | (method git-fetch)
|
| 131 | (uri (git-reference
|
| 132 | (url "https://www.kylheku.com/git/egawk")
|
| 133 | (commit commit)))
|
| 134 | (file-name (git-file-name name version))
|
| 135 | (sha256
|
| 136 | (base32 "0bmfbw6k1aiyiardnk7ha5zlpkvavj013mm4n7wwj2vdcgrs6p1f"))))
|
| 137 | (home-page "https://www.kylheku.com/cgit/egawk/")
|
| 138 | (synopsis "Enhanced GNU Awk")
|
| 139 | (description
|
| 140 | "@command{egawk} is Enhanced GNU Awk. It is a fork of GNU Awk with
|
| 141 | some enhancements designed and implemented by Kaz Kylheku. In particular,
|
| 142 | Enhanced GNU Awk provides the @code{@@let} statement for declaring
|
| 143 | block-scoped lexical variables."))))
|
| 144 |
|
| 145 | (define-public mawk
|
| 146 | (package
|
| 147 | (name "mawk")
|
| 148 | (version "1.3.4-20240905")
|
| 149 | (home-page "https://invisible-island.net/mawk/mawk.html")
|
| 150 | (source (origin
|
| 151 | (method url-fetch)
|
| 152 | (uri (string-append "https://invisible-mirror.net/archives/mawk"
|
| 153 | "/mawk-" version ".tgz"))
|
| 154 | (sha256
|
| 155 | (base32
|
| 156 | "1q4rfcv7ppfw4fra8hp8z0s4qnsv1x598ny4xwb026zsgn96g6d3"))
|
| 157 | (modules '((guix build utils)))
|
| 158 | (snippet
|
| 159 | '(begin
|
| 160 | |
| 161 | (delete-file "parse.c")
|
| 162 | |
| 163 | (substitute* '("test/mawktest" "test/fpe_test")
|
| 164 | (("^PATH=.*")
|
| 165 | ""))))))
|
| 166 | (build-system gnu-build-system)
|
| 167 | (arguments
|
| 168 | (list
|
| 169 | #:parallel-build? #f |
| 170 | #:phases
|
| 171 | #~(modify-phases %standard-phases
|
| 172 | (add-after 'install 'symlink-awk
|
| 173 | (lambda _
|
| 174 | (with-directory-excursion (string-append #$output "/bin")
|
| 175 | (symlink "mawk" "awk")))))))
|
| 176 | (native-inputs
|
| 177 | (list bison))
|
| 178 | (synopsis "Text scanning and processing language")
|
| 179 | (description
|
| 180 | "@command{mawk} is an interpreter for the Awk programming language.
|
| 181 | This version aims to be smaller and faster than GNU Awk, at the expense
|
| 182 | of fewer features and extensions.")
|
| 183 | (license license:gpl2))) |
| 184 |
|
| 185 | (define-public cppawk
|
| 186 | (package
|
| 187 | (name "cppawk")
|
| 188 | (version "20220703")
|
| 189 | (source
|
| 190 | (origin
|
| 191 | (method git-fetch)
|
| 192 | (uri (git-reference
|
| 193 | (url "https://www.kylheku.com/git/cppawk")
|
| 194 | (commit version)))
|
| 195 | (file-name (git-file-name name version))
|
| 196 | (sha256
|
| 197 | (base32 "0b09757q81sz4gn62k3mv5bgllyb2v5m64346s8fc99mqqif70cx"))))
|
| 198 | (build-system copy-build-system)
|
| 199 | (arguments
|
| 200 | `(#:install-plan '(("bin/cppawk" "bin/cppawk")
|
| 201 | ("share/cppawk/include" "share/cppawk/include")
|
| 202 | ("./" "share/man/man1" #:include-regexp (".*\\.1$")))
|
| 203 | #:phases
|
| 204 | (modify-phases %standard-phases
|
| 205 | (add-after 'unpack 'fix-paths
|
| 206 | (lambda _
|
| 207 | (substitute* "bin/cppawk"
|
| 208 | (("/bin/sh") (which "sh"))
|
| 209 | (("/bin/bash") (which "bash"))
|
| 210 | (("dirname") (which "dirname"))
|
| 211 | (("mktemp") (which "mktemp"))
|
| 212 | |
| 213 | (("printf ") (string-append (which "printf") " "))
|
| 214 | (("rm -f") (string-append (which "rm") " -f"))
|
| 215 | (("prepro=cpp") (string-append "prepro=" (which "cpp")))
|
| 216 | (("sed -e") (string-append (which "sed") " -e")))
|
| 217 | (substitute* '("runtests"
|
| 218 | "testdir/testawk"
|
| 219 | "testdir/testcpp"
|
| 220 | "testdir/testdel")
|
| 221 | (("/bin/sh") (which "sh")))
|
| 222 | (substitute* "testsuite.awk"
|
| 223 | (("/usr/bin/awk") (which "awk")))))
|
| 224 | (add-after 'fix-paths 'fix-awk-paths
|
| 225 | (lambda _
|
| 226 | (substitute* "bin/cppawk"
|
| 227 | (("awk=gawk") (string-append "awk=" (which "gawk")))
|
| 228 | (("awk '") (string-append (which "gawk") " '")))))
|
| 229 | (add-after 'fix-awk-paths 'check
|
| 230 | (lambda _
|
| 231 | (invoke "./runtests"))))))
|
| 232 | (native-inputs
|
| 233 | |
| 234 | (list mawk))
|
| 235 | (inputs
|
| 236 | (list coreutils |
| 237 | gawk-mpfr |
| 238 | gcc |
| 239 | sed))
|
| 240 | (home-page "https://www.kylheku.com/cgit/cppawk/")
|
| 241 | (synopsis "Wrapper script that adds C preprocessing to Awk")
|
| 242 | (description
|
| 243 | "@command{cppawk} is a shell script that invokes the C preprocessor
|
| 244 | (@command{cpp}) on Awk code and calls Awk (by default GNU Awk) on the result.
|
| 245 |
|
| 246 | @command{cppawk} understands the basic Awk options like @option{-F} and
|
| 247 | @option{-v}, and also understands common @command{cpp} options like
|
| 248 | @option{-I} and @option{-Dmacro=value}.
|
| 249 |
|
| 250 | @command{cppawk} has no dependencies beyond Awk, @command{cpp}, @command{sed}
|
| 251 | and some GNU core utilities (including @command{printf}). Preprocessed
|
| 252 | programs can be captured and transferred to systems that have Awk but not
|
| 253 | @command{cpp} or @command{cppawk}.")
|
| 254 | (license license:bsd-2)))
|
| 255 |
|
| 256 | (define-public cppawk-egawk
|
| 257 | (package/inherit cppawk
|
| 258 | (name "cppawk-egawk")
|
| 259 | (arguments
|
| 260 | (substitute-keyword-arguments arguments
|
| 261 | ((#:phases phases)
|
| 262 | `(modify-phases ,phases
|
| 263 | (replace 'fix-awk-paths
|
| 264 | (lambda _
|
| 265 | (substitute* "bin/cppawk"
|
| 266 | (("awk=gawk") (string-append "awk=" (which "egawk")))
|
| 267 | (("awk '") (string-append (which "egawk") " '")))))))))
|
| 268 | (inputs
|
| 269 | (modify-inputs inputs
|
| 270 | (delete "gawk-mpfr")
|
| 271 | (prepend egawk-next)))
|
| 272 | (synopsis "Wrapper script that adds C preprocessing to Enhanced GNU Awk")))
|