On Wed, Sep 24, 2014 at 9:45 AM, Ludovic Courtès <l...@gnu.org> wrote:
> Pushed with some tweaks: I’ve added a copyright line for you (let me
> know if it’s wrong), replaced tabs with spaces (if you use Emacs, the
> .dir-locals.el normally ensures that), and moved parts of the commit log
> above to comments in the source (info "(standards) Change Log
> Concepts").
>
> Thank you!

Some more improvements:

I've found that the doc and emacs ".el" files were not installed in
the right place. Also
I've worked out how to set the full gnuplot path in the default
startup configuration file.
Now plotting works without the user having to install gnuplot in his profile.

Regards,
Fede
From ab8a0e9f8f50370b4e9e7ca63d8bef1408a05da6 Mon Sep 17 00:00:00 2001
From: Federico Beffa <be...@fbengineering.ch>
Date: Thu, 25 Sep 2014 17:04:13 +0200
Subject: [PATCH] maxima: Fix default gnuplot path, doc and emacs location

* gnu/packages/maths.scm(maxima): Configure the default gnuplot path. Make doc and
  emacs files reachable from their expected standard location.
---
 gnu/packages/maths.scm | 36 +++++++++++++++++++++++++++++-------
 1 file changed, 29 insertions(+), 7 deletions(-)

diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index c11d1ef..4f0db4c 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -850,8 +850,7 @@ to BMP, JPEG or PNG image formats.")
     (inputs
      `(("gcl" ,gcl)
        ("gnuplot" ,gnuplot)                       ;for plots
-       ("tcl" ,tcl)                               ;Tcl/Tk is used by 'xmaxima'
-       ("tk" ,tk)))
+       ("tk" ,tk)))                               ;Tcl/Tk is used by 'xmaxima'
     (native-inputs
      `(("texinfo" ,texinfo)
        ("perl" ,perl)))
@@ -866,18 +865,41 @@ to BMP, JPEG or PNG image formats.")
                             "/bin/wish"
                             (let ((v ,(package-version tk)))
                               (string-take v (string-index-right v #\.)))))
-
        ;; By default Maxima attempts to write temporary files to
        ;; '/tmp/nix-build-maxima-5.34.1', which doesn't exist.  Work around
        ;; that.
        #:make-flags (list "TMPDIR=/tmp")
-
        #:phases (alist-cons-before
                  'check 'pre-check
                  (lambda _
                    (chmod "src/maxima" #o555))
-                 %standard-phases)))
-
+                 ;; Make sure the doc and emacs files are found in the
+                 ;; standard location.  Also configure maxima to find gnuplot
+                 ;; without having it on the PATH.
+                 (alist-cons-after
+                  'install 'post-install
+                  (lambda* (#:key outputs inputs #:allow-other-keys)
+                    (let ((gnuplot (assoc-ref inputs "gnuplot"))
+                          (out (assoc-ref outputs "out")))
+                      (with-directory-excursion out
+                        (mkdir-p "share/emacs")
+                        (mkdir-p "share/doc")
+                        (symlink 
+                         (string-append out "/share/maxima/" ,version "/emacs/")
+                         (string-append out "/share/emacs/site-lisp"))
+                         (symlink 
+                          (string-append out "/share/maxima/" ,version "/doc/")
+                          (string-append out "/share/doc/maxima"))
+                         (with-atomic-file-replacement
+                             (string-append out "/share/maxima/"
+                                            ,version "/share/maxima-init.lisp")
+                           (lambda (in out)
+                             (begin
+                               (format out "~a ~s~a~%"
+                                       "(setf $gnuplot_command "
+                                       (string-append gnuplot "/bin/gnuplot") ")")
+                               (dump-port in out)))))))
+                  %standard-phases))))
     (home-page "http://maxima.sourceforge.net";)
     (synopsis "Numeric and symbolic expression manipulation")
     (description "Maxima is a system for the manipulation of symbolic and
@@ -889,4 +911,4 @@ point numbers")
     ;; version (which implicitly means gpl1+).
     ;; At least one file (src/maxima.asd) says "version 2."
     ;; GPLv2 only is therefore the smallest subset.
-    (license license:gpl2))) 
+    (license license:gpl2)))
-- 
1.8.4

Reply via email to