unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#56368] [PATCH 1/4] gnu: Use 'license:' prefix in (gnu packages gawk).
@ 2022-07-03 12:59 Paul A. Patience
  2022-07-03 13:01 ` [bug#56368] [PATCH 2/4] gnu: Add gawk-mpfr Paul A. Patience
  2022-07-04  4:59 ` [bug#56368] [PATCH v2 0/4] " Paul A. Patience
  0 siblings, 2 replies; 10+ messages in thread
From: Paul A. Patience @ 2022-07-03 12:59 UTC (permalink / raw)
  To: 56368; +Cc: Paul A. Patience

* gnu/packages/gawk.scm: Import (guix licenses) with 'license:' prefix.
(gawk, mawk)[license]: Prefix with 'license:'.
---
 gnu/packages/gawk.scm | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gnu/packages/gawk.scm b/gnu/packages/gawk.scm
index 1935e73ab7..91252094b5 100644
--- a/gnu/packages/gawk.scm
+++ b/gnu/packages/gawk.scm
@@ -20,7 +20,7 @@
 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

 (define-module (gnu packages gawk)
-  #:use-module (guix licenses)
+  #:use-module ((guix licenses) #:prefix license:)
   #:use-module (gnu packages)
   #:use-module (gnu packages bash)
   #:use-module (gnu packages libsigsegv)
@@ -93,7 +93,7 @@ (define-public gawk
 language for the easy manipulation of formatted text, such as tables of data.
 Gawk features many extensions beyond the traditional implementation,
 including network access, sorting, and large libraries.")
-   (license gpl3+)))
+   (license license:gpl3+)))

 (define-public mawk
   (package
@@ -120,4 +120,4 @@ (define-public mawk
      "@command{mawk} is an interpreter for the Awk programming language.
 This version aims to be smaller and faster than GNU Awk, at the expense
 of fewer features and extensions.")
-    (license gpl2))) ;version 2 only
+    (license license:gpl2))) ;version 2 only
--
2.36.1






