ecl versus defsystem?



>>>>> "James" == James Amundson <amundson at users.sourceforge.net> writes:

    James> Yes. Short version: because I couldn't figure out how to build Maxima
    James> with defsystem and an asdf solution was presented to me.

    James> Long version: For all other lisps, we create a maxima image through
    James> defsystem by compiling, loading and then dumping the resulting
    James> image. Ecl doesn't have a "dump image" concept, it compiles an
    James> application by linking together object files in some manner the
    James> details of which I have not tried to understand. Ecl comes with a
    James> customized asdf that builds applications with a single command.

Here is a partial solution for defystem.  Use the following replacement
functions in maxima.system.  

(defun do-compile-ecl (&rest args)
  (apply #'compile-file (append args (list :system-p t)))
  (let ((file (first args))
	(output (getf (cdr args) :output-file)))
    (c:build-fasl (compile-file-pathname output :type :fasl)
		  :lisp-files (list (compile-file-pathname output :type :object)))))

(defun build-maxima-lib ()
  (labels ((list-all-objects (module)
             (if (eql (mk::component-type module) :file)
		 (list (mk::component-full-pathname module :binary))
		 (apply #'append (mapcar #'list-all-objects (mk::component-components module))))))
    (let* ((files (list-all-objects (mk:find-system 'maxima)))
	   (obj (mapcar #'(lambda (p)
			    (make-pathname :type "o" :defaults p))
			files)))
      (c::build-program "binary-ecl/maxima" :lisp-files obj))))

You'll probably also want to comment out the :compiler-options for ecl
since do-compile-ecl handles that.  Finally, you'll need to adjust the
system definition to load ecl-port.lisp:

	       (:module package :source-pathname ""
			#-ecl :load-only #-ecl t
			:components (#-gcl(:file "maxima-package")
					  #+ecl (:file "ecl-port")
					  (:file "autoconf-variables")))

>From the src directory, I started ecl, loaded defsystem.lisp and
maxima.system, and ran (mk:oos "maxima" :compile).  Then you have to
run (cl-user::build-maxima-lib) to create binary-ecl/maxima.  (The
:finally-do doesn't seem to run.)

Everything seems to work and the testsuite passes.

One nice side-effect:  The binary goes in binary-ecl and doesn't trash
src/maxima.

I did not try to integrate this into the Makefile.  Shouldn't be too hard.

Ray