You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

128 lines
6.1 KiB

;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2013, 2015, 2018 Ludovic Courtès <>
;;; Copyright © 2014, 2015, 2016, 2018 Mark H Weaver <>
;;; Copyright © 2014 Sree Harsha Totakura <>
;;; Copyright © 2015, 2016 Sou Bunnbu <>
;;; Copyright © 2016 Efraim Flashner <>
;;; Copyright © 2016 Ben Woodcroft <>
;;; Copyright © 2016 David Craven <>
;;; Copyright © 2016, 2017, 2018, 2019, 2020 Marius Bakke <>
;;; Copyright © 2017 Ricardo Wurmus <>
;;; Copyright © 2017 Jelle Licht <>
;;; Copyright © 2018 Tobias Geerinckx-Rice <>
;;; Copyright © 2018 Alex Vong <>
;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <>
;;; This file is part of GNU Guix.
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; GNU General Public License for more details.
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix. If not, see <>.
(define-module (gnu packages sqlite)
#:use-module (gnu packages)
#:use-module (gnu packages hurd)
#:use-module (gnu packages readline)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (guix packages)
#:use-module (guix download)
#:use-module (guix build-system gnu)
#:use-module (guix utils)
#:use-module (ice-9 match)
#:use-module (srfi srfi-26))
;;; Commentary:
;;; This module has been separated from (gnu packages databases) to reduce the
;;; number of module references for core packages.
(define-public sqlite
(name "sqlite")
(version "3.31.1")
(source (origin
(method url-fetch)
(uri (let ((numeric-version
(match (string-split version #\.)
((first-digit other-digits ...)
(string-append first-digit
(map (cut string-pad <> 2 #\0)
6 #\0))))))
(string-append ""
numeric-version ".tar.gz")))
(build-system gnu-build-system)
(inputs `(("readline" ,readline)))
(native-inputs (if (hurd-target?)
;; TODO move into origin on the next rebuild cycle.
,@(search-patches "sqlite-hurd.patch")))
(outputs '("out" "static"))
;; to CFLAGS. GNU Icecat will refuse to use the system SQLite
;; unless these options are enabled.
(list (string-append "CFLAGS=-O2 -DSQLITE_SECURE_DELETE "
;; Column metadata is required by GNU Jami and Qt,
#:phases (modify-phases %standard-phases
;; TODO: remove in the next rebuild cycle
,@(if (hurd-target?)
`((add-after 'unpack 'patch-sqlite/hurd
(lambda* (#:key inputs native-inputs
(let ((patch (assoc-ref
(if ,(%current-target-system)
(invoke "patch" "-p1" "--force" "-i" patch)))))
(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/")
(home-page "")
(synopsis "The SQLite database management system")
"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)))
;; Column metadata support was added to the regular 'sqlite' package with
;; commit fad5b1a6d8d9c36bea5785ae4fbc1beb37e644d7.
(define-public sqlite-with-column-metadata
(deprecated-package "sqlite-with-column-metadata" sqlite))