unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] gnu: Add scmutils.
@ 2015-09-15 17:34 Federico Beffa
  2015-09-16  1:59 ` Mark H Weaver
  2015-09-17 13:03 ` Ludovic Courtès
  0 siblings, 2 replies; 6+ messages in thread
From: Federico Beffa @ 2015-09-15 17:34 UTC (permalink / raw)
  To: Guix-devel

[-- Attachment #1: Type: text/plain, Size: 217 bytes --]

Hi,

if you want to try the package in emacs, you must first unload
'geiser' as there is some incompatibility between the latter and
'xscheme' (from MIT-Scheme). The problem is fixed upstream (geiser).

Regards,
Fede

[-- Attachment #2: 0001-gnu-Add-scmutils.patch --]
[-- Type: text/x-diff, Size: 9441 bytes --]

From 1aacd03326def7b52b8166a80cc18c8e8226aa62 Mon Sep 17 00:00:00 2001
From: Federico Beffa <beffa@fbengineering.ch>
Date: Thu, 13 Aug 2015 18:58:01 +0200
Subject: [PATCH] gnu: Add scmutils.

* gnu/packages/scheme.scm (scmutils): New variable.
---
 gnu/packages/scheme.scm | 164 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 164 insertions(+)

diff --git a/gnu/packages/scheme.scm b/gnu/packages/scheme.scm
index 803b8d5..a0a9b58 100644
--- a/gnu/packages/scheme.scm
+++ b/gnu/packages/scheme.scm
@@ -1,6 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2015 Taylan Ulrich Bayırlı/Kammer <taylanbayirli@gmail.com>
+;;; Copyright © 2015 Federico Beffa <beffa@fbengineering.ch>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -486,3 +487,166 @@ addition to support for lightweight VM-based threads, each VM itself runs in
 an isolated heap allowing multiple VMs to run simultaneously in different OS
 threads.")
     (license bsd-3)))
