From 5c2be0d7d628ba27ac1360cc8e998de68a505b2a Mon Sep 17 00:00:00 2001
From: Federico Beffa <be...@fbengineering.ch>
Date: Sun, 27 Dec 2015 19:06:37 +0100
Subject: [PATCH 5/6] gnu: mit-scheme: Generate and install documentation.

* gnu/packages/scheme.scm (mit-scheme): Convert to the 'modify-phases'
  syntax. Add phases 'configure-doc, 'build-doc and 'install-doc. Add
  'texlive' input.
---
 gnu/packages/scheme.scm | 78 ++++++++++++++++++++++++++++++-------------------
 1 file changed, 48 insertions(+), 30 deletions(-)

diff --git a/gnu/packages/scheme.scm b/gnu/packages/scheme.scm
index 7eb03f6..f778b99 100644
--- a/gnu/packages/scheme.scm
+++ b/gnu/packages/scheme.scm
@@ -30,6 +30,7 @@
   #:use-module (gnu packages databases)
   #:use-module (gnu packages emacs)
   #:use-module (gnu packages texinfo)
+  #:use-module (gnu packages texlive)
   #:use-module (gnu packages base)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages avahi)
@@ -59,37 +60,54 @@
     (arguments
      `(#:tests? #f                                ; no "check" target
        #:phases
-       (alist-replace
-        'unpack
-        (lambda* (#:key inputs #:allow-other-keys)
-          (and (zero? (system* "tar" "xzvf"
-                               (assoc-ref inputs "source")))
-               (chdir ,(mit-scheme-source-directory (%current-system)
-                                                    version))
-               (begin
-                 ;; Delete these dangling symlinks since they break
-                 ;; `patch-shebangs'.
-                 (for-each delete-file
-                           (append '("src/lib/shim-config.scm")
-                                   (find-files "src/lib/lib" "\\.so$")
-                                   (find-files "src/lib" "^liarc-")
-                                   (find-files "src/compiler" "^make\\.")))
-                 (chdir "src")
-                 #t)))
-        (alist-replace
-         'build
-         (lambda* (#:key system outputs #:allow-other-keys)
-           (let ((out (assoc-ref outputs "out")))
-             (if (or (string-prefix? "x86_64" system)
-                     (string-prefix? "i686" system))
-                 (zero? (system* "make" "compile-microcode"))
-                 (zero? (system* "./etc/make-liarc.sh"
-                                 (string-append "--prefix=" out))))))
-         %standard-phases))))
+       (modify-phases %standard-phases
+         (replace 'unpack
+           (lambda* (#:key inputs #:allow-other-keys)
+             (and (zero? (system* "tar" "xzvf"
+                                  (assoc-ref inputs "source")))
+                  (chdir ,(mit-scheme-source-directory (%current-system)
+                                                       version))
+                  (begin
+                    ;; Delete these dangling symlinks since they break
+                    ;; `patch-shebangs'.
+                    (for-each delete-file
+                              (append '("src/lib/shim-config.scm")
+                                      (find-files "src/lib/lib" "\\.so$")
+                                      (find-files "src/lib" "^liarc-")
+                                      (find-files "src/compiler" "^make\\.")))
+                    (chdir "src")
+                    #t))))
+         (replace 'build
+           (lambda* (#:key system outputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out")))
+               (if (or (string-prefix? "x86_64" system)
+                       (string-prefix? "i686" system))
+                   (zero? (system* "make" "compile-microcode"))
+                   (zero? (system* "./etc/make-liarc.sh"
+                                   (string-append "--prefix=" out)))))))
+         (add-after 'configure 'configure-doc
+           (lambda* (#:key outputs inputs #:allow-other-keys)
+             (with-directory-excursion "../doc"
+               (let* ((out (assoc-ref outputs "out"))
+                      (bash (assoc-ref inputs "bash"))
+                      (bin/sh (string-append bash "/bin/sh")))
+                 (system* bin/sh "./configure"
+                          (string-append "--prefix=" out)
+                          (string-append "SHELL=" bin/sh))
+                 (substitute* '("Makefile" "make-common")
+                   (("/lib/mit-scheme/doc")
+                    (string-append "/share/doc/" ,name "-" ,version)))
+                 #t))))
+         (add-after 'build 'build-doc
+           (lambda* _
+             (with-directory-excursion "../doc"
+               (zero? (system* "make")))))
+         (add-after 'install 'install-doc
+           (lambda* _
+             (with-directory-excursion "../doc"
+               (zero? (system* "make" "install"))))))))
     (inputs
-     `(;; TODO: Build doc when TeX Live is available.
-       ;; ("automake" ,automake)
-       ;; ("texlive-core" ,texlive-core)
+     `(("texlive" ,texlive)
        ("texinfo" ,texinfo)
        ("m4" ,m4)
        ("libx11" ,libx11)
-- 
2.6.3

Reply via email to