projects/guix·blob wip-postfix · refs

124 lines · 5.4 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2013, 2015, 2018, 2020 Ludovic Courtès <[email protected]>
3;;; Copyright © 2014, 2015, 2016, 2018 Mark H Weaver <[email protected]>
4;;; Copyright © 2014 Sree Harsha Totakura <[email protected]>
5;;; Copyright © 2015, 2016 Sou Bunnbu <[email protected]>
6;;; Copyright © 2016 Efraim Flashner <[email protected]>
7;;; Copyright © 2016 Ben Woodcroft <[email protected]>
8;;; Copyright © 2016 David Craven <[email protected]>
9;;; Copyright © 2016, 2017, 2018, 2019, 2020, 2021 Marius Bakke <[email protected]>
10;;; Copyright © 2017 Ricardo Wurmus <[email protected]>
11;;; Copyright © 2017 Jelle Licht <[email protected]>
12;;; Copyright © 2018 Tobias Geerinckx-Rice <[email protected]>
13;;; Copyright © 2018 Alex Vong <[email protected]>
14;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <[email protected]>
15;;; Copyright © 2022 Matthew James Kraai <[email protected]>
16;;;
17;;; This file is part of GNU Guix.
18;;;
19;;; GNU Guix is free software; you can redistribute it and/or modify it
20;;; under the terms of the GNU General Public License as published by
21;;; the Free Software Foundation; either version 3 of the License, or (at
22;;; your option) any later version.
23;;;
24;;; GNU Guix is distributed in the hope that it will be useful, but
25;;; WITHOUT ANY WARRANTY; without even the implied warranty of
26;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27;;; GNU General Public License for more details.
28;;;
29;;; You should have received a copy of the GNU General Public License
30;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
31
32(define-module (gnu packages sqlite)
33 #:use-module (gnu packages)
34 #:use-module (gnu packages hurd)
35 #:use-module (gnu packages readline)
36 #:use-module ((guix licenses) #:prefix license:)
37 #:use-module (guix packages)
38 #:use-module (guix download)
39 #:use-module (guix build-system gnu)
40 #:use-module (guix utils)
41 #:use-module (guix deprecation)
42 #:use-module (ice-9 match)
43 #:use-module (srfi srfi-26))
44
45;;; Commentary:
46;;;
47;;; This module has been separated from (gnu packages databases) to reduce the
48;;; number of module references for core packages.
49
50(define (sqlite-uri version year)
51 (let ((numeric-version
52 (match (string-split version #\.)
53 ((first-digit other-digits ...)
54 (string-append first-digit
55 (string-pad-right
56 (string-concatenate
57 (map (cut string-pad <> 2 #\0)
58 other-digits))
59 6 #\0))))))
60 (string-append "https://sqlite.org/" (number->string year)
61 "/sqlite-autoconf-" numeric-version ".tar.gz")))
62
63(define-public sqlite
64 (package
65 (name "sqlite")
66 (version "3.39.3")
67 (source (origin
68 (method url-fetch)
69 (uri (sqlite-uri version 2022))
70 (patches (search-patches "sqlite-hurd.patch"))
71 (sha256
72 (base32
73 "1f922kq16g7f4h3gpzim78lvrp5xw9nvlvqw97s2qgxyh8qgns3q"))))
74 (build-system gnu-build-system)
75 (inputs (list readline))
76 (outputs '("out" "static"))
77 (arguments
78 `(#:configure-flags
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.
83 (list (string-append "CFLAGS=-O2 -g -DSQLITE_SECURE_DELETE "
84 "-DSQLITE_ENABLE_FTS3 "
85 "-DSQLITE_ENABLE_UNLOCK_NOTIFY "
86 "-DSQLITE_ENABLE_DBSTAT_VTAB "
87 ;; Column metadata is required by GNU Jami and Qt, et.al.
88 "-DSQLITE_ENABLE_COLUMN_METADATA"))
89 #:phases (modify-phases %standard-phases
90 (add-after 'install 'move-static-library
91 (lambda* (#:key outputs #:allow-other-keys)
92 (let* ((out (assoc-ref outputs "out"))
93 (static (assoc-ref outputs "static"))
94 (source (string-append out "/lib/libsqlite3.a")))
95 (mkdir-p (string-append static "/lib"))
96 (link source (string-append static "/lib/libsqlite3.a"))
97 (delete-file source)
98
99 ;; Remove reference to the static library from the .la file
100 ;; so that Libtool looks for it in the usual places.
101 (substitute* (string-append out "/lib/libsqlite3.la")
102 (("^old_library=.*")
103 "old_library=''\n"))
104 #t))))))
105 (home-page "https://www.sqlite.org/")
106 (synopsis "The SQLite database management system")
107 (description
108 "SQLite is a software library that implements a self-contained, serverless,
109zero-configuration, transactional SQL database engine. SQLite is the most
110widely deployed SQL database engine in the world. The source code for SQLite
111is in the public domain.")
112 (license license:public-domain)))
113
114;; Newer version required for e.g. fossil.
115(define-public sqlite-next
116 (package
117 (inherit sqlite)
118 (version "3.40.0")
119 (source (origin
120 (method url-fetch)
121 (uri (sqlite-uri version 2022))
122 (sha256
123 (base32
124 "1rw0i63822pdkb3a16sqj4jdcp5zg0ffjmi26mshqw6jfqh5acq3"))))))