Commit d1752750 authored by Stelian Ionescu's avatar Stelian Ionescu
Browse files

Update wrapper to cl-launch 2.16

parent 42d96f24
#!/bin/sh
#| CL-LAUNCH 2.07 CONFIGURATION
#| CL-LAUNCH 2.16 CONFIGURATION
SOFTWARE_FILE=.
SOFTWARE_SYSTEM=
SOFTWARE_INIT_FORMS=
SYSTEMS_PATHS=
INCLUDE_PATH=
LISPS="cmucl sbcl clisp ecl openmcl gclcvs allegro lisp gcl"
LISPS="sbcl clisp ccl cmucl ecl gclcvs allegro lispworks lisp gcl"
WRAPPER_CODE=
DUMP=
RESTART=
......@@ -14,7 +14,7 @@ IMAGE_DIR=
IMAGE=
# END OF CL-LAUNCH CONFIGURATION
# This file was generated by CL-Launch 2.07
# This file was generated by CL-Launch 2.16
# This file was automatically generated and contains parts of CL-Launch
#
# Please send your improvements to the author:
......@@ -40,7 +40,7 @@ IMAGE=
# http://www.livejournal.com/users/fare/21806.html
#
PROG="$0"
# cl-launch 2.07 shell wrapper
# cl-launch 2.16 shell wrapper
# Find and execute the most appropriate supported Lisp implementation
# to evaluate software prepared with CL-Launch.
#
......@@ -60,10 +60,12 @@ DO_LISP=do_exec_lisp
HASH_BANG_FORM='(set-dispatch-macro-character #\# #\! #'\''(lambda(stream char arg)(declare(ignore char arg))(values (read-line stream))))'
PACKAGE_FORM=" #.(progn(defpackage :cl-launch (:use :cl))())"
MAYBE_PACKAGE_FORM=
PROGN="(progn"
NGORP=")"
implementation_cmucl () {
implementation "${CMUCL:-cmucl}" || return 1
OPTIONS="${CMUCL_OPTIONS:- -quiet -batch -noinit}"
OPTIONS="${CMUCL_OPTIONS:- -quiet -noinit}"
EVAL=-eval
ENDARGS=--
IMAGE_ARG=-core
......@@ -75,6 +77,9 @@ implementation_cmucl () {
# And so we use exec_lisp_noarg.
BIN_ARG=CMUCL
OPTIONS_ARG=CMUCL_OPTIONS
if [ -z "$CL_LAUNCH_DEBUG" ] ; then
OPTIONS="${OPTIONS} -batch"
fi
}
implementation_lisp () {
implementation ${CMULISP:=lisp} || return 1
......@@ -83,45 +88,59 @@ implementation_lisp () {
}
implementation_sbcl () {
implementation "${SBCL:-sbcl}" || return 1
OPTIONS="${SBCL_OPTIONS:- --noinform --userinit /dev/null --disable-debugger}"
OPTIONS="${SBCL_OPTIONS:- --noinform --userinit /dev/null}"
# We purposefully specify --userinit /dev/null but NOT --sysinit /dev/null
EVAL=--eval # SBCL's eval can only handle one form per argument.
ENDARGS=--end-toplevel-options
IMAGE_ARG=--core
#! IMAGE_ARG=EXECUTABLE_IMAGE # not appropriate: only executable if specified as such
#! DIRECT_EXECUTABLE=t # won't work as of sbcl 0.9.17: we need to modify sbcl
#! so it leaves all argument parsing to the software.
IMAGE_ARG="EXECUTABLE_IMAGE" # we use executable images
# if you want to test non-executable images, uncomment the one below,
# and comment out the :executable t in (defun dump-image ...)
# -IMAGE_ARG=--core
STANDALONE_EXECUTABLE=t # requires sbcl 1.0.21.24 or later.
EXEC_LISP=exec_lisp
BIN_ARG=SBCL
OPTIONS_ARG=SBCL_OPTIONS
if [ -z "$CL_LAUNCH_DEBUG" ] ; then
OPTIONS="${OPTIONS} --disable-debugger"
fi
}
implementation_clisp () {
implementation "${CLISP:-clisp}" || return 1
OPTIONS="${CLISP_OPTIONS:- -norc --quiet --quiet}"
EVAL=-x
LOAD=-i
ENDARGS="-- foo"
ENDARGS="--"
# if the first argument begins with - there might be problems,
# so we avoid that and take the cdr or ext:*args*
IMAGE_ARG=-M # for use without :executable t
#! IMAGE_ARG="EXECUTABLE_IMAGE" # we don't use this by default
#! DIRECT_EXECUTABLE=t # won't work as of unpatched 2.41: we need to modify clisp
#! so it leaves all argument parsing to the software. See for instance
#! http://article.gmane.org/gmane.lisp.clisp.devel/15476
# IMAGE_ARG=-M # for use without :executable t
IMAGE_ARG="EXECUTABLE_IMAGE" # we don't use this by default
STANDALONE_EXECUTABLE=t # will mostly work as of clisp 2.44, but with a (in)security backdoor.
# For details, see the thread at http://sourceforge.net/forum/message.php?msg_id=5532730
EXEC_LISP=exec_lisp
BIN_ARG=CLISP
OPTIONS_ARG=CLISP_OPTIONS
if [ -z "$CL_LAUNCH_DEBUG" ] ; then
OPTIONS="${OPTIONS} -on-error exit"
else
OPTIONS="${OPTIONS} -on-error debug"
fi
}
implementation_lispworks () { ### NEVER TESTED
implementation_lispworks () { ### NOT EXTENSIVELY TESTED
implementation "${LISPWORKS:-lispworks}" || return 1
OPTIONS="${LISPWORKS_OPTIONS:- -siteinit -}" # -init -
LOAD=-init #### No such thing found in the online documentation.
OPTIONS="${LISPWORKS_OPTIONS:- -siteinit - -init -}" #
LOAD=-build #### No such thing found in the online documentation.
#! EVAL=-eval # No such thing found in the online documentation.
#! ENDARGS="--"
IMAGE_ARG="EXECUTABLE_IMAGE" # we don't use this by default
EXEC_LISP=exec_lisp_file
STANDALONE_EXECUTABLE=t
BIN_ARG=LISPWORKS
OPTIONS_ARG=LISPWORKS_OPTIONS
if [ -z "$CL_LAUNCH_DEBUG" ] ; then
: # OPTIONS="${OPTIONS} ..."
else
: # OPTIONS="${OPTIONS} ..."
fi
}
prepare_arg_form () {
ENDARGS= F=
......@@ -158,24 +177,36 @@ implementation_clisp_file () {
EXEC_LISP=exec_lisp_file
# For testing purposes
}
implementation_openmcl () {
implementation "${OPENMCL:-openmcl}" || return 1
OPTIONS="${OPENMCL_OPTIONS:- --no-init --batch}"
implementation_ccl () {
# ClozureCL, nee OpenMCL, forked from MCL, formerly Macintosh Common Lisp, nee Coral Common Lisp
implementation "${CCL:-ccl}" || return 1
OPTIONS="${CCL_OPTIONS:- --no-init}"
EVAL=--eval # -e
IMAGE_ARG=--image-name # -I
# IMAGE_ARG=--image-name # -I
IMAGE_ARG=EXECUTABLE_IMAGE # depends on our using :prepend-kernel t
ENDARGS=--
# (finish-output) is essential for openmcl, that won't do it by default,
# (finish-output) is essential for ccl, that won't do it by default,
# unlike the other lisp implementations tested.
EXEC_LISP=exec_lisp_noarg
# exec_lisp will work great for 1.1, but 1.1 isn't there yet,
EXEC_LISP=exec_lisp
# exec_lisp will work great for 1.1 and later.
# For earlier versions, use exec_lisp_arg instead:
# 1.0 doesn't support --, and the latest 1.1-pre060826 snapshot has a bug
# whereby it doesn't stop at -- when looking for a -I or --image-file argument.
BIN_ARG=OPENMCL
OPTIONS_ARG=OPENMCL_OPTIONS
BIN_ARG=CCL
OPTIONS_ARG=CCL_OPTIONS
if [ -z "$CL_LAUNCH_DEBUG" ] ; then
OPTIONS="${OPTIONS} --batch"
fi
}
implementation_openmcl () {
implementation "${OPENMCL:=openmcl}" || return 1
CCL="$OPENMCL"
CCL_OPTIONS="$OPENMCL_OPTIONS"
implementation_ccl "$@" && BIN_ARG=OPENMCL
}
implementation_gcl () {
implementation "${GCL:-gcl}" || return 1
OPTIONS="${GCL_OPTIONS:- -batch}"
OPTIONS="${GCL_OPTIONS}"
EVAL=-eval
ENDARGS=--
IMAGE_ARG=EXECUTABLE_IMAGE
......@@ -183,6 +214,9 @@ implementation_gcl () {
OPTIONS_ARG=GCL_OPTIONS
export GCL_ANSI=t
EXEC_LISP=exec_lisp
if [ -z "$CL_LAUNCH_DEBUG" ] ; then
OPTIONS="${OPTIONS} -batch"
fi
}
implementation_ecl () {
implementation "${ECL:-ecl}" || return 1
......@@ -191,13 +225,16 @@ implementation_ecl () {
ENDARGS=--
#IMAGE_ARG="-q -load" # for :fasl
IMAGE_ARG="EXECUTABLE_IMAGE" # for :program
DIRECT_EXECUTABLE=t
STANDALONE_EXECUTABLE=t
BIN_ARG=ECL
OPTIONS_ARG=ECL_OPTIONS
EXEC_LISP=exec_lisp
if [ -n "$CL_LAUNCH_DEBUG" ] ; then
PROGN="(handler-bind((error'invoke-debugger))(progn(set'si::*break-enable*'t)"
NGORP="))"
fi
# work around brokenness in c-l-c packaging of ECL,
# at least as of ecl 0.9i-2 and c-l-c 6.2
# at least still as of ecl 0.9j-20080306-4 and c-l-c 6.17
if [ -z "$ECL" ] &&
[ "/usr/bin/ecl" = "$LISP_BIN" ] &&
[ -x "/usr/lib/ecl/ecl-original" ] ; then
......@@ -211,19 +248,29 @@ implementation_gclcvs () {
}
implementation_allegro () {
implementation "${ALLEGRO:-acl}" || return 1
OPTIONS="${ALLEGRO_OPTIONS:- -QQ -qq -batch}"
OPTIONS="${ALLEGRO_OPTIONS:- -QQ -qq}"
EVAL=-e
ENDARGS=--
IMAGE_ARG=-I
EXEC_LISP=exec_lisp
BIN_ARG=ALLEGRO
OPTIONS_ARG=ALLEGRO_OPTIONS
if [ -z "$CL_LAUNCH_DEBUG" ] ; then
OPTIONS="${OPTIONS} -batch -backtrace-on-error"
fi
}
implementation () {
if [ -x "$1" ] ; then
if [ -n "$USE_CLBUILD" ] ; then
if CLBUILD_BIN="`which clbuild 2> /dev/null`" ; then
LISP_BIN="$CLBUILD_BIN --implementation $IMPL lisp"
return 0
else
return 1
fi
elif [ -x "$1" ] ; then
LISP_BIN="$1"
return 0
elif LISP_BIN=`which "$1" 2> /dev/null` ; then
elif LISP_BIN="`which "$1" 2> /dev/null`" ; then
return 0
else
return 1
......@@ -234,6 +281,13 @@ trylisp () {
implementation_${IMPL} "$@"
}
do_exec_lisp () {
if [ -n "$IMAGE" ] ; then
if [ "x$IMAGE_ARG" = xEXECUTABLE_IMAGE ] ; then
LISP_BIN= IMAGE_OPT=
else
IMAGE_OPT="$IMAGE_ARG"
fi
fi
$EXEC_LISP "$@"
}
no_implementation_found () {
......@@ -262,7 +316,15 @@ exec_lisp () {
# must quit before it may return to the clisp frame that would print its value.
# CMUCL allows multiple forms per -eval and won't print values, so is ok anyway.
# I don't know about other Lisps, but they will all work this way.
LAUNCH_FORM="(progn${MAYBE_PACKAGE_FORM}${HASH_BANG_FORM}${LAUNCH_FORMS})"
LAUNCH_FORM="${PROGN}${MAYBE_PACKAGE_FORM}${HASH_BANG_FORM}${LAUNCH_FORMS}${NGORP}"
### This is partial support for CLBUILD.
if [ -n "$USE_CLBUILD" ] ; then
if [ -z "$IMAGE_OPT" ] ; then
OPTIONS=
else
ABORT "Cannot use clbuild with a non-executable image different from clbuild's"
fi
fi
if [ -n "$CL_LAUNCH_VERBOSE" ] ; then set -x ; fi
exec $LISP_BIN $IMAGE_OPT $IMAGE $OPTIONS $EVAL "$LAUNCH_FORM" $ENDARGS "$@"
}
......@@ -294,7 +356,8 @@ eval "$WRAPPER_CODE"
launch_self "$@"
ABORT
# |#
#| ;;; cl-launch 2.07 lisp header
#+xcvb (module ())
#| ;;; cl-launch 2.16 lisp header
|# ;;;; Silence our lisp implementation for quiet batch use...
#| We'd like to evaluate as little as possible of the code without compilation.
......@@ -339,7 +402,7 @@ ABORT
outputs a tag plus a list of source expressions and their resulting values, returns the last values"
(let ((res (gensym))(f (gensym)))
`(let ((,res))
(flet ((,f (fmt &rest args) (apply #'format *error-output* fmt args)))
(flet ((,f (fmt &rest args) (apply #'format *trace-output* fmt args)))
(,f "~&~A~%" ,tag)
,@(mapcan
#'(lambda (x)
......@@ -357,32 +420,10 @@ outputs a tag plus a list of source expressions and their resulting values, retu
clc::source-root-path-to-fasl-path
clc::alternative-root-path-to-fasl-path
clc::*redirect-fasl-files-to-cache*))
#+ecl
(map () #'import
'(c::system-ld-flag
c::library-type-p
c::built-type-p
c::builder
c::build-fasl
c::wt-filtered-data
c::init-function-name
c::data-init
c::compiler-cc
c::linker-cc
c::shared-cc
c::bundle-cc
c::safe-system
c::cmp-delete-file
c::+lisp-program-header+
c::+lisp-program-init+
c::+lisp-program-main+
c::+static-library-prefix+
c::+lisp-program-init+
))
;;; define getenv and quit in ways that minimize package conflicts
;;; (use-package :cl-launch) while in cl-user.
#+(or openmcl allegro gcl clisp ecl)
(import '#+openmcl ccl::getenv
#+(or clozure allegro gcl clisp ecl)
(import '#+clozure ccl::getenv
#+allegro sys:getenv
#+gcl system:getenv
#+clisp ext:getenv
......@@ -394,17 +435,17 @@ outputs a tag plus a list of source expressions and their resulting values, retu
#+lispworks (lispworks:environment-variable x)
#+cmu (cdr (assoc (intern x :keyword) ext:*environment-list*)))
(defun quit (&optional (code 0) (finish-output t))
(when finish-output ;; essential, for openmcl, and for standard compliance.
(when finish-output ;; essential, for ClozureCL, and for standard compliance.
(finish-outputs))
#+cmu (unix:unix-exit code)
#+clisp (ext:quit code)
#+sbcl (sb-unix:unix-exit code)
#+openmcl (ccl:quit code)
#+clozure (ccl:quit code)
#+gcl (lisp:quit code)
#+allegro (excl:exit code :quiet t)
#+ecl (si:quit code)
#+lispworks (lispworks:quit :status code :confirm nil :return nil :ignore-errors-p t)
#-(or cmu clisp sbcl openmcl gcl allegro ecl lispworks)
#-(or cmu clisp sbcl clozure gcl allegro ecl lispworks)
(error "Quitting not implemented")))
#-cl-launch (eval-when (:load-toplevel :execute :compile-toplevel)
;;;; Load ASDF
......@@ -415,6 +456,7 @@ outputs a tag plus a list of source expressions and their resulting values, retu
(or (and (getenv "ASDF_PATH") (probe-file (getenv "ASDF_PATH")))
(probe-file (merge-pathnames "src/asdf/asdf.lisp"
(user-homedir-pathname)))
(probe-file "/usr/share/common-lisp/source/cl-asdf/asdf.lisp")
(probe-file "/usr/share/common-lisp/source/asdf/asdf.lisp")))
(when *asdf-path*
(ignore-errors (load *asdf-path* :verbose nil :print nil)))))
......@@ -459,58 +501,72 @@ outputs a tag plus a list of source expressions and their resulting values, retu
;; Provide compatibility with clc 6.2
(defvar *redirect-fasl-files-to-cache* t)
#+ecl
(defun raw-command-line-arguments ()
nil
#+ecl (loop for i from 0 below (si:argc) collect (si:argv i))
#+gcl si:*command-args*
#+cmu extensions:*command-line-strings*
#+clozure ccl:*unprocessed-command-line-arguments*
#+sbcl sb-ext:*posix-argv*
#+allegro sys:command-line-arguments
#+lispworks sys:*line-arguments-list*
#+clisp (cons "--" ext:*args*))
(defun command-line-arguments ()
(loop for i from 1 below (si:argc) collect (si:argv i)))
(let* ((raw (raw-command-line-arguments))
(cooked #+sbcl raw #-sbcl
(if (eq *dumped* :standalone)
raw
(member "--" raw :test 'string-equal))))
(cdr cooked)))
#+gcl-pre2.7 (defun ensure-directories-exist (x) "hope for the best" nil)
(defvar *implementation-name* nil
"The name of the implementation, used to make a directory hierarchy for fasl files")
(defvar *temporary-directory* "/tmp/"
"The name of the implementation, used to make a directory hierarchy for fasl files")
(defun compute-arguments ()
#+gcl (setf system::*tmp-dir* (ensure-directory-name (or (getenv "TMP") "/tmp"))) ; basic lack fixed after gcl 2.7.0-61, but ending / required still on 2.7.0-64.1
(setf *cl-launch-file* (getenv "CL_LAUNCH_FILE")
*temporary-directory* (ensure-directory-name (or (getenv "TMP") "/tmp"))
#+gcl #+gcl system::*tmp-dir* *temporary-directory* ; basic lack fixed after gcl 2.7.0-61, but ending / required still on 2.7.0-64.1
*verbose* (when (getenv "CL_LAUNCH_VERBOSE") t)
*lisp-fasl-cache* (let* ((cache-env (getenv "LISP_FASL_CACHE"))
(cache-spec
(cond
((null cache-env)
(merge-pathnames
#p".cache/lisp-fasl/"
;;(make-pathname :directory (list :relative ".cache" "lisp-fasl"))
(user-homedir-pathname)))
((equal cache-env "NIL") nil)
(t (dirname->pathname cache-env)))))
#+gcl-pre2.7 cache-spec #-gcl-pre2.7
(when cache-spec
(ensure-directories-exist cache-spec)
(resolve-symlinks cache-spec)))
*lisp-fasl-root* (let* ((root-env
(when (getenv "LISP")
(let ((r (getenv "LISP_FASL_ROOT")))
(when r (if (equal r "NIL") :disabled
(dirname->pathname r))))))
(root-spec
(or root-env
(when *lisp-fasl-cache*
(merge-pathnames
(make-pathname
:directory (list :relative *implementation-name*))
*lisp-fasl-cache*)))))
#+gcl-pre2.7 root-spec #-gcl-pre2.7
(when root-spec
(ensure-directories-exist root-spec)
(resolve-symlinks root-spec))))
*implementation-name* (unique-directory-name #-ecl *verbose*)
*lisp-fasl-cache*
(let* ((cache-env (getenv "LISP_FASL_CACHE"))
(cache-spec
(cond
((null cache-env)
(merge-pathnames
#p".cache/lisp-fasl/"
;;(make-pathname :directory (list :relative ".cache" "lisp-fasl"))
(user-homedir-pathname)))
((equal cache-env "NIL") nil)
(t (dirname->pathname cache-env)))))
(when cache-spec
(ensure-directories-exist cache-spec)
(resolve-symlinks cache-spec)))
*lisp-fasl-root*
(let* ((root-env
(when (getenv "LISP")
(let ((r (getenv "LISP_FASL_ROOT")))
(when r (if (equal r "NIL") :disabled
(dirname->pathname r))))))
(root-spec
(or root-env
(when *lisp-fasl-cache*
(merge-pathnames
(make-pathname
:directory (list :relative *implementation-name*))
*lisp-fasl-cache*)))))
(when root-spec
(ensure-directories-exist root-spec)
(resolve-symlinks root-spec))))
(calculate-output-pathname-translations)
(setf *arguments*
(or *arguments*
#+(or cmu gcl ecl lispworks)
(cdr (member "--"
#+gcl si:*command-args*
#+ecl (command-line-arguments)
#+cmu extensions:*command-line-strings*
#+lispworks system:*line-arguments-list*
:test 'equal))
#+openmcl ccl:*unprocessed-command-line-arguments*
#+sbcl (cdr sb-ext:*posix-argv*)
#+allegro (cdr (sys:command-line-arguments))
#+clisp (cdr ext:*args*))))
(or *arguments* (command-line-arguments))))
(defun register-paths (paths)
#-asdf (declare (ignore paths))
......@@ -521,11 +577,11 @@ outputs a tag plus a list of source expressions and their resulting values, retu
(defun load-stream (&optional (s #-clisp *standard-input*
#+clisp *terminal-io*))
;; GCL 2.6 can't load from a string-input-stream
;; OpenMCL 1.1-pre cannot load from either *standard-input* or *terminal-io*
;; ClozureCL 1.2 cannot load from either *standard-input* or *terminal-io*
;; Allegro 5, I don't remember but it must have been broken when I tested.
#+(or gcl-pre2.7 allegro)
#+(or gcl-pre2.7 clozure allegro)
(do ((eof '#:eof) (x t (read s nil eof))) ((eq x eof)) (eval x))
#-(or gcl-pre2.7 allegro)
#-(or gcl-pre2.7 clozure allegro)
(load s :verbose nil :print nil))
(defun load-string (string)
......@@ -549,46 +605,52 @@ outputs a tag plus a list of source expressions and their resulting values, retu
(finish-outputs)
(when *quit* (quit 0)))
(defun dump-image (filename &key executable (package :cl-user))
(declare (ignorable filename executable package))
(setf *dumped* (if executable :executable t)
*arguments* nil)
(defun dump-image (filename &key standalone (package :cl-user))
(setf *dumped* (if standalone :standalone :wrapped)
*arguments* nil
*package* (find-package package)
*features* (remove :cl-launched *features*))
#+clisp
(ext:saveinitmem filename
:executable executable
:init-function (when executable #'resume)
;; :parse-options (not executable) ;--- requires a patch to clisp
:script t
(apply #'ext:saveinitmem filename
:quiet t
:norc t
:start-package package
:keep-global-handlers nil)
:start-package *package*
:keep-global-handlers nil
:executable (if standalone 0 t) ;--- requires clisp 2.48 or later.
(when standalone
(list
:norc t
:script nil
:init-function #'resume
;; :parse-options nil ;--- requires a non-standard patch to clisp.
)))
#+sbcl
(progn
;;(sb-pcl::precompile-random-code-segments) ;--- it is ugly slow at compile-time (!) when the initial core is a big CLOS program. If you want it, do it yourself
(setf sb-ext::*gc-run-time* 0)
(apply 'sb-ext:save-lisp-and-die filename
:executable executable
(when executable (list :toplevel #'resume))))
:executable t ;--- always include the runtime that goes with the core
(when standalone (list :toplevel #'resume :save-runtime-options t)))) ;--- only save runtime-options for standalone executables
#+cmu
(progn
(ext:gc :full t)
(setf ext:*batch-mode* nil)
(setf ext::*gc-run-time* 0)
(extensions:save-lisp filename))
#+openmcl
(ccl:save-application filename)
#+clozure
(ccl:save-application filename :prepend-kernel t)
#+allegro
(progn
(sys:resize-areas :global-gc t :pack-heap t :sift-old-areas t :tenure t) ; :new 5000000
(excl:dumplisp :name filename :suppress-allegro-cl-banner t))
#+lispworks
(save-image filename :environment nil) ; XXXXX
(if standalone
(lispworks:deliver 'resume filename 0 :interface nil)
(hcl:save-image filename :environment nil))
#+gcl
(progn
(si::set-hole-size 500) (si::gbc nil) (si::sgc-on t)
(si::save-system filename))
#-(or clisp sbcl cmu openmcl allegro gcl lispworks)
#-(or clisp sbcl cmu clozure allegro gcl lispworks)
(%abort 11 "CL-Launch doesn't supports image dumping with this Lisp implementation.~%"))
(defun run (&key paths load system dump restart init (quit 0))
......@@ -600,9 +662,19 @@ outputs a tag plus a list of source expressions and their resulting values, retu
(build-and-run load system restart init quit)))
(defun read-function (string)
`(function ,(read-from-string string)))
(eval `(function ,(read-from-string string))))
#-(and gcl (not gcl-pre2.7))
(defun build-and-load (load system restart init quit)
(do-build-and-load load system restart init quit))
#+(and gcl (not gcl-pre2.7))
(defun build-and-load (load system restart init quit)
(unwind-protect
(do-build-and-load load system restart init quit)
(cleanup-temporary-files)))
(defun do-build-and-load (load system restart init quit)
(when load
(cond
((eq load t) (load-stream))
......@@ -614,7 +686,7 @@ outputs a tag plus a list of source expressions and their resulting values, retu
(load-system system :verbose *verbose*)
#-asdf
(%abort 10 "ERROR: asdf requested, but not found~%"))
(setf *restart* (when restart (eval (read-function restart)))
(setf *restart* (when restart (read-function restart))
*init-forms* init
*quit* quit))
......@@ -625,283 +697,173 @@ outputs a tag plus a list of source expressions and their resulting values, retu
#-ecl
(defun build-and-dump (dump load system restart init quit)
(build-and-load load system restart init quit)
(dump-image dump :executable (getenv "CL_LAUNCH_EXECUTABLE"))
(dump-image dump :standalone (getenv "CL_LAUNCH_STANDALONE"))
(quit))
#+ecl (progn ;;; ECL PATCH: modifies and adds functions into ecl*/src/cmp/cmpmain.lsp
;;; necessary for ecl 0.9i. The patch since made it to the development branch and so
;;; will have to be removed from here when new ecl releases make it to our target
;;; linux distributions.
(defun system-ld-flag (library)
(let ((asdf (find-package "ASDF"))
system)
(labels ((asdfsym (x) (find-symbol (string x) asdf))
(asdfcall (fun &rest rest) (apply (asdfsym fun) rest))
(system-output (system type)
(let ((build (make-instance (asdfsym :build-op) :type type)))
(first (asdfcall :output-files build system))))
(existing-system-output (system type)
(let ((o (system-output system type)))
(and o (probe-file o))))
(find-archive (system)
(or (existing-system-output system :library)
(existing-system-output system :shared-library)))
(fallback () (format nil #-msvc "-l~A" #+msvc "~A.lib" (string-downcase library))))
(or (and asdf
(setf system (asdfcall :find-system library nil))
(find-archive system))
(fallback)))))
(defun library-type-p (type)
(member type
#-msvc '("a" "so")
#+msvc '("lib" "dll")
:test #'equal))
(defun built-type-p (type)
(or (equal type #-msvc "o" #+msvc "obj")
(library-type-p type)))
(defun builder (target output-name &key lisp-files ld-flags shared-data-file
(init-name nil)
(prologue-code "")
(epilogue-code (when (eq target :program) '(SI::TOP-LEVEL)))
#+:win32 (system :console))
;;
;; The epilogue-code can be either a string made of C code, or a
;; lisp form. In the latter case we add some additional C code to
;; clean up, and the lisp form is stored in a text representation,
;; to avoid using the compiler.
;;
(cond ((null epilogue-code)
(setf epilogue-code ""))
((stringp epilogue-code)
)
(t
(with-standard-io-syntax
(setq epilogue-code
(with-output-to-string (stream)
(princ "{ const char *lisp_code = " stream)
(wt-filtered-data (write-to-string epilogue-code) stream)
(princ ";
cl_object output;