Newer
Older
":" ; exec cl-launch "$0" "$@"
#| -*- Lisp -*-
Usage: make && cl-launch -l lispworks bin/install-asdf-as-module
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
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))
(compile-file (subpathname *asdf-dir* "build/asdf.lisp") :output-file fasl)))
Francois-Rene Rideau
committed
(uiop:writeln (multiple-value-list (install-asdf-as-module)))