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