summary refs log tree commit diff
path: root/gnu/packages/scheme.scm
diff options
context:
space:
mode:
authorAdam Massmann <massmannak@gmail.com>2018-06-22 14:29:23 -0400
committerLudovic Courtès <ludo@gnu.org>2018-06-25 23:34:43 +0200
commit44fa8431be2fc9c4ae374fe5bced7a5c03461056 (patch)
tree0ef5767707feb702578a2e04161f018be9145da9 /gnu/packages/scheme.scm
parentf69c1a1832a393586eb6ab4e0d9776b19dcc6782 (diff)
downloadguix-44fa8431be2fc9c4ae374fe5bced7a5c03461056.tar.gz
gnu: Add stalin.
* gnu/packages/scheme.scm (stalin): New variable.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'gnu/packages/scheme.scm')
-rw-r--r--gnu/packages/scheme.scm80
1 files changed, 79 insertions, 1 deletions
diff --git a/gnu/packages/scheme.scm b/gnu/packages/scheme.scm
index dba5067e9e..0b15ea8376 100644
--- a/gnu/packages/scheme.scm
+++ b/gnu/packages/scheme.scm
@@ -9,6 +9,7 @@
 ;;; Copyright © 2017 John Darrington <jmd@gnu.org>
 ;;; Copyright © 2017 Clément Lassieur <clement@lassieur.org>
 ;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2018 Adam Massmann <massmannak@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -356,7 +357,7 @@ mashups, office (web agendas, mail clients, ...), etc.")
      `(#:modules ((guix build gnu-build-system)
                   (guix build utils)
                   (srfi srfi-1))
-       
+
        ;; No `configure' script; run "make check" after "make install" as
        ;; prescribed by README.
        #:phases
@@ -1025,3 +1026,80 @@ the same program, without any interference between them.  Foreign functions in C
 can be added and values can be defined in the Scheme environment.  Being quite a
 small program, it is easy to comprehend, get to grips with, and use.")
     (license bsd-3)))                   ; there are no licence headers
+
+(define-public stalin
+  (let ((commit "ed1c9e339c352b7a6fee40bb2a47607c3466f0be"))
+    ;; FIXME: The Stalin "source" contains C code generated by itself:
+    ;; 'stalin-AMD64.c', etc.
+    (package
+      (name "stalin")
+      (version "0.11")
+      (source (origin
+                ;; Use Pearlmutter's upstream branch with AMD64 patches
+                ;; applied. Saves us from including those 20M! patches
+                ;; in Guix. For more info, see:
+                ;; <ftp.ecn.purdue.edu/qobi/stalin-0.11-amd64-patches.tgz>
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/barak/stalin.git")
+                      (commit commit)))
+                (file-name (string-append name "-" version "-checkout"))
+                (sha256
+                 (base32
+                  "15a5gxj9v7jqlgkg0543gdflw0rbrir7fj5zgifnb33m074wiyhn"))
+                (modules '((guix build utils)))
+                (snippet
+                 ;; remove gc libs from build, we have them as input
+                 '(begin
+                    (delete-file "gc6.8.tar.gz")
+                    (delete-file-recursively "benchmarks")
+                    (substitute* "build"
+                      ((".*gc6.8.*") "")
+                      (("  cd \\.\\.") "")
+                      ((".*B include/libgc.a") "")
+                      ((".*make.*") ""))
+                    #t))))
+      (build-system gnu-build-system)
+      (arguments
+       `(#:make-flags (list "ARCH_OPTS=-freg-struct-return")
+         #:phases
+         (modify-phases %standard-phases
+           (replace 'configure
+             (lambda* (#:key outputs #:allow-other-keys)
+               (let* ((out (assoc-ref outputs "out"))
+                      (include-out (string-append out "/include")))
+                 (invoke "./build")
+                 (for-each (lambda (fname)
+                             (install-file fname include-out))
+                           (find-files "include"))
+                 (substitute* "makefile"
+                   (("\\./include") include-out))
+                 (substitute* "post-make"
+                   (("`pwd`") out))
+                 #t)))
+           (delete 'check)
+           (replace 'install
+             (lambda* (#:key outputs #:allow-other-keys)
+               (let ((out (assoc-ref outputs "out")))
+                 (install-file "stalin.1"
+                               (string-append out "/share/man/man1"))
+                 (install-file "stalin"
+                               (string-append out "/bin"))
+                 #t))))))
+      (inputs
+       `(("libx11" ,libx11)))
+      (propagated-inputs
+       `(("libgc" ,libgc)))
+      (supported-systems '("x86_64-linux"))
+      (home-page "https://engineering.purdue.edu/~qobi/papers/fdlcc.pdf")
+      (synopsis "Brutally efficient Scheme compiler")
+      (description
+       "Stalin is an aggressively optimizing whole-program compiler
+for Scheme that does polyvariant interprocedural flow analysis,
+flow-directed interprocedural escape analysis, flow-directed
+lightweight CPS conversion, flow-directed lightweight closure
+conversion, flow-directed interprocedural lifetime analysis, automatic
+in-lining, unboxing, and flow-directed program-specific and
+program-point-specific low-level representation selection and code
+generation.")
+      (license gpl2+))))