[armedbear-devel] patch to compile with ecl

Pascal J. Bourguignon pjb at informatimago.com
Sun Nov 21 02:42:12 UTC 2010


Here is a patch to allow ecl compile abcl (it fails however).

I also had problems with ZEROP stumbling on NIL, so I rather brutishly 
replaced most of its occurences with EQUAL 0.   run-shell-command will
need some work...

[pjb at kuiper :0.0 abcl-svn]$ svn diff
Index: build-abcl.lisp
===================================================================
--- build-abcl.lisp	(revision 13040)
+++ build-abcl.lisp	(working copy)
@@ -69,9 +69,9 @@
   #+clisp
   (cond ((member :win32 *features*)
          :windows)
-        ((zerop (ext:run-shell-command "uname | grep -i darwin" :output nil))
+        ((equal 0 (ext:run-shell-command "uname | grep -i darwin" :output nil))
          :darwin)
-        ((zerop (ext:run-shell-command "uname | grep -i linux" :output nil))
+        ((equal 0 (ext:run-shell-command "uname | grep -i linux" :output nil))
          :linux)
         (t
          :unknown)))
@@ -94,7 +94,7 @@
                                "\" && "
                                command)))
   (sb-ext:process-exit-code
-   (sb-ext:run-program
+   (sb-ext:run-program 
     "/bin/sh"
     (list  "-c" command)
     :input nil :output output)))
@@ -168,7 +168,24 @@
     (declare (ignore status))
     exitcode))
 
-#+(or sbcl cmu lispworks openmcl)
+#+ecl 
+(defun run-shell-command (command &key directory (output *standard-output*))
+  (when directory
+    (setf command (concatenate 'string
+                    "\\cd \""
+                    (namestring (pathname directory))
+                    "\" && "
+                    command)))
+  (let ((result (si:run-program 
+                 "/bin/sh"
+                 (list  "-c" command)
+                 :input nil :output output)))
+    (if (null result)
+        -1
+        result)))
+
+
+#+(or sbcl cmu lispworks openmcl ecl)
 (defun probe-directory (pathspec)
   (let* ((truename (probe-file pathspec)) ; TRUENAME is a pathname.
          (namestring (and truename (namestring truename)))) ; NAMESTRING is a string.
@@ -285,7 +302,7 @@
 
 (defun java-compile-file (source-file)
   (let ((cmdline (build-javac-command-line source-file)))
-    (zerop (run-shell-command cmdline :directory *abcl-dir*))))
+    (equal 0 (run-shell-command cmdline :directory *abcl-dir*))))
 
 (defun make-classes (force batch)
   (let* ((source-files
@@ -330,7 +347,7 @@
                                        s)
                                       (princ #\space s))))
                          (status (run-shell-command cmdline :directory *abcl-dir*)))
-                    (zerop status)))
+                    (equal 0 status)))
                  (t
                   (ensure-directories-exist *build-root*)
                   (dolist (source-file source-files t)
@@ -350,7 +367,7 @@
       (copy-with-substitutions source-file target-file substitutions-alist)
       (ensure-directories-exist *dist-root*)
       (let ((status (run-shell-command command :directory *tree-root*)))
-        (unless (zerop status)
+        (unless (equal 0 status)
           (format t "~A returned ~S~%" command status))
         status))))
 
@@ -489,13 +506,13 @@
     (when (or full compile-system)
       (let* ((zip    (if (or full jar) nil t))
              (status (do-compile-system :zip zip)))
-        (unless (zerop status)
+        (unless (equal 0 status)
           (format t "Build failed.~%")
           (return-from build-abcl nil))))
     ;; abcl.jar
     (when (or full jar)
       (let ((status (make-jar)))
-        (unless (zerop status)
+        (unless (equal 0 status)
           (format t "Build failed.~%")
           (return-from build-abcl nil))))
     ;; abcl/abcl.bat
@@ -518,7 +535,7 @@
                         (princ #\space s)))
                     (princ "--main=org.armedbear.lisp.Main -o lisp" s)))
          (result (run-shell-command cmdline :directory *abcl-dir*)))
-    (zerop result)))
+    (equal 0 result)))
 
 (defvar *copy-verbose* nil)
 
@@ -591,11 +608,11 @@
                             (namestring parent-dir)
                             version-string version-string))
            (status (run-shell-command command :directory parent-dir)))
-      (unless (zerop status)
+      (unless (equal 0 status)
         (format t "~A returned ~S~%" command status)))
     (let* ((command (format nil "zip -q -r ~A~A.zip ~A"
                             (namestring parent-dir)
                             version-string version-string))
            (status (run-shell-command command :directory parent-dir)))
-      (unless (zerop status)
+      (unless (equal 0 status)
         (format t "~A returned ~S~%" command status)))))
Index: build-from-lisp.sh
===================================================================
--- build-from-lisp.sh	(revision 13040)
+++ build-from-lisp.sh	(working copy)
@@ -72,6 +72,11 @@
     exec "$1" --load "$2" --eval "(progn $3 (ext:quit))"
 }
 
+ecl()
+{
+    exec "$1" -norc -load "$2" -eval "(progn $3 (ext:quit))"
+}
+
 clisp()
 { 
     exec "$1" -ansi -q -norc -i "$2" -x "(progn $3 (ext:quit))"
@@ -120,7 +125,7 @@
     gcl*)
         notimplemented "$IMPL" "$FILE" "$FORM" ;;
     ecl*)
-        notimplemented "$IMPL" "$FILE" "$FORM" ;;
+        ecl   "$IMPL" "$FILE" "$FORM"          ;;
     alisp*)
         notimplemented "$IMPL" "$FILE" "$FORM" ;;
     *)


-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
A bad day in () is better than a good day in {}.





More information about the armedbear-devel mailing list