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@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" ;; *)
On 11/21/10 3:42 AM, Pascal J. Bourguignon wrote:
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...
Thanks for the starting point. The attached patch allows ecl-10.4.1 to build ABCL and has been included in [ABCL trunk as r13041][1].
I used EXT:SYSTEM instead of EXT:RUN-PROGRAM for the shell command interface. Although with this approach there doesn't seem to be a reliable way to redirect the output, at least it reliably returns the exit status correctly. In ecl-10.4.1 there's an undocumented :WAIT keyword to EXT:RUN-PROGRAM that allows one to read the output from the subprocess as it happens, but then doesn't seem to return the exit status from the command. Without the :WAIT nil versioncommand, I wasn't able to reliably read the output. One can see my commented out implementation on line 181ff. if one is interested in experimenting here.
I refactored the BUILD-ABCL approach a bit to give better diagnostics, and somewhat saner structure, but I wouldn't say I'm really satisfied. I expect there will be real problems working under the various Windows-based Lisps that I'm not currently in a great position to regression test. So, I'm not proposing to include support for ecl in abcl-0.23.0, preferring to get more time to test and season the implementation.
[1]: http://trac.common-lisp.net/armedbear/changeset/13041
On Sun, Nov 21, 2010 at 1:50 PM, Mark Evenson evenson@panix.com wrote:
On 11/21/10 3:42 AM, Pascal J. Bourguignon wrote:
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...
CLHS specifies that the argument to ZEROP is a number. SBCL also barks on the form (ZEROP nil).
On the other hand, do you have any reason to prefer (EQUAL 0 ..) over (EQL 0 ...)?
-- Gaby
Gabriel Dos Reis gdr@integrable-solutions.net writes:
On Sun, Nov 21, 2010 at 1:50 PM, Mark Evenson evenson@panix.com wrote:
On 11/21/10 3:42 AM, Pascal J. Bourguignon wrote:
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...
CLHS specifies that the argument to ZEROP is a number. SBCL also barks on the form (ZEROP nil).
On the other hand, do you have any reason to prefer (EQUAL 0 ..) over (EQL 0 ...)?
Indeed, (EQL 0 ...) is perfectly good.
On Sat, Nov 20, 2010 at 8:42 PM, Pascal J. Bourguignon pjb@informatimago.com wrote:
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...
Great! I had almost the same mod in my local copy for a weak. I did not have the courage to finish as I got distracted by other stuff. I hope the ABCL people polish it and get it into trunk.
-- Gaby
On 11/22/10 1:59 AM, Gabriel Dos Reis wrote:
On Sat, Nov 20, 2010 at 8:42 PM, Pascal J. Bourguignon pjb@informatimago.com wrote:
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...
Great! I had almost the same mod in my local copy for a weak. I did not have the courage to finish as I got distracted by other stuff. I hope the ABCL people polish it and get it into trunk.
As noted in my reply to Pascal, I committed a version of this patch in [trunk as of r13041][1].
[1]: http://trac.common-lisp.net/armedbear/changeset/13041
On 11/22/10 8:47 AM, Mark Evenson wrote:
As noted in my reply to Pascal, I committed a version of this patch in [trunk as of r13041][1].
An inadvertent typo somehow crept in: please use [r13042][1]
[1]: http://trac.common-lisp.net/armedbear/changeset/13042
armedbear-devel@common-lisp.net