Commit | Line | Data |
---|---|---|
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")))) |
cd0322a3 RW |
68 | (build-system gnu-build-system) |
69 | (inputs `(("readline" ,readline))) | |
1649c7d6 JN |
70 | (native-inputs (if (hurd-target?) |
71 | ;; TODO move into origin on the next rebuild cycle. | |
72 | `(("hurd-locking-mode.patch" | |
73 | ,@(search-patches "sqlite-hurd.patch"))) | |
74 | '())) | |
3a3c9bae | 75 | (outputs '("out" "static")) |
cd0322a3 RW |
76 | (arguments |
77 | `(#:configure-flags | |
46d5a7e3 MB |
78 | ;; Add -DSQLITE_SECURE_DELETE, -DSQLITE_ENABLE_FTS3, |
79 | ;; -DSQLITE_ENABLE_UNLOCK_NOTIFY and -DSQLITE_ENABLE_DBSTAT_VTAB | |
80 | ;; to CFLAGS. GNU Icecat will refuse to use the system SQLite | |
81 | ;; unless these options are enabled. | |
cd0322a3 | 82 | (list (string-append "CFLAGS=-O2 -DSQLITE_SECURE_DELETE " |
46d5a7e3 | 83 | "-DSQLITE_ENABLE_FTS3 " |
cd0322a3 | 84 | "-DSQLITE_ENABLE_UNLOCK_NOTIFY " |
fad5b1a6 | 85 | "-DSQLITE_ENABLE_DBSTAT_VTAB " |
3a3c9bae MB |
86 | ;; Column metadata is required by GNU Jami and Qt, et.al. |
87 | "-DSQLITE_ENABLE_COLUMN_METADATA")) | |
88 | #:phases (modify-phases %standard-phases | |
1649c7d6 JN |
89 | ;; TODO: remove in the next rebuild cycle |
90 | ,@(if (hurd-target?) | |
91 | `((add-after 'unpack 'patch-sqlite/hurd | |
92 | (lambda* (#:key inputs native-inputs | |
93 | #:allow-other-keys) | |
94 | (let ((patch (assoc-ref | |
95 | (if ,(%current-target-system) | |
96 | native-inputs | |
97 | inputs) | |
98 | "hurd-locking-mode.patch"))) | |
99 | (invoke "patch" "-p1" "--force" "-i" patch))))) | |
100 | '()) | |
3a3c9bae MB |
101 | (add-after 'install 'move-static-library |
102 | (lambda* (#:key outputs #:allow-other-keys) | |
103 | (let* ((out (assoc-ref outputs "out")) | |
104 | (static (assoc-ref outputs "static")) | |
105 | (source (string-append out "/lib/libsqlite3.a"))) | |
106 | (mkdir-p (string-append static "/lib")) | |
107 | (link source (string-append static "/lib/libsqlite3.a")) | |
108 | (delete-file source) | |
109 | ||
110 | ;; Remove reference to the static library from the .la file | |
111 | ;; so that Libtool looks for it in the usual places. | |
112 | (substitute* (string-append out "/lib/libsqlite3.la") | |
113 | (("^old_library=.*") | |
114 | "old_library=''\n")) | |
115 | #t)))))) | |
cd0322a3 RW |
116 | (home-page "https://www.sqlite.org/") |
117 | (synopsis "The SQLite database management system") | |
118 | (description | |
119 | "SQLite is a software library that implements a self-contained, serverless, | |
120 | zero-configuration, transactional SQL database engine. SQLite is the most | |
121 | widely deployed SQL database engine in the world. The source code for SQLite | |
122 | is in the public domain.") | |
123 | (license license:public-domain))) | |
2bb84b8e MB |
124 | |
125 | ;; Column metadata support was added to the regular 'sqlite' package with | |
126 | ;; commit fad5b1a6d8d9c36bea5785ae4fbc1beb37e644d7. | |
127 | (define-public sqlite-with-column-metadata | |
128 | (deprecated-package "sqlite-with-column-metadata" sqlite)) |