Subject: [bug#68552] [PATCH] gnu: Add duckdb.

From: Greg Hogan <[email-masked]>
Date: Wed, 17 Jan 2024 21:49:18 +0000

There exists a package python-duckdb, and this patch adds a package for
the CLI and C++ libraries.

* gnu/packages/cpp.scm (duckdb): New variable.
---
 gnu/packages/cpp.scm | 29 ++++++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index ecd3e4afac..420d9e8708 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -14,7 +14,7 @@
 ;;; Copyright © 2020, 2022 Marius Bakke <[email-masked]>
 ;;; Copyright © 2020 Michael Rohleder <[email-masked]>
 ;;; Copyright © 2020 Alexandros Theodotou <[email-masked]>
-;;; Copyright © 2020-2022 Greg Hogan <[email-masked]>
+;;; Copyright © 2020-2022, 2024 Greg Hogan <[email-masked]>
 ;;; Copyright © 2020 Brett Gilio <[email-masked]>
 ;;; Copyright © 2020 Milkey Mouse <[email-masked]>
 ;;; Copyright © 2021 Raghav Gururajan <[email-masked]>
@@ -3064,3 +3064,30 @@ (define-public tl-optional
 the std::optional for C++11/14/17, with support for monadic operations added in
 C++23.")
     (license license:cc0)))
+
+(define-public duckdb
+  (package
+    (name "duckdb")
+    (version "0.9.2")
+    (source
+      (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/duckdb/duckdb")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "0dbsxyiz7c8sxflbfj87qv0b2s69zk802vsk5h00ra8w8fcbqlj0"))
+       (modules '((guix build utils)))
+       (snippet
+        #~(begin
+            ;; There is no git checkout from which to read the version tag.
+            (substitute* "CMakeLists.txt"
+              (("set\\(DUCKDB_VERSION \"[^\"]*\"")
+               (string-append "set(DUCKDB_VERSION \"v" #$version "-dev0\"")))))))
+    (build-system cmake-build-system)
+    (synopsis "DuckDB embedded database")
+    (description "DuckDB is an in-process SQL OLAP database management system.")
+    (home-page "https://duckdb.org")
+    (license license:expat)))

base-commit: 692272661548eb2a46aaa818175b1a39b3fc9ffa
-- 
2.40.1