guile.scm 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021 Ludovic Courtès <ludo@gnu.org>
  3. ;;; Copyright © 2014 Cyril Roelandt <tipecaml@gmail.com>
  4. ;;; Copyright © 2014, 2016, 2018 David Thompson <davet@gnu.org>
  5. ;;; Copyright © 2014, 2017, 2018 Mark H Weaver <mhw@netris.org>
  6. ;;; Copyright © 2015, 2017 Christine Lemmer-Webber <cwebber@dustycloud.org>
  7. ;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
  8. ;;; Copyright © 2016, 2017 Leo Famulari <leo@famulari.name>
  9. ;;; Copyright © 2016, 2019, 2020 Ricardo Wurmus <rekado@elephly.net>
  10. ;;; Copyright © 2017 Andy Wingo <wingo@igalia.com>
  11. ;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com>
  12. ;;; Copyright © 2017, 2019 Mathieu Othacehe <m.othacehe@gmail.com>
  13. ;;; Copyright © 2017 Tobias Geerinckx-Rice <me@tobias.gr>
  14. ;;; Copyright © 2017, 2018 Amirouche <amirouche@hypermove.net>
  15. ;;; Copyright © 2018 Danny Milosavljevic <dannym@scratchpost.org>
  16. ;;; Copyright © 2018 Eric Bavier <bavier@member.fsf.org>
  17. ;;; Copyright © 2019 Taylan Kammer <taylan.kammer@gmail.com>
  18. ;;; Copyright © 2020, 2021 Efraim Flashner <efraim@flashner.co.il>
  19. ;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
  20. ;;;
  21. ;;; This file is part of GNU Guix.
  22. ;;;
  23. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  24. ;;; under the terms of the GNU General Public License as published by
  25. ;;; the Free Software Foundation; either version 3 of the License, or (at
  26. ;;; your option) any later version.
  27. ;;;
  28. ;;; GNU Guix is distributed in the hope that it will be useful, but
  29. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  30. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  31. ;;; GNU General Public License for more details.
  32. ;;;
  33. ;;; You should have received a copy of the GNU General Public License
  34. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  35. (define-module (gnu packages guile)
  36. #:use-module ((guix licenses) #:prefix license:)
  37. #:use-module (gnu packages)
  38. #:use-module (gnu packages autotools)
  39. #:use-module (gnu packages base)
  40. #:use-module (gnu packages bash)
  41. #:use-module (gnu packages bdw-gc)
  42. #:use-module (gnu packages compression)
  43. #:use-module (gnu packages dbm)
  44. #:use-module (gnu packages flex)
  45. #:use-module (gnu packages gawk)
  46. #:use-module (gnu packages gettext)
  47. #:use-module (gnu packages gperf)
  48. #:use-module (gnu packages hurd)
  49. #:use-module (gnu packages libffi)
  50. #:use-module (gnu packages libunistring)
  51. #:use-module (gnu packages linux)
  52. #:use-module (gnu packages m4)
  53. #:use-module (gnu packages multiprecision)
  54. #:use-module (gnu packages pkg-config)
  55. #:use-module (gnu packages readline)
  56. #:use-module (gnu packages sqlite)
  57. #:use-module (gnu packages texinfo)
  58. #:use-module (gnu packages version-control)
  59. #:use-module (guix packages)
  60. #:use-module (guix download)
  61. #:use-module (guix git-download)
  62. #:use-module (guix build-system gnu)
  63. #:use-module (guix build-system guile)
  64. #:use-module (guix deprecation)
  65. #:use-module (guix utils))
  66. ;;; Commentary:
  67. ;;;
  68. ;;; GNU Guile, and modules and extensions.
  69. ;;;
  70. ;;; Code:
  71. (define-public guile-1.8
  72. (package
  73. (name "guile")
  74. (version "1.8.8")
  75. (source (origin
  76. (method url-fetch)
  77. (uri (string-append "mirror://gnu/guile/guile-" version
  78. ".tar.gz"))
  79. (sha256
  80. (base32
  81. "0l200a0v7h8bh0cwz6v7hc13ds39cgqsmfrks55b1rbj5vniyiy3"))
  82. (patches (search-patches "guile-1.8-cpp-4.5.patch"))))
  83. (build-system gnu-build-system)
  84. (arguments '(#:configure-flags '("--disable-error-on-warning"
  85. ;; Build with '-O1' to work around GC
  86. ;; crash on x86_64:
  87. ;; <https://issues.guix.gnu.org/50427>.
  88. "CFLAGS=-O1 -g -Wall")
  89. ;; Insert a phase before `configure' to patch things up.
  90. #:phases
  91. (modify-phases %standard-phases
  92. (add-before 'configure 'patch-stuff
  93. (lambda* (#:key outputs #:allow-other-keys)
  94. ;; Add a call to `lt_dladdsearchdir' so that
  95. ;; `libguile-readline.so' & co. are in the
  96. ;; loader's search path.
  97. (substitute* "libguile/dynl.c"
  98. (("lt_dlinit.*$" match)
  99. (format #f
  100. " ~a~% lt_dladdsearchdir(\"~a/lib\");~%"
  101. match
  102. (assoc-ref outputs "out"))))
  103. ;; The usual /bin/sh...
  104. (substitute* "ice-9/popen.scm"
  105. (("/bin/sh") (which "sh"))))))
  106. ;; XXX: Several numerical tests and tests related to
  107. ;; 'inet-pton' fail on glibc 2.33/GCC 10. Disable them.
  108. ;; TODO: Remove this package when its dependents no longer
  109. ;; need it.
  110. #:tests? #f))
  111. ;; When cross-compiling, a native version of Guile itself is needed.
  112. (native-inputs (if (%current-target-system)
  113. `(("self" ,this-package))
  114. '()))
  115. (inputs (list gawk readline))
  116. ;; Since `guile-1.8.pc' has "Libs: ... -lgmp -lltdl", these must be
  117. ;; propagated.
  118. (propagated-inputs (list gmp libltdl))
  119. (native-search-paths
  120. (list (search-path-specification
  121. (variable "GUILE_LOAD_PATH")
  122. (files '("share/guile/site")))))
  123. (synopsis "Scheme implementation intended especially for extensions")
  124. (description
  125. "Guile is the GNU Ubiquitous Intelligent Language for Extensions, the
  126. official extension language of the GNU system. It is an implementation of
  127. the Scheme language which can be easily embedded in other applications to
  128. provide a convenient means of extending the functionality of the application
  129. without requiring the source code to be rewritten.")
  130. (home-page "https://www.gnu.org/software/guile/")
  131. (license license:lgpl2.0+)))
  132. (define-public guile-2.0
  133. (package
  134. (name "guile")
  135. (version "2.0.14")
  136. (source (origin
  137. (method url-fetch)
  138. (uri (string-append "mirror://gnu/guile/guile-" version
  139. ".tar.xz"))
  140. (sha256
  141. (base32
  142. "10lxc6l5alf3lzbs3ihnbfy6dfcrsyf8667wa57f26vf4mk2ai78"))))
  143. (build-system gnu-build-system)
  144. ;; When cross-compiling, a native version of Guile itself is needed.
  145. (native-inputs `(,@(if (%current-target-system)
  146. `(("self" ,this-package))
  147. '())
  148. ("pkgconfig" ,pkg-config)))
  149. (inputs `(("libffi" ,libffi)
  150. ,@(libiconv-if-needed)
  151. ;; We need Bash when cross-compiling because some of the scripts
  152. ;; in bin/ refer to it. Use 'bash-minimal' because we don't need
  153. ;; an interactive Bash with Readline and all.
  154. ,@(if (target-mingw?) '() `(("bash" ,bash-minimal)))))
  155. (propagated-inputs
  156. `( ;; These ones aren't normally needed here, but since `libguile-2.0.la'
  157. ;; reads `-lltdl -lunistring', adding them here will add the needed
  158. ;; `-L' flags. As for why the `.la' file lacks the `-L' flags, see
  159. ;; <http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/18903>.
  160. ("libunistring" ,libunistring)
  161. ;; Depend on LIBLTDL, not LIBTOOL. That way, we avoid some the extra
  162. ;; dependencies that LIBTOOL has, which is helpful during bootstrap.
  163. ("libltdl" ,libltdl)
  164. ;; The headers and/or `guile-2.0.pc' refer to these packages, so they
  165. ;; must be propagated.
  166. ("bdw-gc" ,libgc)
  167. ("gmp" ,gmp)))
  168. (outputs '("out" "debug"))
  169. (arguments
  170. `(#:configure-flags '("--disable-static") ; saves 3 MiB
  171. ;; Work around non-reproducible .go files as described in
  172. ;; <https://bugs.gnu.org/20272>, which affects 2.0, 2.2, and 3.0 so far.
  173. #:parallel-build? #f
  174. #:phases
  175. (modify-phases %standard-phases
  176. ,@(if (hurd-system?)
  177. '((add-after 'unpack 'disable-tests
  178. (lambda _
  179. ;; Hangs at: "Running 00-repl-server.test"
  180. (rename-file "test-suite/tests/00-repl-server.test" "00-repl-server.test")
  181. ;; Sometimes Hangs at: "Running 00-socket.test"
  182. (rename-file "test-suite/tests/00-socket.test" "00-socket.test")
  183. ;; FAIL: srfi-18.test: thread-sleep!: thread sleeps fractions of a second
  184. (rename-file "test-suite/tests/srfi-18.test" "srfi-18.test")
  185. ;; failed to remove 't-guild-compile-7215.go.tdL7yC
  186. (substitute* "test-suite/standalone/Makefile.in"
  187. (("test-guild-compile ") ""))
  188. #t)))
  189. '())
  190. (add-before 'configure 'pre-configure
  191. (lambda* (#:key inputs #:allow-other-keys)
  192. ;; Tell (ice-9 popen) the file name of Bash.
  193. (let ((bash (assoc-ref inputs "bash")))
  194. (substitute* "module/ice-9/popen.scm"
  195. ;; If bash is #f allow fallback for user to provide
  196. ;; "bash" in PATH. This happens when cross-building to
  197. ;; MinGW for which we do not have Bash yet.
  198. (("/bin/sh")
  199. ,@(if (target-mingw?)
  200. '((if bash
  201. (string-append bash "/bin/bash")
  202. "bash"))
  203. '((string-append bash "/bin/bash")))))
  204. #t))))))
  205. (native-search-paths
  206. (list (search-path-specification
  207. (variable "GUILE_LOAD_PATH")
  208. (files '("share/guile/site/2.0")))
  209. (search-path-specification
  210. (variable "GUILE_LOAD_COMPILED_PATH")
  211. (files '("lib/guile/2.0/site-ccache")))))
  212. (synopsis "Scheme implementation intended especially for extensions")
  213. (description
  214. "Guile is the GNU Ubiquitous Intelligent Language for Extensions, the
  215. official extension language of the GNU system. It is an implementation of
  216. the Scheme language which can be easily embedded in other applications to
  217. provide a convenient means of extending the functionality of the application
  218. without requiring the source code to be rewritten.")
  219. (home-page "https://www.gnu.org/software/guile/")
  220. (license license:lgpl3+)))
  221. (define-public guile-2.2
  222. (package (inherit guile-2.0)
  223. (name "guile")
  224. (version "2.2.7")
  225. (source (origin
  226. (method url-fetch)
  227. ;; Note: we are limited to one of the compression formats
  228. ;; supported by the bootstrap binaries, so no lzip here.
  229. (uri (string-append "mirror://gnu/guile/guile-" version
  230. ".tar.xz"))
  231. (sha256
  232. (base32
  233. "013mydzhfswqci6xmyc1ajzd59pfbdak15i0b090nhr9bzm7dxyd"))
  234. (modules '((guix build utils)))
  235. (patches (search-patches
  236. "guile-2.2-skip-oom-test.patch"
  237. "guile-2.2-skip-so-test.patch"))
  238. ;; Remove the pre-built object files. Instead, build everything
  239. ;; from source, at the expense of significantly longer build
  240. ;; times (almost 3 hours on a 4-core Intel i5).
  241. (snippet '(begin
  242. (for-each delete-file
  243. (find-files "prebuilt" "\\.go$"))
  244. #t))))
  245. (arguments
  246. (substitute-keyword-arguments (package-arguments guile-2.0)
  247. ((#:configure-flags flags ''())
  248. (if (target-x86-32?) ;<https://issues.guix.gnu.org/49368>
  249. `(append ,flags '("CFLAGS=-g -O2 -fexcess-precision=standard"))
  250. flags))))
  251. (properties '((timeout . 72000) ;20 hours
  252. (max-silent-time . 36000))) ;10 hours (needed on ARM
  253. ; when heavily loaded)
  254. (native-search-paths
  255. (list (search-path-specification
  256. (variable "GUILE_LOAD_PATH")
  257. (files '("share/guile/site/2.2")))
  258. (search-path-specification
  259. (variable "GUILE_LOAD_COMPILED_PATH")
  260. (files '("lib/guile/2.2/site-ccache")))))))
  261. (define-deprecated guile-2.2/bug-fix guile-2.2)
  262. (define-public guile-2.2.4
  263. (package
  264. (inherit guile-2.2)
  265. (version "2.2.4")
  266. (source (origin
  267. (inherit (package-source guile-2.2))
  268. (uri (string-append "mirror://gnu/guile/guile-" version
  269. ".tar.xz"))
  270. (sha256
  271. (base32
  272. "07p3g0v2ba2vlfbfidqzlgbhnzdx46wh2rgc5gszq1mjyx5bks6r"))))))
  273. (define-public guile-3.0
  274. ;; This is the latest Guile stable version.
  275. (package
  276. (inherit guile-2.2)
  277. (name "guile")
  278. (version "3.0.7")
  279. (source (origin
  280. (inherit (package-source guile-2.2))
  281. (patches '()) ; We no longer need the patches.
  282. (uri (string-append "mirror://gnu/guile/guile-"
  283. version ".tar.xz"))
  284. (sha256
  285. (base32
  286. "1dwiwsrpm4f96alfnz6wibq378242z4f16vsxgy1n9r00v3qczgm"))
  287. ;; Replace the snippet because the oom-test still
  288. ;; fails on some 32-bit architectures.
  289. (snippet '(begin
  290. (substitute* "test-suite/standalone/Makefile.in"
  291. (("test-out-of-memory") ""))
  292. (for-each delete-file
  293. (find-files "prebuilt" "\\.go$"))))))
  294. ;; Build with the bundled mini-GMP to avoid interference with GnuTLS' own
  295. ;; use of GMP via Nettle: <https://issues.guix.gnu.org/46330>.
  296. (propagated-inputs
  297. (modify-inputs (package-propagated-inputs guile-2.2)
  298. (delete "gmp" "libltdl")))
  299. (arguments
  300. (substitute-keyword-arguments (package-arguments guile-2.0)
  301. ((#:configure-flags flags ''())
  302. ;; XXX: JIT-enabled Guile crashes in obscure ways on GNU/Hurd.
  303. `(cons* ,@(if (hurd-target?)
  304. '("--disable-jit")
  305. '())
  306. ;; -fexcess-precision=standard is required when compiling for
  307. ;; i686-linux, otherwise "numbers.test" will fail
  308. ;; (see <https://issues.guix.gnu.org/49368> and
  309. ;; <https://issues.guix.gnu.org/49659>).
  310. ;; TODO: Keep this in GUILE-2.2 and remove from here on next
  311. ;; rebuild cycle.
  312. ,@(if (target-x86-32?)
  313. '("CFLAGS=-g -O2 -fexcess-precision=standard")
  314. '())
  315. "--enable-mini-gmp"
  316. ,flags))
  317. ((#:phases phases)
  318. `(modify-phases ,phases
  319. (add-before 'check 'disable-stack-overflow-test
  320. (lambda _
  321. ;; This test can invoke the "OOM killer", especially when
  322. ;; running on emulated hardware (QEMU). Skip it.
  323. (substitute* "test-suite/standalone/test-stack-overflow"
  324. (("!#")
  325. "!#\n(exit 77)\n"))))
  326. ,@(if (string-prefix? "powerpc-" (%current-system))
  327. `((add-after 'unpack 'adjust-bootstrap-flags
  328. (lambda _
  329. ;; Upstream knows about suggested solution.
  330. ;; https://debbugs.gnu.org/cgi/bugreport.cgi?bug=45214
  331. (substitute* "bootstrap/Makefile.in"
  332. (("^GUILE_OPTIMIZATIONS.*")
  333. "GUILE_OPTIMIZATIONS = -O1 -Oresolve-primitives -Ocps\n"))))
  334. (add-after 'unpack 'skip-failing-fdes-test
  335. (lambda _
  336. ;; ERROR: ((system-error "seek" "~A" ("Bad file descriptor") (9)))
  337. (substitute* "test-suite/tests/ports.test"
  338. (("fdes not closed\"" all) (string-append all "(exit 77)")))
  339. #t)))
  340. '())))))
  341. (native-search-paths
  342. (list (search-path-specification
  343. (variable "GUILE_LOAD_PATH")
  344. (files '("share/guile/site/3.0")))
  345. (search-path-specification
  346. (variable "GUILE_LOAD_COMPILED_PATH")
  347. (files '("lib/guile/3.0/site-ccache"
  348. "share/guile/site/3.0")))))))
  349. (define-public guile-3.0-latest
  350. guile-3.0)
  351. (define-public guile-3.0/libgc-7
  352. ;; Using libgc-7 avoid crashes that can occur, particularly when loading
  353. ;; data in to the Guix Data Service:
  354. ;; https://debbugs.gnu.org/cgi/bugreport.cgi?bug=40525
  355. (hidden-package
  356. (package
  357. (inherit guile-3.0-latest)
  358. (propagated-inputs
  359. (modify-inputs (package-propagated-inputs guile-3.0)
  360. (replace "bdw-gc" libgc-7))))))
  361. (define-public guile-3.0/fixed
  362. ;; A package of Guile that's rarely changed. It is the one used in the
  363. ;; `base' module, and thus changing it entails a full rebuild.
  364. (package
  365. (inherit guile-3.0)
  366. (properties '((hidden? . #t) ;people should install 'guile-2.2'
  367. (timeout . 72000) ;20 hours
  368. (max-silent-time . 36000))))) ;10 hours (needed on ARM
  369. ; when heavily loaded)
  370. (define-public guile-next
  371. (let ((version "3.0.5")
  372. (revision "0")
  373. (commit "91547abf54d5e0795afda2781259ab8923eb527b"))
  374. (package
  375. (inherit guile-3.0)
  376. (name "guile-next")
  377. (version (git-version version revision commit))
  378. (source (origin
  379. ;; The main goal here is to allow for '--with-branch'.
  380. (method git-fetch)
  381. (uri (git-reference
  382. (url "https://git.savannah.gnu.org/git/guile.git")
  383. (commit commit)))
  384. (file-name (git-file-name name version))
  385. (sha256
  386. (base32
  387. "09i1c77h2shygylfk0av31jsc1my6zjl230b2cx6vyl58q8c0cqy"))))
  388. (arguments
  389. (substitute-keyword-arguments (package-arguments guile-3.0)
  390. ((#:phases phases '%standard-phases)
  391. `(modify-phases ,phases
  392. (add-before 'check 'skip-failing-tests
  393. (lambda _
  394. (substitute* "test-suite/standalone/test-out-of-memory"
  395. (("!#") "!#\n\n(exit 77)\n"))
  396. (delete-file "test-suite/tests/version.test")
  397. #t))))))
  398. (native-inputs
  399. (modify-inputs (package-native-inputs guile-3.0)
  400. (prepend autoconf
  401. automake
  402. libtool
  403. flex
  404. gnu-gettext
  405. texinfo
  406. gperf)))
  407. (synopsis "Development version of GNU Guile"))))
  408. (define* (make-guile-readline guile #:optional (name "guile-readline"))
  409. (package
  410. (name name)
  411. (version (package-version guile))
  412. (source (package-source guile))
  413. (build-system gnu-build-system)
  414. (arguments
  415. '(#:configure-flags '("--disable-silent-rules"
  416. "--enable-mini-gmp") ;for Guile >= 3.0.6
  417. #:phases (modify-phases %standard-phases
  418. (add-before 'build 'chdir
  419. (lambda* (#:key outputs #:allow-other-keys)
  420. (invoke "make" "-C" "libguile" "scmconfig.h")
  421. (invoke "make" "-C" "lib")
  422. (chdir "guile-readline")
  423. (substitute* "Makefile"
  424. (("../libguile/libguile-[[:graph:]]+\\.la")
  425. ;; Remove dependency on libguile-X.Y.la.
  426. "")
  427. (("^READLINE_LIBS = (.*)$" _ libs)
  428. ;; Link against the provided libguile.
  429. (string-append "READLINE_LIBS = "
  430. "-lguile-$(GUILE_EFFECTIVE_VERSION) "
  431. libs "\n"))
  432. (("\\$\\(top_builddir\\)/meta/build-env")
  433. ;; Use the provided Guile, not the one from
  434. ;; $(builddir).
  435. "")
  436. ;; Install modules to the 'site' directories.
  437. (("^moddir = .*$")
  438. "moddir = $(pkgdatadir)/site/$(GUILE_EFFECTIVE_VERSION)\n")
  439. (("^ccachedir = .*$")
  440. "ccachedir = $(pkglibdir)/$(GUILE_EFFECTIVE_VERSION)/site-ccache\n"))
  441. ;; Load 'guile-readline.so' from the right place.
  442. (substitute* "ice-9/readline.scm"
  443. (("load-extension \"guile-readline\"")
  444. (format #f "load-extension \
  445. (string-append ~s \"/lib/guile/\" (effective-version) \"/extensions/guile-readline\")"
  446. (assoc-ref outputs "out"))))
  447. #t)))))
  448. (home-page (package-home-page guile))
  449. (native-inputs (package-native-inputs guile))
  450. (inputs
  451. `(,@(package-inputs guile) ;to placate 'configure'
  452. ,@(package-propagated-inputs guile)
  453. ("guile" ,guile)
  454. ("readline" ,readline)))
  455. (synopsis "Line editing support for GNU Guile")
  456. (description
  457. "This module provides line editing support via the Readline library for
  458. GNU@tie{}Guile. Use the @code{(ice-9 readline)} module and call its
  459. @code{activate-readline} procedure to enable it.")
  460. (license license:gpl3+)))
  461. (define-public guile-readline
  462. (make-guile-readline guile-3.0))
  463. (define-public guile2.2-readline
  464. (make-guile-readline guile-2.2 "guile2.2-readline"))
  465. (define (guile-variant-package-name prefix)
  466. (lambda (name)
  467. "Return NAME with PREFIX instead of \"guile-\", when applicable."
  468. (if (string-prefix? "guile-" name)
  469. (string-append prefix "-"
  470. (string-drop name
  471. (string-length "guile-")))
  472. name)))
  473. (define package-for-guile-2.0
  474. ;; A procedure that rewrites the dependency tree of the given package to use
  475. ;; GUILE-2.0 instead of GUILE-3.0.
  476. (package-input-rewriting `((,guile-3.0 . ,guile-2.0))
  477. (guile-variant-package-name "guile2.0")
  478. #:deep? #f))
  479. (define package-for-guile-2.2
  480. (package-input-rewriting `((,guile-3.0 . ,guile-2.2))
  481. (guile-variant-package-name "guile2.2")
  482. #:deep? #f))
  483. (define-syntax define-deprecated-guile3.0-package
  484. (lambda (s)
  485. "Define a deprecated package alias for \"guile3.0-something\"."
  486. (syntax-case s ()
  487. ((_ name)
  488. (and (identifier? #'name)
  489. (string-prefix? "guile3.0-" (symbol->string (syntax->datum
  490. #'name))))
  491. (let ((->guile (lambda (str)
  492. (let ((base (string-drop str
  493. (string-length "guile3.0-"))))
  494. (string-append "guile-" base)))))
  495. (with-syntax ((package-name (symbol->string (syntax->datum #'name)))
  496. (package
  497. (datum->syntax
  498. #'name
  499. (string->symbol
  500. (->guile (symbol->string (syntax->datum
  501. #'name))))))
  502. (old-name
  503. ;; XXX: This is the name generated by
  504. ;; 'define-deprecated'.
  505. (datum->syntax
  506. #'name
  507. (symbol-append '% (syntax->datum #'name)
  508. '/deprecated))))
  509. #'(begin
  510. (define-deprecated name package
  511. (deprecated-package package-name package))
  512. (export old-name))))))))
  513. (define-deprecated-guile3.0-package guile3.0-readline)
  514. (define-public guile-for-guile-emacs
  515. (let ((commit "15ca78482ac0dd2e3eb36dcb31765d8652d7106d")
  516. (revision "1"))
  517. (package (inherit guile-2.2)
  518. (name "guile-for-guile-emacs")
  519. (version (git-version "2.1.2" revision commit))
  520. (source (origin
  521. (method git-fetch)
  522. (uri (git-reference
  523. (url "git://git.savannah.gnu.org/guile.git")
  524. (commit commit)))
  525. (file-name (git-file-name name version))
  526. (sha256
  527. (base32
  528. "1l7ik4q4zk7vq4m3gnwizc0b64b1mdr31hxqlzxs94xaf2lvi7s2"))))
  529. (arguments
  530. (substitute-keyword-arguments (package-arguments guile-2.2)
  531. ((#:phases phases '%standard-phases)
  532. `(modify-phases ,phases
  533. (replace 'bootstrap
  534. (lambda _
  535. ;; Disable broken tests.
  536. ;; TODO: Fix them!
  537. (substitute* "test-suite/tests/gc.test"
  538. (("\\(pass-if \"after-gc-hook gets called\"" m)
  539. (string-append "#;" m)))
  540. (substitute* "test-suite/tests/version.test"
  541. (("\\(pass-if \"version reporting works\"" m)
  542. (string-append "#;" m)))
  543. ;; Warning: Unwind-only `out-of-memory' exception; skipping pre-unwind handler.
  544. ;; FAIL: test-out-of-memory
  545. (substitute* "test-suite/standalone/Makefile.am"
  546. (("(check_SCRIPTS|TESTS) \\+= test-out-of-memory") ""))
  547. (patch-shebang "build-aux/git-version-gen")
  548. (invoke "sh" "autogen.sh")
  549. #t))))))
  550. (native-inputs
  551. (modify-inputs (package-native-inputs guile-2.2)
  552. (prepend autoconf
  553. automake
  554. libtool
  555. flex
  556. texinfo
  557. gettext-minimal))))))
  558. ;;;
  559. ;;; Extensions.
  560. ;;;
  561. (define-public guile-json-1
  562. (package
  563. (name "guile-json")
  564. (version "1.3.2")
  565. (home-page "https://github.com/aconchillo/guile-json")
  566. (source (origin
  567. (method url-fetch)
  568. (uri (string-append "mirror://savannah/guile-json/guile-json-"
  569. version ".tar.gz"))
  570. (sha256
  571. (base32
  572. "0m6yzb169r6iz56k3nkncjaiijwi4p0x9ijn1p5ax3s77jklxy9k"))))
  573. (build-system gnu-build-system)
  574. (arguments
  575. `(#:make-flags '("GUILE_AUTO_COMPILE=0"))) ;to prevent guild warnings
  576. (native-inputs (list pkg-config guile-2.2))
  577. (inputs (list guile-2.2))
  578. (synopsis "JSON module for Guile")
  579. (description
  580. "Guile-JSON supports parsing and building JSON documents according to the
  581. specification. These are the main features:
  582. @itemize
  583. @item Strictly complies to @uref{http://json.org, specification}.
  584. @item Build JSON documents programmatically via macros.
  585. @item Unicode support for strings.
  586. @item Allows JSON pretty printing.
  587. @end itemize\n")
  588. ;; Version 1.2.0 switched to GPLv3+ (from LGPLv3+).
  589. (license license:gpl3+)))
  590. ;; Deprecate the 'guile-json' alias to force the use 'guile-json-1' or
  591. ;; 'guile-json-3'. In the future, we may reuse 'guile-json' as an alias for
  592. ;; 'guile-json-3'.
  593. (define-deprecated guile-json guile-json-1)
  594. (export guile-json)
  595. (define-public guile2.0-json
  596. (package-for-guile-2.0 guile-json-1))
  597. (define-public guile-json-3
  598. ;; This version is incompatible with 1.x; see the 'NEWS' file.
  599. (package
  600. (inherit guile-json-1)
  601. (name "guile-json")
  602. (version "3.5.0")
  603. (source (origin
  604. (method url-fetch)
  605. (uri (string-append "mirror://savannah/guile-json/guile-json-"
  606. version ".tar.gz"))
  607. (sha256
  608. (base32
  609. "0nj0684qgh6ppkbdyxqfyjwsv2qbyairxpi8fzrhsi3xnc7jn4im"))))
  610. (native-inputs (list pkg-config guile-3.0))
  611. (inputs (list guile-3.0))))
  612. (define-public guile3.0-json
  613. (deprecated-package "guile3.0-json" guile-json-3))
  614. (define-public guile-json-4
  615. (package
  616. (inherit guile-json-3)
  617. (name "guile-json")
  618. (version "4.5.2")
  619. (source (origin
  620. (method url-fetch)
  621. (uri (string-append "mirror://savannah/guile-json/guile-json-"
  622. version ".tar.gz"))
  623. (sha256
  624. (base32
  625. "0cqr0ljqmzlc2bwrapcsmcgxg147h66mcxf23824ri5i6vn4dc0s"))))))
  626. (define-public guile2.2-json
  627. (package-for-guile-2.2 guile-json-4))
  628. ;; There are two guile-gdbm packages, one using the FFI and one with
  629. ;; direct C bindings, hence the verbose name.
  630. (define-public guile-gdbm-ffi
  631. (package
  632. (name "guile-gdbm-ffi")
  633. (version "20120209.fa1d5b6")
  634. (source (origin
  635. (method git-fetch)
  636. (uri (git-reference
  637. (url "https://github.com/ijp/guile-gdbm")
  638. (commit "fa1d5b6231d0e4d096687b378c025f2148c5f246")))
  639. (file-name (string-append name "-" version "-checkout"))
  640. (patches (search-patches
  641. "guile-gdbm-ffi-support-gdbm-1.14.patch"))
  642. (sha256
  643. (base32
  644. "1j8wrsw7v9w6qkl47xz0rdikg50v16nn6kbs3lgzcymjzpa7babj"))))
  645. (build-system guile-build-system)
  646. (arguments
  647. '(#:phases (modify-phases %standard-phases
  648. (add-after 'unpack 'move-examples
  649. (lambda* (#:key outputs #:allow-other-keys)
  650. ;; Move examples where they belong.
  651. (let* ((out (assoc-ref outputs "out"))
  652. (doc (string-append out "/share/doc/"
  653. (strip-store-file-name out)
  654. "/examples")))
  655. (copy-recursively "examples" doc)
  656. (delete-file-recursively "examples")
  657. #t)))
  658. (add-after 'unpack 'set-libgdbm-file-name
  659. (lambda* (#:key inputs #:allow-other-keys)
  660. (substitute* "gdbm.scm"
  661. (("\\(dynamic-link \"libgdbm\"\\)")
  662. (format #f "(dynamic-link \"~a/lib/libgdbm.so\")"
  663. (assoc-ref inputs "gdbm"))))
  664. #t)))))
  665. (native-inputs (list guile-3.0))
  666. (inputs (list gdbm))
  667. (home-page "https://github.com/ijp/guile-gdbm")
  668. (synopsis "Guile bindings to the GDBM library via Guile's FFI")
  669. (description
  670. "Guile bindings to the GDBM key-value storage system, using
  671. Guile's foreign function interface.")
  672. (license license:gpl3+)))
  673. (define-public guile2.0-gdbm-ffi
  674. (package-for-guile-2.0 guile-gdbm-ffi))
  675. (define-public guile2.2-gdbm-ffi
  676. (package-for-guile-2.2 guile-gdbm-ffi))
  677. (define-deprecated-guile3.0-package guile3.0-gdbm-ffi)
  678. (define-public guile-sqlite3
  679. (package
  680. (name "guile-sqlite3")
  681. (version "0.1.2")
  682. (home-page "https://notabug.org/guile-sqlite3/guile-sqlite3.git")
  683. (source (origin
  684. (method git-fetch)
  685. (uri (git-reference
  686. (url home-page)
  687. (commit (string-append "v" version))))
  688. (sha256
  689. (base32
  690. "1nryy9j3bk34i0alkmc9bmqsm0ayz92k1cdf752mvhyjjn8nr928"))
  691. (file-name (string-append name "-" version "-checkout"))))
  692. (build-system gnu-build-system)
  693. (native-inputs (list autoconf automake guile-3.0 pkg-config))
  694. (inputs (list guile-3.0 sqlite))
  695. (synopsis "Access SQLite databases from Guile")
  696. (description
  697. "This package provides Guile bindings to the SQLite database system.")
  698. (license license:gpl3+)))
  699. (define-public guile2.0-sqlite3
  700. (package-for-guile-2.0 guile-sqlite3))
  701. (define-public guile2.2-sqlite3
  702. (package-for-guile-2.2 guile-sqlite3))
  703. (define-deprecated-guile3.0-package guile3.0-sqlite3)
  704. (define-public guile-bytestructures
  705. (package
  706. (name "guile-bytestructures")
  707. (version "1.0.10")
  708. (home-page "https://github.com/TaylanUB/scheme-bytestructures")
  709. (source (origin
  710. (method git-fetch)
  711. (uri (git-reference
  712. (url home-page)
  713. (commit version)))
  714. (file-name (git-file-name name version))
  715. (sha256
  716. (base32
  717. "14k50jln32kkxv41hvsdgjkkfj6xlv06vc1caz01qkgk1fzh72nk"))))
  718. (build-system gnu-build-system)
  719. (arguments
  720. `(#:make-flags '("GUILE_AUTO_COMPILE=0") ;to prevent guild warnings
  721. #:phases (modify-phases %standard-phases
  722. (add-after 'install 'install-doc
  723. (lambda* (#:key outputs #:allow-other-keys)
  724. (let* ((out (assoc-ref outputs "out"))
  725. (package ,(package-full-name this-package "-"))
  726. (doc (string-append out "/share/doc/" package)))
  727. (install-file "README.md" doc)
  728. #t))))))
  729. (native-inputs (list autoconf automake pkg-config guile-3.0))
  730. (inputs (list guile-3.0))
  731. (synopsis "Structured access to bytevector contents for Guile")
  732. (description
  733. "Guile bytestructures offers a system imitating the type system
  734. of the C programming language, to be used on bytevectors. C's type
  735. system works on raw memory, and Guile works on bytevectors which are
  736. an abstraction over raw memory. It's also more powerful than the C
  737. type system, elevating types to first-class status.")
  738. (license license:gpl3+)
  739. (properties '((upstream-name . "bytestructures")))))
  740. (define-public guile2.0-bytestructures
  741. (package-for-guile-2.0 guile-bytestructures))
  742. (define-public guile2.2-bytestructures
  743. (package-for-guile-2.2 guile-bytestructures))
  744. (define-deprecated-guile3.0-package guile3.0-bytestructures)
  745. (define-public guile-git
  746. (package
  747. (name "guile-git")
  748. (version "0.5.2")
  749. (home-page "https://gitlab.com/guile-git/guile-git.git")
  750. (source (origin
  751. (method git-fetch)
  752. (uri (git-reference
  753. (url home-page)
  754. (commit (string-append "v" version))))
  755. (file-name (git-file-name name version))
  756. (sha256
  757. (base32
  758. "11a51acibwi2hpaygmrpn6nwbr4lqalc87ihrgj3mhz6swbsk9n7"))))
  759. (build-system gnu-build-system)
  760. (arguments
  761. `(#:make-flags '("GUILE_AUTO_COMPILE=0"))) ; to prevent guild warnings
  762. (native-inputs
  763. (list pkg-config autoconf automake texinfo guile-3.0 guile-bytestructures))
  764. (inputs
  765. (list guile-3.0 libgit2))
  766. (propagated-inputs
  767. (list guile-bytestructures))
  768. (synopsis "Guile bindings for libgit2")
  769. (description
  770. "This package provides Guile bindings to libgit2, a library to
  771. manipulate repositories of the Git version control system.")
  772. (license license:gpl3+)))
  773. (define-public guile2.2-git
  774. (package-for-guile-2.2 guile-git))
  775. (define-public guile2.0-git
  776. (package-for-guile-2.0 guile-git))
  777. (define-deprecated-guile3.0-package guile3.0-git)
  778. (define-public guile-zlib
  779. (package
  780. (name "guile-zlib")
  781. (version "0.1.0")
  782. (source
  783. (origin
  784. ;; XXX: Do not use "git-fetch" method here that would create and
  785. ;; endless inclusion loop, because this package is used as an extension
  786. ;; in the same method.
  787. (method url-fetch)
  788. (uri
  789. (string-append "https://notabug.org/guile-zlib/guile-zlib/archive/v"
  790. version ".tar.gz"))
  791. (file-name (string-append name "-" version ".tar.gz"))
  792. (sha256
  793. ;; content hash: 1ip18nzwnczqyhn9cpzxkm9vzpi5fz5sy96cgjhmp7cwhnkmv6zv
  794. (base32
  795. "1safz7rrbdf1d98x3lgx5v74kivpyf9n1v6pdyy22vd0f2sjdir5"))))
  796. (build-system gnu-build-system)
  797. (arguments
  798. '(#:make-flags
  799. '("GUILE_AUTO_COMPILE=0"))) ;to prevent guild warnings
  800. (native-inputs (list autoconf automake pkg-config guile-3.0))
  801. (inputs (list guile-3.0 zlib))
  802. (synopsis "Guile bindings to zlib")
  803. (description
  804. "This package provides Guile bindings for zlib, a lossless
  805. data-compression library. The bindings are written in pure Scheme by using
  806. Guile's foreign function interface.")
  807. (home-page "https://notabug.org/guile-zlib/guile-zlib")
  808. (license license:gpl3+)))
  809. (define-public guile2.2-zlib
  810. (package-for-guile-2.2 guile-zlib))
  811. (define-public guile-lzlib
  812. (package
  813. (name "guile-lzlib")
  814. (version "0.0.2")
  815. (source
  816. (origin
  817. (method url-fetch)
  818. (uri
  819. (string-append "https://notabug.org/guile-lzlib/guile-lzlib/archive/"
  820. version ".tar.gz"))
  821. (file-name (string-append name "-" version ".tar.gz"))
  822. (sha256
  823. (base32
  824. "11sggvncyx08ssp1s5xii4d6nskh1qwqihnbpzzvkrs7sivxn8w6"))))
  825. (build-system gnu-build-system)
  826. (arguments
  827. '(#:make-flags
  828. '("GUILE_AUTO_COMPILE=0"))) ;to prevent guild warnings
  829. (native-inputs (list autoconf automake pkg-config guile-3.0))
  830. (inputs (list guile-3.0 lzlib))
  831. (synopsis "Guile bindings to lzlib")
  832. (description
  833. "This package provides Guile bindings for lzlib, a C library for
  834. in-memory LZMA compression and decompression. The bindings are written in
  835. pure Scheme by using Guile's foreign function interface.")
  836. (home-page "https://notabug.org/guile-lzlib/guile-lzlib")
  837. (license license:gpl3+)))
  838. (define-public guile2.2-lzlib
  839. (package-for-guile-2.2 guile-lzlib))
  840. (define-public guile-zstd
  841. (package
  842. (name "guile-zstd")
  843. (version "0.1.1")
  844. (home-page "https://notabug.org/guile-zstd/guile-zstd")
  845. (source (origin
  846. (method git-fetch)
  847. (uri (git-reference (url home-page)
  848. (commit (string-append "v" version))))
  849. (file-name (git-file-name name version))
  850. (sha256
  851. (base32
  852. "1c8l7829b5yx8wdc0mrhzjfwb6h9hb7cd8dfxcr71a7vlsi86310"))))
  853. (build-system gnu-build-system)
  854. (native-inputs (list autoconf automake pkg-config guile-3.0))
  855. (inputs (list `(,zstd "lib") guile-3.0))
  856. (synopsis "GNU Guile bindings to the zstd compression library")
  857. (description
  858. "This package provides a GNU Guile interface to the zstd (``zstandard'')
  859. compression library.")
  860. (license license:gpl3+)))
  861. ;;; guile.scm ends here