From patchwork Sun Jul 3 13:02:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Paul A. Patience" X-Patchwork-Id: 40490 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id A866527BBEA; Sun, 3 Jul 2022 14:03:16 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 1BC6F27BBE9 for ; Sun, 3 Jul 2022 14:03:16 +0100 (BST) Received: from localhost ([::1]:43906 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o7zFq-00043G-Vk for patchwork@mira.cbaines.net; Sun, 03 Jul 2022 09:03:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42994) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o7zFf-00042o-6t for guix-patches@gnu.org; Sun, 03 Jul 2022 09:03:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:49699) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o7zFe-0004BI-Pb for guix-patches@gnu.org; Sun, 03 Jul 2022 09:03:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1o7zFe-0006yD-NK for guix-patches@gnu.org; Sun, 03 Jul 2022 09:03:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#56368] [PATCH 4/4] gnu: Add cppawk and cppawk-egawk. Resent-From: "Paul A. Patience" Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 03 Jul 2022 13:03:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56368 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 56368@debbugs.gnu.org Cc: "Paul A. Patience" Received: via spool by 56368-submit@debbugs.gnu.org id=B56368.165685335426744 (code B ref 56368); Sun, 03 Jul 2022 13:03:02 +0000 Received: (at 56368) by debbugs.gnu.org; 3 Jul 2022 13:02:34 +0000 Received: from localhost ([127.0.0.1]:43594 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o7zFC-0006xH-8D for submit@debbugs.gnu.org; Sun, 03 Jul 2022 09:02:34 -0400 Received: from mail-4323.proton.ch ([185.70.43.23]:42222) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o7zF9-0006x3-Qj for 56368@debbugs.gnu.org; Sun, 03 Jul 2022 09:02:33 -0400 Date: Sun, 03 Jul 2022 13:02:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=apatience.com; s=protonmail2; t=1656853345; x=1657112545; bh=fYGpWKlYkWFFyQqpSfYuyuq6PvptR6ptBkVzkzr5cM4=; h=Date:To:From:Cc:Reply-To:Subject:Message-ID:In-Reply-To: References:Feedback-ID:From:To:Cc:Date:Subject:Reply-To: Feedback-ID:Message-ID; b=HdzO6z9SRTiilqE2Zj1MgDWnSquRA5Xm0AjoAg/anR1ecxcU77M/l53aDVetBDetk CVO1rcWP7Un70rsRKCQ1MDZLGon7pr+KQHFlIAdRdHtHYGNl/WaB235zkulHuJhyZR LzfKeTDqbqN8W7ksQ0caCdSeh4ldsbM+GpCmqirQqaqyDhUpb5a1vnBLVRLr9wsgtV 9lKtPaKIaKa8cUrP2cO5o9eFtyuXdRcrHdyAnPPojb1wr9VBOkQV5zjPQ8hQKtXeFO f11i/hrhTvAXRgbRz+tfS1dqQSQ5rsenuTOBF9IQDsDKZkUyvmB/WzIagFWMU/wj6Q 0XjP23yrEb7Qg== From: "Paul A. Patience" Message-ID: <20220703130154.879277-3-paul@apatience.com> In-Reply-To: <20220703130154.879277-1-paul@apatience.com> References: <20220703130154.879277-1-paul@apatience.com> Feedback-ID: 19227857:user:proton MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: "Paul A. Patience" Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/packages/gawk.scm (cppawk, cppawk-egawk): New variables. --- gnu/packages/gawk.scm | 94 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) -- 2.36.1 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")))