guile.scm 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950
  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. '())
  335. ,@(if (or (target-ppc32?)
  336. (target-riscv64?))
  337. `((add-after 'unpack 'skip-failing-fdes-test
  338. (lambda _
  339. ;; ERROR: ((system-error "seek" "~A" ("Bad file descriptor") (9)))
  340. (substitute* "test-suite/tests/ports.test"
  341. (("fdes not closed\"" all) (string-append all "(exit 77)")))
  342. #t)))
  343. '())))))
  344. (native-search-paths
  345. (list (search-path-specification
  346. (variable "GUILE_LOAD_PATH")
  347. (files '("share/guile/site/3.0")))
  348. (search-path-specification
  349. (variable "GUILE_LOAD_COMPILED_PATH")
  350. (files '("lib/guile/3.0/site-ccache"
  351. "share/guile/site/3.0")))))))
  352. (define-public guile-3.0-latest
  353. guile-3.0)
  354. (define-public guile-3.0/libgc-7
  355. ;; Using libgc-7 avoid crashes that can occur, particularly when loading
  356. ;; data in to the Guix Data Service:
  357. ;; https://debbugs.gnu.org/cgi/bugreport.cgi?bug=40525
  358. (hidden-package
  359. (package
  360. (inherit guile-3.0-latest)
  361. (propagated-inputs
  362. (modify-inputs (package-propagated-inputs guile-3.0)
  363. (replace "bdw-gc" libgc-7))))))
  364. (define-public guile-3.0/fixed
  365. ;; A package of Guile that's rarely changed. It is the one used in the
  366. ;; `base' module, and thus changing it entails a full rebuild.
  367. (package
  368. (inherit guile-3.0)
  369. (properties '((hidden? . #t) ;people should install 'guile-2.2'
  370. (timeout . 72000) ;20 hours
  371. (max-silent-time . 36000))))) ;10 hours (needed on ARM
  372. ; when heavily loaded)
  373. (define-public guile-next
  374. (let ((version "3.0.5")
  375. (revision "0")
  376. (commit "91547abf54d5e0795afda2781259ab8923eb527b"))
  377. (package
  378. (inherit guile-3.0)
  379. (name "guile-next")
  380. (version (git-version version revision commit))
  381. (source (origin
  382. ;; The main goal here is to allow for '--with-branch'.
  383. (method git-fetch)
  384. (uri (git-reference
  385. (url "https://git.savannah.gnu.org/git/guile.git")
  386. (commit commit)))
  387. (file-name (git-file-name name version))
  388. (sha256
  389. (base32
  390. "09i1c77h2shygylfk0av31jsc1my6zjl230b2cx6vyl58q8c0cqy"))))
  391. (arguments
  392. (substitute-keyword-arguments (package-arguments guile-3.0)
  393. ((#:phases phases '%standard-phases)
  394. `(modify-phases ,phases
  395. (add-before 'check 'skip-failing-tests
  396. (lambda _
  397. (substitute* "test-suite/standalone/test-out-of-memory"
  398. (("!#") "!#\n\n(exit 77)\n"))
  399. (delete-file "test-suite/tests/version.test")
  400. #t))))))
  401. (native-inputs
  402. (modify-inputs (package-native-inputs guile-3.0)
  403. (prepend autoconf
  404. automake
  405. libtool
  406. flex
  407. gnu-gettext
  408. texinfo
  409. gperf)))
  410. (synopsis "Development version of GNU Guile"))))
  411. (define* (make-guile-readline guile #:optional (name "guile-readline"))
  412. (package
  413. (name name)
  414. (version (package-version guile))
  415. (source (package-source guile))
  416. (build-system gnu-build-system)
  417. (arguments
  418. '(#:configure-flags '("--disable-silent-rules"
  419. "--enable-mini-gmp") ;for Guile >= 3.0.6
  420. #:phases (modify-phases %standard-phases
  421. (add-before 'build 'chdir
  422. (lambda* (#:key outputs #:allow-other-keys)
  423. (invoke "make" "-C" "libguile" "scmconfig.h")
  424. (invoke "make" "-C" "lib")
  425. (chdir "guile-readline")
  426. (substitute* "Makefile"
  427. (("../libguile/libguile-[[:graph:]]+\\.la")
  428. ;; Remove dependency on libguile-X.Y.la.
  429. "")
  430. (("^READLINE_LIBS = (.*)$" _ libs)
  431. ;; Link against the provided libguile.
  432. (string-append "READLINE_LIBS = "
  433. "-lguile-$(GUILE_EFFECTIVE_VERSION) "
  434. libs "\n"))
  435. (("\\$\\(top_builddir\\)/meta/build-env")
  436. ;; Use the provided Guile, not the one from
  437. ;; $(builddir).
  438. "")
  439. ;; Install modules to the 'site' directories.
  440. (("^moddir = .*$")
  441. "moddir = $(pkgdatadir)/site/$(GUILE_EFFECTIVE_VERSION)\n")
  442. (("^ccachedir = .*$")
  443. "ccachedir = $(pkglibdir)/$(GUILE_EFFECTIVE_VERSION)/site-ccache\n"))
  444. ;; Load 'guile-readline.so' from the right place.
  445. (substitute* "ice-9/readline.scm"
  446. (("load-extension \"guile-readline\"")
  447. (format #f "load-extension \
  448. (string-append ~s \"/lib/guile/\" (effective-version) \"/extensions/guile-readline\")"
  449. (assoc-ref outputs "out"))))
  450. #t)))))
  451. (home-page (package-home-page guile))
  452. (native-inputs (package-native-inputs guile))
  453. (inputs
  454. `(,@(package-inputs guile) ;to placate 'configure'
  455. ,@(package-propagated-inputs guile)
  456. ("guile" ,guile)
  457. ("readline" ,readline)))
  458. (synopsis "Line editing support for GNU Guile")
  459. (description
  460. "This module provides line editing support via the Readline library for
  461. GNU@tie{}Guile. Use the @code{(ice-9 readline)} module and call its
  462. @code{activate-readline} procedure to enable it.")
  463. (license license:gpl3+)))
  464. (define-public guile-readline
  465. (make-guile-readline guile-3.0))
  466. (define-public guile2.2-readline
  467. (make-guile-readline guile-2.2 "guile2.2-readline"))
  468. (define (guile-variant-package-name prefix)
  469. (lambda (name)
  470. "Return NAME with PREFIX instead of \"guile-\", when applicable."
  471. (if (string-prefix? "guile-" name)
  472. (string-append prefix "-"
  473. (string-drop name
  474. (string-length "guile-")))
  475. name)))
  476. (define package-for-guile-2.0
  477. ;; A procedure that rewrites the dependency tree of the given package to use
  478. ;; GUILE-2.0 instead of GUILE-3.0.
  479. (package-input-rewriting `((,guile-3.0 . ,guile-2.0))
  480. (guile-variant-package-name "guile2.0")
  481. #:deep? #f))
  482. (define package-for-guile-2.2
  483. (package-input-rewriting `((,guile-3.0 . ,guile-2.2))
  484. (guile-variant-package-name "guile2.2")
  485. #:deep? #f))
  486. (define-syntax define-deprecated-guile3.0-package
  487. (lambda (s)
  488. "Define a deprecated package alias for \"guile3.0-something\"."
  489. (syntax-case s ()
  490. ((_ name)
  491. (and (identifier? #'name)
  492. (string-prefix? "guile3.0-" (symbol->string (syntax->datum
  493. #'name))))
  494. (let ((->guile (lambda (str)
  495. (let ((base (string-drop str
  496. (string-length "guile3.0-"))))
  497. (string-append "guile-" base)))))
  498. (with-syntax ((package-name (symbol->string (syntax->datum #'name)))
  499. (package
  500. (datum->syntax
  501. #'name
  502. (string->symbol
  503. (->guile (symbol->string (syntax->datum
  504. #'name))))))
  505. (old-name
  506. ;; XXX: This is the name generated by
  507. ;; 'define-deprecated'.
  508. (datum->syntax
  509. #'name
  510. (symbol-append '% (syntax->datum #'name)
  511. '/deprecated))))
  512. #'(begin
  513. (define-deprecated name package
  514. (deprecated-package package-name package))
  515. (export old-name))))))))
  516. (define-deprecated-guile3.0-package guile3.0-readline)
  517. (define-public guile-for-guile-emacs
  518. (let ((commit "15ca78482ac0dd2e3eb36dcb31765d8652d7106d")
  519. (revision "1"))
  520. (package (inherit guile-2.2)
  521. (name "guile-for-guile-emacs")
  522. (version (git-version "2.1.2" revision commit))
  523. (source (origin
  524. (method git-fetch)
  525. (uri (git-reference
  526. (url "git://git.savannah.gnu.org/guile.git")
  527. (commit commit)))
  528. (file-name (git-file-name name version))
  529. (sha256
  530. (base32
  531. "1l7ik4q4zk7vq4m3gnwizc0b64b1mdr31hxqlzxs94xaf2lvi7s2"))))
  532. (arguments
  533. (substitute-keyword-arguments (package-arguments guile-2.2)
  534. ((#:phases phases '%standard-phases)
  535. `(modify-phases ,phases
  536. (replace 'bootstrap
  537. (lambda _
  538. ;; Disable broken tests.
  539. ;; TODO: Fix them!
  540. (substitute* "test-suite/tests/gc.test"
  541. (("\\(pass-if \"after-gc-hook gets called\"" m)
  542. (string-append "#;" m)))
  543. (substitute* "test-suite/tests/version.test"
  544. (("\\(pass-if \"version reporting works\"" m)
  545. (string-append "#;" m)))
  546. ;; Warning: Unwind-only `out-of-memory' exception; skipping pre-unwind handler.
  547. ;; FAIL: test-out-of-memory
  548. (substitute* "test-suite/standalone/Makefile.am"
  549. (("(check_SCRIPTS|TESTS) \\+= test-out-of-memory") ""))
  550. (patch-shebang "build-aux/git-version-gen")
  551. (invoke "sh" "autogen.sh")
  552. #t))))))
  553. (native-inputs
  554. (modify-inputs (package-native-inputs guile-2.2)
  555. (prepend autoconf
  556. automake
  557. libtool
  558. flex
  559. texinfo
  560. gettext-minimal))))))
  561. ;;;
  562. ;;; Extensions.
  563. ;;;
  564. (define-public guile-json-1
  565. (package
  566. (name "guile-json")
  567. (version "1.3.2")
  568. (home-page "https://github.com/aconchillo/guile-json")
  569. (source (origin
  570. (method url-fetch)
  571. (uri (string-append "mirror://savannah/guile-json/guile-json-"
  572. version ".tar.gz"))
  573. (sha256
  574. (base32
  575. "0m6yzb169r6iz56k3nkncjaiijwi4p0x9ijn1p5ax3s77jklxy9k"))))
  576. (build-system gnu-build-system)
  577. (arguments
  578. `(#:make-flags '("GUILE_AUTO_COMPILE=0"))) ;to prevent guild warnings
  579. (native-inputs (list pkg-config guile-2.2))
  580. (inputs (list guile-2.2))
  581. (synopsis "JSON module for Guile")
  582. (description
  583. "Guile-JSON supports parsing and building JSON documents according to the
  584. specification. These are the main features:
  585. @itemize
  586. @item Strictly complies to @uref{http://json.org, specification}.
  587. @item Build JSON documents programmatically via macros.
  588. @item Unicode support for strings.
  589. @item Allows JSON pretty printing.
  590. @end itemize\n")
  591. ;; Version 1.2.0 switched to GPLv3+ (from LGPLv3+).
  592. (license license:gpl3+)))
  593. ;; Deprecate the 'guile-json' alias to force the use 'guile-json-1' or
  594. ;; 'guile-json-3'. In the future, we may reuse 'guile-json' as an alias for
  595. ;; 'guile-json-3'.
  596. (define-deprecated guile-json guile-json-1)
  597. (export guile-json)
  598. (define-public guile2.0-json
  599. (package-for-guile-2.0 guile-json-1))
  600. (define-public guile-json-3
  601. ;; This version is incompatible with 1.x; see the 'NEWS' file.
  602. (package
  603. (inherit guile-json-1)
  604. (name "guile-json")
  605. (version "3.5.0")
  606. (source (origin
  607. (method url-fetch)
  608. (uri (string-append "mirror://savannah/guile-json/guile-json-"
  609. version ".tar.gz"))
  610. (sha256
  611. (base32
  612. "0nj0684qgh6ppkbdyxqfyjwsv2qbyairxpi8fzrhsi3xnc7jn4im"))))
  613. (native-inputs (list pkg-config guile-3.0))
  614. (inputs (list guile-3.0))))
  615. (define-public guile3.0-json
  616. (deprecated-package "guile3.0-json" guile-json-3))
  617. (define-public guile-json-4
  618. (package
  619. (inherit guile-json-3)
  620. (name "guile-json")
  621. (version "4.5.2")
  622. (source (origin
  623. (method url-fetch)
  624. (uri (string-append "mirror://savannah/guile-json/guile-json-"
  625. version ".tar.gz"))
  626. (sha256
  627. (base32
  628. "0cqr0ljqmzlc2bwrapcsmcgxg147h66mcxf23824ri5i6vn4dc0s"))))))
  629. (define-public guile2.2-json
  630. (package-for-guile-2.2 guile-json-4))
  631. ;; There are two guile-gdbm packages, one using the FFI and one with
  632. ;; direct C bindings, hence the verbose name.
  633. (define-public guile-gdbm-ffi
  634. (package
  635. (name "guile-gdbm-ffi")
  636. (version "20120209.fa1d5b6")
  637. (source (origin
  638. (method git-fetch)
  639. (uri (git-reference
  640. (url "https://github.com/ijp/guile-gdbm")
  641. (commit "fa1d5b6231d0e4d096687b378c025f2148c5f246")))
  642. (file-name (string-append name "-" version "-checkout"))
  643. (patches (search-patches
  644. "guile-gdbm-ffi-support-gdbm-1.14.patch"))
  645. (sha256
  646. (base32
  647. "1j8wrsw7v9w6qkl47xz0rdikg50v16nn6kbs3lgzcymjzpa7babj"))))
  648. (build-system guile-build-system)
  649. (arguments
  650. '(#:phases (modify-phases %standard-phases
  651. (add-after 'unpack 'move-examples
  652. (lambda* (#:key outputs #:allow-other-keys)
  653. ;; Move examples where they belong.
  654. (let* ((out (assoc-ref outputs "out"))
  655. (doc (string-append out "/share/doc/"
  656. (strip-store-file-name out)
  657. "/examples")))
  658. (copy-recursively "examples" doc)
  659. (delete-file-recursively "examples")
  660. #t)))
  661. (add-after 'unpack 'set-libgdbm-file-name
  662. (lambda* (#:key inputs #:allow-other-keys)
  663. (substitute* "gdbm.scm"
  664. (("\\(dynamic-link \"libgdbm\"\\)")
  665. (format #f "(dynamic-link \"~a/lib/libgdbm.so\")"
  666. (assoc-ref inputs "gdbm"))))
  667. #t)))))
  668. (native-inputs (list guile-3.0))
  669. (inputs (list gdbm))
  670. (home-page "https://github.com/ijp/guile-gdbm")
  671. (synopsis "Guile bindings to the GDBM library via Guile's FFI")
  672. (description
  673. "Guile bindings to the GDBM key-value storage system, using
  674. Guile's foreign function interface.")
  675. (license license:gpl3+)))
  676. (define-public guile2.0-gdbm-ffi
  677. (package-for-guile-2.0 guile-gdbm-ffi))
  678. (define-public guile2.2-gdbm-ffi
  679. (package-for-guile-2.2 guile-gdbm-ffi))
  680. (define-deprecated-guile3.0-package guile3.0-gdbm-ffi)
  681. (define-public guile-sqlite3
  682. (package
  683. (name "guile-sqlite3")
  684. (version "0.1.2")
  685. (home-page "https://notabug.org/guile-sqlite3/guile-sqlite3.git")
  686. (source (origin
  687. (method git-fetch)
  688. (uri (git-reference
  689. (url home-page)
  690. (commit (string-append "v" version))))
  691. (sha256
  692. (base32
  693. "1nryy9j3bk34i0alkmc9bmqsm0ayz92k1cdf752mvhyjjn8nr928"))
  694. (file-name (string-append name "-" version "-checkout"))))
  695. (build-system gnu-build-system)
  696. (native-inputs (list autoconf automake guile-3.0 pkg-config))
  697. (inputs (list guile-3.0 sqlite))
  698. (synopsis "Access SQLite databases from Guile")
  699. (description
  700. "This package provides Guile bindings to the SQLite database system.")
  701. (license license:gpl3+)))
  702. (define-public guile2.0-sqlite3
  703. (package-for-guile-2.0 guile-sqlite3))
  704. (define-public guile2.2-sqlite3
  705. (package-for-guile-2.2 guile-sqlite3))
  706. (define-deprecated-guile3.0-package guile3.0-sqlite3)
  707. (define-public guile-bytestructures
  708. (package
  709. (name "guile-bytestructures")
  710. (version "1.0.10")
  711. (home-page "https://github.com/TaylanUB/scheme-bytestructures")
  712. (source (origin
  713. (method git-fetch)
  714. (uri (git-reference
  715. (url home-page)
  716. (commit version)))
  717. (file-name (git-file-name name version))
  718. (sha256
  719. (base32
  720. "14k50jln32kkxv41hvsdgjkkfj6xlv06vc1caz01qkgk1fzh72nk"))))
  721. (build-system gnu-build-system)
  722. (arguments
  723. `(#:make-flags '("GUILE_AUTO_COMPILE=0") ;to prevent guild warnings
  724. #:phases (modify-phases %standard-phases
  725. (add-after 'install 'install-doc
  726. (lambda* (#:key outputs #:allow-other-keys)
  727. (let* ((out (assoc-ref outputs "out"))
  728. (package ,(package-full-name this-package "-"))
  729. (doc (string-append out "/share/doc/" package)))
  730. (install-file "README.md" doc)
  731. #t))))))
  732. (native-inputs (list autoconf automake pkg-config guile-3.0))
  733. (inputs (list guile-3.0))
  734. (synopsis "Structured access to bytevector contents for Guile")
  735. (description
  736. "Guile bytestructures offers a system imitating the type system
  737. of the C programming language, to be used on bytevectors. C's type
  738. system works on raw memory, and Guile works on bytevectors which are
  739. an abstraction over raw memory. It's also more powerful than the C
  740. type system, elevating types to first-class status.")
  741. (license license:gpl3+)
  742. (properties '((upstream-name . "bytestructures")))))
  743. (define-public guile2.0-bytestructures
  744. (package-for-guile-2.0 guile-bytestructures))
  745. (define-public guile2.2-bytestructures
  746. (package-for-guile-2.2 guile-bytestructures))
  747. (define-deprecated-guile3.0-package guile3.0-bytestructures)
  748. (define-public guile-git
  749. (package
  750. (name "guile-git")
  751. (version "0.5.2")
  752. (home-page "https://gitlab.com/guile-git/guile-git.git")
  753. (source (origin
  754. (method git-fetch)
  755. (uri (git-reference
  756. (url home-page)
  757. (commit (string-append "v" version))))
  758. (file-name (git-file-name name version))
  759. (sha256
  760. (base32
  761. "11a51acibwi2hpaygmrpn6nwbr4lqalc87ihrgj3mhz6swbsk9n7"))))
  762. (build-system gnu-build-system)
  763. (arguments
  764. `(#:make-flags '("GUILE_AUTO_COMPILE=0"))) ; to prevent guild warnings
  765. (native-inputs
  766. (list pkg-config autoconf automake texinfo guile-3.0 guile-bytestructures))
  767. (inputs
  768. (list guile-3.0 libgit2))
  769. (propagated-inputs
  770. (list guile-bytestructures))
  771. (synopsis "Guile bindings for libgit2")
  772. (description
  773. "This package provides Guile bindings to libgit2, a library to
  774. manipulate repositories of the Git version control system.")
  775. (license license:gpl3+)))
  776. (define-public guile2.2-git
  777. (package-for-guile-2.2 guile-git))
  778. (define-public guile2.0-git
  779. (package-for-guile-2.0 guile-git))
  780. (define-deprecated-guile3.0-package guile3.0-git)
  781. (define-public guile-zlib
  782. (package
  783. (name "guile-zlib")
  784. (version "0.1.0")
  785. (source
  786. (origin
  787. ;; XXX: Do not use "git-fetch" method here that would create and
  788. ;; endless inclusion loop, because this package is used as an extension
  789. ;; in the same method.
  790. (method url-fetch)
  791. (uri
  792. (string-append "https://notabug.org/guile-zlib/guile-zlib/archive/v"
  793. version ".tar.gz"))
  794. (file-name (string-append name "-" version ".tar.gz"))
  795. (sha256
  796. ;; content hash: 1ip18nzwnczqyhn9cpzxkm9vzpi5fz5sy96cgjhmp7cwhnkmv6zv
  797. (base32
  798. "1safz7rrbdf1d98x3lgx5v74kivpyf9n1v6pdyy22vd0f2sjdir5"))))
  799. (build-system gnu-build-system)
  800. (arguments
  801. '(#:make-flags
  802. '("GUILE_AUTO_COMPILE=0"))) ;to prevent guild warnings
  803. (native-inputs (list autoconf automake pkg-config guile-3.0))
  804. (inputs (list guile-3.0 zlib))
  805. (synopsis "Guile bindings to zlib")
  806. (description
  807. "This package provides Guile bindings for zlib, a lossless
  808. data-compression library. The bindings are written in pure Scheme by using
  809. Guile's foreign function interface.")
  810. (home-page "https://notabug.org/guile-zlib/guile-zlib")
  811. (license license:gpl3+)))
  812. (define-public guile2.2-zlib
  813. (package-for-guile-2.2 guile-zlib))
  814. (define-public guile-lzlib
  815. (package
  816. (name "guile-lzlib")
  817. (version "0.0.2")
  818. (source
  819. (origin
  820. (method url-fetch)
  821. (uri
  822. (string-append "https://notabug.org/guile-lzlib/guile-lzlib/archive/"
  823. version ".tar.gz"))
  824. (file-name (string-append name "-" version ".tar.gz"))
  825. (sha256
  826. (base32
  827. "11sggvncyx08ssp1s5xii4d6nskh1qwqihnbpzzvkrs7sivxn8w6"))))
  828. (build-system gnu-build-system)
  829. (arguments
  830. '(#:make-flags
  831. '("GUILE_AUTO_COMPILE=0"))) ;to prevent guild warnings
  832. (native-inputs (list autoconf automake pkg-config guile-3.0))
  833. (inputs (list guile-3.0 lzlib))
  834. (synopsis "Guile bindings to lzlib")
  835. (description
  836. "This package provides Guile bindings for lzlib, a C library for
  837. in-memory LZMA compression and decompression. The bindings are written in
  838. pure Scheme by using Guile's foreign function interface.")
  839. (home-page "https://notabug.org/guile-lzlib/guile-lzlib")
  840. (license license:gpl3+)))
  841. (define-public guile2.2-lzlib
  842. (package-for-guile-2.2 guile-lzlib))
  843. (define-public guile-zstd
  844. (package
  845. (name "guile-zstd")
  846. (version "0.1.1")
  847. (home-page "https://notabug.org/guile-zstd/guile-zstd")
  848. (source (origin
  849. (method git-fetch)
  850. (uri (git-reference (url home-page)
  851. (commit (string-append "v" version))))
  852. (file-name (git-file-name name version))
  853. (sha256
  854. (base32
  855. "1c8l7829b5yx8wdc0mrhzjfwb6h9hb7cd8dfxcr71a7vlsi86310"))))
  856. (build-system gnu-build-system)
  857. (native-inputs (list autoconf automake pkg-config guile-3.0))
  858. (inputs (list `(,zstd "lib") guile-3.0))
  859. (synopsis "GNU Guile bindings to the zstd compression library")
  860. (description
  861. "This package provides a GNU Guile interface to the zstd (``zstandard'')
  862. compression library.")
  863. (license license:gpl3+)))
  864. ;;; guile.scm ends here