unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] gnu: Add CCL.
@ 2015-02-15 23:59 Taylan Ulrich Bayırlı/Kammer
  2015-02-23 21:46 ` Ludovic Courtès
  0 siblings, 1 reply; 3+ messages in thread
From: Taylan Ulrich Bayırlı/Kammer @ 2015-02-15 23:59 UTC (permalink / raw)
  To: guix-devel

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

This uses a precompiled lisp heap image, which cannot be generated
without already having another version of itself (not even another CL
implementation), so it's perfect breeding ground for a Thompson
hack. :-)

I've been told to wait for Ludovic's input on whether the package is
acceptable, due to the heap image issue, so postpone reviewing it if you
want.

Also, I assume there's no need to regenerate the heap image, unlike the
"lisp kernel" which is a C program and therefore needs to be compiled by
us to have its rpath and such fixed.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-diff, Size: 5893 bytes --]

From bf6f00133ab1b18ecd07d6f217376fb1ca1b3bd5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Taylan=20Ulrich=20Bay=C4=B1rl=C4=B1/Kammer?=
 <taylanbayirli@gmail.com>
Date: Mon, 16 Feb 2015 00:46:12 +0100
Subject: [PATCH] gnu: Add CCL.

* gnu/packages/lisp.scm (ccl): New variable.
---
 gnu/packages/lisp.scm | 108 +++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 107 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/lisp.scm b/gnu/packages/lisp.scm
index fe9cdab..de6a170 100644
--- a/gnu/packages/lisp.scm
+++ b/gnu/packages/lisp.scm
@@ -36,7 +36,10 @@
   #:use-module (gnu packages readline)
   #:use-module (gnu packages libsigsegv)
   #:use-module (gnu packages admin)
-  #:use-module (gnu packages ed))
+  #:use-module (gnu packages ed)
+  #:use-module (gnu packages m4)
+  #:use-module (gnu packages version-control)
+  #:use-module (ice-9 match))
 
 (define-public gcl
   (package
@@ -278,3 +281,106 @@ statistical profiler, a code coverage tool, and many other extensions.")
     ;; loop macro has its own license.  See COPYING file for further notes.
     (license (list license:public-domain license:bsd-2
                    (license:x11-style "file://src/code/loop.lisp")))))
+
+(define-public ccl
+  (package
+    (name "ccl")
+    (version "1.10")
+    (source #f)
+    (build-system gnu-build-system)
+    ;; CCL consists of a "lisp kernel" and "heap image", both of which are
+    ;; shipped in precompiled form in source tarballs.  The former is a C
+    ;; program which we can rebuild from scratch, but the latter cannot be
+    ;; generated without an already working copy of CCL, and is platform
+    ;; dependent, so we need to fetch the correct tarball for the platform.
+    (inputs
+     `(("ccl"
+        ,(origin
+           (method url-fetch)
+           (uri (string-append
+                 "ftp://ftp.clozure.com/pub/release/1.10/ccl-" version "-"
+                 (match (%current-system)
+                   ((or "i686-linux" "x86_64-linux") "linuxx86")
+                   ("armhf-linux" "linuxarm"))
+                 ".tar.gz"))
+           (sha256
+            (base32
+             (match (%current-system)
+               ((or "i686-linux" "x86_64-linux")
+                "0mr653q5px05lr11z2mk551m5g47b4wq96vbfibpp0qlc9jp58lc")
+               ("armhf"
+                "1py02irpmi2qz5rq3h33wfv6impf15z8i2rign6hvhlqn7s99wwh"))))))))
+    (native-inputs
+     `(("m4" ,m4)
+       ("subversion" ,subversion)))
+    (arguments
+     `(#:tests? #f                      ;no 'check' target
+       #:phases
+       (alist-replace
+        'unpack
+        (lambda* (#:key inputs #:allow-other-keys)
+          (and (zero? (system* "tar" "xzvf" (assoc-ref inputs "ccl")))
+               (begin (chdir "ccl") #t)))
+        (alist-delete
+         'configure
+         (alist-cons-before
+          'build 'pre-build
+          ;; Enter the source directory for the current platform's lisp
+          ;; kernel, and run 'make clean' to remove the precompiled one.
+          (lambda _
+            (chdir (string-append
+                    "lisp-kernel/"
+                    ,(match (or (%current-target-system) (%current-system))
+                       ("i686-linux" "linuxx8632")
+                       ("x86_64-linux" "linuxx8664")
+                       ("armhf-linux" "linuxarm"))))
+            (substitute* '("Makefile")
+              (("/bin/rm") "rm"))
+            (setenv "CC" "gcc")
+            (zero? (system* "make" "clean")))
+          ;; XXX Do we need to recompile the heap image as well for Guix?
+          ;; For now just use the one we already got in the tarball.
+          (alist-replace
+           'install
+           (lambda* (#:key outputs inputs #:allow-other-keys)
+             ;; The lisp kernel built by running 'make' in lisp-kernel/$system
+             ;; is put back into the original directory, so go back.  The heap
+             ;; image is there as well.
+             (chdir "../..")
+             (let* ((out (assoc-ref outputs "out"))
+                    (libdir (string-append out "/lib/"))
+                    (bindir (string-append out "/bin/"))
+                    (wrapper (string-append bindir "ccl"))
+                    (bash (assoc-ref inputs "bash"))
+                    (kernel
+                     ,(match (or (%current-target-system) (%current-system))
+                        ("i686-linux" "lx86cl")
+                        ("x86_64-linux" "lx86cl64")
+                        ("armhf-linux" "armcl")))
+                    (heap (string-append kernel ".image")))
+               (mkdir-p libdir)
+               (mkdir-p bindir)
+               (copy-file kernel (string-append libdir kernel))
+               (copy-file heap (string-append libdir heap))
+               (with-output-to-file wrapper
+                 (lambda ()
+                   (display
+                    (string-append
+                     "#!" bash "/bin/sh\n"
+                     "if [ -z \"$CCL_DEFAULT_DIRECTORY\" ]; then\n"
+                     "    CCL_DEFAULT_DIRECTORY=" libdir "\n"
+                     "fi\n"
+                     "export CCL_DEFAULT_DIRECTORY\n"
+                     "exec " libdir kernel "\n"))))
+               (chmod wrapper #o755)))
+           %standard-phases))))))
+    (home-page "http://ccl.clozure.com/")
+    (synopsis "Common Lisp implementation")
+    (description "Clozure CL (often called CCL for short) is a Common Lisp
+implementation featuring fast compilation speed, native threads, a precise,
+generational, compacting garbage collector, and a convenient foreign-function
+interface.")
+    ;; See file doc/LICENSE for clarifications it makes regarding how the LGPL
+    ;; applies to Lisp code according to them.
+    (license (list license:lgpl2.1
+                   license:clarified-artistic)))) ;TRIVIAL-LDAP package
-- 
2.2.1


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

* Re: [PATCH] gnu: Add CCL.
  2015-02-15 23:59 [PATCH] gnu: Add CCL Taylan Ulrich Bayırlı/Kammer
@ 2015-02-23 21:46 ` Ludovic Courtès
  2015-02-23 22:14   ` Taylan Ulrich Bayırlı/Kammer
  0 siblings, 1 reply; 3+ messages in thread
From: Ludovic Courtès @ 2015-02-23 21:46 UTC (permalink / raw)
  To: Taylan Ulrich "Bayırlı/Kammer"; +Cc: guix-devel

taylanbayirli@gmail.com (Taylan Ulrich "Bayırlı/Kammer") skribis:

> This uses a precompiled lisp heap image, which cannot be generated
> without already having another version of itself (not even another CL
> implementation), so it's perfect breeding ground for a Thompson
> hack. :-)
>
> I've been told to wait for Ludovic's input on whether the package is
> acceptable, due to the heap image issue, so postpone reviewing it if you
> want.

I think this is an unfortunate but common bootstrapping problem for
compilers (MIT/GNU Scheme, GCJ/ECJ/IcedTea, GHC, etc.) and there’s not
much we can do about it when the upstream maintainers don’t provide a
way to bootstrap from source.  So I think that’s not great, but that’s
acceptable.

[...]

> +             (match (%current-system)
> +               ((or "i686-linux" "x86_64-linux")
> +                "0mr653q5px05lr11z2mk551m5g47b4wq96vbfibpp0qlc9jp58lc")
> +               ("armhf"
> +                "1py02irpmi2qz5rq3h33wfv6impf15z8i2rign6hvhlqn7s99wwh"))))))))

Please add a ‘supported-systems’ field that lists those 3 systems.

OK to push with this change.

> +    (license (list license:lgpl2.1
> +                   license:clarified-artistic)))) ;TRIVIAL-LDAP package

TRIVIAL-LDAP?

Thanks!

Ludo’.

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

* Re: [PATCH] gnu: Add CCL.
  2015-02-23 21:46 ` Ludovic Courtès
@ 2015-02-23 22:14   ` Taylan Ulrich Bayırlı/Kammer
  0 siblings, 0 replies; 3+ messages in thread
From: Taylan Ulrich Bayırlı/Kammer @ 2015-02-23 22:14 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

ludo@gnu.org (Ludovic Courtès) writes:

>> +    (license (list license:lgpl2.1
>> +                   license:clarified-artistic)))) ;TRIVIAL-LDAP package
>
> TRIVIAL-LDAP?

Just the name of some CL package.

Thanks for the review; pushed with the change you requested.

Taylan

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

end of thread, other threads:[~2015-02-23 22:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-15 23:59 [PATCH] gnu: Add CCL Taylan Ulrich Bayırlı/Kammer
2015-02-23 21:46 ` Ludovic Courtès
2015-02-23 22:14   ` Taylan Ulrich Bayırlı/Kammer

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).