summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2018-10-21 21:12:00 +0200
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2018-11-22 12:18:52 +0100
commitaf90cc45aec1aa03ce25feae403e5d7eb90a9a01 (patch)
tree07982ef18b4a16d83e11b8040d22d182f90451df /gnu
parent90d5ec55aeb30d08ac109184fc83f1059b34d038 (diff)
downloadguix-af90cc45aec1aa03ce25feae403e5d7eb90a9a01.tar.gz
gnu: giac-xcas: Add a "doc" output
* gnu/packages/algebra.scm (giac-xcas): Add "doc" output.
[arguments]: Add phase to install documentation in the appropriate directory.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/packages/algebra.scm28
1 files changed, 27 insertions, 1 deletions
diff --git a/gnu/packages/algebra.scm b/gnu/packages/algebra.scm
index fdae3ac55b..cc1a8f25d0 100644
--- a/gnu/packages/algebra.scm
+++ b/gnu/packages/algebra.scm
@@ -257,8 +257,12 @@ precision.")
                (base32
                 "0ds1zh712sr20qh0fih8jnm4nlv90andllp8n263qs7rlhblz551"))))
     (build-system gnu-build-system)
+    (outputs '("out" "doc"))            ;77MiB of documentation
     (arguments
-     `(#:phases
+     `(#:modules ((ice-9 ftw)
+                  (guix build utils)
+                  (guix build gnu-build-system))
+       #:phases
        (modify-phases %standard-phases
          (add-after 'unpack 'patch-bin-cp
            ;; Some Makefiles contain hard-coded "/bin/cp".
@@ -271,6 +275,28 @@ precision.")
            (lambda _
              (substitute* "check/Makefile.in"
                (("chk_fhan11") ""))
+             #t))
+         (add-after 'install 'install-doc
+           ;; Setting --docdir to "doc" output isn't sufficient as
+           ;; documentation and examples are scattered throughout the source.
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (doc (assoc-ref outputs "doc"))
+                    (docdir (string-append doc
+                                           "/share/doc/"
+                                           (string-append ,name "-" ,version))))
+               ;; For some reason, the install process moves
+               ;; "share/giac/examples" instead of "share/giac/doc" to
+               ;; "$(docdir)".  Clean up the mess and start over.
+               (delete-file-recursively (string-append doc "/share"))
+               (mkdir-p docdir)
+               (with-directory-excursion out
+                 (for-each (lambda (f)
+                             (unless (member f '("." ".."))
+                               (copy-recursively (string-append "share/giac/" f)
+                                                 (string-append docdir "/" f))))
+                           (scandir "share/giac"))
+                 (delete-file-recursively "share/giac")))
              #t)))))
     (inputs
      `(("fltk" ,fltk)