summary refs log tree commit diff
diff options
context:
space:
mode:
authorFederico Beffa <beffa@fbengineering.ch>2016-01-09 11:04:40 +0100
committerFederico Beffa <beffa@fbengineering.ch>2016-02-03 10:48:36 +0100
commitf163c290f1aa2925d0c7fdbc94f82625092bb330 (patch)
tree312945f729cc0440ac54184d9b009a7d6b9d7a86
parentaf00e6335207b44056437eecab2e76c957c21a89 (diff)
downloadguix-f163c290f1aa2925d0c7fdbc94f82625092bb330.tar.gz
gnu: mit-scheme: Generate and install documentation.
* gnu/packages/scheme.scm (mit-scheme): Add 'doc' output.
  [arguments]: Add phases 'configure-doc, 'build-doc and 'install-doc.
  [native-inputs]: Add 'texlive'. Move 'texinfo' and 'm4' from inputs.
-rw-r--r--gnu/packages/scheme.scm50
1 files changed, 46 insertions, 4 deletions
diff --git a/gnu/packages/scheme.scm b/gnu/packages/scheme.scm
index 752dae226a..352b66c59b 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)
@@ -55,9 +56,13 @@
     (name "mit-scheme")
     (version "9.2")
     (source #f)                                   ; see below
+    (outputs '("out" "doc"))
     (build-system gnu-build-system)
     (arguments
      `(#:tests? #f                                ; no "check" target
+       #:modules ((guix build gnu-build-system)
+                  (guix build utils)
+                  (srfi srfi-1))
        #:phases
        (modify-phases %standard-phases
          (replace 'unpack
@@ -83,11 +88,48 @@
                        (string-prefix? "i686" system))
                    (zero? (system* "make" "compile-microcode"))
                    (zero? (system* "./etc/make-liarc.sh"
-                                   (string-append "--prefix=" out))))))))))
+                                   (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* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (doc (assoc-ref outputs "doc"))
+                    (old-doc-dir (string-append out "/share/doc"))
+                    (new-doc/mit-scheme-dir
+                     (string-append doc "/share/doc/" ,name "-" ,version)))
+               (with-directory-excursion "../doc"
+                 (for-each (lambda (target)
+                             (system* "make" target))
+                           '("install-config" "install-info-gz" "install-man"
+                             "install-html" "install-pdf")))
+               (mkdir-p new-doc/mit-scheme-dir)
+               (copy-recursively
+                (string-append old-doc-dir "/" ,name "-" ,version)
+                new-doc/mit-scheme-dir)
+               (delete-file-recursively old-doc-dir)
+               #t))))))
+    (native-inputs
+     `(("texlive" ,texlive)
+       ("texinfo" ,texinfo)
+       ("m4" ,m4)))
     (inputs
-     `(("texinfo" ,texinfo)
-       ("m4" ,m4)
-       ("libx11" ,libx11)
+     `(("libx11" ,libx11)
 
        ("source"