Subject: [PATCH] gnu: Add lexy.
From: "Paul A. Patience" <[email-masked]>
To: [email-masked]
Cc: "Paul A. Patience" <[email-masked]>
Date: Wed, 14 Feb 2024 17:04:12 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

* gnu/packages/cpp.scm (lexy): New variable.

Change-Id: I77d896570999d639f223eb014fcfb48b911c8cc8
---
 gnu/packages/cpp.scm | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index 62a1923571..402d9d59f5 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -1376,6 +1376,44 @@ (define-public pegtl
 parsers according to a Parsing Expression Grammar (PEG).")
     (license license:expat)))
 
+(define-public lexy
+  ;; Bug fixes since last release.
+  (let ((commit "b82ffcbe70687a8e97115480b0b6cb3ce39e3a2a")
+        (revision "0"))
+    (package
+      (name "lexy")
+      (version (git-version "2022.12.1" revision commit))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://github.com/foonathan/lexy")
+               (commit commit)))
+         (file-name (git-file-name name version))
+         (sha256
+          (base32 "05fhpjzmhasjqgg0z2k0055i7yjznbh6xgwn9fqlk61vdrfk9hw9"))))
+      (build-system cmake-build-system)
+      (arguments
+       (list #:configure-flags #~(list "-DLEXY_BUILD_DOCS=OFF") ; needs Hugo
+             #:phases
+             #~(modify-phases %standard-phases
+                 (add-after 'unpack 'fix-dependencies
+                   (lambda _
+                     (substitute* "tests/CMakeLists.txt"
+                       (("^message\\(STATUS \"Fetching doctest\"\\).*") "")
+                       (("^include\\(FetchContent\\).*") "")
+                       (("^FetchContent_Declare\\(doctest .*") "")
+                       (("^FetchContent_MakeAvailable\\(doctest\\)")
+                        "find_package(doctest REQUIRED)")
+                       (("^(target_link_libraries\\(lexy_test_base .*) doctest\\)"
+                         _ prefix)
+                        (string-append prefix ")"))))))))
+      (native-inputs (list doctest))
+      (home-page "https://lexy.foonathan.net/")
+      (synopsis "C++ parser combinator library")
+      (description "lexy is a parser combinator library for C++17 and later.")
+      (license license:boost1.0))))
+
 (define-public psascan
   (package
     (name "psascan")

base-commit: 570ef13a87bb54d3410c431700ba78316a2641e2
-- 
2.41.0