diff --git a/bin/asdf-builder b/bin/asdf-builder index 4bff0bc5ac19a9cf3a1a26159bdd78fd9b945625..571d8cea7a35e49947cb286d91bd2a1ddc0e3bd1 100755 --- a/bin/asdf-builder +++ b/bin/asdf-builder @@ -1,6 +1,8 @@ ":" ; exec sbcl --script "$0" "$@" ; exit # -*- Lisp -*- ;;;;; Really runs on any decent Common Lisp implementation +;;; Can also be invoked by cl-launch 4: cl-launch "$0" "$@" +(eval-when (:compile-toplevel :load-toplevel :execute) (setf *load-verbose* nil *load-print* nil *compile-verbose* nil *compile-print* nil) @@ -13,24 +15,32 @@ (string :1.x)))) #-asdf2 (load (merge-pathnames "../build/asdf.lisp" *load-pathname*)) #-asdf2 (error "Not ASDF2, you lose!") +) (in-package :asdf) + +(eval-when (:compile-toplevel :load-toplevel :execute) (defparameter *provided-version* (asdf-version)) (format t "Initializing the source registry... ~%") (initialize-source-registry) (format t "Upgrading to the latest ASDF... ~%") -(load-system :asdf) -(let ((ver (asdf-version))) - (if (equal ver *provided-version*) - (format t "Congratulations to your implementation for being up to date!~%") - (format t "Upgraded to ASDF ~A~%" ver))) -(format t "Now loading some dependencies... ~%") -(load-systems :cl-ppcre :fare-utils :inferior-shell) +(load-system :asdf)) + +(eval-when (:compile-toplevel :load-toplevel :execute) + (in-package :asdf) + (let ((ver (asdf-version))) + (if (equal ver *provided-version*) + (format t "Congratulations to your implementation for being up to date!~%") + (format t "Upgraded to ASDF ~A~%" ver))) + (format t "Now loading some dependencies... ~%") + (load-systems :cl-ppcre :fare-utils :inferior-shell)) (format t "There we are!~%") -(restore-image) +(unless (featurep :cl-launch) (restore-image)) -(defpackage :asdf-builder (:use :cl :uiop :asdf/operate :asdf :fare-utils :inferior-shell)) +(defpackage :asdf-builder + (:use :cl :uiop :asdf/operate :asdf :fare-utils :inferior-shell) + (:shadow #:DBG)) (in-package :asdf-builder) (uiop-debug) @@ -303,8 +313,7 @@ (build-asdf))) (defun git-version () - (first (run '("git" "describe" "--tags" "--match" "[0-9].[0-9][0-9]") - :output :lines :show t))) + (first (run/lines '("git" "describe" "--tags" "--match" "[0-9].[0-9][0-9]") :show t))) ;;;; Main entry point diff --git a/bin/install-asdf-as-module b/bin/install-asdf-as-module new file mode 100644 index 0000000000000000000000000000000000000000..dcc270d22c5fa170169db07845a48ff964ca5859 --- /dev/null +++ b/bin/install-asdf-as-module @@ -0,0 +1,64 @@ +":" ; exec cl-launch "$0" "$@" +#| -*- Lisp -*- +Usage: cl-launch -l lispworks install-asdf-as-module + +This script will install the current version of ASDF +as a module pre-compiled for your implementation, +as specified by option -l (--lisp) of cl-launch, +so you can (require "asdf") within your implementation +and have it load a recent ASDF instead of an outdated one. + +This file requires cl-launch 4 and works on most implementations. +It notably doesn't work on: +* ABCL, that keeps ASDF in its jar, but that's OK because + ABCL has a recent enough ASDF3 that is capable of upgrading itself. +* GCL, that doesn't have a usable REQUIRE mechanism. +* mocl, that doesn't support ASDF 3 yet. +* Corman Lisp, RMCL, Genera, that are obsolete anyway. +|# +(require :asdf) + +(in-package :asdf) + +(defvar *asdf-dir* + (ensure-pathname (system-relative-pathname :asdf ()) + :want-physical t :want-absolute t + :want-existing t :truename t)) + +(defun asdf-module-directory () + #+allegro #p"sys:code;" + #+clisp (subpathname custom:*lib-directory* "asdf/") + #+clozure #p"ccl:tools;" + #+cmu #p"modules:asdf/" + #+(or ecl mkcl) #p"sys:" + #+gcl system:*system-directory* + #+lispworks (system:lispworks-dir "load-on-demand/utilities/") + #+sbcl (subpathname (sb-int:sbcl-homedir-pathname) "contrib/") + #+scl #p"file://modules/" + #+xcl ext:*xcl-home* + #-(or allegro clisp clozure cmu ecl gcl lispworks mkcl sbcl scl xcl) + (error "asdf-module-directory not implemented on ~A" (implementation-type))) + +(defun asdf-module-fasl () + #+allegro + (flet ((pathname-key (x) + (let ((type (pathname-type x))) + (cond + ((and (stringp type) (every #'digit-char-p type)) (parse-integer type)) + ((equal type "fasl") 0) + (t -1))))) + (first (sort (directory (merge-pathnames* "asdf.*" (asdf-module-directory))) + #'> :key #'pathname-key))) + #+(or clisp clozure cmu ecl gcl lispworks mkcl sbcl scl xcl) + (compile-file-pathname (subpathname (truename (asdf-module-directory)) "asdf.lisp")) + #-(or allegro clisp clozure cmu ecl gcl lispworks mkcl sbcl scl xcl) + (error "Not implemented on ~A" (implementation-type))) + +(defun install-asdf-as-module () + (let ((fasl (asdf-module-fasl))) + (ensure-directories-exist (translate-logical-pathname fasl)) + (handler-bind ((warning #'muffle-warning)) + (compile-file* (subpathname *asdf-dir* "build/asdf.lisp") :output-file fasl)))) + +(trace compile-file*) +(install-asdf-as-module)