diff mbox series

[bug#54581] Add emacs-sqlite3-api package

Message ID 87ils0g5uz.fsf@burningswell.com
State Accepted
Headers show
Series [bug#54581] Add emacs-sqlite3-api package | expand

Commit Message

Roman Scherer March 26, 2022, 2:09 p.m. UTC
Hello Guix,

this patch adds the emacs-sqlite3-api package to Guix. It is a dynamic
module for GNU Emacs 25+ that provides direct access to the core SQLite3
C API from Emacs Lisp.

Could you please review it?

Thanks, Roman.

Comments

M March 26, 2022, 9:17 p.m. UTC | #1
Roman Scherer schreef op za 26-03-2022 om 15:09 [+0100]:
> +               ;; Compile the shared object file.
> +               (apply invoke "make" "CC=gcc" make-flags)

This is broken when cross-compiling.  Use (string-append "CC=" ,(cc-
for-target)) instead of "CC=gcc".

Greetings,
Maxime.
M March 26, 2022, 9:20 p.m. UTC | #2
Roman Scherer schreef op za 26-03-2022 om 15:09 [+0100]:
> +      (description "SQLite3 is a dynamic module for GNU Emacs 25+
> that provides
> +direct access to the core SQLite3 C API from Emacs Lisp.")

While this package integrates SQLite3 into Emacs, SQLite itself is not
part of Emacs, so I would reformulate this a bit.  The description is
also a bit short, ‘(guix)Synopses and Descriptions’ recommends longer
descriptions.  Additionally, the only Emacs in Guix, emacs@27.2, is
25+, so no need to write 25+ here.

Greetings,
Maxime.
M March 26, 2022, 9:21 p.m. UTC | #3
Roman Scherer schreef op za 26-03-2022 om 15:09 [+0100]:
> +         #:tests? #f))

I see some tests in the 'tests' directory.
M March 26, 2022, 9:23 p.m. UTC | #4
Roman Scherer schreef op za 26-03-2022 om 15:09 [+0100]:
> +             (lambda* (#:key (make-flags '()) outputs #:allow-other-
> keys)

'make-flags' is never set, so I would remove it and simplify the invoke
to

  (invoke "make" ... (string-append "CC=" ,(cc-for-target)))

Greetings,
Maxime.
M March 26, 2022, 9:25 p.m. UTC | #5
Roman Scherer schreef op za 26-03-2022 om 15:09 [+0100]:
> +         #:phases
> +         (modify-phases %standard-phases

Could consts.c be built from source?
diff mbox series

Patch

From 9136e4ad504528763315dcb2148c4da0ca1dbe74 Mon Sep 17 00:00:00 2001
From: r0man <roman@burningswell.com>
Date: Sat, 26 Mar 2022 14:59:01 +0100
Subject: [PATCH] Add emacs-sqlite3-api package

This patch adds the emacs-sqlite3-api package to Guix. It is a dynamic module
for GNU Emacs 25+ that provides direct access to the core SQLite3 C API from
Emacs Lisp.
---
 gnu/packages/emacs-xyz.scm | 47 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)

diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index 42fc13f4c2..422739a744 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -5731,6 +5731,53 @@  (define-public emacs-sqlite
 It is not intended as a user interface.")
       (license license:gpl3+))))
 
+(define-public emacs-sqlite3-api
+  (let ((version "0.0.1")
+        (revision "0")
+        (commit "88dfeae8f9612cb3564a7393aa8a5c867aacbaf8"))
+    (package
+      (name "emacs-sqlite3-api")
+      (version (git-version version revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/pekingduck/emacs-sqlite3-api")
+                      (commit commit)))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  "0sj1fsgcgfzz6dfpmp8r5gmdwpbdzpk5g5lm8j7c3nqj6wqgg7g6"))))
+      (build-system emacs-build-system)
+      (arguments
+       `(#:modules ((guix build emacs-build-system)
+                    (guix build emacs-utils)
+                    (guix build utils))
+         #:phases
+         (modify-phases %standard-phases
+           (add-after 'unpack 'patch-module-load
+             (lambda* (#:key outputs #:allow-other-keys)
+               (chmod "sqlite3.el" #o644)
+               (emacs-substitute-sexps "sqlite3.el"
+                 ("(require 'sqlite3-api nil t)"
+                  `(module-load ,(string-append (assoc-ref outputs "out")
+                                                "/lib/sqlite3-api.so"))))))
+           (add-before 'install 'build-emacs-module
+             ;; Run make.
+             (lambda* (#:key (make-flags '()) outputs #:allow-other-keys)
+               ;; Compile the shared object file.
+               (apply invoke "make" "CC=gcc" make-flags)
+               ;; Move the file into /lib.
+               (install-file "sqlite3-api.so"
+                             (string-append (assoc-ref outputs "out")
+                                            "/lib")))))
+         #:tests? #f))
+      (inputs (list sqlite))
+      (home-page "https://github.com/pekingduck/emacs-sqlite3-api")
+      (synopsis "SQLite3 API for GNU Emacs 25+")
+      (description "SQLite3 is a dynamic module for GNU Emacs 25+ that provides
+direct access to the core SQLite3 C API from Emacs Lisp.")
+      (license license:gpl3+))))
+
 (define-public emacs-sr-speedbar
   (let ((commit "77a83fb50f763a465c021eca7343243f465b4a47")
         (revision "0"))
-- 
2.34.0