zile.scm 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2012, 2013, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
  3. ;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org>
  4. ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
  5. ;;; Copyright © 2018, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
  6. ;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
  7. ;;; Copyright © 2021 Matthew James Kraai <kraai@ftbfs.org>
  8. ;;;
  9. ;;; This file is part of GNU Guix.
  10. ;;;
  11. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  12. ;;; under the terms of the GNU General Public License as published by
  13. ;;; the Free Software Foundation; either version 3 of the License, or (at
  14. ;;; your option) any later version.
  15. ;;;
  16. ;;; GNU Guix is distributed in the hope that it will be useful, but
  17. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  18. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. ;;; GNU General Public License for more details.
  20. ;;;
  21. ;;; You should have received a copy of the GNU General Public License
  22. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  23. (define-module (gnu packages zile)
  24. #:use-module (guix licenses)
  25. #:use-module (guix download)
  26. #:use-module (guix git-download)
  27. #:use-module (guix packages)
  28. #:use-module (guix utils)
  29. #:use-module (guix build-system gnu)
  30. #:use-module (gnu packages autotools)
  31. #:use-module (gnu packages bash)
  32. #:use-module (gnu packages bdw-gc)
  33. #:use-module (gnu packages glib)
  34. #:use-module (gnu packages guile)
  35. #:use-module (gnu packages gnome)
  36. #:use-module (gnu packages gnupg)
  37. #:use-module (gnu packages m4)
  38. #:use-module (gnu packages man)
  39. #:use-module (gnu packages ncurses)
  40. #:use-module (gnu packages perl)
  41. #:use-module (gnu packages pkg-config)
  42. #:use-module (gnu packages version-control))
  43. (define-public zile
  44. (package
  45. (name "zile")
  46. (version "2.6.2")
  47. (source (origin
  48. (method url-fetch)
  49. (uri (string-append "mirror://gnu/zile/zile-"
  50. version ".tar.gz"))
  51. (sha256
  52. (base32
  53. "0hf788zadmwx0xp1dhrgqcfvhwnarh6h9b51va4dr2y9yfppvsvp"))))
  54. (build-system gnu-build-system)
  55. (arguments
  56. `(#:phases
  57. (modify-phases %standard-phases
  58. (add-before 'configure 'patch-/bin/sh
  59. (lambda* (#:key inputs #:allow-other-keys)
  60. (let ((bash (assoc-ref inputs "bash")))
  61. ;; Refer to the actual shell.
  62. (substitute* '("src/shell.c")
  63. (("/bin/sh")
  64. (string-append bash "/bin/sh")))
  65. #t)))
  66. ;; Zile generates its manual pages by calling the built Zile
  67. ;; with the --help argument. That does not work when cross-
  68. ;; compiling; use the native Zile added below in that case.
  69. ,@(if (%current-target-system)
  70. '((add-before 'build 'use-native-zile-for-documentation
  71. (lambda _
  72. (substitute* "build-aux/zile-help2man-wrapper"
  73. (("src/zile")
  74. (which "zile")))
  75. #t)))
  76. '()))))
  77. (inputs
  78. `(("boehm-gc" ,libgc)
  79. ("ncurses" ,ncurses)
  80. ("bash" ,bash)
  81. ("gee" ,libgee)
  82. ("glib" ,glib)))
  83. (native-inputs
  84. `(("perl" ,perl)
  85. ("help2man" ,help2man)
  86. ;; When cross-compiling, Zile needs a native version of itself to
  87. ;; generate the manual pages (see the related phase above).
  88. ,@(if (%current-target-system)
  89. `(("self" ,this-package))
  90. '())
  91. ("pkg-config" ,pkg-config)))
  92. (home-page "https://www.gnu.org/software/zile/")
  93. (synopsis "Lightweight Emacs clone")
  94. (description
  95. "GNU Zile is a lightweight Emacs clone. It usage is similar to the
  96. default Emacs configuration, but it carries a much lighter feature set.")
  97. (license gpl3+)))
  98. (define-public zile-on-guile
  99. ;; This is a fork of Zile that uses Guile, announced here:
  100. ;; <http://lists.gnu.org/archive/html/guile-user/2012-02/msg00033.html>.
  101. (let ((commit "fd097811a60e58696d734c35b0eb7da3afc1adb7")
  102. (revision "0"))
  103. (package
  104. (inherit zile)
  105. (name "zile-on-guile")
  106. (version (string-append (package-version zile)
  107. "-" revision "."
  108. (string-take commit 7)))
  109. (home-page "https://github.com/spk121/zile")
  110. (source (origin
  111. (method git-fetch)
  112. (uri (git-reference
  113. (url home-page)
  114. (commit commit)
  115. (recursive? #t))) ;for the Gnulib sub-module
  116. (sha256
  117. (base32
  118. "0wlli8hqal9ikmbl3a49kyhzyf164jk6mdbir3bclq2gxszs532d"))
  119. (file-name (string-append name "-" version "-checkout"))))
  120. (inputs
  121. `(("guile" ,guile-2.0)
  122. ,@(package-inputs zile)))
  123. (native-inputs
  124. `(("m4" ,m4) ;for 'bootstrap'
  125. ("autoconf" ,autoconf)
  126. ("automake" ,automake)
  127. ;; For some reason, 'bootstrap' insists on having these.
  128. ("git" ,git)
  129. ("gpg" ,gnupg)
  130. ,@(package-native-inputs zile)))
  131. (arguments
  132. (substitute-keyword-arguments (package-arguments zile)
  133. ((#:phases phases)
  134. `(modify-phases ,phases
  135. (replace 'bootstrap
  136. (lambda _
  137. ;; Make sure all the files are writable so that ./bootstrap
  138. ;; can proceed.
  139. (for-each (lambda (file)
  140. (chmod file #o755))
  141. (find-files "."))
  142. (patch-shebang "gnulib/gnulib-tool")
  143. (invoke "sh" "./bootstrap"
  144. "--gnulib-srcdir=gnulib"
  145. "--skip-git" "--skip-po"
  146. "--verbose")))
  147. (replace 'patch-/bin/sh
  148. (lambda* (#:key inputs #:allow-other-keys)
  149. (let ((bash (assoc-ref inputs "bash")))
  150. ;; Refer to the actual shell.
  151. (substitute* '("lib/spawni.c" "src/funcs.c")
  152. (("/bin/sh")
  153. (string-append bash "/bin/sh")))
  154. #t)))
  155. (add-after 'install 'wrap-command
  156. (lambda* (#:key outputs #:allow-other-keys)
  157. ;; Add zile.scm to the search path.
  158. (let* ((out (assoc-ref outputs "out"))
  159. (scheme (dirname
  160. (car (find-files out "^zile\\.scm$")))))
  161. (wrap-program (string-append out "/bin/zile-on-guile")
  162. `("GUILE_LOAD_PATH" ":" prefix (,scheme)))
  163. #t)))))))
  164. (synopsis "Lightweight clone of the Emacs editor using Guile")
  165. (description
  166. "GNU Zile is a lightweight clone of the Emacs editor, and Zile-on-Guile
  167. is a variant of Zile that can be extended in Guile Scheme. Hitting
  168. @kbd{M-C} (or: @kbd{Alt} and @kbd{C}) brings up a Guile REPL from which
  169. interactive functions akin to those of Emacs can be invoked."))))