guile.scm 39 KB

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