From e52f21984e77740ed19314a62e6447cb811b5752 Mon Sep 17 00:00:00 2001 From: Munyoki Kilyungi Date: Wed, 6 Nov 2024 07:31:36 +0300 Subject: Add gn-guile. * gn/packages/guile.scm (gn-guile): New package. --- gn/packages/guile.scm | 165 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 165 insertions(+) create mode 100644 gn/packages/guile.scm (limited to 'gn') diff --git a/gn/packages/guile.scm b/gn/packages/guile.scm new file mode 100644 index 0000000..6f0b41d --- /dev/null +++ b/gn/packages/guile.scm @@ -0,0 +1,165 @@ +(define-module (gn packages guile) + #:use-module ((guix licenses) #:prefix license:) + #:use-module (guix gexp) + #:use-module (guix packages) + #:use-module (guix git-download) + #:use-module (guix build-system guile) + #:use-module (guix build-system gnu) + #:use-module ((gnu packages autotools) #:select (libltdl autoconf automake libtool)) + #:use-module ((gnu packages databases) #:select (mariadb)) + #:use-module ((gnu packages compression) #:select (zlib)) + #:use-module ((gnu packages perl) #:select (perl)) + #:use-module ((gnu packages texinfo) #:select (texinfo)) + #:use-module (guix utils) + #:use-module (gnu packages build-tools) + #:use-module (gnu packages package-management) + #:use-module ((gnu packages bash) #:select (bash-minimal)) + #:use-module ((gnu packages bioinformatics) #:select (gemma)) + #:use-module ((gnu packages certs) #:select (nss-certs)) + #:use-module ((gnu packages guile) #:select (guile-json-4 guile-3.0 guile-2.2 guile-readline)) + #:use-module ((gnu packages guile-xyz) #:select (guile-dbi guile-dbd-mysql guile-fibers guile-redis guile-hashing guile-commonmark)) + #:use-module ((gnu packages parallel) #:select (parallel)) + #:use-module ((gnu packages perl) #:select (perl)) + #:use-module ((gnu packages tls) #:select (guile-gnutls openssl))) + +;; Lifted from: +;; https://lists.gnu.org/archive/html/artanis/2023-03/txtNk7zz7rJAN.txt +(define-public guile3-dbi + (package + (name "guile3-dbi") + (version "2.1.8") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/opencog/guile-dbi") + (commit (string-append "guile-dbi-" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "123m4j82bi60s1v95pjh4djb7bh6zdwmljbpyg7zq8ni2gyal7lw")))) + (build-system gnu-build-system) + (arguments + `(#:modules (((guix build guile-build-system) + #:select (target-guile-effective-version)) + ,@%default-gnu-imported-modules) + #:imported-modules ((guix build guile-build-system) + ,@%default-gnu-imported-modules) + #:configure-flags + (list (string-append + "--with-guile-site-dir=" %output "/share/guile/site/" + (target-guile-effective-version (assoc-ref %build-inputs "guile")))) + #:phases + (modify-phases %standard-phases + (add-after 'unpack 'chdir + (lambda _ + ;; The upstream Git repository contains all the code, so change + ;; to the directory specific to guile-dbi. + (chdir "guile-dbi"))) + (add-after 'install 'patch-extension-path + (lambda* (#:key inputs outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (dbi.scm (string-append out "/share/guile/site/" + (target-guile-effective-version + (assoc-ref inputs "guile")) + "/dbi/dbi.scm")) + (ext (string-append out "/lib/libguile-dbi"))) + (substitute* dbi.scm (("libguile-dbi") ext)))))))) + (inputs + (list libltdl)) + (native-inputs + (list autoconf automake libtool perl texinfo guile-3.0)) + (synopsis "Guile database abstraction layer") + (home-page "https://github.com/opencog/guile-dbi") + (description + "guile-dbi is a library for Guile that provides a convenient interface to +SQL databases. Database programming with guile-dbi is generic in that the same +programming interface is presented regardless of which database system is used. +It currently supports MySQL, Postgres and SQLite3.") + (license license:gpl2+) + (native-search-paths + (list (search-path-specification + (variable "GUILE_DBD_PATH") + (files '("lib"))))))) + +(define-public guile3-dbd-mysql + (package + (inherit guile3-dbi) + (name "guile3-dbd-mysql") + (arguments + (substitute-keyword-arguments (package-arguments guile3-dbi) + ((#:phases phases) + `(modify-phases ,phases + (replace 'chdir + (lambda _ + ;; The upstream Git repository contains all the code, so change + ;; to the directory specific to guile-dbd-mysql. + (chdir "guile-dbd-mysql"))) + (add-after 'chdir 'patch-src + (lambda _ + (substitute* "configure.ac" + (("mariadbclient") "mariadb")) + (substitute* "src/guile-dbd-mysql.c" + (("