[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/emacsql 394bb062aa 219/427: Add a small library for determ
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/emacsql 394bb062aa 219/427: Add a small library for determining binary to use. |
Date: |
Tue, 13 Dec 2022 02:59:45 -0500 (EST) |
branch: elpa/emacsql
commit 394bb062aa17d9e6214c61f520005c79cc1d06ff
Author: Christopher Wellons <wellons@nullprogram.com>
Commit: Christopher Wellons <wellons@nullprogram.com>
Add a small library for determining binary to use.
---
Makefile | 3 ++-
emacsql-sqlite.el | 3 ++-
emacsql-system.el | 44 ++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 48 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
index 8c0a9554ec..4ee2f453be 100644
--- a/Makefile
+++ b/Makefile
@@ -6,7 +6,8 @@ BATCH := $(VIRTUAL) -batch -Q -L .
PACKAGE := emacsql
VERSION := $(shell $(CASK) version)
-EL = emacsql-compiler.el emacsql.el emacsql-sqlite.el emacsql-psql.el
+EL = emacsql-compiler.el emacsql-system.el emacsql.el \
+ emacsql-sqlite.el emacsql-psql.el
ELC = $(EL:.el=.elc)
EXTRA_DIST = README.md UNLICENSE
diff --git a/emacsql-sqlite.el b/emacsql-sqlite.el
index 1d63360920..7491999050 100644
--- a/emacsql-sqlite.el
+++ b/emacsql-sqlite.el
@@ -5,9 +5,10 @@
(require 'cl-lib)
(require 'eieio)
(require 'emacsql)
+(require 'emacsql-system)
(defvar emacsql-sqlite-executable
- (expand-file-name "bin/emacsql-sqlite-linux-x86_64"
+ (expand-file-name (emacsql-system-binary "bin/emacsql-sqlite")
(file-name-directory load-file-name))
"Path to the Emacsql backend (this is not the sqlite3 shell).")
diff --git a/emacsql-system.el b/emacsql-system.el
new file mode 100644
index 0000000000..2ac8bfcc21
--- /dev/null
+++ b/emacsql-system.el
@@ -0,0 +1,44 @@
+;;; emacsql-system.el --- detect OS and machine -*- lexical-binding: t; -*-
+
+;;; Commentary:
+
+;;; Code:
+
+(require 'cl-lib)
+
+(defun emacsql-system-normalize-arch (arch)
+ "Normalize the name of string ARCH."
+ (cl-case (intern arch)
+ ((x86 i386 i486 i586 i686) 'x86)
+ ((x86_64 amd64) 'x86_64)
+ (otherwise (intern arch))))
+
+(defun emacsql-system-architecture ()
+ "Determine this system's architecture."
+ (emacsql-system-normalize-arch
+ (if (executable-find "uname")
+ (with-temp-buffer
+ (call-process "uname" nil (current-buffer) nil "-m")
+ (replace-regexp-in-string "\\s " "" (buffer-string)))
+ (getenv "PROCESSOR_ARCHITECTURE"))))
+
+(defun emacsql-system-tuple ()
+ "Return a tuple (kernel architecture) for the current system."
+ (list
+ (cl-ecase system-type
+ (gnu 'hurd)
+ (gnu/linux 'linux)
+ ((gnu/kfreebsd berkeley-unix) 'bsd)
+ (darwin 'darwin)
+ (ms-dos 'dos)
+ (windows-nt 'windows)
+ (cygwin 'windows))
+ (emacsql-system-architecture)))
+
+(defun emacsql-system-binary (prefix)
+ "Determine an executable name for PREFIX."
+ (concat prefix "-" (mapconcat #'symbol-name (emacsql-system-tuple) "-")))
+
+(provide 'emacsql-system)
+
+;;; emacsql-system.el ends here
- [nongnu] elpa/emacsql d440b44778 076/427: Add escape vector test., (continued)
- [nongnu] elpa/emacsql d440b44778 076/427: Add escape vector test., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 1db49d7f4c 090/427: Add Windows notice again., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 1ad58cd68d 108/427: Allow substatement in IN operator., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 8fa7c00978 170/427: Add sentinel cleanup to psql., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 6d17256e1b 171/427: Add a mix-in class to reduce code duplication., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 749becb017 181/427: Disable notices and warnings in psql., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql e42d939235 187/427: In SQLite, block for up to 30 seconds on db lock., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 3ba9109d45 198/427: Start using real version numbers., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql de0bde9a02 207/427: Use Cask package-file directive instead., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql bb3dbfc891 213/427: Set a global query timeout., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 394bb062aa 219/427: Add a small library for determining binary to use.,
ELPA Syncer <=
- [nongnu] elpa/emacsql f030b9952d 224/427: Fix up psql-connection., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql dc2afbbc1f 221/427: Adjust the Emacsql wire protocol., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 6318472b20 223/427: Link the Makefiles together., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql a7728339ba 216/427: Switch to custom middleware., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql ab53199d07 232/427: Fix escaping issue in middleware., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 6ad267f93b 229/427: Change :value to :scalar., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 1146f2e26a 233/427: Flesh out the changes in the README., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql ed77eac846 237/427: Add string prepared statements., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 847196cafa 226/427: Set tty to raw in psql., ELPA Syncer, 2022/12/13
- [nongnu] elpa/emacsql 3e5ce21b0d 242/427: Tweak the new implementation notes., ELPA Syncer, 2022/12/13