gnu: emacs-consult: Fix grammar.
[jackhill/guix/guix.git] / gnu / packages / noweb.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2020 Tobias Geerinckx-Rice <me@tobias.gr>
4 ;;;
5 ;;; This file is part of GNU Guix.
6 ;;;
7 ;;; GNU Guix is free software; you can redistribute it and/or modify it
8 ;;; under the terms of the GNU General Public License as published by
9 ;;; the Free Software Foundation; either version 3 of the License, or (at
10 ;;; your option) any later version.
11 ;;;
12 ;;; GNU Guix is distributed in the hope that it will be useful, but
13 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;;; GNU General Public License for more details.
16 ;;;
17 ;;; You should have received a copy of the GNU General Public License
18 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
19
20 (define-module (gnu packages noweb)
21 #:use-module (guix packages)
22 #:use-module (guix git-download)
23 #:use-module (guix build-system gnu)
24 #:use-module (guix licenses)
25 #:use-module (gnu packages perl))
26
27 (define-public noweb
28 (package
29 (name "noweb")
30 (version "2.12")
31 (source
32 (origin
33 (method git-fetch)
34 (uri (git-reference
35 (url "https://github.com/nrnrnr/noweb")
36 (commit (string-append "v" (string-join (string-split version #\.)
37 "_")))))
38 (file-name (git-file-name name version))
39 (sha256
40 (base32 "1160i2ghgzqvnb44kgwd6s3p4jnk9668rmc15jlcwl7pdf3xqm95"))))
41 (build-system gnu-build-system)
42 (arguments
43 '(#:phases
44 (modify-phases %standard-phases
45 (add-after 'unpack 'bind-early
46 (lambda* (#:key outputs #:allow-other-keys)
47 (let* ((out (assoc-ref outputs "out"))
48 (bin (string-append out "/bin")))
49 (substitute* (list "src/lib/nwmtime"
50 "src/shell/htmltoc")
51 (("exec perl ")
52 (format #f "exec ~a " (which "perl"))))
53 (substitute* "src/shell/noweb"
54 ((" cpif ")
55 (format #f " ~a/cpif " bin)))
56 #t)))
57 (add-before 'install 'pre-install
58 (lambda* (#:key outputs #:allow-other-keys)
59 (let ((out (assoc-ref outputs "out")))
60 (mkdir-p (string-append out "/share/texmf/tex/latex"))
61 #t)))
62 (add-after 'install 'post-install
63 (lambda* (#:key outputs inputs #:allow-other-keys)
64 (let ((out (assoc-ref outputs "out"))
65 (cu (assoc-ref inputs "coreutils"))
66 (du (assoc-ref inputs "diffutils")))
67 (with-directory-excursion out
68 (for-each (lambda (prog)
69 (substitute* prog
70 (("nawk") (which "awk"))))
71 (append (map (lambda (x)
72 (string-append "bin/" x))
73 '("noweb" "nountangle"
74 "noroots" "noroff"
75 "noindex"))
76 (map (lambda (x)
77 (string-append "lib/" x))
78 '("btdefn" "emptydefn" "noidx"
79 "pipedocs" "toascii" "tohtml"
80 "toroff" "totex" "unmarkup"))))
81 (substitute* "bin/cpif"
82 (("^PATH=.*$")
83 (string-append "PATH=" cu "/bin:" du "/bin\n"))))
84 #t)))
85 (replace 'configure
86 (lambda _
87 ;; Jump in the source.
88 (chdir "src")
89 #t)))
90 #:make-flags (let ((out (assoc-ref %outputs "out")))
91 (list (string-append "BIN=" out "/bin")
92 (string-append "LIB=" out "/lib")
93 (string-append "MAN=" out "/share/man")
94 (string-append "TEXINPUTS=" out
95 "/share/texmf/tex/latex")))
96 #:tests? #f)) ; no tests
97 (inputs
98 `(("perl" ,perl)))
99 (home-page "https://www.cs.tufts.edu/~nr/noweb/")
100 (synopsis "Literate programming tool")
101 (description
102 "Noweb is designed to meet the needs of literate programmers while
103 remaining as simple as possible. Its primary advantages are simplicity,
104 extensibility, and language-independence—especially noticeable when compared
105 with other literate-programming tools. noweb uses 5 control sequences to
106 WEB's 27. The noweb manual is only 4 pages; an additional page explains how
107 to customize its LaTeX output. noweb works “out of the box” with any
108 programming language, and supports TeX, LaTeX, HTML, and troff back ends.")
109 (license
110 (list bsd-2 ; dual-licenced under this and…
111 (fsf-free "https://www.cs.tufts.edu/~nr/noweb/#copyright")))))