gnu: sqlite: Add -DSQLITE_ENABLE_UNLOCK_NOTIFY to CFLAGS.
[jackhill/guix/guix.git] / gnu / packages / databases.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012, 2013, 2014 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2012, 2014 Andreas Enge <andreas@enge.fr>
4 ;;; Copyright © 2013 Cyril Roelandt <tipecaml@gmail.com>
5 ;;; Copyright © 2014 David Thompson <davet@gnu.org>
6 ;;; Copyright © 2014, 2015 Mark H Weaver <mhw@netris.org>
7 ;;;
8 ;;; This file is part of GNU Guix.
9 ;;;
10 ;;; GNU Guix is free software; you can redistribute it and/or modify it
11 ;;; under the terms of the GNU General Public License as published by
12 ;;; the Free Software Foundation; either version 3 of the License, or (at
13 ;;; your option) any later version.
14 ;;;
15 ;;; GNU Guix is distributed in the hope that it will be useful, but
16 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;;; GNU General Public License for more details.
19 ;;;
20 ;;; You should have received a copy of the GNU General Public License
21 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
22
23 (define-module (gnu packages databases)
24 #:use-module (gnu packages)
25 #:use-module (gnu packages perl)
26 #:use-module (gnu packages linux)
27 #:use-module (gnu packages openssl)
28 #:use-module (gnu packages compression)
29 #:use-module (gnu packages ncurses)
30 #:use-module (gnu packages readline)
31 #:use-module (gnu packages emacs)
32 #:use-module (gnu packages check)
33 #:use-module (gnu packages algebra)
34 #:use-module (gnu packages curl)
35 #:use-module (gnu packages gnupg)
36 #:use-module (gnu packages python)
37 #:use-module ((guix licenses)
38 #:select (gpl2 gpl3+ lgpl2.1+ lgpl3+ x11-style bsd-style
39 public-domain))
40 #:use-module (guix packages)
41 #:use-module (guix download)
42 #:use-module (guix build-system gnu)
43 #:use-module (guix build-system perl)
44 #:use-module (srfi srfi-26)
45 #:use-module (ice-9 match))
46
47 (define-public bdb
48 (package
49 (name "bdb")
50 (version "5.3.21")
51 (source (origin
52 (method url-fetch)
53 (uri (string-append "http://download.oracle.com/berkeley-db/db-" version
54 ".tar.gz"))
55 (sha256 (base32
56 "1f2g2612lf8djbwbwhxsvmffmf9d7693kh2l20195pqp0f9jmnfx"))))
57 (build-system gnu-build-system)
58 (outputs '("out" ; programs, libraries, headers
59 "doc")) ; 94 MiB of HTML docs
60 (arguments
61 '(#:tests? #f ; no check target available
62 #:phases
63 (alist-replace
64 'configure
65 (lambda* (#:key outputs #:allow-other-keys)
66 (let ((out (assoc-ref outputs "out"))
67 (doc (assoc-ref outputs "doc")))
68 ;; '--docdir' is not honored, so we need to patch.
69 (substitute* "dist/Makefile.in"
70 (("docdir[[:blank:]]*=.*")
71 (string-append "docdir = " doc "/share/doc/bdb")))
72
73 (zero?
74 (system* "./dist/configure"
75 (string-append "--prefix=" out)
76 (string-append "CONFIG_SHELL=" (which "bash"))
77 (string-append "SHELL=" (which "bash"))
78
79 ;; The compatibility mode is needed by some packages,
80 ;; notably iproute2.
81 "--enable-compat185"))))
82 %standard-phases)))
83 (synopsis "Berkeley database")
84 (description
85 "Berkeley DB is an embeddable database allowing developers the choice of
86 SQL, Key/Value, XML/XQuery or Java Object storage for their data model.")
87 (license (bsd-style "file://LICENSE"
88 "See LICENSE in the distribution."))
89 (home-page
90 "http://www.oracle.com/us/products/database/berkeley-db/overview/index.html")))
91
92 (define-public mysql
93 (package
94 (name "mysql")
95 (version "5.1.73")
96 (source (origin
97 (method url-fetch)
98 (uri (string-append
99 "http://dev.mysql.com/get/Downloads/MySQL-5.1/mysql-"
100 version ".tar.gz"))
101 (sha256
102 (base32
103 "1dfwi4ck0vq6sdci6gz0031s7zz5lc3pddqlgm0292s00l9y5sq5"))))
104 (build-system gnu-build-system)
105 (inputs
106 `(("procps" ,procps)
107 ("openssl" ,openssl)
108 ("perl" ,perl)
109 ("zlib" ,zlib)
110 ("ncurses" ,ncurses)))
111 (arguments
112 '(#:modules ((guix build gnu-build-system)
113 (guix build utils)
114 (ice-9 ftw)) ; for "rm -rf"
115 #:phases (alist-cons-after
116 'install 'clean-up
117 (lambda* (#:key outputs #:allow-other-keys)
118 ;; Remove the 112 MiB of tests that get installed.
119 (let ((out (assoc-ref outputs "out")))
120 (define (rm-rf dir)
121 (file-system-fold (const #t) ; enter?
122 (lambda (file stat result) ; leaf
123 (delete-file file))
124 (const #t) ; down
125 (lambda (dir stat result) ; up
126 (rmdir dir))
127 (const #t)
128 (lambda (file stat errno result)
129 (format (current-error-port)
130 "error: ~a: ~a~%"
131 file (strerror errno)))
132 #t
133 (string-append out "/" dir)))
134 (rm-rf "mysql-test")
135 (rm-rf "sql-bench")
136
137 ;; Compress the 14 MiB Info file.
138 (zero?
139 (system* "gzip" "--best"
140 (string-append out "/share/info/mysql.info")))))
141 %standard-phases)))
142 (home-page "http://www.mysql.com/")
143 (synopsis "Fast, easy to use, and popular database")
144 (description
145 "MySQL is a fast, reliable, and easy to use relational database
146 management system that supports the standardized Structured Query
147 Language.")
148 (license gpl2)))
149
150 (define-public postgresql
151 (package
152 (name "postgresql")
153 (version "9.3.5")
154 (source (origin
155 (method url-fetch)
156 (uri (string-append "http://ftp.postgresql.org/pub/source/v"
157 version "/postgresql-" version ".tar.gz"))
158 (sha256
159 (base32
160 "08kga00izykgvnx7hn995wc4zjqslspapaa8z63045p1ya14mr4g"))))
161 (build-system gnu-build-system)
162 (inputs
163 `(("readline" ,readline)
164 ("zlib" ,zlib)))
165 (home-page "http://www.postgresql.org/")
166 (synopsis "Powerful object-relational database system")
167 (description
168 "PostgreSQL is a powerful object-relational database system. It is fully
169 ACID compliant, has full support for foreign keys, joins, views, triggers, and
170 stored procedures (in multiple languages). It includes most SQL:2008 data
171 types, including INTEGER, NUMERIC, BOOLEAN, CHAR, VARCHAR, DATE, INTERVAL, and
172 TIMESTAMP. It also supports storage of binary large objects, including
173 pictures, sounds, or video.")
174 (license (x11-style "file://COPYRIGHT"))))
175
176 (define-public recutils
177 (package
178 (name "recutils")
179 (version "1.7")
180 (source (origin
181 (method url-fetch)
182 (uri (string-append "mirror://gnu/recutils/recutils-"
183 version ".tar.gz"))
184 (sha256
185 (base32
186 "0cdwa4094x3yx7vn98xykvnlp9rngvd58d19vs3vh5hrvggccg93"))))
187 (build-system gnu-build-system)
188
189 ;; Running tests in parallel leads to test failures and crashes in
190 ;; torture/utils.
191 (arguments '(#:parallel-tests? #f))
192
193 (native-inputs `(("emacs" ,emacs)
194 ("bc" ,bc)))
195
196 ;; TODO: Add more optional inputs.
197 ;; FIXME: Our Bash doesn't have development headers (need for the 'readrec'
198 ;; built-in command), but it's not clear how to get them installed.
199 ;; See <https://lists.gnu.org/archive/html/bug-bash/2014-03/msg00125.html>.
200 (inputs `(("curl" ,curl)
201 ("libgcrypt" ,libgcrypt)
202 ("check" ,check)))
203 (synopsis "Manipulate plain text files as databases")
204 (description
205 "GNU Recutils is a set of tools and libraries for creating and
206 manipulating text-based, human-editable databases. Despite being text-based,
207 databases created with Recutils carry all of the expected features such as
208 unique fields, primary keys, time stamps and more. Many different field
209 types are supported, as is encryption.")
210 (license gpl3+)
211 (home-page "http://www.gnu.org/software/recutils/")))
212
213 (define-public sqlite
214 (package
215 (name "sqlite")
216 (version "3.8.8.3")
217 (source (origin
218 (method url-fetch)
219 ;; TODO: Download from sqlite.org once this bug :
220 ;; http://lists.gnu.org/archive/html/bug-guile/2013-01/msg00027.html
221 ;; has been fixed.
222 (uri (let ((numeric-version
223 (match (string-split version #\.)
224 ((first-digit other-digits ...)
225 (string-append first-digit
226 (string-pad-right
227 (string-concatenate
228 (map (cut string-pad <> 2 #\0)
229 other-digits))
230 6 #\0))))))
231 (string-append
232 "mirror://sourceforge/sqlite.mirror/SQLite%20" version
233 "/sqlite-autoconf-" numeric-version ".tar.gz")))
234 (sha256
235 (base32
236 "04dl53iv5q0srv4jcgjfzsrdzkq6dg1sgmlmpw9lrd4xrmj6jmvl"))))
237 (build-system gnu-build-system)
238 (inputs `(("readline" ,readline)))
239 (arguments
240 `(#:configure-flags
241 ;; Add -DSQLITE_SECURE_DELETE and -DSQLITE_ENABLE_UNLOCK_NOTIFY to
242 ;; CFLAGS. GNU Icecat will refuse to use the system SQLite unless these
243 ;; options are enabled.
244 '("CFLAGS=-O2 -DSQLITE_SECURE_DELETE -DSQLITE_ENABLE_UNLOCK_NOTIFY")))
245 (home-page "http://www.sqlite.org/")
246 (synopsis "The SQLite database management system")
247 (description
248 "SQLite is a software library that implements a self-contained, serverless,
249 zero-configuration, transactional SQL database engine. SQLite is the most
250 widely deployed SQL database engine in the world. The source code for SQLite
251 is in the public domain.")
252 (license public-domain)))
253
254 (define-public tdb
255 (package
256 (name "tdb")
257 (version "1.3.0")
258 (source (origin
259 (method url-fetch)
260 (uri (string-append "http://samba.org/ftp/tdb/tdb-"
261 version ".tar.gz"))
262 (sha256
263 (base32
264 "085sd2kii72fr0c4pdc7c7m0xk34nc66wnjp21c83dss826y9gh4"))))
265 (build-system gnu-build-system)
266 (arguments
267 '(#:phases (alist-replace
268 'configure
269 (lambda* (#:key outputs #:allow-other-keys)
270 (let ((out (assoc-ref outputs "out")))
271 ;; The 'configure' script is a wrapper for Waf and
272 ;; doesn't recognize things like '--enable-fast-install'.
273 (zero? (system* "./configure"
274 (string-append "--prefix=" out)))))
275 %standard-phases)))
276 (native-inputs
277 `(;; TODO: Build the documentation.
278 ;; ("docbook-xsl" ,docbook-xsl)
279 ;; ("libxml2" ,libxml2)
280 ;; ("libxslt" ,libxslt)
281 ("python" ,python-2))) ;for the Waf build system
282 (home-page "http://tdb.samba.org/")
283 (synopsis "Trivial database")
284 (description
285 "TDB is a Trivial Database. In concept, it is very much like GDBM,
286 and BSD's DB except that it allows multiple simultaneous writers and uses
287 locking internally to keep writers from trampling on each other. TDB is also
288 extremely small.")
289 (license lgpl3+)))
290
291 (define-public perl-dbi
292 (package
293 (name "perl-dbi")
294 (version "1.631")
295 (source (origin
296 (method url-fetch)
297 (uri (string-append
298 "mirror://cpan/authors/id/T/TI/TIMB/DBI-"
299 version ".tar.gz"))
300 (sha256
301 (base32
302 "04fmrnchhwi7jx4niaiv93vmi343hdm3xj04w9zr2m9hhqh782np"))))
303 (build-system perl-build-system)
304 (synopsis "Database independent interface for Perl")
305 (description "This package provides an database interface for Perl.")
306 (home-page "http://search.cpan.org/~timb/DBI-1.631/DBI.pm")
307 (license (package-license perl))))
308
309 (define-public perl-dbd-sqlite
310 (package
311 (name "perl-dbd-sqlite")
312 (version "1.42")
313 (source (origin
314 (method url-fetch)
315 (uri (string-append
316 "mirror://cpan/authors/id/I/IS/ISHIGAKI/DBD-SQLite-"
317 version ".tar.gz"))
318 (sha256
319 (base32
320 "14x9cjsc8dz8ad1nad0bqiq9cbk1rjfb8h5y0rpk3pdl38y6afxb"))))
321 (build-system perl-build-system)
322 (inputs `(("sqlite" ,sqlite)))
323 (propagated-inputs `(("perl-dbi" ,perl-dbi)))
324 (synopsis "SQlite interface for Perl")
325 (description "DBD::SQLite is a Perl DBI driver for SQLite, that includes
326 the entire thing in the distribution. So in order to get a fast transaction
327 capable RDBMS working for your Perl project you simply have to install this
328 module, and nothing else.")
329 (license (package-license perl))
330 (home-page "http://search.cpan.org/~ishigaki/DBD-SQLite/lib/DBD/SQLite.pm")))
331
332
333 (define-public unixodbc
334 (package
335 (name "unixodbc")
336 (version "2.3.2")
337 (source (origin
338 (method url-fetch)
339 (uri
340 (string-append
341 "ftp://ftp.unixodbc.org/pub/unixODBC/unixODBC-" version ".tar.gz"))
342 (sha256
343 (base32 "16jw5fq7wgfky6ak1h2j2pqx99jivsdl4q8aq6immpr55xs5jd4w"))))
344 (build-system gnu-build-system)
345 (synopsis "Data source abstraction library")
346 (description "Unixodbc is a library providing an API with which to access
347 data sources. Data sources include SQL Servers and any software with an ODBC
348 Driver.")
349 (license lgpl2.1+)
350 ;; COPYING contains copy of lgpl2.1 - but copyright notices just say "LGPL"
351 (home-page "http://www.unixodbc.org")))