From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33829) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eyKD7-0001ve-T4 for guix-patches@gnu.org; Tue, 20 Mar 2018 12:34:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eyKD5-0001rq-MH for guix-patches@gnu.org; Tue, 20 Mar 2018 12:34:05 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:36213) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eyKD5-0001rj-Hr for guix-patches@gnu.org; Tue, 20 Mar 2018 12:34:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eyKD5-0006JR-Bg for guix-patches@gnu.org; Tue, 20 Mar 2018 12:34:03 -0400 Subject: [bug#30884] [PATCH 4/6] gnu: Add emacs-emacsql. Resent-Message-ID: From: Oleg Pykhalov Date: Tue, 20 Mar 2018 19:33:08 +0300 Message-Id: <20180320163310.11955-4-go.wigust@gmail.com> In-Reply-To: <20180320163310.11955-1-go.wigust@gmail.com> References: <20180320163310.11955-1-go.wigust@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 30884@debbugs.gnu.org * 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