guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#58261] [PATCH v3 05/15] gnu: Add tinydir.


From: David Elsing
Subject: [bug#58261] [PATCH v3 05/15] gnu: Add tinydir.
Date: Thu, 13 Oct 2022 21:04:14 +0000

* gnu/packages/cpp.scm (tinydir): New variable.
---
 gnu/packages/cpp.scm                          | 41 +++++++++++++++++++
 .../patches/tinydir-fix-cbehave-test.patch    | 16 ++++++++
 2 files changed, 57 insertions(+)
 create mode 100644 gnu/packages/patches/tinydir-fix-cbehave-test.patch

diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index b6a0a70ed7..7871660611 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -2093,3 +2093,44 @@ (define-public sajson
       (description "@code{sajson} is an in-place JSON parser with support for
 parsing with only a single memory allocation.")
       (license license:expat))))
+
+(define-public tinydir
+  (package
+    (name "tinydir")
+    (version "1.2.5")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/cxong/tinydir";)
+                    (commit version)))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "1nprgdfx4i8wzc1idw6chan4fjfa75b5ll8kghdc0q2278pny259"))
+              (patches (search-patches "tinydir-fix-cbehave-test.patch"))
+              (modules '((guix build utils)))
+              (snippet '(delete-file-recursively "tests/cbehave"))))
+    (build-system cmake-build-system)
+    (arguments
+     (list
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'path-cmake
+            (lambda _
+              (substitute* "tests/CMakeLists.txt"
+                (("^include_dir.*cbehave.*")
+                 (string-append "include_directories("#$cbehave "/include)"))
+                (("^add_subdir.*cbeha.*") ""))))
+          (add-before 'configure 'chdir
+            (lambda _
+              (chdir "tests")))
+          (replace 'install
+            (lambda _
+              (install-file "../tinydir.h"
+                            (string-append #$output "/include")))))))
+    (native-inputs (list cbehave))
+    (home-page "https://github.com/cxong/tinydir";)
+    (synopsis "Directory listing wrapper")
+    (description "@code{tinydir} is a header-only C wrapper for listing
+directory contents.")
+    (license license:bsd-2)))
diff --git a/gnu/packages/patches/tinydir-fix-cbehave-test.patch 
b/gnu/packages/patches/tinydir-fix-cbehave-test.patch
new file mode 100644
index 0000000000..84ecee12c2
--- /dev/null
+++ b/gnu/packages/patches/tinydir-fix-cbehave-test.patch
@@ -0,0 +1,16 @@
+Make test work with upstream cbehave
+(tinydir bundles a modified version)
+
+diff --git a/tests/file_open_test.c b/tests/file_open_test.c
+index 3e659bc..9f6f88d 100644
+--- a/tests/file_open_test.c
++++ b/tests/file_open_test.c
+@@ -19,4 +19,7 @@ FEATURE(file_open, "File open")
+       SCENARIO_END
+ FEATURE_END
+ 
+-CBEHAVE_RUN("File open:", TEST_FEATURE(file_open))
++int main(void) {
++      cbehave_feature _cfeatures[] = {{feature_idx(file_open)}};
++      return cbehave_runner("File open:", _cfeatures);
++}
-- 
2.37.0






reply via email to

[Prev in Thread] Current Thread [Next in Thread]