^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [bug#56368] [PATCH 2/4] gnu: Add gawk-mpfr.
  2022-07-03 12:59 [bug#56368] [PATCH 1/4] gnu: Use 'license:' prefix in (gnu packages gawk) Paul A. Patience
@ 2022-07-03 13:01 ` Paul A. Patience
  2022-07-03 13:02   ` [bug#56368] [PATCH 3/4] gnu: Add egawk-next Paul A. Patience
  2022-07-03 13:02   ` [bug#56368] [PATCH 4/4] gnu: Add cppawk and cppawk-egawk Paul A. Patience
  2022-07-04  4:59 ` [bug#56368] [PATCH v2 0/4] " Paul A. Patience
  1 sibling, 2 replies; 10+ messages in thread
From: Paul A. Patience @ 2022-07-03 13:01 UTC (permalink / raw)
  To: 56368; +Cc: Paul A. Patience

* gnu/packages/gawk.scm (gawk-mpfr): New variable.
---
 gnu/packages/gawk.scm | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/gnu/packages/gawk.scm b/gnu/packages/gawk.scm
index 91252094b5..52ac66f9bb 100644
--- a/gnu/packages/gawk.scm
+++ b/gnu/packages/gawk.scm
@@ -3,6 +3,7 @@
 ;;; Copyright © 2014, 2015 Mark H Weaver <mhw@netris.org>
 ;;; Copyright © 2018 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2021 Marius Bakke <marius@gnu.org>
+;;; Copyright © 2022 Paul A. Patience <paul@apatience.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -24,6 +25,7 @@ (define-module (gnu packages gawk)
   #:use-module (gnu packages)
   #:use-module (gnu packages bash)
   #:use-module (gnu packages libsigsegv)
+  #:use-module (gnu packages multiprecision)
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix build-system gnu))
@@ -95,6 +97,14 @@ (define-public gawk
 including network access, sorting, and large libraries.")
    (license license:gpl3+)))

+;; Separate from gawk to facilitate bootstrapping.
+(define-public gawk-mpfr
+  (package/inherit gawk
+    (name "gawk-mpfr")
+    (inputs
+     (modify-inputs (package-inputs gawk)
+       (prepend mpfr)))))
+
 (define-public mawk
   (package
     (name "mawk")
--
2.36.1






^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [bug#56368] [PATCH 3/4] gnu: Add egawk-next.
  2022-07-03 13:01 ` [bug#56368] [PATCH 2/4] gnu: Add gawk-mpfr Paul A. Patience
@ 2022-07-03 13:02   ` Paul A. Patience
  2022-07-03 13:02   ` [bug#56368] [PATCH 4/4] gnu: Add cppawk and cppawk-egawk Paul A. Patience
  1 sibling, 0 replies; 10+ messages in thread
From: Paul A. Patience @ 2022-07-03 13:02 UTC (permalink / raw)
  To: 56368; +Cc: Paul A. Patience

* gnu/packages/gawk.scm (egawk-next): New variable.
---
 gnu/packages/gawk.scm | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/gnu/packages/gawk.scm b/gnu/packages/gawk.scm
index 52ac66f9bb..f0e034b750 100644
--- a/gnu/packages/gawk.scm
+++ b/gnu/packages/gawk.scm
@@ -28,6 +28,7 @@ (define-module (gnu packages gawk)
   #:use-module (gnu packages multiprecision)
   #:use-module (guix packages)
   #:use-module (guix download)
+  #:use-module (guix git-download)
   #:use-module (guix build-system gnu))

 (define-public gawk
@@ -105,6 +106,34 @@ (define-public gawk-mpfr
      (modify-inputs (package-inputs gawk)
        (prepend mpfr)))))

+;; Suffixed with -next because, similarly to Emacs, development versions are
+;; numbered x.y.60+z, and also there are no tagged versions of egawk yet.
+;; (However, though egawk's --version lists 5.1.60, it is actually forked from
+;; a development version of gawk 5.1.1.)
+(define-public egawk-next
+  (let ((commit "f00e74ffc73f6ba6fe74fb7a26319770b8c3792c")
+        (revision "0"))
+    (package
+      (inherit gawk-mpfr)
+      (name "egawk-next")
+      (version (git-version "5.1.60" revision commit))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://www.kylheku.com/git/egawk")
+               (commit commit)))
+         (file-name (git-file-name name version))
+         (sha256
+          (base32 "0bmfbw6k1aiyiardnk7ha5zlpkvavj013mm4n7wwj2vdcgrs6p1f"))))
+      (home-page "https://www.kylheku.com/git/egawk")
+      (synopsis "Enhanced GNU Awk")
+      (description
+       "@command{egawk} is Enhanced GNU Awk.  It is a fork of GNU Awk with
+some enhancements designed and implemented by Kaz Kylheku.  In particular,
+Enhanced GNU Awk provides the @code{@@let} statement for declaring
+block-scoped lexical variables."))))
+
 (define-public mawk
   (package
     (name "mawk")
--
2.36.1






^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [bug#56368] [PATCH 4/4] gnu: Add cppawk and cppawk-egawk.
  2022-07-03 13:01 ` [bug#56368] [PATCH 2/4] gnu: Add gawk-mpfr Paul A. Patience
  2022-07-03 13:02   ` [bug#56368] [PATCH 3/4] gnu: Add egawk-next Paul A. Patience
@ 2022-07-03 13:02   ` Paul A. Patience
  1 sibling, 0 replies; 10+ messages in thread
From: Paul A. Patience @ 2022-07-03 13:02 UTC (permalink / raw)
  To: 56368; +Cc: Paul A. Patience

* gnu/packages/gawk.scm (cppawk, cppawk-egawk): New variables.
---
 gnu/packages/gawk.scm | 94 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 94 insertions(+)

diff --git a/gnu/packages/gawk.scm b/gnu/packages/gawk.scm
index f0e034b750..4d74f6d47e 100644
--- a/gnu/packages/gawk.scm
+++ b/gnu/packages/gawk.scm
@@ -23,12 +23,16 @@
 (define-module (gnu packages gawk)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (gnu packages)
+  #:use-module (gnu packages base)
   #:use-module (gnu packages bash)
+  #:use-module (gnu packages gcc)
   #:use-module (gnu packages libsigsegv)
   #:use-module (gnu packages multiprecision)
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix git-download)
+  #:use-module (guix utils)
+  #:use-module (guix build-system copy)
   #:use-module (guix build-system gnu))

 (define-public gawk
@@ -160,3 +164,93 @@ (define-public mawk
 This version aims to be smaller and faster than GNU Awk, at the expense
 of fewer features and extensions.")
     (license license:gpl2))) ;version 2 only
+
+(define-public cppawk
+  (package
+    (name "cppawk")
+    (version "20220703")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://www.kylheku.com/cgit/cppawk/")
+             ;; The version isn't tagged.
+             (commit "99fcf1f7e633bea1dcb678382a3adbd845920f69")))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "19g773aybvr2g02bw91v8ygmvqlrlv2bpp4bk3svqfrhxbrhr0fl"))))
+    (build-system copy-build-system)
+    (arguments
+     `(#:install-plan '(("bin/cppawk" "bin/cppawk")
+                        ("share/cppawk/include" "share/cppawk/include")
+                        ("./" "share/man/man1" #:include-regexp (".*\\.1$")))
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'fix-paths
+           (lambda _
+             (substitute* "bin/cppawk"
+               (("/bin/bash") (which "bash"))
+               (("dirname") (which "dirname"))
+               (("mktemp") (which "mktemp"))
+               ;; Extra space to prevent matching Awk's printf.
+               (("printf ") (string-append (which "printf") " "))
+               (("rm -f") (string-append (which "rm") " -f"))
+               (("prepro=cpp") (string-append "prepro=" (which "cpp")))
+               (("sed -e") (string-append (which "sed") " -e")))
+             (substitute* "runtests"
+               (("--awk=mawk") (string-append "--awk=" (which "mawk")))
+               (("rm -f") (string-append (which "rm") " -f")))
+             (substitute* "testcases"
+               (("grep") (which "grep")))
+             (substitute* "testsuite.awk"
+               (("cat output") (string-append (which "cat") " output"))
+               (("sh script.sh") (string-append (which "bash") " script.sh")))))
+         (add-after 'fix-paths 'fix-awk-paths
+           (lambda _
+             (substitute* "bin/cppawk"
+               (("awk=gawk") (string-append "awk=" (which "gawk")))
+               (("awk '") (string-append (which "gawk") " '")))))
+         (add-after 'build 'check
+           (lambda _
+             (invoke "./runtests"))))))
+    (native-inputs
+     ;; For tests
+     (list mawk))
+    (inputs
+     (list coreutils                    ; For dirname, mktemp, printf, rm
+           gawk-mpfr                    ; Default variant, but supports others
+           gcc                          ; For cpp
+           sed))
+    (home-page "https://www.kylheku.com/cgit/cppawk/")
+    (synopsis "Wrapper script that adds C preprocessing to Awk")
+    (description
+     "@command{cppawk} is a shell script that invokes the C preprocessor
+(@command{cpp}) on Awk code and calls Awk (by default GNU Awk) on the result.
+
+@command{cppawk} understands the basic Awk options like @option{-F} and
+@option{-v}, and also understands common @command{cpp} options like
+@option{-I} and @option{-Dmacro=value}.
+
+@command{cppawk} has no dependencies beyond Awk, @command{cpp}, @command{sed}
+and some GNU core utilities (including @command{printf}).  Preprocessed
+programs can be captured and transferred to systems that have Awk but not
+@command{cpp} or @command{cppawk}.")
+    (license license:bsd-2)))
+
+(define-public cppawk-egawk
+  (package/inherit cppawk
+    (name "cppawk-egawk")
+    (arguments
+     (substitute-keyword-arguments (package-arguments cppawk)
+       ((#:phases phases)
+        `(modify-phases ,phases
+           (replace 'fix-awk-paths
+             (lambda _
+               (substitute* "bin/cppawk"
+                 (("awk=gawk") (string-append "awk=" (which "egawk")))
+                 (("awk '") (string-append (which "egawk") " '")))))))))
+    (inputs
+     (modify-inputs (package-inputs cppawk)
+       (delete "gawk-mpfr")
+       (prepend egawk-next)))
+    (synopsis "cppawk that calls Enhanced GNU Awk by default")))
--
2.36.1






