From 75922458af60081bf6964006d5b9c180ff9ec8ca Mon Sep 17 00:00:00 2001 From: "Paul A. Patience" Date: Sat, 10 Jul 2021 20:23:49 -0400 Subject: gnu: txr: Build documentation. * gnu/packages/lisp.scm (man-for-txr): New variable. (txr)[native-inputs]: New field. [inputs]: Move above the arguments field. [arguments]<#:phases>{inhibit-doc-syms-generation, build-doc, install-doc}: New phases. {fix-tests}: Add after the unpack phase rather than after the configure phase so that all file-modifying phases are performed after unpacking. Signed-off-by: Guillaume Le Vaillant --- gnu/packages/lisp.scm | 96 +++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 90 insertions(+), 6 deletions(-) (limited to 'gnu/packages/lisp.scm') diff --git a/gnu/packages/lisp.scm b/gnu/packages/lisp.scm index 382f48beb1..e6d09ce353 100644 --- a/gnu/packages/lisp.scm +++ b/gnu/packages/lisp.scm @@ -18,6 +18,7 @@ ;;; Copyright © 2020 Marius Bakke ;;; Copyright © 2020 Zhu Zihao ;;; Copyright © 2021 Sharlatan Hellseher +;;; Copyright © 2021 Paul A. Patience ;;; ;;; This file is part of GNU Guix. ;;; @@ -59,8 +60,10 @@ #:use-module (gnu packages fontutils) #:use-module (gnu packages gcc) #:use-module (gnu packages gettext) + #:use-module (gnu packages ghostscript) #:use-module (gnu packages gl) #:use-module (gnu packages glib) + #:use-module (gnu packages groff) #:use-module (gnu packages m4) #:use-module (gnu packages maths) #:use-module (gnu packages multiprecision) @@ -846,6 +849,60 @@ enough to play the original mainframe Zork all the way through.") (home-page "http://www.russotto.net/git/mrussotto/confusion/src/master/src/README") (license license:gpl3+)))) +(define man-for-txr + (let ((commit "dfbf19b9a96474b8c1bacac85e43605e5691ceb2") + ;; Number of additional commits since the last tag (see the output of + ;; "git describe --tags"). + (revision "41")) + (package + (name "man-for-txr") + (version (git-version "1.6g" revision commit)) + (source + (origin + (method git-fetch) + (uri (git-reference + (url "http://www.kylheku.com/git/man/") + (commit commit))) + (file-name (git-file-name name version)) + (sha256 + (base32 "1zy0g8fj9nsfwzvg88hyaiy94r8j14xhs8vy2ln2niqdm6x2lvy2")))) + (build-system gnu-build-system) + (arguments + `(#:tests? #f ; There are no tests. + #:phases + (modify-phases %standard-phases + (add-after 'unpack 'fix-man2html-makefile + (lambda _ + (substitute* "man2html/Makefile.in" + ;; It inadvertently ignores @bindir@. + (("^(bindir = \\$\\(DESTDIR\\)\\$\\(PREFIX\\)).*" _ prefix) + (string-append prefix "@bindir@\n"))) + #t)) + (add-after 'unpack 'delete-generated-files + (lambda _ + (for-each delete-file + (append + (list "conf_script") + (map (lambda (d) (string-append d "/Makefile")) + '("." "man" "man2html" "src")) + (map (lambda (f) (string-append "src/" f)) + '("makewhatis.in" "man.conf" + "paths.h" "version.h")))) + #t)) + (replace 'configure + (lambda* (#:key outputs #:allow-other-keys) + (setenv "CC" ,(cc-for-target)) + ;; Humor the manually written configure script. + (invoke "./configure" "+lang" "en" "+fhs" + (string-append "-prefix=" (assoc-ref outputs "out"))) + #t))))) + (home-page "http://www.kylheku.com/cgit/man/") + (synopsis "Modifications to the man utilities, specifically man2html") + (description + "This is a fork of the man utilities intended specifically for building +the HTML documentation of TXR.") + (license license:gpl2)))) + (define-public txr (package (name "txr") @@ -860,6 +917,13 @@ enough to play the original mainframe Zork all the way through.") (sha256 (base32 "14zaziymnbr2ld79x4h7sf88bzzzj82w3xpavmcx7mhwannb2swh")))) (build-system gnu-build-system) + (native-inputs + ;; Required to build the documentation. + `(("ghostscript" ,ghostscript) + ("groff" ,groff) + ("man2html" ,man-for-txr))) + (inputs + `(("libffi" ,libffi))) (arguments `(#:configure-flags (list ,(string-append "cc=" (cc-for-target)) @@ -867,6 +931,22 @@ enough to play the original mainframe Zork all the way through.") #:test-target "tests" #:phases (modify-phases %standard-phases + (add-after 'unpack 'inhibit-doc-syms-generation + (lambda _ + (substitute* "genman.txr" + ;; Exit from genman.txr before it tries to write to + ;; stdlib/doc-syms.tl, which is anyway kept up to date with + ;; each release (and is already compiled to stdlib/doc-syms.tlo + ;; when genman.txr is run). + (("^@\\(output \"share/txr/stdlib/doc-syms\\.tl\"\\).*" line) + (string-append "@(do (exit))\n" line))) + #t)) + (add-after 'unpack 'fix-tests + (lambda _ + (substitute* (list "tests/017/realpath.tl" + "tests/017/realpath.expected") + (("/usr/bin") "/")) + #t)) (replace 'configure ;; ./configure is a hand-written script that can't handle standard ;; autotools arguments like CONFIG_SHELL. @@ -874,14 +954,18 @@ enough to play the original mainframe Zork all the way through.") (setenv "txr_shell" (which "bash")) (apply invoke "./configure" configure-flags) #t)) - (add-after 'configure 'fix-tests + (add-after 'build 'build-doc (lambda _ - (substitute* (list "tests/017/realpath.tl" - "tests/017/realpath.expected") - (("/usr/bin") "/")) + (setenv "GS_GENERATE_UUIDS" "0") + (invoke "make" "txr-manpage.html" "txr-manpage.pdf") + #t)) + (add-after 'install 'install-doc + (lambda* (#:key outputs #:allow-other-keys) + (let ((doc (string-append (assoc-ref outputs "out") + "/share/doc/" ,name "-" ,version))) + (for-each (lambda (f) (install-file f doc)) + '("txr-manpage.html" "txr-manpage.pdf"))) #t))))) - (inputs - `(("libffi" ,libffi))) (synopsis "General-purpose, multi-paradigm programming language") (description "TXR is a general-purpose, multi-paradigm programming language. It -- cgit v1.2.3 From 6a0658afa7388f2b9f55a2ef437ae0c2776e19b8 Mon Sep 17 00:00:00 2001 From: "Paul A. Patience" Date: Sat, 17 Jul 2021 23:19:31 -0400 Subject: gnu: txr: Fix license installation. The install-license-files phase was installing LICENSE-CYG when it shouldn't have, because that license applies only to TXR builds for Microsoft Windows; and it was also ignoring the METALICENSE file. However, TXR's Makefile was already installing the LICENSE and METALICENSE files into share/txr (the datadir), so redirect them into the appropriate doc directory and delete the install-license-files phase. * gnu/packages/lisp.scm (txr)[arguments]<#:phases> {fix-license-installation}: New phase. {install-license-files}: Delete phase. Signed-off-by: Guillaume Le Vaillant --- gnu/packages/lisp.scm | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'gnu/packages/lisp.scm') diff --git a/gnu/packages/lisp.scm b/gnu/packages/lisp.scm index e6d09ce353..dbeeb5cd60 100644 --- a/gnu/packages/lisp.scm +++ b/gnu/packages/lisp.scm @@ -931,6 +931,15 @@ the HTML documentation of TXR.") #:test-target "tests" #:phases (modify-phases %standard-phases + (add-after 'unpack 'fix-license-installation + (lambda* (#:key outputs #:allow-other-keys) + (substitute* "Makefile" + (("INSTALL(,.*LICENSE,.*)\\$\\(datadir\\)" _ match) + (string-append "INSTALL" match + (assoc-ref outputs "out") + "/share/doc/" ,name "-" ,version))) + #t)) + (delete 'install-license-files) (add-after 'unpack 'inhibit-doc-syms-generation (lambda _ (substitute* "genman.txr" -- cgit v1.2.3 From 59d09bfb2b69bb7e13815f5d1c1734d2db3d63d5 Mon Sep 17 00:00:00 2001 From: "Paul A. Patience" Date: Tue, 13 Jul 2021 19:38:12 -0400 Subject: gnu: txr: Update to 266. * gnu/packages/lisp.scm (txr)[version]: Update to 266. [inputs]: Add bash. [arguments]<#:phases>{inhibit-doc-syms-generation}: Correct the path to doc-syms.tl to its new location. {fix-tests}: Fix another test. {fix-paths}: New phase. Co-authored-by: Guillaume Le Vaillant --- gnu/packages/lisp.scm | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'gnu/packages/lisp.scm') diff --git a/gnu/packages/lisp.scm b/gnu/packages/lisp.scm index dbeeb5cd60..d8d7a7394c 100644 --- a/gnu/packages/lisp.scm +++ b/gnu/packages/lisp.scm @@ -54,6 +54,7 @@ #:use-module (guix build-system trivial) #:use-module (gnu packages admin) #:use-module (gnu packages base) + #:use-module (gnu packages bash) #:use-module (gnu packages bdw-gc) #:use-module (gnu packages compression) #:use-module (gnu packages ed) @@ -906,7 +907,7 @@ the HTML documentation of TXR.") (define-public txr (package (name "txr") - (version "263") + (version "266") (source (origin (method git-fetch) @@ -915,7 +916,7 @@ the HTML documentation of TXR.") (commit (string-append "txr-" version)))) (file-name (git-file-name name version)) (sha256 - (base32 "14zaziymnbr2ld79x4h7sf88bzzzj82w3xpavmcx7mhwannb2swh")))) + (base32 "1k9mj3zaxdsylgnb8g6cq0cmp6420x7fp3nnsqdmds4gh8ib95wn")))) (build-system gnu-build-system) (native-inputs ;; Required to build the documentation. @@ -923,7 +924,8 @@ the HTML documentation of TXR.") ("groff" ,groff) ("man2html" ,man-for-txr))) (inputs - `(("libffi" ,libffi))) + `(("bash" ,bash) + ("libffi" ,libffi))) (arguments `(#:configure-flags (list ,(string-append "cc=" (cc-for-target)) @@ -947,14 +949,21 @@ the HTML documentation of TXR.") ;; stdlib/doc-syms.tl, which is anyway kept up to date with ;; each release (and is already compiled to stdlib/doc-syms.tlo ;; when genman.txr is run). - (("^@\\(output \"share/txr/stdlib/doc-syms\\.tl\"\\).*" line) + (("^@\\(output \"stdlib/doc-syms\\.tl\"\\).*" line) (string-append "@(do (exit))\n" line))) #t)) + (add-after 'unpack 'fix-paths + (lambda* (#:key inputs #:allow-other-keys) + (substitute* "stream.c" + (("/bin/sh") + (string-append (assoc-ref inputs "bash") "/bin/bash"))))) (add-after 'unpack 'fix-tests (lambda _ (substitute* (list "tests/017/realpath.tl" "tests/017/realpath.expected") (("/usr/bin") "/")) + (substitute* "tests/018/path-test.tl" + (("/bin") (dirname (which "sh")))) #t)) (replace 'configure ;; ./configure is a hand-written script that can't handle standard -- cgit v1.2.3 From ce27cde2629d54eeb135e0e4754f3ab35a0fddaf Mon Sep 17 00:00:00 2001 From: Guillaume Le Vaillant Date: Wed, 21 Jul 2021 10:57:27 +0200 Subject: gnu: txr: Reduce closure size. * gnu/packages/lisp.scm (txr)[inputs]: Replace bash by bash-minimal. --- gnu/packages/lisp.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gnu/packages/lisp.scm') diff --git a/gnu/packages/lisp.scm b/gnu/packages/lisp.scm index d8d7a7394c..838742e1b2 100644 --- a/gnu/packages/lisp.scm +++ b/gnu/packages/lisp.scm @@ -924,7 +924,7 @@ the HTML documentation of TXR.") ("groff" ,groff) ("man2html" ,man-for-txr))) (inputs - `(("bash" ,bash) + `(("bash" ,bash-minimal) ("libffi" ,libffi))) (arguments `(#:configure-flags -- cgit v1.2.3