branch: elpa/sqlite3
commit 39c1834b6122a028eb4e9812081702a3e89ef545
Author: Kevin Rineer <[email protected]>
Commit: Kevin Rineer <[email protected]>
feat(readme): Add straight.el installation method
It may be the case that folks might want to use the straight package
manager to install this project.
The deletion in the README is a a very small fix to markdown markup
that remained after an org markup transition.
---
README.org | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 79 insertions(+), 1 deletion(-)
diff --git a/README.org b/README.org
index 1d12880ce36..70c0678d02a 100644
--- a/README.org
+++ b/README.org
@@ -46,6 +46,7 @@
- [[#installation--removal][Installation & Removal]]
- [[#melpa][Melpa]]
- [[#elpa][Elpa]]
+ - [[#straightel][Straight.el]]
- [[#manual-installation][Manual Installation]]
- [[#removal][Removal]]
- [[#note-on-package-update][Note on Package Update]]
@@ -96,7 +97,7 @@ compilation of the dynamic module:
sqlite3-api module must be built. Do so now?
#+END_SRC
-The module is built using the `make all` command by default. To customize the
build process, you can override this behavior by setting the
`SQLITE3_API_BUILD_COMMAND` environment variable.
+The module is built using the ~make all~ command by default. To customize the
build process, you can override this behavior by setting the
=SQLITE3_API_BUILD_COMMAND= environment variable.
*** Elpa
#+BEGIN_SRC sh :eval no :exports code
@@ -119,6 +120,83 @@ If you have sqlite3 installed in a nonstandard location:
$ make INC=/path/to/sqlite3/include LIB="-L/path/to/sqlite3/lib -lsqlite3"
#+END_SRC
+*** Straight.el
+If you would like to use this library with
[[https://github.com/radian-software/straight.el][the straight emacs package
manager]], you will need git pre-installed.
+The following are example snippets of elisp that can be included in your init
file for using straight.
+**** Setting up the build environment
+For those where sqlite3 C library is installed to a non-standard directory,
such as with an installation via homebrew, you may need to add the path to the
=libsqlite3.so= to your =LD_LIBRARY_PATH= environment variable with ~setenv~.
+
+#+begin_src emacs-lisp :eval no :exports code
+(defconst sqlite-lib-dir
+ ;; This example executes 'brew --prefix sqlite' to find the current
installation path dynamically
+ (concat
+ (string-trim (shell-command-to-string "brew --prefix sqlite"))
+ "/lib"))
+
+;; Set LD_LIBRARY_PATH in Emacs' environment
+(setenv "LD_LIBRARY_PATH"
+ (if-let (current-path (getenv "LD_LIBRARY_PATH"))
+ (concat sqlite-lib-dir ":" current-path)
+ sqlite-lib-dir))
+#+end_src
+
+**** Installing via Straight without the use-package macro
+We need to modify =straight-default-files-directive= with an explicit list of
=:files= or our shared object that we compile with ~make~ will not be linked
into the emacs load path.
+Hence, we add to the =:defaults=, the shared library file extensions with a
globbing pattern.
+
+Homebrew users will want to uncomment the =:pre-build= directive so that
straight runs ~make~ in a way that finds brew's sqlite installation directory.
+
+#+begin_src emacs-lisp :eval no :exports code
+(straight-use-package
+ '(sqlite3
+ :host github
+ :repo "kevinrineer/emacs-sqlite3-api"
+ :branch "generic-makefile"
+ :files (:defaults "*.dll" "*.dylib" "*.so")
+ ;; :pre-build ("env" "HOMEBREW=1" "make" "all")
+))
+(load-library "sqlite3")
+
+
+(straight-use-package
+ '(sqlite3
+ :host github
+ :repo "pekingduck/emacs-sqlite3-api"
+ :files (:defaults "*.dll" "*.dylib" "*.so")
+ ))
+(load-library "sqlite3")
+#+end_src
+
+**** Straight with the use-package macro
+One can optionally use straight with the use-package macro to get all of the
configuration handled in one block:
+
+#+begin_src emacs-lisp :eval no :exports code
+(use-package sqlite3
+ :init
+ (defconst sqlite-lib-dir
+ ;; Execute 'brew --prefix sqlite' to find the current installation path
+ (concat
+ (string-trim (shell-command-to-string "brew --prefix sqlite"))
+ "/lib"))
+ (setenv "LD_LIBRARY_PATH"
+ (if-let (current-path (getenv "LD_LIBRARY_PATH"))
+ (concat sqlite-lib-dir ":" current-path)
+ sqlite-lib-dir))
+ ;; 2. Customize straight.el's build process for the sqlite3 module
+ :straight
+ (sqlite3
+ :host github
+ :repo "kevinrineer/emacs-sqlite3-api"
+ :branch "generic-makefile"
+ :files (:defaults "*.dll" "*.dylib" "*.so")
+ :pre-build ("env" "HOMEBREW=1" "make" "all"))
+ :config
+ (load-library "sqlite3")
+)
+#+end_src
+
+The =:init= section runs before the package is loaded into emacs, so it is
great for handling things the OS dynamic loader might want defined.
+
*** Manual Installation
#+BEGIN_SRC sh :eval no :exports code
$ git clone https://github.com/pekingduck/emacs-sqlite3-api