summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArsen Arsenović <arsen@gentoo.org>2023-10-12 23:23:13 +0200
committerArsen Arsenović <arsen@gentoo.org>2023-10-19 15:42:36 +0200
commit2f069f94515aef18f66e582cc22013d15ae8b512 (patch)
tree7c76366b7f103357df66a603071890253150730d
parentdev-java/bcutil: Stabilize 1.76 arm64, #915968 (diff)
downloadgentoo-2f069f94515aef18f66e582cc22013d15ae8b512.tar.gz
gentoo-2f069f94515aef18f66e582cc22013d15ae8b512.tar.bz2
gentoo-2f069f94515aef18f66e582cc22013d15ae8b512.zip
app-emacs/emacsql: new package, add 3.1.1
Signed-off-by: Arsen Arsenović <arsen@gentoo.org>
-rw-r--r--app-emacs/emacsql/Manifest1
-rw-r--r--app-emacs/emacsql/emacsql-3.1.1.ebuild80
-rw-r--r--app-emacs/emacsql/files/emacsql-3.1.1-fix-utf8-bom-writing.patch52
-rw-r--r--app-emacs/emacsql/metadata.xml15
4 files changed, 148 insertions, 0 deletions
diff --git a/app-emacs/emacsql/Manifest b/app-emacs/emacsql/Manifest
new file mode 100644
index 000000000000..79f47d710948
--- /dev/null
+++ b/app-emacs/emacsql/Manifest
@@ -0,0 +1 @@
+DIST emacsql-3.1.1.tar.gz 2392710 BLAKE2B 7281c9630c26363d9e88463a3ead8b241a3fc1a5e87cbf855eb233ef6b295ca6ba4ea4a79b5137b27f9eed33012dfaa183dab7be8e76b240305ee921edebe874 SHA512 0ec3890cfa014a0afef23e2e38bcd844527b0a497bbfe6f89cbbb090811d43996074e642f83f7f49b27659fc51a901645a54aac600e9988dcb40fffe86a06fbf
diff --git a/app-emacs/emacsql/emacsql-3.1.1.ebuild b/app-emacs/emacsql/emacsql-3.1.1.ebuild
new file mode 100644
index 000000000000..3ba6d2c8d2a6
--- /dev/null
+++ b/app-emacs/emacsql/emacsql-3.1.1.ebuild
@@ -0,0 +1,80 @@
+# Copyright 2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+NEED_EMACS=25.1
+inherit edo elisp toolchain-funcs
+
+DESCRIPTION="A high-level Emacs Lisp RDBMS front-end"
+HOMEPAGE="https://github.com/magit/emacsql"
+
+if [[ ${PV} == *9999* ]]; then
+ inherit git-r3
+
+ EGIT_REPO_URI="https://github.com/magit/${PN}.git"
+else
+ SRC_URI="
+ https://github.com/magit/${PN}/archive/refs/tags/${PV}.tar.gz -> ${P}.tar.gz
+ "
+ KEYWORDS="~amd64"
+fi
+
+LICENSE="Unlicense"
+SLOT="0"
+# TODO(arsen): postgres-pg using app-emacs/pg (unpackaged as of yet)
+IUSE="+sqlite postgres mysql"
+
+DEPEND="
+ sqlite? ( dev-db/sqlite:3 )
+"
+RDEPEND="
+ ${DEPEND}
+ postgres? ( dev-db/postgresql )
+ mysql? ( virtual/mysql )
+"
+BDEPEND="virtual/pkgconfig"
+
+PATCHES=(
+ "${FILESDIR}/${PN}-3.1.1-fix-utf8-bom-writing.patch"
+)
+
+SITEFILE="50${PN}-gentoo.el"
+
+src_prepare() {
+ default
+
+ # Not packaged.
+ rm emacsql-pg.el || die
+
+ local -A backends=(
+ [sqlite]=sqlite
+ [postgres]=psql
+ [mysql]=mysql
+ )
+
+ for useflag in "${!backends[@]}"; do
+ if ! use "${useflag}"; then
+ rm emacsql-"${backends[${useflag}]}".el || die
+ fi
+ done
+}
+
+src_compile() {
+ if use sqlite; then
+ edo $(tc-getCC) -fPIC -Wall -Wextra \
+ $($(tc-getPKG_CONFIG) --cflags --libs sqlite3) \
+ ${CPPFLAGS} ${CFLAGS} ${LDFLAGS} -o emacsql-sqlite \
+ sqlite/emacsql.c
+ fi
+ elisp_src_compile
+}
+
+src_install() {
+ elisp_src_install
+
+ if use sqlite; then
+ exeinto "${SITELISP}"/emacsql/sqlite
+ doexe emacsql-sqlite
+ fi
+}
diff --git a/app-emacs/emacsql/files/emacsql-3.1.1-fix-utf8-bom-writing.patch b/app-emacs/emacsql/files/emacsql-3.1.1-fix-utf8-bom-writing.patch
new file mode 100644
index 000000000000..ffa30dec85cb
--- /dev/null
+++ b/app-emacs/emacsql/files/emacsql-3.1.1-fix-utf8-bom-writing.patch
@@ -0,0 +1,52 @@
+From 3cec7dcb201568a09ee9cebf0ea1e43cba9d334a Mon Sep 17 00:00:00 2001
+From: Jonas Bernoulli <jonas@bernoul.li>
+Date: Tue, 17 Jan 2023 17:33:37 +0100
+Subject: [PATCH] Use utf-8 coding-system instead of utf-8-auto
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+This fixes an issue that was merely triggered by a change in Emacs
+[1]. [2: 127bb98] started binding `coding-system-for-write' and
+`coding-system-for-read' to `utf-8-auto'. As Eli points out at [3]
+`utf-8-auto' was probably a mistake and `utf-8' should have been
+used instead.
+
+1: https://github.com/emacsmirror/emacs/commit/cfd2b3504ab5de6eb5
+
+2: 2014-02-02 127bb98df20d84117d34822f50ea584af81b19c3
+ Set coding system to utf-8-auto for sqlite.
+
+3: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=60872#11.
+
+ > Setting coding-system-for-write to utf-8-auto makes no sense;
+ > that coding-system's _only_ raison d'être is for using in
+ > coding-system-for-read, i.e. when decoding stuff that may or
+ > may not start with a BOM.
+
+Since EmacSQL is not a general-purpose database but instead stores
+data encoded by Emacs for later retrieval by Emacs only, we do not
+have to with the unlikely appearance of a BOM, so we can use `utf-8'
+instead of `utf-8-auto' for writes *and* reads.
+
+Re #104, #106, magit/forge#533, magit/forge#535, bug#60872.
+---
+ emacsql-sqlite.el | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/emacsql-sqlite.el b/emacsql-sqlite.el
+index 1193147..7b8876f 100644
+--- a/emacsql-sqlite.el
++++ b/emacsql-sqlite.el
+@@ -73,8 +73,9 @@ used.")
+ ((connection emacsql-sqlite-connection) &rest _rest)
+ (emacsql-sqlite-ensure-binary)
+ (let* ((process-connection-type nil) ; use a pipe
+- (coding-system-for-write 'utf-8-auto)
+- (coding-system-for-read 'utf-8-auto)
++ ;; See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=60872#11.
++ (coding-system-for-write 'utf-8)
++ (coding-system-for-read 'utf-8)
+ (file (slot-value connection 'file))
+ (buffer (generate-new-buffer " *emacsql-sqlite*"))
+ (fullfile (if file (expand-file-name file) ":memory:"))
diff --git a/app-emacs/emacsql/metadata.xml b/app-emacs/emacsql/metadata.xml
new file mode 100644
index 000000000000..0b03e24c9c24
--- /dev/null
+++ b/app-emacs/emacsql/metadata.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="person">
+ <email>arsen@gentoo.org</email>
+ <description>Arsen Arsenović</description>
+ </maintainer>
+ <maintainer type="project">
+ <email>gnu-emacs@gentoo.org</email>
+ <name>Gentoo GNU Emacs project</name>
+ </maintainer>
+ <upstream>
+ <remote-id type="github">magit/emacsql</remote-id>
+ </upstream>
+</pkgmetadata>