projects/guix·blob javascript-team · refs

281 lines · 12.8 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2012, 2013, 2014, 2016, 2020 Ludovic Courtès <[email protected]>
3;;; Copyright © 2013, 2015, 2025 Andreas Enge <[email protected]>
4;;; Copyright © 2016-2018, 2020, 2021, 2025 Efraim Flashner <[email protected]>
5;;; Copyright © 2017, 2018 Marius Bakke <[email protected]>
6;;; Copyright © 2018 Mark H Weaver <[email protected]>
7;;; Copyright © 2020 Jakub Kądziołka <[email protected]>
8;;; Copyright © 2021 Leo Le Bouter <[email protected]>
9;;; Copyright © 2021, 2022 Maxime Devos <[email protected]>
10;;; Copyright © 2021 LuHui <[email protected]>
11;;; Copyright © 2024 Janneke Nieuwenhuizen <[email protected]>
12;;; Copyright © 2025 Brennan Vincent <[email protected]>
13;;;
14;;; This file is part of GNU Guix.
15;;;
16;;; GNU Guix is free software; you can redistribute it and/or modify it
17;;; under the terms of the GNU General Public License as published by
18;;; the Free Software Foundation; either version 3 of the License, or (at
19;;; your option) any later version.
20;;;
21;;; GNU Guix is distributed in the hope that it will be useful, but
22;;; WITHOUT ANY WARRANTY; without even the implied warranty of
23;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24;;; GNU General Public License for more details.
25;;;
26;;; You should have received a copy of the GNU General Public License
27;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
28
29;;; Commentary:
30;;;
31;;; This module has been separated from (gnu packages databases) to reduce the
32;;; number of module references for core packages.
33
34(define-module (gnu packages dbm)
35 #:use-module (gnu packages)
36 #:use-module (gnu packages autotools)
37 #:use-module ((guix licenses) #:prefix license:)
38 #:use-module (guix packages)
39 #:use-module (guix download)
40 #:use-module (guix gexp)
41 #:use-module (guix build-system gnu)
42 #:use-module (guix utils)
43 #:use-module (ice-9 match))
44
45(define bdb-snippet
46 ;; Remove some bundled and generated files. Some of the old
47 ;; Autotools files are too old for some architectures
48 ;; (e.g. aarch64 and powerpc64le).
49 #~(begin
50 (for-each delete-file-recursively
51 '("dist/configure"
52 "dist/config.sub"
53 "dist/config.guess"
54 "dist/install-sh"
55 "dist/ltmain.sh"
56 "dist/aclocal/libtool.m4"
57 "dist/aclocal/ltoptions.m4"
58 "dist/aclocal/ltsugar.m4"
59 "dist/aclocal/ltversion.m4"
60 "dist/aclocal/lt~obsolete.m4"))
61 (substitute* "dist/configure.ac"
62 ;; Placate 'automake'.
63 (("AC_DEFINE\\(DB_WIN32\\)")
64 "AC_DEFINE(DB_WIN32, [], [Description])")
65 (("AC_DEFINE\\(HAVE_SYSTEM_INCLUDE_FILES\\)")
66 "AC_DEFINE(HAVE_SYSTEM_INCLUDE_FILES, [], [Description])"))))
67
68(define-public bdb-5.3
69 (package
70 (name "bdb")
71 (version "5.3.28")
72 (source (origin
73 (method url-fetch)
74 (uri (string-append "https://download.oracle.com/berkeley-db/db-"
75 version ".tar.gz"))
76 (sha256
77 (base32
78 "0a1n5hbl7027fbz5lm0vp0zzfp1hmxnz14wx3zl9563h83br5ag0"))
79 (patch-flags '("-p0"))
80 (patches (search-patches "bdb-5.3-atomics-on-gcc-9.patch"))
81 (modules '((guix build utils)
82 (srfi srfi-1)))
83 (snippet bdb-snippet)))
84 (build-system gnu-build-system)
85 (outputs '("out" ; programs, libraries, headers
86 "doc")) ; 94 MiB of HTML docs
87 (arguments
88 (list #:tests? #f ; no check target available
89 #:disallowed-references '("doc")
90 #:out-of-source? #true
91 #:configure-flags
92 #~(list
93 #$@(if (target-ppc64le?)
94 #~("CFLAGS=-g -O2 -Wno-error=implicit-function-declaration -fpermissive")
95 #~("CFLAGS=-g -O2 -Wno-error=implicit-function-declaration"))
96 ;; Remove 7 MiB of .a files.
97 "--disable-static"
98
99 ;; The compatibility mode is needed by some packages,
100 ;; notably iproute2.
101 "--enable-compat185"
102
103 ;; The following flag is needed so that the inclusion
104 ;; of db_cxx.h into C++ files works; it leads to
105 ;; HAVE_CXX_STDHEADERS being defined in db_cxx.h.
106 "--enable-cxx")
107 #:phases
108 #~(modify-phases %standard-phases
109 (replace 'bootstrap
110 (lambda* (#:key inputs native-inputs outputs
111 #:allow-other-keys #:rest arguments)
112 (with-directory-excursion "dist"
113 (for-each (lambda (x)
114 (install-file x "aclocal"))
115 (find-files "aclocal_java"))
116 (apply (assq-ref %standard-phases 'bootstrap) arguments)
117 (let ((automake-files (search-input-directory
118 (or native-inputs inputs)
119 "share/automake-1.16")))
120 (define (replace file)
121 (symlink (string-append automake-files "/" file) file))
122 (for-each replace '("config.sub" "config.guess"
123 "install-sh"))))))
124 #$@(if (or (target-arm?)
125 (target-riscv64?))
126 #~((add-after 'unpack 'bdb-configure-patch
127 (lambda _
128 (invoke
129 "patch" "-p1" "-i"
130 #$(local-file
131 (search-patch "bdb-4-5-configure.patch"))))))
132 #~())
133 (add-before 'configure 'pre-configure
134 (lambda _
135 (chdir "dist")
136 ;; '--docdir' is not honored, so we need to patch.
137 (substitute* "Makefile.in"
138 (("docdir[[:blank:]]*=.*")
139 (string-append "docdir = " #$output:doc
140 "/share/doc/bdb")))
141 ;; Replace __EDIT_DB_VERSION__... by actual version numbers.
142 ;; s_config is responsible for this, but also runs autoconf
143 ;; again, so patch out the autoconf bits.
144 (substitute* "s_config"
145 (("^.*(aclocal|autoconf|autoheader|config\\.hin).*$") "")
146 (("^.*auto4mte.*$") "")
147 (("rm (.*) configure") "")
148 (("chmod (.*) config.guess(.*)$") ""))
149 (invoke "sh" "s_config"))))))
150 (native-inputs (list autoconf automake-1.16.5 libtool))
151 (synopsis "Berkeley database")
152 (description
153 "Berkeley DB is an embeddable database allowing developers the choice of
154SQL, Key/Value, XML/XQuery or Java Object storage for their data model.")
155 (home-page
156 "http://www.oracle.com/us/products/database/berkeley-db/overview/index.html")
157 (license (license:non-copyleft "file://LICENSE"
158 "See LICENSE in the distribution."))))
159
160(define-public bdb-6
161 (package
162 (name "bdb")
163 (version "6.2.32")
164 (source (origin
165 (method url-fetch)
166 (uri (string-append "https://download.oracle.com/berkeley-db/db-"
167 version ".tar.gz"))
168 (sha256
169 (base32
170 "1yx8wzhch5wwh016nh0kfxvknjkafv6ybkqh6nh7lxx50jqf5id9"))
171 (modules '((guix build utils)
172 (srfi srfi-1)))
173 (snippet bdb-snippet)))
174 ;; Copy-paste the arguments from bdb-5.3 and drop the
175 ;; 'bdb-configure patch phase.
176 (build-system gnu-build-system)
177 (outputs '("out" "doc"))
178 (arguments
179 (list #:tests? #f ; no check target available
180 #:disallowed-references '("doc")
181 #:out-of-source? #true
182 #:configure-flags
183 #~(list
184 "CFLAGS=-g -O2 -Wno-error=implicit-function-declaration"
185 ;; Remove 7 MiB of .a files.
186 "--disable-static"
187
188 ;; The compatibility mode is needed by some packages,
189 ;; notably iproute2.
190 "--enable-compat185"
191
192 ;; The following flag is needed so that the inclusion
193 ;; of db_cxx.h into C++ files works; it leads to
194 ;; HAVE_CXX_STDHEADERS being defined in db_cxx.h.
195 "--enable-cxx")
196 #:phases
197 #~(modify-phases %standard-phases
198 (replace 'bootstrap
199 (lambda* (#:key inputs native-inputs outputs
200 #:allow-other-keys #:rest arguments)
201 (with-directory-excursion "dist"
202 (for-each (lambda (x)
203 (install-file x "aclocal"))
204 (find-files "aclocal_java"))
205 (apply (assq-ref %standard-phases 'bootstrap) arguments)
206 (let ((automake-files (search-input-directory
207 (or native-inputs inputs)
208 "share/automake-1.16")))
209 (define (replace file)
210 (symlink (string-append automake-files "/" file) file))
211 (for-each replace '("config.sub" "config.guess"
212 "install-sh"))))))
213 (add-before 'configure 'pre-configure
214 (lambda _
215 (chdir "dist")
216 ;; '--docdir' is not honored, so we need to patch.
217 (substitute* "Makefile.in"
218 (("docdir[[:blank:]]*=.*")
219 (string-append "docdir = " #$output:doc
220 "/share/doc/bdb")))
221 ;; Replace __EDIT_DB_VERSION__... by actual version numbers.
222 ;; s_config is responsible for this, but also runs autoconf
223 ;; again, so patch out the autoconf bits.
224 (substitute* "s_config"
225 (("^.*(aclocal|autoconf|autoheader|config\\.hin).*$") "")
226 (("^.*auto4mte.*$") "")
227 (("rm (.*) configure") "")
228 (("chmod (.*) config.guess(.*)$") ""))
229 (invoke "sh" "s_config"))))))
230 (native-inputs (list autoconf automake-1.16.5 libtool))
231 (synopsis "Berkeley database")
232 (description
233 "Berkeley DB is an embeddable database allowing developers the choice of
234SQL, Key/Value, XML/XQuery or Java Object storage for their data model.")
235 (home-page
236 "http://www.oracle.com/us/products/database/berkeley-db/overview/index.html")
237 ;; Starting with version 6, BDB is distributed under AGPL3. Many individual
238 ;; files are covered by the 3-clause BSD license.
239 (license (list license:agpl3+ license:bsd-3))))
240
241(define-public bdb bdb-6)
242
243(define-public gdbm
244 (package
245 (name "gdbm")
246 (version "1.25")
247 (source (origin
248 (method url-fetch)
249 (uri (string-append "mirror://gnu/gdbm/gdbm-"
250 version ".tar.gz"))
251 (sha256
252 (base32
253 "1v4kycs1n9x0pczm9ny6m16gfgpmj8gwv0bvh7w7gn3fjb2v6bfh"))
254 (patches
255 (search-patches "gdbm-lockwait-test.patch"))))
256 (arguments `(#:configure-flags '("--enable-libgdbm-compat"
257 "--disable-static")
258 ,@(if (target-loongarch64?)
259 `(#:phases
260 (modify-phases %standard-phases
261 (add-after 'unpack 'update-config
262 (lambda* (#:key native-inputs inputs #:allow-other-keys)
263 (for-each (lambda (file)
264 (install-file
265 (search-input-file
266 (or native-inputs inputs)
267 (string-append "/bin/" file)) "build-aux"))
268 '("config.guess" "config.sub"))))))
269 '())))
270 (native-inputs (if (target-loongarch64?)
271 (list config)
272 '()))
273 (build-system gnu-build-system)
274 (home-page "https://www.gnu.org.ua/software/gdbm")
275 (synopsis
276 "Hash library of database functions compatible with traditional dbm")
277 (description
278 "GDBM is a library for manipulating hashed databases. It is used to
279store key/value pairs in a file in a manner similar to the Unix dbm library
280and provides interfaces to the traditional file format.")
281 (license license:gpl3+)))