Merge branch 'staging' into core-updates
[jackhill/guix/guix.git] / gnu / packages / sqlite.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2015, 2018 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2014, 2015, 2016, 2018 Mark H Weaver <mhw@netris.org>
4 ;;; Copyright © 2014 Sree Harsha Totakura <sreeharsha@totakura.in>
5 ;;; Copyright © 2015, 2016 Sou Bunnbu <iyzsong@gmail.com>
6 ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
7 ;;; Copyright © 2016 Ben Woodcroft <donttrustben@gmail.com>
8 ;;; Copyright © 2016 David Craven <david@craven.ch>
9 ;;; Copyright © 2016, 2017, 2018, 2019 Marius Bakke <mbakke@fastmail.com>
10 ;;; Copyright © 2017 Ricardo Wurmus <rekado@elephly.net>
11 ;;; Copyright © 2017 Jelle Licht <jlicht@fsfe.org>
12 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
13 ;;; Copyright © 2018 Alex Vong <alexvong1995@gmail.com>
14 ;;;
15 ;;; This file is part of GNU Guix.
16 ;;;
17 ;;; GNU Guix is free software; you can redistribute it and/or modify it
18 ;;; under the terms of the GNU General Public License as published by
19 ;;; the Free Software Foundation; either version 3 of the License, or (at
20 ;;; your option) any later version.
21 ;;;
22 ;;; GNU Guix is distributed in the hope that it will be useful, but
23 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
24 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 ;;; GNU General Public License for more details.
26 ;;;
27 ;;; You should have received a copy of the GNU General Public License
28 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
29
30 (define-module (gnu packages sqlite)
31 #:use-module (gnu packages)
32 #:use-module (gnu packages readline)
33 #:use-module ((guix licenses) #:prefix license:)
34 #:use-module (guix packages)
35 #:use-module (guix download)
36 #:use-module (guix build-system gnu)
37 #:use-module (guix utils)
38 #:use-module (ice-9 match)
39 #:use-module (srfi srfi-26))
40
41 ;;; Commentary:
42 ;;;
43 ;;; This module has been separated from (gnu packages databases) to reduce the
44 ;;; number of module references for core packages.
45
46 (define-public sqlite
47 (package
48 (name "sqlite")
49 (version "3.30.1")
50 (source (origin
51 (method url-fetch)
52 (uri (let ((numeric-version
53 (match (string-split version #\.)
54 ((first-digit other-digits ...)
55 (string-append first-digit
56 (string-pad-right
57 (string-concatenate
58 (map (cut string-pad <> 2 #\0)
59 other-digits))
60 6 #\0))))))
61 (string-append "https://sqlite.org/2019/sqlite-autoconf-"
62 numeric-version ".tar.gz")))
63 (sha256
64 (base32
65 "0q4f57a5995wz9c7dfiqy9zwl0kn0b900nxwinqa3llv13dm0nlc"))))
66 (build-system gnu-build-system)
67 (inputs `(("readline" ,readline)))
68 (outputs '("out" "static"))
69 (arguments
70 `(#:configure-flags
71 ;; Add -DSQLITE_SECURE_DELETE, -DSQLITE_ENABLE_FTS3,
72 ;; -DSQLITE_ENABLE_UNLOCK_NOTIFY and -DSQLITE_ENABLE_DBSTAT_VTAB
73 ;; to CFLAGS. GNU Icecat will refuse to use the system SQLite
74 ;; unless these options are enabled.
75 (list (string-append "CFLAGS=-O2 -DSQLITE_SECURE_DELETE "
76 "-DSQLITE_ENABLE_FTS3 "
77 "-DSQLITE_ENABLE_UNLOCK_NOTIFY "
78 "-DSQLITE_ENABLE_DBSTAT_VTAB "
79 ;; Column metadata is required by GNU Jami and Qt, et.al.
80 "-DSQLITE_ENABLE_COLUMN_METADATA"))
81 #:phases (modify-phases %standard-phases
82 (add-after 'install 'move-static-library
83 (lambda* (#:key outputs #:allow-other-keys)
84 (let* ((out (assoc-ref outputs "out"))
85 (static (assoc-ref outputs "static"))
86 (source (string-append out "/lib/libsqlite3.a")))
87 (mkdir-p (string-append static "/lib"))
88 (link source (string-append static "/lib/libsqlite3.a"))
89 (delete-file source)
90
91 ;; Remove reference to the static library from the .la file
92 ;; so that Libtool looks for it in the usual places.
93 (substitute* (string-append out "/lib/libsqlite3.la")
94 (("^old_library=.*")
95 "old_library=''\n"))
96 #t))))))
97 (home-page "https://www.sqlite.org/")
98 (synopsis "The SQLite database management system")
99 (description
100 "SQLite is a software library that implements a self-contained, serverless,
101 zero-configuration, transactional SQL database engine. SQLite is the most
102 widely deployed SQL database engine in the world. The source code for SQLite
103 is in the public domain.")
104 (license license:public-domain)))