ros compile-file support '-asdf' option.

This commit is contained in:
SANO Masatoshi 2017-10-26 23:05:49 +09:00
parent 4e8c8f638f
commit 4e1e2fa0a7
2 changed files with 41 additions and 27 deletions

View file

@ -4,8 +4,7 @@
exec ros +Q +A -- $0 "$@"
|#
(progn ;;init forms
(ros:asdf)
#-asdf(ros:ensure-asdf)
#-asdf(ros:ensure-asdf :version nil)
(roswell:include "util")
)
@ -45,30 +44,47 @@ exec ros +Q +A -- $0 "$@"
(defun main (&rest argv)
(declare (ignorable argv))
(let ((out t))
(let ((out t)
asdf)
(consume
argv
(("-o" opt)
(setf out opt))
(uiop:chdir
(setf *default-pathname-defaults* (truename opt)))
(setf out t))
(("-o-")
(setf out nil))
(("-o.")
(setf out t))
(("-asdf")
(setf asdf t))
(("+asdf")
(setf asdf nil))
((:in file)
(asdf:compile-file*
file
:output-file
(make-pathname
:defaults (cond ((eql out t) (uiop:getcwd))
(out out)
(t (fasl-dir)))
:name (pathname-name file)
:type (format nil "~A~A"
(if (eql out t)
(substitute #\- #\/ (substitute #\_ #\. (opt "impl")))
(pathname-type file))
(if (ros:opt"asdf.version")
(format nil "_~A"
(substitute #\- #\/ (substitute #\_ #\. (ros:opt"asdf.version"))))
""))))))))
(if asdf
(uiop:chdir
(setf *default-pathname-defaults*
(merge-pathnames (format nil "lisp/asdf/~A/" file) (homedir))))
(when (ros:opt "asdf.version")
(ros:asdf)))
(funcall (read-from-string "asdf:compile-file*")
(if asdf
"asdf.lisp"
file)
:output-file
(make-pathname
:defaults (if (or out asdf)
(uiop:getcwd)
(fasl-dir))
:name (if asdf
"asdf"
(pathname-name file))
:type (format nil "~A~@[_~A~]"
(if (or out asdf)
(substitute #\- #\/ (substitute #\_ #\. (opt "impl")))
(pathname-type file))
(and (not asdf)
(ros:opt"asdf.version")
(substitute #\- #\/ (substitute #\_ #\. (ros:opt"asdf.version")))))))))))
;;; vim: set ft=lisp lisp:

View file

@ -75,17 +75,17 @@ have the latest asdf, and this file has a workaround for this.
nil ret)))
(let (sentinel)
(defun ensure-asdf ()
(defun ensure-asdf (&key (version (opt "asdf.version")))
(let ((*error-output* (if (verbose)
*error-output*
(make-broadcast-stream))))
(setf sentinel
(or sentinel
(when (and (opt "asdf")
(when (and version
(and (find :asdf *features*)
(not (or (equal (opt "asdf")
(not (or (equal version
(funcall (read-from-string "asdf:asdf-version")))
(= (length (opt "asdf")) 40)))))
(= (length version) 40)))))
(funcall 'asdf :no-download t))
(find :asdf *features*)
(ignore-errors (require "asdf")))
@ -244,9 +244,7 @@ have the latest asdf, and this file has a workaround for this.
(path (merge-pathnames (format nil "lisp/asdf/~A/asdf.lisp" version) (opt "homedir"))))
(when (equal version "NIL")
(error "asdf download error?"))
(let ((fasl (format nil "~A_~A"
(substitute #\- #\/ (substitute #\_ #\. (opt "impl")))
(substitute #\_ #\. (opt "asdf.version")))))
(let ((fasl (substitute #\- #\/ (substitute #\_ #\. (opt "impl")))))
(setf path (or (probe-file (make-pathname :defaults path :type fasl)) path)))
(when (probe-file path)
(ignore-errors