gnu: emacs-consult: Fix grammar.
[jackhill/guix/guix.git] / gnu / packages / sqlite.scm
CommitLineData
cd0322a3
RW
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>
2bb84b8e 9;;; Copyright © 2016, 2017, 2018, 2019, 2020 Marius Bakke <mbakke@fastmail.com>
cd0322a3
RW
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>
1649c7d6 14;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
cd0322a3
RW
15;;;
16;;; This file is part of GNU Guix.
17;;;
18;;; GNU Guix is free software; you can redistribute it and/or modify it
19;;; under the terms of the GNU General Public License as published by
20;;; the Free Software Foundation; either version 3 of the License, or (at
21;;; your option) any later version.
22;;;
23;;; GNU Guix is distributed in the hope that it will be useful, but
24;;; WITHOUT ANY WARRANTY; without even the implied warranty of
25;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26;;; GNU General Public License for more details.
27;;;
28;;; You should have received a copy of the GNU General Public License
29;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
30
31(define-module (gnu packages sqlite)
32 #:use-module (gnu packages)
1649c7d6 33 #:use-module (gnu packages hurd)
cd0322a3
RW
34 #:use-module (gnu packages readline)
35 #:use-module ((guix licenses) #:prefix license:)
36 #:use-module (guix packages)
37 #:use-module (guix download)
38 #:use-module (guix build-system gnu)
39 #:use-module (guix utils)
40 #:use-module (ice-9 match)
41 #:use-module (srfi srfi-26))
42
43;;; Commentary:
44;;;
45;;; This module has been separated from (gnu packages databases) to reduce the
46;;; number of module references for core packages.
47
48(define-public sqlite
49 (package
50 (name "sqlite")
f97db3de 51 (version "3.31.1")
cd0322a3
RW
52 (source (origin
53 (method url-fetch)
54 (uri (let ((numeric-version
55 (match (string-split version #\.)
56 ((first-digit other-digits ...)
57 (string-append first-digit
58 (string-pad-right
59 (string-concatenate
60 (map (cut string-pad <> 2 #\0)
61 other-digits))
62 6 #\0))))))
0d775f98 63 (string-append "https://sqlite.org/2020/sqlite-autoconf-"
cd0322a3
RW
64 numeric-version ".tar.gz")))
65 (sha256
66 (base32
f97db3de 67 "1bj936svd8i5g25xd1bj52hj4zca01fgl3sqkj86z9q5pkz4wa32"))))
6e7ba453 68 (replacement sqlite/fixed)
cd0322a3
RW
69 (build-system gnu-build-system)
70 (inputs `(("readline" ,readline)))
1649c7d6
JN
71 (native-inputs (if (hurd-target?)
72 ;; TODO move into origin on the next rebuild cycle.
73 `(("hurd-locking-mode.patch"
74 ,@(search-patches "sqlite-hurd.patch")))
75 '()))
3a3c9bae 76 (outputs '("out" "static"))
cd0322a3
RW
77 (arguments
78 `(#:configure-flags
46d5a7e3
MB
79 ;; Add -DSQLITE_SECURE_DELETE, -DSQLITE_ENABLE_FTS3,
80 ;; -DSQLITE_ENABLE_UNLOCK_NOTIFY and -DSQLITE_ENABLE_DBSTAT_VTAB
81 ;; to CFLAGS. GNU Icecat will refuse to use the system SQLite
82 ;; unless these options are enabled.
cd0322a3 83 (list (string-append "CFLAGS=-O2 -DSQLITE_SECURE_DELETE "
46d5a7e3 84 "-DSQLITE_ENABLE_FTS3 "
cd0322a3 85 "-DSQLITE_ENABLE_UNLOCK_NOTIFY "
fad5b1a6 86 "-DSQLITE_ENABLE_DBSTAT_VTAB "
3a3c9bae
MB
87 ;; Column metadata is required by GNU Jami and Qt, et.al.
88 "-DSQLITE_ENABLE_COLUMN_METADATA"))
89 #:phases (modify-phases %standard-phases
1649c7d6
JN
90 ;; TODO: remove in the next rebuild cycle
91 ,@(if (hurd-target?)
92 `((add-after 'unpack 'patch-sqlite/hurd
93 (lambda* (#:key inputs native-inputs
94 #:allow-other-keys)
95 (let ((patch (assoc-ref
96 (if ,(%current-target-system)
97 native-inputs
98 inputs)
99 "hurd-locking-mode.patch")))
100 (invoke "patch" "-p1" "--force" "-i" patch)))))
101 '())
3a3c9bae
MB
102 (add-after 'install 'move-static-library
103 (lambda* (#:key outputs #:allow-other-keys)
104 (let* ((out (assoc-ref outputs "out"))
105 (static (assoc-ref outputs "static"))
106 (source (string-append out "/lib/libsqlite3.a")))
107 (mkdir-p (string-append static "/lib"))
108 (link source (string-append static "/lib/libsqlite3.a"))
109 (delete-file source)
110
111 ;; Remove reference to the static library from the .la file
112 ;; so that Libtool looks for it in the usual places.
113 (substitute* (string-append out "/lib/libsqlite3.la")
114 (("^old_library=.*")
115 "old_library=''\n"))
116 #t))))))
cd0322a3
RW
117 (home-page "https://www.sqlite.org/")
118 (synopsis "The SQLite database management system")
119 (description
120 "SQLite is a software library that implements a self-contained, serverless,
121zero-configuration, transactional SQL database engine. SQLite is the most
122widely deployed SQL database engine in the world. The source code for SQLite
123is in the public domain.")
124 (license license:public-domain)))
2bb84b8e 125
6e7ba453
LLB
126(define-public sqlite/fixed
127 (package
128 (inherit sqlite)
129 (version "3.32.3")
130 (source (origin
131 (method url-fetch)
132 (uri (let ((numeric-version
133 (match (string-split version #\.)
134 ((first-digit other-digits ...)
135 (string-append first-digit
136 (string-pad-right
137 (string-concatenate
138 (map (cut string-pad <> 2 #\0)
139 other-digits))
140 6 #\0))))))
141 (string-append "https://sqlite.org/2020/sqlite-autoconf-"
142 numeric-version ".tar.gz")))
143 (sha256
144 (base32
145 "0rlbaq177gcgk5dswd3akbhv2nvvzljrbhgy18hklbhw7h90f5d3"))))))
146
2bb84b8e
MB
147;; Column metadata support was added to the regular 'sqlite' package with
148;; commit fad5b1a6d8d9c36bea5785ae4fbc1beb37e644d7.
149(define-public sqlite-with-column-metadata
150 (deprecated-package "sqlite-with-column-metadata" sqlite))