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> | |
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") | |
f97db3de | 49 | (version "3.31.1") |
cd0322a3 RW |
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)))))) | |
0d775f98 | 61 | (string-append "https://sqlite.org/2020/sqlite-autoconf-" |
cd0322a3 RW |
62 | numeric-version ".tar.gz"))) |
63 | (sha256 | |
64 | (base32 | |
f97db3de | 65 | "1bj936svd8i5g25xd1bj52hj4zca01fgl3sqkj86z9q5pkz4wa32")))) |
cd0322a3 RW |
66 | (build-system gnu-build-system) |
67 | (inputs `(("readline" ,readline))) | |
3a3c9bae | 68 | (outputs '("out" "static")) |
cd0322a3 RW |
69 | (arguments |
70 | `(#:configure-flags | |
46d5a7e3 MB |
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. | |
cd0322a3 | 75 | (list (string-append "CFLAGS=-O2 -DSQLITE_SECURE_DELETE " |
46d5a7e3 | 76 | "-DSQLITE_ENABLE_FTS3 " |
cd0322a3 | 77 | "-DSQLITE_ENABLE_UNLOCK_NOTIFY " |
fad5b1a6 | 78 | "-DSQLITE_ENABLE_DBSTAT_VTAB " |
3a3c9bae MB |
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)))))) | |
cd0322a3 RW |
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))) | |
2bb84b8e MB |
105 | |
106 | ;; Column metadata support was added to the regular 'sqlite' package with | |
107 | ;; commit fad5b1a6d8d9c36bea5785ae4fbc1beb37e644d7. | |
108 | (define-public sqlite-with-column-metadata | |
109 | (deprecated-package "sqlite-with-column-metadata" sqlite)) |