all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Oleg Pykhalov <go.wigust@gmail.com>
To: 30884@debbugs.gnu.org
Subject: [bug#30884] [PATCH 4/6] gnu: Add emacs-emacsql.
Date: Tue, 20 Mar 2018 19:33:08 +0300	[thread overview]
Message-ID: <20180320163310.11955-4-go.wigust@gmail.com> (raw)
In-Reply-To: <20180320163310.11955-1-go.wigust@gmail.com>

* gnu/packages/emacs.scm (emacs-emacsql): New public variable.
---
 gnu/packages/emacs.scm | 94 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 94 insertions(+)

diff --git a/gnu/packages/emacs.scm b/gnu/packages/emacs.scm
index 41bb69914..83deb256f 100644
--- a/gnu/packages/emacs.scm
+++ b/gnu/packages/emacs.scm
@@ -64,6 +64,7 @@
   #:use-module (gnu packages audio)
   #:use-module (gnu packages bash)
   #:use-module (gnu packages code)
+  #:use-module (gnu packages databases)
   #:use-module (gnu packages guile)
   #:use-module (gnu packages gtk)
   #:use-module (gnu packages gnome)
@@ -7478,3 +7479,96 @@ after its registered lisp object has been garbage collected.  This allows for
 extra resources, such as buffers and processes, to be cleaned up after the
 object has been freed.")
   (license license:unlicense)))
+
+(define-public emacs-emacsql
+  (package
+    (name "emacs-emacsql")
+    (version "2.0.3")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "https://github.com/skeeto/emacsql/archive/"
+                           version ".tar.gz"))
+       (file-name (string-append name "-" version ".tar.gz"))
+       (sha256
+        (base32
+         "04hfjdgl1zc7jysgjc7d7d3xqpr7q1q9gsmzffjd91ii3hpqjgx6"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:modules ((ice-9 match)
+                  (srfi srfi-26)
+                  ,@%gnu-build-system-modules
+                  (guix build emacs-utils))
+       #:imported-modules (,@%gnu-build-system-modules
+                           (guix build emacs-utils))
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure)
+         (add-before 'build 'patch-elisp-shell-shebangs
+           (lambda _
+             (substitute* (find-files "." "\\.el")
+               (("/bin/sh") (which "sh")))
+             #t))
+         (add-after 'patch-elisp-shell-shebangs 'setenv-emacsloadpath
+           (lambda* (#:key inputs #:allow-other-keys)
+             (define (el-dir store-dir)
+               (match (find-files store-dir "\\.el$")
+                 ((f1 f2 ...) (dirname f1))
+                 (_ "")))
+             (define emacs-prefix? (cut string-prefix? "emacs-" <>))
+             (let* ((emacs-load-paths
+                     (map (match-lambda
+                            (((? emacs-prefix? name) . dir)
+                             (string-append (el-dir dir) ":"))
+                            (_ ""))
+                          inputs))
+                    (emacs-load-path-value
+                     (string-concatenate emacs-load-paths)))
+               (format #t "environment variable `EMACSLOADPATH' set to ~a\n"
+                       emacs-load-path-value)
+               (setenv "EMACSLOADPATH" emacs-load-path-value))
+             #t))
+         (add-after 'setenv-emacsloadpath 'setenv-shell
+           (lambda _
+             (setenv "SHELL" "sh")))
+         (add-after 'setenv-shell 'build-emacsql-sqlite
+           (lambda _
+             (invoke "make" "binary" "CC=gcc")))
+         (add-after 'build-emacsql-sqlite 'install-emacsql-sqlite
+           (lambda* (#:key outputs #:allow-other-keys)
+             (install-file "sqlite/emacsql-sqlite"
+                           (string-append (assoc-ref outputs "out")
+                                          "/bin"))
+             #t))
+         (add-after 'install-emacsql-sqlite 'patch-emacsql-sqlite.el
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((file "emacsql-sqlite.el"))
+               (chmod file #o644)
+               (emacs-substitute-sexps file
+                 ("(defvar emacsql-sqlite-user-prompted" 't)
+                 ("(executable-find" (which "gcc"))
+                 ("(defvar emacsql-sqlite-executable"
+                  (string-append (assoc-ref outputs "out")
+                                 "/bin/emacsql-sqlite"))))))
+         (delete 'check) ; No ‘check’ target in ‘./Makefile’.
+         (replace 'install ; No ‘install’ target in ‘./Makefile’.
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out")))
+               (install-file "sqlite/emacsql-sqlite"
+                             (string-append out "/bin"))
+               (for-each (cut install-file <>
+                              (string-append out "/share/emacs/site-lisp"))
+                         (find-files "." "\\.elc*$")))
+             #t)))))
+    (inputs
+     `(("emacs-minimal" ,emacs-minimal)
+       ("mysql" ,mysql)
+       ("postgresql" ,postgresql)))
+    (propagated-inputs
+     `(("emacs-finalize" ,emacs-finalize)
+       ("emacs-pg" ,emacs-pg)))
+    (home-page "https://github.com/skeeto/emacsql")
+    (synopsis "Emacs high-level SQL database front-end")
+    (description "EmacSQL provides a high-level Emacs Lisp front-end for
+SQLite (primarily), PostgreSQL, MySQL, and potentially other SQL databases.")
+  (license license:gpl3+)))
-- 
2.16.2

  parent reply	other threads:[~2018-03-20 16:34 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-20 16:29 [bug#30884] [PATCH 0/6] gnu: Add emacs-epkg Oleg Pykhalov
2018-03-20 16:33 ` [bug#30884] [PATCH 1/6] gnu: Add emacs-pg Oleg Pykhalov
2018-03-20 16:33   ` [bug#30884] [PATCH 2/6] gnu: Add emacs-cl-generic Oleg Pykhalov
2018-04-04 12:32     ` Ludovic Courtès
2018-03-20 16:33   ` [bug#30884] [PATCH 3/6] gnu: Add emacs-finalize Oleg Pykhalov
2018-04-04 12:33     ` Ludovic Courtès
2018-03-20 16:33   ` Oleg Pykhalov [this message]
2018-04-04 12:37     ` [bug#30884] [PATCH 4/6] gnu: Add emacs-emacsql Ludovic Courtès
2018-03-20 16:33   ` [bug#30884] [PATCH 5/6] gnu: Add emacs-closql Oleg Pykhalov
2018-04-04 12:38     ` Ludovic Courtès
2018-03-20 16:33   ` [bug#30884] [PATCH 6/6] gnu: Add emacs-epkg Oleg Pykhalov
2018-04-04 12:39     ` Ludovic Courtès
2018-04-04 12:32   ` [bug#30884] [PATCH 1/6] gnu: Add emacs-pg Ludovic Courtès
2018-03-20 16:43 ` [bug#30884] guix lint produces warnings Oleg Pykhalov
2018-04-14 17:50 ` [bug#30884] Status: [PATCH 0/6] gnu: Add emacs-epkg Oleg Pykhalov
2018-04-16 14:08   ` bug#30884: " Oleg Pykhalov
2018-04-19  1:09   ` [bug#30884] " Maxim Cournoyer
2018-04-19  2:07     ` Maxim Cournoyer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180320163310.11955-4-go.wigust@gmail.com \
    --to=go.wigust@gmail.com \
    --cc=30884@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.