Subject: Re: Executables: Why all the abuse?
From: rpw3@rpw3.org (Rob Warnock)
Date: Tue, 03 Feb 2004 06:03:54 -0600
Newsgroups: comp.lang.lisp
Message-ID: <apadneArz8m3E4LdXTWc-g@speakeasy.net>
Rayiner Hashem <heliosc@mindspring.com> wrote:
+---------------
| ... If CMUCL spit out a small binary that
| linked with "libcmucl.so" or "cmucl.dll" end-user Lisp apps would
| become much more palatable. It doesn't matter if the binary is 500KB
| but libcmucl.dll is 11.5MB --- the difference in perception is huge.
+---------------

Done. All you need is a CMUCL core image with a "#!" reader macro
that acts like a comment, then concatenate the following onto the
front of your FASL files (as noted):

  #!/usr/local/bin/cmucl
  ;;;; Hack to allow CMUCL FASL files to run as shell scripts.
  ;;;; Usage: cat {this_file} foo1.x86f ... fooN.x86f > foo ; chmod +x foo
  ;;;; The last "fooN.x86f" should have a top-level form which starts the app.
  (let* ((my-name (second *command-line-strings*))
	 (stream (open *script-name* :element-type '(unsigned-byte 8))))
    (dotimes (i 9) (read-line stream)) ; Eat header text from stream, then
    (load stream :contents :binary)    ;   pass rest to FASLOAD.
    (continue))   ; Keep LOAD of script from falling into FASL file(s).

The "libcmucl.so" is actually two files, a small executable (".../bin/lisp")
and a larger core file (".../lib/cmucl/lib/lisp.core"), but the point is
that it would be shared by all of the "executables" you deliver.


-Rob

-----
Rob Warnock			<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607