sqlite.scm 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2013, 2015, 2018, 2020 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>
  9. ;;; Copyright © 2016, 2017, 2018, 2019, 2020, 2021 Marius Bakke <marius@gnu.org>
  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. ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
  15. ;;;
  16. ;;; This file is part of GNU Guix.
  17. ;;;
  18. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  19. ;;; under the terms of the GNU General Public License as published by
  20. ;;; the Free Software Foundation; either version 3 of the License, or (at
  21. ;;; your option) any later version.
  22. ;;;
  23. ;;; GNU Guix is distributed in the hope that it will be useful, but
  24. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  25. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  26. ;;; GNU General Public License for more details.
  27. ;;;
  28. ;;; You should have received a copy of the GNU General Public License
  29. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  30. (define-module (gnu packages sqlite)
  31. #:use-module (gnu packages)
  32. #:use-module (gnu packages hurd)
  33. #:use-module (gnu packages readline)
  34. #:use-module ((guix licenses) #:prefix license:)
  35. #:use-module (guix packages)
  36. #:use-module (guix download)
  37. #:use-module (guix build-system gnu)
  38. #:use-module (guix utils)
  39. #:use-module (ice-9 match)
  40. #:use-module (srfi srfi-26))
  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. (define (sqlite-uri version year)
  46. (let ((numeric-version
  47. (match (string-split version #\.)
  48. ((first-digit other-digits ...)
  49. (string-append first-digit
  50. (string-pad-right
  51. (string-concatenate
  52. (map (cut string-pad <> 2 #\0)
  53. other-digits))
  54. 6 #\0))))))
  55. (string-append "https://sqlite.org/" (number->string year)
  56. "/sqlite-autoconf-" numeric-version ".tar.gz")))
  57. (define-public sqlite
  58. (package
  59. (name "sqlite")
  60. (version "3.36.0")
  61. (source (origin
  62. (method url-fetch)
  63. (uri (sqlite-uri version 2021))
  64. (patches (search-patches "sqlite-hurd.patch"))
  65. (sha256
  66. (base32
  67. "1qxwkfvd185dfcqbakrzikrsw6ffr5jp1gl3dch9dsdyjvmw745x"))))
  68. (build-system gnu-build-system)
  69. (inputs `(("readline" ,readline)))
  70. (outputs '("out" "static"))
  71. (arguments
  72. `(#:configure-flags
  73. ;; Add -DSQLITE_SECURE_DELETE, -DSQLITE_ENABLE_FTS3,
  74. ;; -DSQLITE_ENABLE_UNLOCK_NOTIFY and -DSQLITE_ENABLE_DBSTAT_VTAB
  75. ;; to CFLAGS. GNU Icecat will refuse to use the system SQLite
  76. ;; unless these options are enabled.
  77. (list (string-append "CFLAGS=-O2 -g -DSQLITE_SECURE_DELETE "
  78. "-DSQLITE_ENABLE_FTS3 "
  79. "-DSQLITE_ENABLE_UNLOCK_NOTIFY "
  80. "-DSQLITE_ENABLE_DBSTAT_VTAB "
  81. ;; Column metadata is required by GNU Jami and Qt, et.al.
  82. "-DSQLITE_ENABLE_COLUMN_METADATA"))
  83. #:phases (modify-phases %standard-phases
  84. (add-after 'install 'move-static-library
  85. (lambda* (#:key outputs #:allow-other-keys)
  86. (let* ((out (assoc-ref outputs "out"))
  87. (static (assoc-ref outputs "static"))
  88. (source (string-append out "/lib/libsqlite3.a")))
  89. (mkdir-p (string-append static "/lib"))
  90. (link source (string-append static "/lib/libsqlite3.a"))
  91. (delete-file source)
  92. ;; Remove reference to the static library from the .la file
  93. ;; so that Libtool looks for it in the usual places.
  94. (substitute* (string-append out "/lib/libsqlite3.la")
  95. (("^old_library=.*")
  96. "old_library=''\n"))
  97. #t))))))
  98. (home-page "https://www.sqlite.org/")
  99. (synopsis "The SQLite database management system")
  100. (description
  101. "SQLite is a software library that implements a self-contained, serverless,
  102. zero-configuration, transactional SQL database engine. SQLite is the most
  103. widely deployed SQL database engine in the world. The source code for SQLite
  104. is in the public domain.")
  105. (license license:public-domain)))
  106. (define-public sqlite-3.33
  107. (package
  108. (inherit sqlite)
  109. (version "3.33.0")
  110. (source (origin
  111. (method url-fetch)
  112. (uri (sqlite-uri version 2020))
  113. (sha256
  114. (base32
  115. "05dvdfaxd552gj5p7k0i72sfam7lykaw1g2pfn52jnppqx42qshh"))))))
  116. ;; Column metadata support was added to the regular 'sqlite' package with
  117. ;; commit fad5b1a6d8d9c36bea5785ae4fbc1beb37e644d7.
  118. (define-public sqlite-with-column-metadata
  119. (deprecated-package "sqlite-with-column-metadata" sqlite))