Subject: [PATCH v3 04/15] gnu: Add cbehave.

From: David Elsing <[email-masked]>
Date: Thu, 13 Oct 2022 21:04:13 +0000

* gnu/packages/check.scm (cbehave): New variable.
---
 gnu/packages/check.scm | 56 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 56 insertions(+)

diff --git a/gnu/packages/check.scm b/gnu/packages/check.scm
index 797fe71277..70dfbbac27 100644
--- a/gnu/packages/check.scm
+++ b/gnu/packages/check.scm
@@ -38,6 +38,7 @@
 ;;; Copyright © 2020, 2021, 2022 Maxim Cournoyer <[email-masked]>
 ;;; Copyright © 2021 Hugo Lecomte <[email-masked]>
 ;;; Copyright © 2022 Maxime Devos <[email-masked]>
+;;; Copyright © 2022 David Elsing <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -3190,3 +3191,58 @@ (define-public python-pytest-regressions
 tables by saving expected data in a data directory (courtesy of pytest-datadir)
 that can be used to verify that future runs produce the same data.")
     (license license:expat)))
+
+(define-public cbehave
+  (let ((commit "5deaea0eaaf52f1c5ccdac0c68c003988f348fb4")
+        (revision "1"))
+    (package
+      (name "cbehave")
+      (version (git-version "0.2.0" revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/bigwhite/cbehave")
+                      (commit commit)))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  "0kicawxmxn059n3rmfc7r2q5wfjrqbr6lm8dmsi86ba76ak0f9gi"))
+                (snippet
+                 #~(begin
+                     (for-each
+                      (lambda (file)
+                        (delete-file file))
+                      '("Makefile.in" "aclocal.m4" "config.guess" "config.sub"
+                        "configure" "depcomp" "install-sh" "libtool"
+                        "ltmain.sh" "missing" "src/Makefile.in"
+                        "src/example/Makefile.in"))))))
+      (build-system gnu-build-system)
+      (arguments
+       (list
+        #:configure-flags #~(list "--enable-shared" "--disable-static")
+        #:phases
+        #~(modify-phases %standard-phases
+            (add-before 'bootstrap 'rename-configure.in
+              (lambda _
+                (rename-file "configure.in" "configure.ac")))
+            (add-after 'rename-configure.in 'set-AM_PROG_AR
+              (lambda _
+                (substitute* "configure.ac"
+                  (("^AC_PROG_LIBTOOL.*" orig)
+                   (string-append "AM_PROG_AR\n" orig)))))
+            (add-after 'set-AM_PROG_AR 'enable-tests
+              (lambda _
+                (let ((port (open-file "src/example/Makefile.am" "a")))
+                  (display (string-append "\nTESTS = calculator_test"
+                                          " text_editor_test string_test"
+                                          " product_database_test mock_test\n")
+                           port)
+                  (close-port port))))
+            (add-before 'check 'create-dummy-file
+              (lambda _
+                (invoke "touch" "src/example/foo.txt"))))))
+      (native-inputs (list autoconf automake libtool))
+      (home-page "https://github.com/bigwhite/cbehave")
+      (synopsis "Behavior-driven development framework for C")
+      (description "CBehave is a C framework for behavior-driven development.")
+      (license license:apsl2))))
-- 
2.37.0