| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 | |
| 23 | |
| 24 | |
| 25 | |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | |
| 31 | |
| 32 | |
| 33 |
|
| 34 | (define-module (gnu packages sqlite)
|
| 35 | #:use-module (gnu packages)
|
| 36 | #:use-module (gnu packages hurd)
|
| 37 | #:use-module (gnu packages readline)
|
| 38 | #:use-module ((guix licenses) #:prefix license:)
|
| 39 | #:use-module (guix packages)
|
| 40 | #:use-module (guix download)
|
| 41 | #:use-module (guix build-system gnu)
|
| 42 | #:use-module (guix gexp)
|
| 43 | #:use-module (guix utils)
|
| 44 | #:use-module (guix deprecation)
|
| 45 | #:use-module (ice-9 match)
|
| 46 | #:use-module (srfi srfi-26))
|
| 47 |
|
| 48 | |
| 49 | |
| 50 | |
| 51 | |
| 52 |
|
| 53 | (define (sqlite-uri version year)
|
| 54 | (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))))))
|
| 63 | (string-append "https://sqlite.org/" (number->string year)
|
| 64 | "/sqlite-autoconf-" numeric-version ".tar.gz")))
|
| 65 |
|
| 66 | (define-public sqlite
|
| 67 | (package
|
| 68 | (name "sqlite")
|
| 69 | (version "3.39.3")
|
| 70 | (source (origin
|
| 71 | (method url-fetch)
|
| 72 | (uri (sqlite-uri version 2022))
|
| 73 | (patches (search-patches "sqlite-hurd.patch"))
|
| 74 | (sha256
|
| 75 | (base32
|
| 76 | "1f922kq16g7f4h3gpzim78lvrp5xw9nvlvqw97s2qgxyh8qgns3q"))))
|
| 77 | (build-system gnu-build-system)
|
| 78 | (inputs (list readline))
|
| 79 | (outputs '("out" "static"))
|
| 80 | (arguments
|
| 81 | `(#:configure-flags
|
| 82 | |
| 83 | |
| 84 | |
| 85 | |
| 86 | (list (string-append "CFLAGS=-O2 -g -DSQLITE_SECURE_DELETE "
|
| 87 | "-DSQLITE_ENABLE_FTS3 "
|
| 88 | "-DSQLITE_ENABLE_UNLOCK_NOTIFY "
|
| 89 | "-DSQLITE_ENABLE_DBSTAT_VTAB "
|
| 90 | |
| 91 | "-DSQLITE_ENABLE_COLUMN_METADATA"))
|
| 92 | #:phases (modify-phases %standard-phases
|
| 93 | (add-after 'install 'move-static-library
|
| 94 | (lambda* (#:key outputs #:allow-other-keys)
|
| 95 | (let* ((out (assoc-ref outputs "out"))
|
| 96 | (static (assoc-ref outputs "static"))
|
| 97 | (source (string-append out "/lib/libsqlite3.a")))
|
| 98 | (mkdir-p (string-append static "/lib"))
|
| 99 | (link source (string-append static "/lib/libsqlite3.a"))
|
| 100 | (delete-file source)
|
| 101 |
|
| 102 | |
| 103 | |
| 104 | (substitute* (string-append out "/lib/libsqlite3.la")
|
| 105 | (("^old_library=.*")
|
| 106 | "old_library=''\n"))
|
| 107 | #t))))))
|
| 108 | (home-page "https://www.sqlite.org/")
|
| 109 | (synopsis "The SQLite database management system")
|
| 110 | (description
|
| 111 | "SQLite is a software library that implements a self-contained, serverless,
|
| 112 | zero-configuration, transactional SQL database engine. SQLite is the most
|
| 113 | widely deployed SQL database engine in the world. The source code for SQLite
|
| 114 | is in the public domain.")
|
| 115 | (license license:public-domain)))
|
| 116 |
|
| 117 | |
| 118 | (define-public sqlite-next
|
| 119 | (package
|
| 120 | (inherit sqlite)
|
| 121 | (version "3.53.4")
|
| 122 | (source (origin
|
| 123 | (method url-fetch)
|
| 124 | (uri (sqlite-uri version 2026))
|
| 125 | (sha256
|
| 126 | (base32
|
| 127 | "177b2saql7f8b8m59gnmgwgsci8143wnpla8zpl5vkcj1s88750f"))))
|
| 128 | (arguments
|
| 129 | (substitute-keyword-arguments arguments
|
| 130 | ((#:tests? _ #f)
|
| 131 | #f)
|
| 132 | ((#:configure-flags flags #~(list))
|
| 133 | #~(map (lambda (flag)
|
| 134 | (if (string-prefix? "CFLAGS=" flag)
|
| 135 | (string-append flag
|
| 136 | |
| 137 | " -DSQLITE_ENABLE_FTS4"
|
| 138 | " -DSQLITE_ENABLE_FTS5"
|
| 139 | |
| 140 | |
| 141 | " -DSQLITE_ENABLE_FTS3_PARENTHESIS"
|
| 142 | " -DSQLITE_ENABLE_GEOPOLY"
|
| 143 | " -DSQLITE_ENABLE_MATH_FUNCTIONS"
|
| 144 | " -DSQLITE_ENABLE_PERCENTILE"
|
| 145 | " -DSQLITE_ENABLE_PREUPDATE_HOOK"
|
| 146 | " -DSQLITE_ENABLE_RBU"
|
| 147 | " -DSQLITE_ENABLE_RTREE"
|
| 148 | " -DSQLITE_ENABLE_SESSION")
|
| 149 | flag))
|
| 150 | |
| 151 | |
| 152 | (cons* "--disable-option-checking"
|
| 153 | (string-append "--with-readline-header="
|
| 154 | #$(this-package-input "readline") "/include")
|
| 155 | #$flags)))
|
| 156 | ((#:phases phases #~(list))
|
| 157 | #~(modify-phases #$phases
|
| 158 | (replace 'move-static-library
|
| 159 | (lambda* (#:key outputs #:allow-other-keys)
|
| 160 | (let* ((out (assoc-ref outputs "out"))
|
| 161 | (static (assoc-ref outputs "static"))
|
| 162 | (source (string-append out "/lib/libsqlite3.a")))
|
| 163 | (mkdir-p (string-append static "/lib"))
|
| 164 | (link source (string-append static "/lib/libsqlite3.a"))
|
| 165 | (delete-file source)
|
| 166 | (when (file-exists? (string-append out "/lib/libsqlite3.la"))
|
| 167 | (substitute* (string-append out "/lib/libsqlite3.la")
|
| 168 | (("^old_library=.*")
|
| 169 | "old_library=''\n"))))))))))))
|