Commit | Line | Data |
---|---|---|
cd0322a3 | 1 | ;;; GNU Guix --- Functional package management for GNU |
4b0e0578 | 2 | ;;; Copyright © 2013, 2015, 2018, 2020 Ludovic Courtès <ludo@gnu.org> |
cd0322a3 RW |
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> | |
0788e62d | 9 | ;;; Copyright © 2016, 2017, 2018, 2019, 2020, 2021 Marius Bakke <marius@gnu.org> |
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 | ||
0788e62d MB |
48 | (define (sqlite-uri version year) |
49 | (let ((numeric-version | |
50 | (match (string-split version #\.) | |
51 | ((first-digit other-digits ...) | |
52 | (string-append first-digit | |
53 | (string-pad-right | |
54 | (string-concatenate | |
55 | (map (cut string-pad <> 2 #\0) | |
56 | other-digits)) | |
57 | 6 #\0)))))) | |
58 | (string-append "https://sqlite.org/" (number->string year) | |
59 | "/sqlite-autoconf-" numeric-version ".tar.gz"))) | |
60 | ||
cd0322a3 RW |
61 | (define-public sqlite |
62 | (package | |
63 | (name "sqlite") | |
4b957543 | 64 | (version "3.36.0") |
cd0322a3 RW |
65 | (source (origin |
66 | (method url-fetch) | |
0788e62d | 67 | (uri (sqlite-uri version 2021)) |
b2dc7cb8 | 68 | (patches (search-patches "sqlite-hurd.patch")) |
cd0322a3 RW |
69 | (sha256 |
70 | (base32 | |
4b957543 | 71 | "1qxwkfvd185dfcqbakrzikrsw6ffr5jp1gl3dch9dsdyjvmw745x")))) |
cd0322a3 | 72 | (build-system gnu-build-system) |
8394619b | 73 | (inputs (list readline)) |
3a3c9bae | 74 | (outputs '("out" "static")) |
cd0322a3 RW |
75 | (arguments |
76 | `(#:configure-flags | |
46d5a7e3 MB |
77 | ;; Add -DSQLITE_SECURE_DELETE, -DSQLITE_ENABLE_FTS3, |
78 | ;; -DSQLITE_ENABLE_UNLOCK_NOTIFY and -DSQLITE_ENABLE_DBSTAT_VTAB | |
79 | ;; to CFLAGS. GNU Icecat will refuse to use the system SQLite | |
80 | ;; unless these options are enabled. | |
4b0e0578 | 81 | (list (string-append "CFLAGS=-O2 -g -DSQLITE_SECURE_DELETE " |
46d5a7e3 | 82 | "-DSQLITE_ENABLE_FTS3 " |
cd0322a3 | 83 | "-DSQLITE_ENABLE_UNLOCK_NOTIFY " |
fad5b1a6 | 84 | "-DSQLITE_ENABLE_DBSTAT_VTAB " |
3a3c9bae MB |
85 | ;; Column metadata is required by GNU Jami and Qt, et.al. |
86 | "-DSQLITE_ENABLE_COLUMN_METADATA")) | |
87 | #:phases (modify-phases %standard-phases | |
88 | (add-after 'install 'move-static-library | |
89 | (lambda* (#:key outputs #:allow-other-keys) | |
90 | (let* ((out (assoc-ref outputs "out")) | |
91 | (static (assoc-ref outputs "static")) | |
92 | (source (string-append out "/lib/libsqlite3.a"))) | |
93 | (mkdir-p (string-append static "/lib")) | |
94 | (link source (string-append static "/lib/libsqlite3.a")) | |
95 | (delete-file source) | |
96 | ||
97 | ;; Remove reference to the static library from the .la file | |
98 | ;; so that Libtool looks for it in the usual places. | |
99 | (substitute* (string-append out "/lib/libsqlite3.la") | |
100 | (("^old_library=.*") | |
101 | "old_library=''\n")) | |
102 | #t)))))) | |
cd0322a3 RW |
103 | (home-page "https://www.sqlite.org/") |
104 | (synopsis "The SQLite database management system") | |
105 | (description | |
106 | "SQLite is a software library that implements a self-contained, serverless, | |
107 | zero-configuration, transactional SQL database engine. SQLite is the most | |
108 | widely deployed SQL database engine in the world. The source code for SQLite | |
109 | is in the public domain.") | |
110 | (license license:public-domain))) | |
50b36f68 MB |
111 | |
112 | ;; Newer version required for e.g. fossil. | |
113 | (define-public sqlite-next | |
114 | (package | |
115 | (inherit sqlite) | |
1c060f59 | 116 | (version "3.39.3") |
50b36f68 MB |
117 | (source (origin |
118 | (method url-fetch) | |
9c814255 | 119 | (uri (sqlite-uri version 2022)) |
50b36f68 MB |
120 | (sha256 |
121 | (base32 | |
1c060f59 | 122 | "1f922kq16g7f4h3gpzim78lvrp5xw9nvlvqw97s2qgxyh8qgns3q")))))) |