gnu: zile: Update to 2.6.2.
[jackhill/guix/guix.git] / gnu / packages / zile.scm
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
24 (define-module (gnu packages zile)
25 #:use-module (guix licenses)
26 #:use-module (guix download)
27 #:use-module (guix git-download)
28 #:use-module (guix packages)
29 #:use-module (guix utils)
30 #:use-module (guix build-system gnu)
31 #:use-module (gnu packages autotools)
32 #:use-module (gnu packages bash)
33 #:use-module (gnu packages bdw-gc)
34 #:use-module (gnu packages glib)
35 #:use-module (gnu packages guile)
36 #:use-module (gnu packages gnome)
37 #:use-module (gnu packages gnupg)
38 #:use-module (gnu packages m4)
39 #:use-module (gnu packages man)
40 #:use-module (gnu packages ncurses)
41 #:use-module (gnu packages perl)
42 #:use-module (gnu packages pkg-config)
43 #:use-module (gnu packages version-control))
44
45 (define-public zile
46 (package
47 (name "zile")
48 (version "2.6.2")
49 (source (origin
50 (method url-fetch)
51 (uri (string-append "mirror://gnu/zile/zile-"
52 version ".tar.gz"))
53 (sha256
54 (base32
55 "0hf788zadmwx0xp1dhrgqcfvhwnarh6h9b51va4dr2y9yfppvsvp"))))
56 (build-system gnu-build-system)
57 (arguments
58 `(#:phases
59 (modify-phases %standard-phases
60 (add-before 'configure 'patch-/bin/sh
61 (lambda* (#:key inputs #:allow-other-keys)
62 (let ((bash (assoc-ref inputs "bash")))
63 ;; Refer to the actual shell.
64 (substitute* '("src/shell.c")
65 (("/bin/sh")
66 (string-append bash "/bin/sh")))
67 #t)))
68 ;; Zile generates its manual pages by calling the built Zile
69 ;; with the --help argument. That does not work when cross-
70 ;; compiling; use the native Zile added below in that case.
71 ,@(if (%current-target-system)
72 '((add-before 'build 'use-native-zile-for-documentation
73 (lambda _
74 (substitute* "build-aux/zile-help2man-wrapper"
75 (("src/zile")
76 (which "zile")))
77 #t)))
78 '()))))
79 (inputs
80 `(("boehm-gc" ,libgc)
81 ("ncurses" ,ncurses)
82 ("bash" ,bash)
83 ("gee" ,libgee)
84 ("glib" ,glib)))
85 (native-inputs
86 `(("perl" ,perl)
87 ("help2man" ,help2man)
88 ;; When cross-compiling, Zile needs a native version of itself to
89 ;; generate the manual pages (see the related phase above).
90 ,@(if (%current-target-system)
91 `(("self" ,this-package))
92 '())
93 ("pkg-config" ,pkg-config)))
94 (home-page "https://www.gnu.org/software/zile/")
95 (synopsis "Lightweight Emacs clone")
96 (description
97 "GNU Zile is a lightweight Emacs clone. It usage is similar to the
98 default Emacs configuration, but it carries a much lighter feature set.")
99 (license gpl3+)))
100
101 (define-public zile-on-guile
102 ;; This is a fork of Zile that uses Guile, announced here:
103 ;; <http://lists.gnu.org/archive/html/guile-user/2012-02/msg00033.html>.
104 (let ((commit "fd097811a60e58696d734c35b0eb7da3afc1adb7")
105 (revision "0"))
106 (package
107 (inherit zile)
108 (name "zile-on-guile")
109 (version (string-append (package-version zile)
110 "-" revision "."
111 (string-take commit 7)))
112 (home-page "https://github.com/spk121/zile")
113 (source (origin
114 (method git-fetch)
115 (uri (git-reference
116 (url home-page)
117 (commit commit)
118 (recursive? #t))) ;for the Gnulib sub-module
119 (sha256
120 (base32
121 "0wlli8hqal9ikmbl3a49kyhzyf164jk6mdbir3bclq2gxszs532d"))
122 (file-name (string-append name "-" version "-checkout"))))
123 (inputs
124 `(("guile" ,guile-2.0)
125 ,@(package-inputs zile)))
126 (native-inputs
127 `(("m4" ,m4) ;for 'bootstrap'
128 ("autoconf" ,autoconf)
129 ("automake" ,automake)
130
131 ;; For some reason, 'bootstrap' insists on having these.
132 ("git" ,git)
133 ("gpg" ,gnupg)
134
135 ,@(package-native-inputs zile)))
136 (arguments
137 (substitute-keyword-arguments (package-arguments zile)
138 ((#:phases phases)
139 `(modify-phases ,phases
140 (replace 'bootstrap
141 (lambda _
142 ;; Make sure all the files are writable so that ./bootstrap
143 ;; can proceed.
144 (for-each (lambda (file)
145 (chmod file #o755))
146 (find-files "."))
147 (patch-shebang "gnulib/gnulib-tool")
148 (invoke "sh" "./bootstrap"
149 "--gnulib-srcdir=gnulib"
150 "--skip-git" "--skip-po"
151 "--verbose")))
152 (add-after 'install 'wrap-command
153 (lambda* (#:key outputs #:allow-other-keys)
154 ;; Add zile.scm to the search path.
155 (let* ((out (assoc-ref outputs "out"))
156 (scheme (dirname
157 (car (find-files out "^zile\\.scm$")))))
158 (wrap-program (string-append out "/bin/zile-on-guile")
159 `("GUILE_LOAD_PATH" ":" prefix (,scheme)))
160 #t)))))))
161 (synopsis "Lightweight clone of the Emacs editor using Guile")
162 (description
163 "GNU Zile is a lightweight clone of the Emacs editor, and Zile-on-Guile
164 is a variant of Zile that can be extended in Guile Scheme. Hitting
165 @kbd{M-C} (or: @kbd{Alt} and @kbd{C}) brings up a Guile REPL from which
166 interactive functions akin to those of Emacs can be invoked."))))