+
+;; FIXME: This function is temporarily in the engineering module and not
+;; exported.  It will be moved to an utility module for general use.  Once
+;; this is done, we should remove this definition.
+(define broken-tarball-fetch
+  (@@ (gnu packages engineering) broken-tarball-fetch))
+
+(define-public scmutils
+  (let ()
+    (define (system-suffix)
+      (cond
+       ((string-prefix? "x86_64" (or (%current-target-system)
+                                     (%current-system)))
+        "x86-64")
+       (else "i386")))
+
+    (package
+      (name "scmutils")
+      (version "20140302")
+      (source
+       (origin
+         (method broken-tarball-fetch)
+         (file-name (string-append name "-" version ".tar.gz"))
+         (uri (string-append "http://groups.csail.mit.edu/mac/users/gjs/6946"
+                             "/scmutils-tarballs/" name "-" version
+                             "-x86-64-gnu-linux.tar.gz"))
+         (sha256
+          (base32 "10cnbm7nh78m5mrl1di85s29gny81jb1am9zd9f9yx725xb6dnfg"))))
+      (build-system gnu-build-system)
+      (inputs
+       `(("mit-scheme" ,mit-scheme)
+         ("emacs" ,emacs-no-x)))
+      (arguments
+       `(#:tests? #f ;; no tests-suite
+         #:modules ((guix build gnu-build-system)
+                    (guix build utils)
+                    (guix build emacs-utils))
+         #:imported-modules (,@%gnu-build-system-modules
+                             (guix build emacs-utils))
+         #:phases
+         (modify-phases %standard-phases
+           (replace 'configure
+                    (lambda* (#:key outputs #:allow-other-keys)
+                      (let ((out (assoc-ref outputs "out")))
+                        ;; Required to find .bci files at runtime.
+                        (with-directory-excursion "scmutils"
+                          (rename-file "src" "scmutils"))
+                        (substitute* "scmutils/scmutils/load.scm"
+                          (("/usr/local/scmutils/")
+                           (string-append out "/lib/mit-scheme-"
+                                          ,(system-suffix) "/")))
+                        #t)))
+           (replace 'build
+                    (lambda* (#:key outputs #:allow-other-keys)
+                      (let* ((out (assoc-ref outputs "out"))
+                             (make-img (string-append
+                                        "echo '(load \"load\") "
+                                        "(disk-save \"edwin-mechanics.com\")'"
+                                        "| mit-scheme")))
+                        (with-directory-excursion "scmutils/scmutils"
+                          (and (zero? (system "mit-scheme < compile.scm"))
+                               (zero? (system make-img)))))))
+           (add-before 'install 'fix-bin
+                       (lambda* (#:key inputs outputs #:allow-other-keys)
+                         (let* ((out (assoc-ref outputs "out"))
+                                (scm-root (assoc-ref inputs "mit-scheme")))
+                           (substitute* "bin/mechanics"
+                             (("ROOT=\"\\$\\{SCMUTILS_ROOT:-/.*\\}\"")
+                              (string-append
+                               "ROOT=\"${SCMUTILS_ROOT:-" scm-root "}\"\n"
+                               "LIB=\"${ROOT}/lib/mit-scheme-"
+                               ,(system-suffix) ":"
+                               out "/lib/mit-scheme-" ,(system-suffix) "\""))
+                             (("EDWIN_INFO_DIRECTORY=.*\n") "")
+                             (("SCHEME=.*\n")
+                              (string-append "SCHEME=\"${ROOT}/bin/scheme "
+                                             "--library ${LIB}\"\n"))
+                             (("export EDWIN_INFO_DIRECTORY") ""))
+                           #t)))
+           (add-before 'install 'emacs-tags
+                       (lambda* (#:key inputs outputs #:allow-other-keys)
+                         (with-directory-excursion "scmutils/scmutils"
+                           (zero? (apply system* "etags"
+                                         (find-files "." "\\.scm"))))))
+           (replace 'install
+                    (lambda* (#:key outputs #:allow-other-keys)
+                      (define* (copy-files-to-directory files dir
+                                                        #:optional (delete? #f))
+                        (for-each (lambda (f)
+                                    (copy-file f (string-append dir "/" f))
+                                    (when delete? (delete-file f)))
+                                  files))
+
+                      (let* ((out (assoc-ref outputs "out"))
+                             (bin (string-append out "/bin"))
+                             (doc (string-append out "/share/doc/"
+                                                 ,name "-" ,version))
+                             (lib (string-append out "/lib/mit-scheme-"
+                                                 ,(system-suffix)
+                                                 "/scmutils")))
+                        (for-each (lambda (d) (mkdir-p d)) (list lib doc bin))
+                        (with-directory-excursion "scmutils/scmutils"
+                          (copy-files-to-directory '("COPYING" "LICENSE")
+                                                   doc #t)
+                          (for-each (lambda (f) (delete-file f))
+                                    (find-files "." "\\.bin"))
+                          (copy-files-to-directory '("edwin-mechanics.com")
+                                                   (string-append lib "/..") #t)
+                          (copy-recursively "." lib))
+                        (with-directory-excursion "bin"
+                          (copy-files-to-directory (find-files ".") bin))
+                        (with-directory-excursion "scmutils/manual"
+                          (copy-files-to-directory (find-files ".") doc))
+                        #t)))
+           (add-after 'install 'emacs-helpers
+                      (lambda* (#:key inputs outputs #:allow-other-keys)
+                        (let* ((out (assoc-ref outputs "out"))
+                               (mit-root (assoc-ref inputs "mit-scheme"))
+                               (emacs-lisp-dir
+                                (string-append out "/share/emacs/site-lisp"))
+                               (el-file (string-append emacs-lisp-dir
+                                                       "/scmutils.el"))
+                               (lib-relative-path
+                                (string-append "/lib/mit-scheme-"
+                                               ,(system-suffix))))
+                          (mkdir-p emacs-lisp-dir)
+                          (call-with-output-file el-file
+                            (lambda (p)
+                              (format p
+                                      ";;;###autoload
+(defun scmutils-load ()
+  (interactive)
+  (require 'xscheme)
+  (let ((mit-root \"~a\")
+    (scmutils \"~a\"))
+    (run-scheme
+     (concat mit-root \"/bin/scheme --library \"
+          mit-root \"~a:\" scmutils \"~a\"
+          \" --band edwin-mechanics.com\"
+          \" --emacs\"))))
+
+;;;###autoload
+(defun scmutils-load-tags ()
+  (interactive)
+  (let ((scmutils \"~a\"))
+    (visit-tags-table (concat scmutils \"/TAGS\"))))
+"
+                                      mit-root out
+                                      lib-relative-path
+                                      lib-relative-path
+                                      (string-append out lib-relative-path
+                                                     "/scmutils"))))
+                          (emacs-byte-compile-directory (dirname el-file))
+                          #t))))))
+      (supported-systems '("x86_64-linux" "i686-linux"))
+      (home-page
+       "http://groups.csail.mit.edu/mac/users/gjs/6946/linux-install.htm")
+      (synopsis "The Scmutils library for MIT Scheme")
+      (description "The Scmutils system is an integrated library of
+procedures, embedded in the programming language Scheme, and intended to
+support teaching and research in mathematical physics and electrical
+engineering.")
+      (license gpl2+))))
-- 
2.4.3


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] gnu: Add scmutils.
  2015-09-15 17:34 [PATCH] gnu: Add scmutils Federico Beffa
@ 2015-09-16  1:59 ` Mark H Weaver
  2015-09-16  6:30   ` Federico Beffa
  2015-09-17 13:03 ` Ludovic Courtès
  1 sibling, 1 reply; 6+ messages in thread
From: Mark H Weaver @ 2015-09-16  1:59 UTC (permalink / raw)
  To: Federico Beffa; +Cc: Guix-devel

Federico Beffa <beffa@ieee.org> writes:

> if you want to try the package in emacs, you must first unload
> 'geiser' as there is some incompatibility between the latter and
> 'xscheme' (from MIT-Scheme). The problem is fixed upstream (geiser).

It looks like this package downloads a pre-compiled binary bundle
containing both MIT/GNU Scheme and scmutils.  There's no compelling
reason to do that here.  We already have a package for MIT/GNU scheme,
so it should be possible to use that to compile this from source.  Let's
do that instead please.

      Mark

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] gnu: Add scmutils.
  2015-09-16  1:59 ` Mark H Weaver
@ 2015-09-16  6:30   ` Federico Beffa
  0 siblings, 0 replies; 6+ messages in thread
From: Federico Beffa @ 2015-09-16  6:30 UTC (permalink / raw)
  To: Mark H Weaver; +Cc: Guix-devel

On Wed, Sep 16, 2015 at 3:59 AM, Mark H Weaver <mhw@netris.org> wrote:
> Federico Beffa <beffa@ieee.org> writes:
>
>> if you want to try the package in emacs, you must first unload
>> 'geiser' as there is some incompatibility between the latter and
>> 'xscheme' (from MIT-Scheme). The problem is fixed upstream (geiser).
>
> It looks like this package downloads a pre-compiled binary bundle
> containing both MIT/GNU Scheme and scmutils.  There's no compelling
> reason to do that here.  We already have a package for MIT/GNU scheme,
> so it should be possible to use that to compile this from source.  Let's
> do that instead please.

If you would look carefully at the recipe you would see that the
tarball distributes the source together with a binary distribution and
that my patch discards all pre-compiled bits, recompiles the sources
with the mit-scheme from guix and only installs those.

Regards,
Fede

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] gnu: Add scmutils.
  2015-09-15 17:34 [PATCH] gnu: Add scmutils Federico Beffa
  2015-09-16  1:59 ` Mark H Weaver
@ 2015-09-17 13:03 ` Ludovic Courtès
  2015-09-17 16:19   ` Federico Beffa
  1 sibling, 1 reply; 6+ messages in thread
From: Ludovic Courtès @ 2015-09-17 13:03 UTC (permalink / raw)
  To: Federico Beffa; +Cc: Guix-devel

Federico Beffa <beffa@ieee.org> skribis:

> From 1aacd03326def7b52b8166a80cc18c8e8226aa62 Mon Sep 17 00:00:00 2001
> From: Federico Beffa <beffa@fbengineering.ch>
> Date: Thu, 13 Aug 2015 18:58:01 +0200
> Subject: [PATCH] gnu: Add scmutils.
>
> * gnu/packages/scheme.scm (scmutils): New variable.

Overall LGTM.  The comments below are largely cosmetic:

> +;; FIXME: This function is temporarily in the engineering module and not
> +;; exported.  It will be moved to an utility module for general use.  Once
> +;; this is done, we should remove this definition.
> +(define broken-tarball-fetch
> +  (@@ (gnu packages engineering) broken-tarball-fetch))

Not important for this patch, but eventually we could always make a
(guix tarbomb-fetch) module that would export this procedure.

> +         (modify-phases %standard-phases

Since the phases are nontrivial, I would suggest adding a comment right
before the ‘lambda*’ line of each phase to briefly mention what it does.

> +           (add-before 'install 'fix-bin

Maybe ‘fix-directory-names’?

> +                    (lambda* (#:key outputs #:allow-other-keys)
> +                      (define* (copy-files-to-directory files dir
> +                                                        #:optional (delete? #f))
> +                        (for-each (lambda (f)
> +                                    (copy-file f (string-append dir "/" f))

Note for later: once ‘core-updates’ is merged, we should write this as:

  (install-file f dir)

> +                                    (when delete? (delete-file f)))
> +                                  files))
> +
> +                      (let* ((out (assoc-ref outputs "out"))
> +                             (bin (string-append out "/bin"))
> +                             (doc (string-append out "/share/doc/"
> +                                                 ,name "-" ,version))
> +                             (lib (string-append out "/lib/mit-scheme-"
> +                                                 ,(system-suffix)
> +                                                 "/scmutils")))
> +                        (for-each (lambda (d) (mkdir-p d)) (list lib doc bin))

This can be written as:

  (for-each mkdir-p (list …))

> +                        (with-directory-excursion "scmutils/scmutils"
> +                          (copy-files-to-directory '("COPYING" "LICENSE")
> +                                                   doc #t)
> +                          (for-each (lambda (f) (delete-file f))
> +                                    (find-files "." "\\.bin"))

  (for-each delete-file (find-files …))

This phase deletes a bunch of pre-compiled files, which are those Mark
and you were referring to, IIUC.  Could you move the removal of all the
pre-compiled files to a ‘snippet’?

This will ensure that ‘guix build -S scmutils’ provides only source code.

> +                               (emacs-lisp-dir
> +                                (string-append out "/share/emacs/site-lisp"))

This should be:

  (string-append out "/share/emacs/site-lisp/guix.d/" ,name "-" ,version)

That way, when installing the package from Emacs, it will automatically
be found and loaded (I realize the manual doesn’t explain it, but it
probably should.)

> +      (supported-systems '("x86_64-linux" "i686-linux"))

Please add a comment above explaining why this is the case.

> +      (synopsis "The Scmutils library for MIT Scheme")

-The

Well, this was not an easy package.  Thanks for working on it!

Ludo’.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] gnu: Add scmutils.
  2015-09-17 13:03 ` Ludovic Courtès
@ 2015-09-17 16:19   ` Federico Beffa
  2015-09-17 19:54     ` Ludovic Courtès
  0 siblings, 1 reply; 6+ messages in thread
From: Federico Beffa @ 2015-09-17 16:19 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: Guix-devel

[-- Attachment #1: Type: text/plain, Size: 1875 bytes --]

On Thu, Sep 17, 2015 at 3:03 PM, Ludovic Courtès <ludo@gnu.org> wrote:
> Federico Beffa <beffa@ieee.org> skribis:
>
>> From 1aacd03326def7b52b8166a80cc18c8e8226aa62 Mon Sep 17 00:00:00 2001
>> From: Federico Beffa <beffa@fbengineering.ch>
>> Date: Thu, 13 Aug 2015 18:58:01 +0200
>> Subject: [PATCH] gnu: Add scmutils.
>>
>> * gnu/packages/scheme.scm (scmutils): New variable.
>

[...]

>> +                        (with-directory-excursion "scmutils/scmutils"
>> +                          (copy-files-to-directory '("COPYING" "LICENSE")
>> +                                                   doc #t)
>> +                          (for-each (lambda (f) (delete-file f))
>> +                                    (find-files "." "\\.bin"))
>
>   (for-each delete-file (find-files …))
>
> This phase deletes a bunch of pre-compiled files, which are those Mark
> and you were referring to, IIUC.  Could you move the removal of all the
> pre-compiled files to a ‘snippet’?

The source code and the binary distribution to which Mark was
referring are totally separated and live in different directories. The
code never even enters the directory with the binary code. The files
I'm deleting here are some of the files generated by the compiler, but
not needed at runtime. I delete those and copy everything else from
that directory.

I've added the snippet to delete the directory containing the binary code.

[...]

>> +      (supported-systems '("x86_64-linux" "i686-linux"))
>
> Please add a comment above explaining why this is the case.

Actually I'm not sure if it runs on other platforms. The tarballs are
specific for the Intel x*86* family of processors, but maybe it's just
a restriction on the binary part of the content. I've deleted this
restriction. We'll see if it compiles on hydra.

Thanks for the review,
Fede

[-- Attachment #2: 0001-gnu-Add-scmutils.patch --]
[-- Type: text/x-diff, Size: 10203 bytes --]

From cc432e7c6f91600cf4e03b07286af4ea631c27c0 Mon Sep 17 00:00:00 2001
From: Federico Beffa <beffa@fbengineering.ch>
Date: Thu, 13 Aug 2015 18:58:01 +0200
Subject: [PATCH] gnu: Add scmutils.

* gnu/packages/scheme.scm (scmutils): New variable.
---
 gnu/packages/scheme.scm | 177 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 177 insertions(+)

diff --git a/gnu/packages/scheme.scm b/gnu/packages/scheme.scm
index 803b8d5..7465b1b 100644
--- a/gnu/packages/scheme.scm
+++ b/gnu/packages/scheme.scm
@@ -1,6 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2015 Taylan Ulrich Bayırlı/Kammer <taylanbayirli@gmail.com>
+;;; Copyright © 2015 Federico Beffa <beffa@fbengineering.ch>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -486,3 +487,179 @@ addition to support for lightweight VM-based threads, each VM itself runs in
 an isolated heap allowing multiple VMs to run simultaneously in different OS
 threads.")
     (license bsd-3)))
+
+;; FIXME: This function is temporarily in the engineering module and not
+;; exported.  It will be moved to an utility module for general use.  Once
+;; this is done, we should remove this definition.
+(define broken-tarball-fetch
+  (@@ (gnu packages engineering) broken-tarball-fetch))
+
+(define-public scmutils
+  (let ()
+    (define (system-suffix)
+      (cond
+       ((string-prefix? "x86_64" (or (%current-target-system)
+                                     (%current-system)))
+        "x86-64")
+       (else "i386")))
+
+    (package
+      (name "scmutils")
+      (version "20140302")
+      (source
+       (origin
+         (method broken-tarball-fetch)
+         (modules '((guix build utils)))
+         (snippet
+          ;; Remove binary code
+          '(delete-file-recursively "scmutils/mit-scheme"))
+         (file-name (string-append name "-" version ".tar.gz"))
+         (uri (string-append "http://groups.csail.mit.edu/mac/users/gjs/6946"
+                             "/scmutils-tarballs/" name "-" version
+                             "-x86-64-gnu-linux.tar.gz"))
+         (sha256
+          (base32 "10cnbm7nh78m5mrl1di85s29gny81jb1am9zd9f9yx725xb6dnfg"))))
+      (build-system gnu-build-system)
+      (inputs
+       `(("mit-scheme" ,mit-scheme)
+         ("emacs" ,emacs-no-x)))
+      (arguments
+       `(#:tests? #f ;; no tests-suite
+         #:modules ((guix build gnu-build-system)
+                    (guix build utils)
+                    (guix build emacs-utils))
+         #:imported-modules (,@%gnu-build-system-modules
+                             (guix build emacs-utils))
+         #:phases
+         (modify-phases %standard-phases
+           (replace 'configure
+                    ;; No standard build procedure is used. We set the correct
+                    ;; runtime path in the custom build system.
+                    (lambda* (#:key outputs #:allow-other-keys)
+                      (let ((out (assoc-ref outputs "out")))
+                        ;; Required to find .bci files at runtime.
+                        (with-directory-excursion "scmutils"
+                          (rename-file "src" "scmutils"))
+                        (substitute* "scmutils/scmutils/load.scm"
+                          (("/usr/local/scmutils/")
+                           (string-append out "/lib/mit-scheme-"
+                                          ,(system-suffix) "/")))
+                        #t)))
+           (replace 'build
+                    ;; Compile the code and build a band.
+                    (lambda* (#:key outputs #:allow-other-keys)
+                      (let* ((out (assoc-ref outputs "out"))
+                             (make-img (string-append
+                                        "echo '(load \"load\") "
+                                        "(disk-save \"edwin-mechanics.com\")'"
+                                        "| mit-scheme")))
+                        (with-directory-excursion "scmutils/scmutils"
+                          (and (zero? (system "mit-scheme < compile.scm"))
+                               (zero? (system make-img)))))))
+           (add-before 'install 'fix-directory-names
+                       ;; Correct directory names in the startup script.
+                       (lambda* (#:key inputs outputs #:allow-other-keys)
+                         (let* ((out (assoc-ref outputs "out"))
+                                (scm-root (assoc-ref inputs "mit-scheme")))
+                           (substitute* "bin/mechanics"
+                             (("ROOT=\"\\$\\{SCMUTILS_ROOT:-/.*\\}\"")
+                              (string-append
+                               "ROOT=\"${SCMUTILS_ROOT:-" scm-root "}\"\n"
+                               "LIB=\"${ROOT}/lib/mit-scheme-"
+                               ,(system-suffix) ":"
+                               out "/lib/mit-scheme-" ,(system-suffix) "\""))
+                             (("EDWIN_INFO_DIRECTORY=.*\n") "")
+                             (("SCHEME=.*\n")
+                              (string-append "SCHEME=\"${ROOT}/bin/scheme "
+                                             "--library ${LIB}\"\n"))
+                             (("export EDWIN_INFO_DIRECTORY") ""))
+                           #t)))
+           (add-before 'install 'emacs-tags
+                       ;; Generate Emacs's tags for easy reference to source
+                       ;; code.
+                       (lambda* (#:key inputs outputs #:allow-other-keys)
+                         (with-directory-excursion "scmutils/scmutils"
+                           (zero? (apply system* "etags"
+                                         (find-files "." "\\.scm"))))))
+           (replace 'install
+                    ;; Copy files to the store.
+                    (lambda* (#:key outputs #:allow-other-keys)
+                      (define* (copy-files-to-directory files dir
+                                                        #:optional (delete? #f))
+                        (for-each (lambda (f)
+                                    (copy-file f (string-append dir "/" f))
+                                    (when delete? (delete-file f)))
+                                  files))
+
+                      (let* ((out (assoc-ref outputs "out"))
+                             (bin (string-append out "/bin"))
+                             (doc (string-append out "/share/doc/"
+                                                 ,name "-" ,version))
+                             (lib (string-append out "/lib/mit-scheme-"
+                                                 ,(system-suffix)
+                                                 "/scmutils")))
+                        (for-each mkdir-p (list lib doc bin))
+                        (with-directory-excursion "scmutils/scmutils"
+                          (copy-files-to-directory '("COPYING" "LICENSE")
+                                                   doc #t)
+                          (for-each delete-file (find-files "." "\\.bin"))
+                          (copy-files-to-directory '("edwin-mechanics.com")
+                                                   (string-append lib "/..") #t)
+                          (copy-recursively "." lib))
+                        (with-directory-excursion "bin"
+                          (copy-files-to-directory (find-files ".") bin))
+                        (with-directory-excursion "scmutils/manual"
+                          (copy-files-to-directory (find-files ".") doc))
+                        #t)))
+           (add-after 'install 'emacs-helpers
+                      ;; Add convenience Emacs commands to easily load the
+                      ;; Scmutils band in an MIT-Scheme buffer inside of Emacs
+                      ;; and to easily load code tags.
+                      (lambda* (#:key inputs outputs #:allow-other-keys)
+                        (let* ((out (assoc-ref outputs "out"))
+                               (mit-root (assoc-ref inputs "mit-scheme"))
+                               (emacs-lisp-dir
+                                (string-append out "/share/emacs/site-lisp"
+                                               "/guix.d/" ,name "-" ,version))
+                               (el-file (string-append emacs-lisp-dir
+                                                       "/scmutils.el"))
+                               (lib-relative-path
+                                (string-append "/lib/mit-scheme-"
+                                               ,(system-suffix))))
+                          (mkdir-p emacs-lisp-dir)
+                          (call-with-output-file el-file
+                            (lambda (p)
+                              (format p
+                                      ";;;###autoload
+(defun scmutils-load ()
+  (interactive)
+  (require 'xscheme)
+  (let ((mit-root \"~a\")
+    (scmutils \"~a\"))
+    (run-scheme
+     (concat mit-root \"/bin/scheme --library \"
+          mit-root \"~a:\" scmutils \"~a\"
+          \" --band edwin-mechanics.com\"
+          \" --emacs\"))))
+
+;;;###autoload
+(defun scmutils-load-tags ()
+  (interactive)
+  (let ((scmutils \"~a\"))
+    (visit-tags-table (concat scmutils \"/TAGS\"))))
+"
+                                      mit-root out
+                                      lib-relative-path
+                                      lib-relative-path
+                                      (string-append out lib-relative-path
+                                                     "/scmutils"))))
+                          (emacs-byte-compile-directory (dirname el-file))
+                          #t))))))
+      (home-page
+       "http://groups.csail.mit.edu/mac/users/gjs/6946/linux-install.htm")
+      (synopsis "Scmutils library for MIT Scheme")
+      (description "The Scmutils system is an integrated library of
+procedures, embedded in the programming language Scheme, and intended to
+support teaching and research in mathematical physics and electrical
+engineering.")
+      (license gpl2+))))
-- 
2.4.3


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] gnu: Add scmutils.
  2015-09-17 16:19   ` Federico Beffa
@ 2015-09-17 19:54     ` Ludovic Courtès
  0 siblings, 0 replies; 6+ messages in thread
From: Ludovic Courtès @ 2015-09-17 19:54 UTC (permalink / raw)
  To: Federico Beffa; +Cc: Guix-devel

Federico Beffa <beffa@ieee.org> skribis:

> On Thu, Sep 17, 2015 at 3:03 PM, Ludovic Courtès <ludo@gnu.org> wrote:
>> Federico Beffa <beffa@ieee.org> skribis:

[...]

>>> +                        (with-directory-excursion "scmutils/scmutils"
>>> +                          (copy-files-to-directory '("COPYING" "LICENSE")
>>> +                                                   doc #t)
>>> +                          (for-each (lambda (f) (delete-file f))
>>> +                                    (find-files "." "\\.bin"))
>>
>>   (for-each delete-file (find-files …))
>>
>> This phase deletes a bunch of pre-compiled files, which are those Mark
>> and you were referring to, IIUC.  Could you move the removal of all the
>> pre-compiled files to a ‘snippet’?
>
> The source code and the binary distribution to which Mark was
> referring are totally separated and live in different directories. The
> code never even enters the directory with the binary code. The files
> I'm deleting here are some of the files generated by the compiler, but
> not needed at runtime. I delete those and copy everything else from
> that directory.

OK, sorry for the confusion.

> I've added the snippet to delete the directory containing the binary code.

Great.

>>> +      (supported-systems '("x86_64-linux" "i686-linux"))
>>
>> Please add a comment above explaining why this is the case.
>
> Actually I'm not sure if it runs on other platforms. The tarballs are
> specific for the Intel x*86* family of processors, but maybe it's just
> a restriction on the binary part of the content. I've deleted this
> restriction. We'll see if it compiles on hydra.

Yeah, ‘mit-scheme’ already has restrictions on ‘supported-systems’
anyway.

> From cc432e7c6f91600cf4e03b07286af4ea631c27c0 Mon Sep 17 00:00:00 2001
> From: Federico Beffa <beffa@fbengineering.ch>
> Date: Thu, 13 Aug 2015 18:58:01 +0200
> Subject: [PATCH] gnu: Add scmutils.
>
> * gnu/packages/scheme.scm (scmutils): New variable.

OK to push, thanks!

Ludo’.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-09-17 19:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-15 17:34 [PATCH] gnu: Add scmutils Federico Beffa
2015-09-16  1:59 ` Mark H Weaver
2015-09-16  6:30   ` Federico Beffa
2015-09-17 13:03 ` Ludovic Courtès
2015-09-17 16:19   ` Federico Beffa
2015-09-17 19:54     ` Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).