From 57a818db7a3b9323967d444380bc9a97fb9afb2d Mon Sep 17 00:00:00 2001
From: Kristian Lein-Mathisen <kristianlein@gmail.com>
Date: Mon, 23 Sep 2024 12:55:35 +0200
Subject: [PATCH 1/2] gnu: sqlite: refactor sqlite-uri into
sqlite-numeric-version
* gnu/packages/sqlite.scm: sqlite-uri is too specific to be reusable
As I intend to introduce sqlite-doc, a few issues arise. First, the sqlite url
suffix changes from `tar.gz` til `zip`. Second, the hardcodec `autoconf` part
is turned into `doc`. Calculating the numeric version of sqlite urls is still
useful, and thus still exposed as a function.
Change-Id: I26eb746fb3918889a15f5b7d6949e5bc01a76c22
---
gnu/packages/sqlite.scm | 121 +++++++++++++++++++++-------------------
1 file changed, 64 insertions(+), 57 deletions(-)
@@ -32,12 +32,15 @@
(define-module (gnu packages sqlite)
#:use-module (gnu packages)
+ #:use-module (gnu packages compression)
#:use-module (gnu packages hurd)
#:use-module (gnu packages readline)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (guix packages)
+ #:use-module (guix gexp)
#:use-module (guix download)
#:use-module (guix build-system gnu)
+ #:use-module (guix build-system trivial)
#:use-module (guix utils)
#:use-module (guix deprecation)
#:use-module (ice-9 match)
@@ -48,7 +51,7 @@ (define-module (gnu packages sqlite)
;;; This module has been separated from (gnu packages databases) to reduce the
;;; number of module references for core packages.
-(define (sqlite-uri version year)
+(define (sqlite-numeric-version version)
(let ((numeric-version
(match (string-split version #\.)
((first-digit other-digits ...)
@@ -58,68 +61,72 @@ (define (sqlite-uri version year)
(map (cut string-pad <> 2 #\0)
other-digits))
6 #\0))))))
- (string-append "https://sqlite.org/" (number->string year)
- "/sqlite-autoconf-" numeric-version ".tar.gz")))
+ numeric-version))
+
(define-public sqlite
- (package
- (name "sqlite")
- (version "3.39.3")
- (source (origin
- (method url-fetch)
- (uri (sqlite-uri version 2022))
- (patches (search-patches "sqlite-hurd.patch"))
- (sha256
- (base32
- "1f922kq16g7f4h3gpzim78lvrp5xw9nvlvqw97s2qgxyh8qgns3q"))))
- (build-system gnu-build-system)
- (inputs (list readline))
- (outputs '("out" "static"))
- (arguments
- `(#:configure-flags
- ;; Add -DSQLITE_SECURE_DELETE, -DSQLITE_ENABLE_FTS3,
- ;; -DSQLITE_ENABLE_UNLOCK_NOTIFY and -DSQLITE_ENABLE_DBSTAT_VTAB
- ;; to CFLAGS. GNU Icecat will refuse to use the system SQLite
- ;; unless these options are enabled.
- (list (string-append "CFLAGS=-O2 -g -DSQLITE_SECURE_DELETE "
- "-DSQLITE_ENABLE_FTS3 "
- "-DSQLITE_ENABLE_UNLOCK_NOTIFY "
- "-DSQLITE_ENABLE_DBSTAT_VTAB "
- ;; Column metadata is required by GNU Jami and Qt, et.al.
- "-DSQLITE_ENABLE_COLUMN_METADATA"))
- #:phases (modify-phases %standard-phases
- (add-after 'install 'move-static-library
- (lambda* (#:key outputs #:allow-other-keys)
- (let* ((out (assoc-ref outputs "out"))
- (static (assoc-ref outputs "static"))
- (source (string-append out "/lib/libsqlite3.a")))
- (mkdir-p (string-append static "/lib"))
- (link source (string-append static "/lib/libsqlite3.a"))
- (delete-file source)
+ (let* ((version "3.39.3")
+ (numeric-version (sqlite-numeric-version version)))
+ (package
+ (name "sqlite")
+ (version version)
+ (source (origin
+ (method url-fetch)
+ (uri (string-append "https://sqlite.org/2022/sqlite-autoconf-" numeric-version ".tar.gz"))
+ (patches (search-patches "sqlite-hurd.patch"))
+ (sha256
+ (base32
+ "1f922kq16g7f4h3gpzim78lvrp5xw9nvlvqw97s2qgxyh8qgns3q"))))
+ (build-system gnu-build-system)
+ (inputs (list readline))
+ (outputs '("out" "static"))
+ (arguments
+ `(#:configure-flags
+ ;; Add -DSQLITE_SECURE_DELETE, -DSQLITE_ENABLE_FTS3,
+ ;; -DSQLITE_ENABLE_UNLOCK_NOTIFY and -DSQLITE_ENABLE_DBSTAT_VTAB
+ ;; to CFLAGS. GNU Icecat will refuse to use the system SQLite
+ ;; unless these options are enabled.
+ (list (string-append "CFLAGS=-O2 -g -DSQLITE_SECURE_DELETE "
+ "-DSQLITE_ENABLE_FTS3 "
+ "-DSQLITE_ENABLE_UNLOCK_NOTIFY "
+ "-DSQLITE_ENABLE_DBSTAT_VTAB "
+ ;; Column metadata is required by GNU Jami and Qt, et.al.
+ "-DSQLITE_ENABLE_COLUMN_METADATA"))
+ #:phases (modify-phases %standard-phases
+ (add-after 'install 'move-static-library
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (static (assoc-ref outputs "static"))
+ (source (string-append out "/lib/libsqlite3.a")))
+ (mkdir-p (string-append static "/lib"))
+ (link source (string-append static "/lib/libsqlite3.a"))
+ (delete-file source)
- ;; Remove reference to the static library from the .la file
- ;; so that Libtool looks for it in the usual places.
- (substitute* (string-append out "/lib/libsqlite3.la")
- (("^old_library=.*")
- "old_library=''\n"))
- #t))))))
- (home-page "https://www.sqlite.org/")
- (synopsis "The SQLite database management system")
- (description
- "SQLite is a software library that implements a self-contained, serverless,
+ ;; Remove reference to the static library from the .la file
+ ;; so that Libtool looks for it in the usual places.
+ (substitute* (string-append out "/lib/libsqlite3.la")
+ (("^old_library=.*")
+ "old_library=''\n"))
+ #t))))))
+ (home-page "https://www.sqlite.org/")
+ (synopsis "The SQLite database management system")
+ (description
+ "SQLite is a software library that implements a self-contained, serverless,
zero-configuration, transactional SQL database engine. SQLite is the most
widely deployed SQL database engine in the world. The source code for SQLite
is in the public domain.")
- (license license:public-domain)))
+ (license license:public-domain))))
;; Newer version required for e.g. fossil.
(define-public sqlite-next
- (package
- (inherit sqlite)
- (version "3.46.0")
- (source (origin
- (method url-fetch)
- (uri (sqlite-uri version 2024))
- (sha256
- (base32
- "0zbs853s8ly693qdg0l7vs4shwn3plmvdczr2s478wsj6dxnm3kg"))))))
+ (let* ((version "3.46.0")
+ (numeric-version (sqlite-numeric-version version)))
+ (package
+ (inherit sqlite)
+ (version version)
+ (source (origin
+ (method url-fetch)
+ (uri (string-append "https://sqlite.org/2024/sqlite-autoconf-" numeric-version ".tar.gz"))
+ (sha256
+ (base32
+ "0zbs853s8ly693qdg0l7vs4shwn3plmvdczr2s478wsj6dxnm3kg")))))))
--
2.46.0