^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [bug#56368] [PATCH v2 0/4] gnu: Add cppawk and cppawk-egawk.
  2022-07-03 12:59 [bug#56368] [PATCH 1/4] gnu: Use 'license:' prefix in (gnu packages gawk) Paul A. Patience
  2022-07-03 13:01 ` [bug#56368] [PATCH 2/4] gnu: Add gawk-mpfr Paul A. Patience
@ 2022-07-04  4:59 ` Paul A. Patience
  2022-07-04  4:59   ` [bug#56368] [PATCH v2 1/4] gnu: Use 'license:' prefix in (gnu packages gawk) Paul A. Patience
                     ` (4 more replies)
  1 sibling, 5 replies; 10+ messages in thread
From: Paul A. Patience @ 2022-07-04  4:59 UTC (permalink / raw)
  To: 56368; +Cc: Paul A. Patience

Updated to use the tagged version of cppawk which is now available.
Also fixed the git url (which is slightly different from the homepage url).

Paul A. Patience (4):
  gnu: Use 'license:' prefix in (gnu packages gawk).
  gnu: Add gawk-mpfr.
  gnu: Add egawk-next.
  gnu: Add cppawk and cppawk-egawk.

 gnu/packages/gawk.scm | 130 +++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 127 insertions(+), 3 deletions(-)

--
2.36.1






^ permalink raw reply	[flat|nested] 10+ messages in thread

* [bug#56368] [PATCH v2 1/4] gnu: Use 'license:' prefix in (gnu packages gawk).
  2022-07-04  4:59 ` [bug#56368] [PATCH v2 0/4] " Paul A. Patience
@ 2022-07-04  4:59   ` Paul A. Patience
  2022-07-04  4:59   ` [bug#56368] [PATCH v2 2/4] gnu: Add gawk-mpfr Paul A. Patience
                     ` (3 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: Paul A. Patience @ 2022-07-04  4:59 UTC (permalink / raw)
  To: 56368; +Cc: Paul A. Patience

* gnu/packages/gawk.scm: Import (guix licenses) with 'license:' prefix.
(gawk, mawk)[license]: Prefix with 'license:'.
---
 gnu/packages/gawk.scm | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gnu/packages/gawk.scm b/gnu/packages/gawk.scm
index 1935e73ab7..91252094b5 100644
--- a/gnu/packages/gawk.scm
+++ b/gnu/packages/gawk.scm
@@ -20,7 +20,7 @@
 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

 (define-module (gnu packages gawk)
-  #:use-module (guix licenses)
+  #:use-module ((guix licenses) #:prefix license:)
   #:use-module (gnu packages)
   #:use-module (gnu packages bash)
   #:use-module (gnu packages libsigsegv)
@@ -93,7 +93,7 @@ (define-public gawk
 language for the easy manipulation of formatted text, such as tables of data.
 Gawk features many extensions beyond the traditional implementation,
 including network access, sorting, and large libraries.")
-   (license gpl3+)))
+   (license license:gpl3+)))

 (define-public mawk
   (package
@@ -120,4 +120,4 @@ (define-public mawk
      "@command{mawk} is an interpreter for the Awk programming language.
 This version aims to be smaller and faster than GNU Awk, at the expense
 of fewer features and extensions.")
-    (license gpl2))) ;version 2 only
+    (license license:gpl2))) ;version 2 only
--
2.36.1






^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [bug#56368] [PATCH v2 2/4] gnu: Add gawk-mpfr.
  2022-07-04  4:59 ` [bug#56368] [PATCH v2 0/4] " Paul A. Patience
  2022-07-04  4:59   ` [bug#56368] [PATCH v2 1/4] gnu: Use 'license:' prefix in (gnu packages gawk) Paul A. Patience
@ 2022-07-04  4:59   ` Paul A. Patience
  2022-07-04  4:59   ` [bug#56368] [PATCH v2 3/4] gnu: Add egawk-next Paul A. Patience
                     ` (2 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: Paul A. Patience @ 2022-07-04  4:59 UTC (permalink / raw)
  To: 56368; +Cc: Paul A. Patience

* gnu/packages/gawk.scm (gawk-mpfr): New variable.
---
 gnu/packages/gawk.scm | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/gnu/packages/gawk.scm b/gnu/packages/gawk.scm
index 91252094b5..52ac66f9bb 100644
--- a/gnu/packages/gawk.scm
+++ b/gnu/packages/gawk.scm
@@ -3,6 +3,7 @@
 ;;; Copyright © 2014, 2015 Mark H Weaver <mhw@netris.org>
 ;;; Copyright © 2018 Efraim Flashner <efraim@flashner.co.il>
 ;;; Copyright © 2021 Marius Bakke <marius@gnu.org>
+;;; Copyright © 2022 Paul A. Patience <paul@apatience.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -24,6 +25,7 @@ (define-module (gnu packages gawk)
   #:use-module (gnu packages)
   #:use-module (gnu packages bash)
   #:use-module (gnu packages libsigsegv)
+  #:use-module (gnu packages multiprecision)
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix build-system gnu))
@@ -95,6 +97,14 @@ (define-public gawk
 including network access, sorting, and large libraries.")
    (license license:gpl3+)))

+;; Separate from gawk to facilitate bootstrapping.
+(define-public gawk-mpfr
+  (package/inherit gawk
+    (name "gawk-mpfr")
+    (inputs
+     (modify-inputs (package-inputs gawk)
+       (prepend mpfr)))))
+
 (define-public mawk
   (package
     (name "mawk")
--
2.36.1






^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [bug#56368] [PATCH v2 3/4] gnu: Add egawk-next.
  2022-07-04  4:59 ` [bug#56368] [PATCH v2 0/4] " Paul A. Patience
  2022-07-04  4:59   ` [bug#56368] [PATCH v2 1/4] gnu: Use 'license:' prefix in (gnu packages gawk) Paul A. Patience
  2022-07-04  4:59   ` [bug#56368] [PATCH v2 2/4] gnu: Add gawk-mpfr Paul A. Patience
@ 2022-07-04  4:59   ` Paul A. Patience
  2022-07-04  4:59   ` [bug#56368] [PATCH v2 4/4] gnu: Add cppawk and cppawk-egawk Paul A. Patience
  2022-07-08 15:39   ` bug#56368: [PATCH 1/4] gnu: Use 'license:' prefix in (gnu packages gawk) Ludovic Courtès
  4 siblings, 0 replies; 10+ messages in thread
From: Paul A. Patience @ 2022-07-04  4:59 UTC (permalink / raw)
  To: 56368; +Cc: Paul A. Patience

* gnu/packages/gawk.scm (egawk-next): New variable.
---
 gnu/packages/gawk.scm | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/gnu/packages/gawk.scm b/gnu/packages/gawk.scm
index 52ac66f9bb..6b905f6654 100644
--- a/gnu/packages/gawk.scm
+++ b/gnu/packages/gawk.scm
@@ -28,6 +28,7 @@ (define-module (gnu packages gawk)
   #:use-module (gnu packages multiprecision)
   #:use-module (guix packages)
   #:use-module (guix download)
+  #:use-module (guix git-download)
   #:use-module (guix build-system gnu))

 (define-public gawk
@@ -105,6 +106,34 @@ (define-public gawk-mpfr
      (modify-inputs (package-inputs gawk)
        (prepend mpfr)))))

+;; Suffixed with -next because, similarly to Emacs, development versions are
+;; numbered x.y.60+z, and also there are no tagged versions of egawk yet.
+;; (However, though egawk's --version lists 5.1.60, it is actually forked from
+;; a development version of gawk 5.1.1.)
+(define-public egawk-next
+  (let ((commit "f00e74ffc73f6ba6fe74fb7a26319770b8c3792c")
+        (revision "0"))
+    (package
+      (inherit gawk-mpfr)
+      (name "egawk-next")
+      (version (git-version "5.1.60" revision commit))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://www.kylheku.com/git/egawk")
+               (commit commit)))
+         (file-name (git-file-name name version))
+         (sha256
+          (base32 "0bmfbw6k1aiyiardnk7ha5zlpkvavj013mm4n7wwj2vdcgrs6p1f"))))
+      (home-page "https://www.kylheku.com/cgit/egawk/")
+      (synopsis "Enhanced GNU Awk")
+      (description
+       "@command{egawk} is Enhanced GNU Awk.  It is a fork of GNU Awk with
+some enhancements designed and implemented by Kaz Kylheku.  In particular,
+Enhanced GNU Awk provides the @code{@@let} statement for declaring
+block-scoped lexical variables."))))
+
 (define-public mawk
   (package
     (name "mawk")
--
2.36.1






^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [bug#56368] [PATCH v2 4/4] gnu: Add cppawk and cppawk-egawk.
  2022-07-04  4:59 ` [bug#56368] [PATCH v2 0/4] " Paul A. Patience
                     ` (2 preceding siblings ...)
  2022-07-04  4:59   ` [bug#56368] [PATCH v2 3/4] gnu: Add egawk-next Paul A. Patience
@ 2022-07-04  4:59   ` Paul A. Patience
  2022-07-08 15:39   ` bug#56368: [PATCH 1/4] gnu: Use 'license:' prefix in (gnu packages gawk) Ludovic Courtès
  4 siblings, 0 replies; 10+ messages in thread
From: Paul A. Patience @ 2022-07-04  4:59 UTC (permalink / raw)
  To: 56368; +Cc: Paul A. Patience

* gnu/packages/gawk.scm (cppawk, cppawk-egawk): New variables.
---
 gnu/packages/gawk.scm | 85 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

diff --git a/gnu/packages/gawk.scm b/gnu/packages/gawk.scm
index 6b905f6654..9feaf059fb 100644
--- a/gnu/packages/gawk.scm
+++ b/gnu/packages/gawk.scm
@@ -23,12 +23,16 @@
 (define-module (gnu packages gawk)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (gnu packages)
+  #:use-module (gnu packages base)
   #:use-module (gnu packages bash)
+  #:use-module (gnu packages gcc)
   #:use-module (gnu packages libsigsegv)
   #:use-module (gnu packages multiprecision)
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix git-download)
+  #:use-module (guix utils)
+  #:use-module (guix build-system copy)
   #:use-module (guix build-system gnu))

 (define-public gawk
@@ -160,3 +164,84 @@ (define-public mawk
 This version aims to be smaller and faster than GNU Awk, at the expense
 of fewer features and extensions.")
     (license license:gpl2))) ;version 2 only
+
+(define-public cppawk
+  (package
+    (name "cppawk")
+    (version "20220703")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://www.kylheku.com/git/cppawk")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0b09757q81sz4gn62k3mv5bgllyb2v5m64346s8fc99mqqif70cx"))))
+    (build-system copy-build-system)
+    (arguments
+     `(#:install-plan '(("bin/cppawk" "bin/cppawk")
+                        ("share/cppawk/include" "share/cppawk/include")
+                        ("./" "share/man/man1" #:include-regexp (".*\\.1$")))
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'fix-paths
+           (lambda _
+             (substitute* "bin/cppawk"
+               (("/bin/bash") (which "bash"))
+               (("dirname") (which "dirname"))
+               (("mktemp") (which "mktemp"))
+               ;; Extra space to prevent matching Awk's printf.
+               (("printf ") (string-append (which "printf") " "))
+               (("rm -f") (string-append (which "rm") " -f"))
+               (("prepro=cpp") (string-append "prepro=" (which "cpp")))
+               (("sed -e") (string-append (which "sed") " -e")))))
+         (add-after 'fix-paths 'fix-awk-paths
+           (lambda _
+             (substitute* "bin/cppawk"
+               (("awk=gawk") (string-append "awk=" (which "gawk")))
+               (("awk '") (string-append (which "gawk") " '")))))
+         (add-after 'build 'check
+           (lambda _
+             (invoke "./runtests"))))))
+    (native-inputs
+     ;; For tests
+     (list mawk))
+    (inputs
+     (list coreutils                    ; For dirname, mktemp, printf, rm
+           gawk-mpfr                    ; Default variant, but supports others
+           gcc                          ; For cpp
+           sed))
+    (home-page "https://www.kylheku.com/cgit/cppawk/")
+    (synopsis "Wrapper script that adds C preprocessing to Awk")
+    (description
+     "@command{cppawk} is a shell script that invokes the C preprocessor
+(@command{cpp}) on Awk code and calls Awk (by default GNU Awk) on the result.
+
+@command{cppawk} understands the basic Awk options like @option{-F} and
+@option{-v}, and also understands common @command{cpp} options like
+@option{-I} and @option{-Dmacro=value}.
+
+@command{cppawk} has no dependencies beyond Awk, @command{cpp}, @command{sed}
+and some GNU core utilities (including @command{printf}).  Preprocessed
+programs can be captured and transferred to systems that have Awk but not
+@command{cpp} or @command{cppawk}.")
+    (license license:bsd-2)))
+
+(define-public cppawk-egawk
+  (package/inherit cppawk
+    (name "cppawk-egawk")
+    (arguments
+     (substitute-keyword-arguments (package-arguments cppawk)
+       ((#:phases phases)
+        `(modify-phases ,phases
+           (replace 'fix-awk-paths
+             (lambda _
+               (substitute* "bin/cppawk"
+                 (("awk=gawk") (string-append "awk=" (which "egawk")))
+                 (("awk '") (string-append (which "egawk") " '")))))))))
+    (inputs
+     (modify-inputs (package-inputs cppawk)
+       (delete "gawk-mpfr")
+       (prepend egawk-next)))
+    (synopsis "cppawk that calls Enhanced GNU Awk by default")))
--
2.36.1






^ permalink raw reply related	[flat|nested] 10+ messages in thread

* bug#56368: [PATCH 1/4] gnu: Use 'license:' prefix in (gnu packages gawk).
  2022-07-04  4:59 ` [bug#56368] [PATCH v2 0/4] " Paul A. Patience
                     ` (3 preceding siblings ...)
  2022-07-04  4:59   ` [bug#56368] [PATCH v2 4/4] gnu: Add cppawk and cppawk-egawk Paul A. Patience
@ 2022-07-08 15:39   ` Ludovic Courtès
  4 siblings, 0 replies; 10+ messages in thread
From: Ludovic Courtès @ 2022-07-08 15:39 UTC (permalink / raw)
  To: Paul A. Patience; +Cc: 56368-done

Hi Paul,

"Paul A. Patience" <paul@apatience.com> skribis:

>   gnu: Use 'license:' prefix in (gnu packages gawk).
>   gnu: Add gawk-mpfr.
>   gnu: Add egawk-next.
>   gnu: Add cppawk and cppawk-egawk.

Applied, thanks!

Ludo’.




^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2022-07-08 16:27 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-03 12:59 [bug#56368] [PATCH 1/4] gnu: Use 'license:' prefix in (gnu packages gawk) Paul A. Patience
2022-07-03 13:01 ` [bug#56368] [PATCH 2/4] gnu: Add gawk-mpfr Paul A. Patience
2022-07-03 13:02   ` [bug#56368] [PATCH 3/4] gnu: Add egawk-next Paul A. Patience
2022-07-03 13:02   ` [bug#56368] [PATCH 4/4] gnu: Add cppawk and cppawk-egawk Paul A. Patience
2022-07-04  4:59 ` [bug#56368] [PATCH v2 0/4] " Paul A. Patience
2022-07-04  4:59   ` [bug#56368] [PATCH v2 1/4] gnu: Use 'license:' prefix in (gnu packages gawk) Paul A. Patience
2022-07-04  4:59   ` [bug#56368] [PATCH v2 2/4] gnu: Add gawk-mpfr Paul A. Patience
2022-07-04  4:59   ` [bug#56368] [PATCH v2 3/4] gnu: Add egawk-next Paul A. Patience
2022-07-04  4:59   ` [bug#56368] [PATCH v2 4/4] gnu: Add cppawk and cppawk-egawk Paul A. Patience
2022-07-08 15:39   ` bug#56368: [PATCH 1/4] gnu: Use 'license:' prefix in (gnu packages gawk) Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).