summaryrefslogtreecommitdiff
path: root/gnu/packages/databases.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/databases.scm')
-rw-r--r--gnu/packages/databases.scm148
1 files changed, 132 insertions, 16 deletions
diff --git a/gnu/packages/databases.scm b/gnu/packages/databases.scm
index acce540e06..cb843672af 100644
--- a/gnu/packages/databases.scm
+++ b/gnu/packages/databases.scm
@@ -37,6 +37,7 @@
;;; Copyright © 2019 Alex Griffin <a@ajgrf.com>
;;; Copyright © 2019 Gábor Boskovits <boskovits@gmail.com>
;;; Copyright © 2019 Pierre Langlois <pierre.langlois@gmx.com>
+;;; Copyright © 2019 Guillaume Le Vaillant <glv@posteo.net>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -96,6 +97,7 @@
#:use-module (gnu packages python)
#:use-module (gnu packages python-crypto)
#:use-module (gnu packages python-web)
+ #:use-module (gnu packages python-science)
#:use-module (gnu packages python-xyz)
#:use-module (gnu packages rdf)
#:use-module (gnu packages readline)
@@ -715,9 +717,11 @@ Language.")
(find-files "pcre") (find-files "zlib")))
#t))))
(build-system cmake-build-system)
+ (outputs '("out" "lib" "dev"))
(arguments
`(#:configure-flags
- '("-DBUILD_CONFIG=mysql_release"
+ (list
+ "-DBUILD_CONFIG=mysql_release"
;; Linking with libarchive fails, like this:
;; ld: /gnu/store/...-libarchive-3.2.2/lib/libarchive.a(archive_entry.o):
@@ -741,15 +745,26 @@ Language.")
"-DDEFAULT_COLLATION=utf8_general_ci"
"-DMYSQL_DATADIR=/var/lib/mysql"
"-DMYSQL_UNIX_ADDR=/run/mysqld/mysqld.sock"
- "-DINSTALL_INFODIR=share/mysql/docs"
- "-DINSTALL_MANDIR=share/man"
+ (string-append "-DCMAKE_INSTALL_PREFIX=" (assoc-ref %outputs "lib"))
+ (string-append "-DCMAKE_INSTALL_RPATH=" (assoc-ref %outputs "lib")
+ "/lib")
+ (string-append "-DINSTALL_INFODIR=" (assoc-ref %outputs "out")
+ "/share/mysql/docs")
+ (string-append "-DINSTALL_MANDIR=" (assoc-ref %outputs "out")
+ "/share/man")
+ (string-append "-DINSTALL_SCRIPTDIR=" (assoc-ref %outputs "out") "/bin")
+ (string-append "-DINSTALL_BINDIR=" (assoc-ref %outputs "out") "/bin")
+ "-DCMAKE_INSTALL_LIBDIR=lib"
"-DINSTALL_PLUGINDIR=lib/mysql/plugin"
- "-DINSTALL_SCRIPTDIR=bin"
- "-DINSTALL_INCLUDEDIR=include/mysql"
- "-DINSTALL_DOCREADMEDIR=share/mysql/docs"
- "-DINSTALL_SUPPORTFILESDIR=share/mysql/support-files"
+ (string-append "-DINSTALL_INCLUDEDIR=" (assoc-ref %outputs "dev")
+ "/include/mysql")
+ (string-append "-DINSTALL_DOCREADMEDIR=" (assoc-ref %outputs "out")
+ "/share/mysql/docs")
+ (string-append "-DINSTALL_DOCDIR=" (assoc-ref %outputs "out")
+ "/share/mysql/docs")
+ (string-append "-DINSTALL_SUPPORTFILESDIR=" (assoc-ref %outputs "out")
+ "/share/mysql/support-files")
"-DINSTALL_MYSQLSHAREDIR=share/mysql"
- "-DINSTALL_DOCDIR=share/mysql/docs"
"-DINSTALL_SHAREDIR=share")
#:phases
(modify-phases %standard-phases
@@ -832,19 +847,29 @@ Language.")
'install 'post-install
(lambda* (#:key outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
- (test (assoc-ref outputs "test")))
+ (dev (assoc-ref outputs "dev"))
+ (lib (assoc-ref outputs "lib")))
(substitute* (string-append out "/bin/mysql_install_db")
(("basedir=\"\"")
(string-append "basedir=\"" out "\"")))
;; Remove unneeded files for testing.
- (with-directory-excursion out
+ (with-directory-excursion lib
(for-each delete-file-recursively
- '("data" "mysql-test" "sql-bench"
- "share/man/man1/mysql-test-run.pl.1"))
- ;; Delete huge and unnecessary executables.
- (for-each delete-file (find-files "bin" "(test|embedded)"))
+ '("data" "mysql-test" "sql-bench"))
;; And static libraries.
(for-each delete-file (find-files "lib" "\\.a$")))
+ (with-directory-excursion out
+ (delete-file "share/man/man1/mysql-test-run.pl.1")
+ ;; Delete huge and unnecessary executables.
+ (for-each delete-file (find-files "bin" "(test|embedded)")))
+ (mkdir-p (string-append dev "/share"))
+ (mkdir-p (string-append dev "/bin"))
+ (rename-file (string-append lib "/bin/mysqld")
+ (string-append out "/bin/mysqld"))
+ (rename-file (string-append lib "/share/pkgconfig")
+ (string-append dev "/share/pkgconfig"))
+ (rename-file (string-append out "/bin/mysql_config")
+ (string-append dev "/bin/mysql_config"))
#t))))))
(native-inputs
`(("bison" ,bison)
@@ -1609,7 +1634,8 @@ columns, primary keys, unique constraints and relationships.")
#:tests? #f))
(propagated-inputs
`(("perl-dbi" ,perl-dbi)
- ("mysql" ,mariadb)))
+ ("mysql" ,mariadb "lib")
+ ("mysql-dev" ,mariadb "dev")))
(home-page "https://metacpan.org/release/DBD-mysql")
(synopsis "DBI MySQL interface")
(description "This package provides a MySQL driver for the Perl5
@@ -2727,7 +2753,8 @@ database).")
("mock" ,python-mock)
("py.test" ,python-pytest)))
(inputs
- `(("mysql" ,mariadb)
+ `(("mysql" ,mariadb "lib")
+ ("mysql-dev" ,mariadb "dev")
("libz" ,zlib)
("openssl" ,openssl)))
(home-page "https://github.com/PyMySQL/mysqlclient-python")
@@ -3170,3 +3197,92 @@ NumPy, and other traditional Python scientific computing packages.")
It implements the Python DB API 2.0 specification and includes support for
SQLAlchemy.")
(license license:asl2.0)))
+
+(define-public libdbi
+ (package
+ (name "libdbi")
+ (version "0.9.0")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append "mirror://sourceforge/libdbi/libdbi/libdbi-"
+ version "/libdbi-" version ".tar.gz"))
+ (sha256
+ (base32
+ "00s5ra7hdlq25iv23nwf4h1v3kmbiyzx0v9bhggjiii4lpf6ryys"))))
+ (build-system gnu-build-system)
+ (synopsis "Database independent abstraction layer in C")
+ (description
+ "This library implements a database independent abstraction layer in C,
+similar to the DBI/DBD layer in Perl. Writing one generic set of code,
+programmers can leverage the power of multiple databases and multiple
+simultaneous database connections by using this framework.")
+ (home-page "http://libdbi.sourceforge.net/")
+ (license license:lgpl2.1+)))
+
+(define-public libdbi-drivers
+ (package
+ (name "libdbi-drivers")
+ (version "0.9.0")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append "mirror://sourceforge/libdbi-drivers/"
+ "libdbi-drivers/libdbi-drivers-" version
+ "/libdbi-drivers-" version ".tar.gz"))
+ (sha256
+ (base32
+ "0m680h8cc4428xin4p733azysamzgzcmv4psjvraykrsaz6ymlj3"))))
+ (build-system gnu-build-system)
+ (native-inputs
+ `(("inetutils" ,inetutils)
+ ("glibc-locales" ,glibc-locales)))
+ (inputs
+ `(("libdbi" ,libdbi)
+ ("mysql" ,mariadb)
+ ("postgresql" ,postgresql)
+ ("sqlite" ,sqlite)))
+ (arguments
+ `(#:configure-flags
+ (let ((libdbi (assoc-ref %build-inputs "libdbi"))
+ (mysql (assoc-ref %build-inputs "mysql"))
+ (postgresql (assoc-ref %build-inputs "postgresql"))
+ (sqlite (assoc-ref %build-inputs "sqlite")))
+ (list "--disable-docs"
+ (string-append "--with-dbi-incdir=" libdbi "/include")
+ (string-append "--with-dbi-libdir=" libdbi "/lib")
+ "--with-mysql"
+ (string-append "--with-mysql-incdir=" mysql "/include/mysql")
+ (string-append "--with-mysql-libdir=" mysql "/lib")
+ "--with-pgsql"
+ (string-append "--with-pgsql-incdir=" postgresql "/include")
+ (string-append "--with-pgsql-libdir=" postgresql "/lib")
+ "--with-sqlite3"
+ (string-append "--with-sqlite-incdir=" sqlite "/include")
+ (string-append "--with-sqlite-libdir=" sqlite "/lib")))
+ #:phases
+ (modify-phases %standard-phases
+ (add-after 'unpack 'fix-tests
+ (lambda* (#:key inputs #:allow-other-keys)
+ (substitute* "tests/test_mysql.sh"
+ (("^MYMYSQLD=.*")
+ (string-append "MYMYSQLD="
+ (assoc-ref inputs "mysql")
+ "/bin/mysqld")))
+ #t))
+ (add-after 'install 'remove-empty-directories
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let ((var (string-append (assoc-ref outputs "out") "/var")))
+ (delete-file-recursively var))
+ #t)))))
+ (synopsis "Database drivers for the libdbi framework")
+ (description
+ "The @code{libdbi-drivers} library provides the database specific drivers
+for the @code{libdbi} framework.
+
+The drivers officially supported by @code{libdbi} are:
+@itemize
+@item MySQL,
+@item PostgreSQL,
+@item SQLite.
+@end itemize")
+ (home-page "http://libdbi-drivers.sourceforge.net/")
+ (license license:lgpl2.1+)))