| 1 |
(defpackage :ecl-quicklisp |
| 2 |
(:use :cl)) |
| 3 |
|
| 4 |
(in-package :ecl-quicklisp) |
| 5 |
|
| 6 |
(require :ecl-curl) |
| 7 |
|
| 8 |
(defparameter *quicklisp-url* "http://beta.quicklisp.org/quicklisp.lisp") |
| 9 |
|
| 10 |
(defparameter *quicklisp-directory* |
| 11 |
#+windows |
| 12 |
(translate-logical-pathname "SYS:QUICKLISP;") |
| 13 |
#-windows |
| 14 |
(translate-logical-pathname "HOME:QUICKLISP;") |
| 15 |
) |
| 16 |
|
| 17 |
(defparameter *quicklisp-setup* |
| 18 |
#+windows |
| 19 |
"SYS:QUICKLISP;SETUP.LISP" |
| 20 |
#-windows |
| 21 |
"HOME:QUICKLISP;SETUP.LISP" |
| 22 |
) |
| 23 |
|
| 24 |
(defun safe-download (url filename) |
| 25 |
(ensure-directories-exist filename) |
| 26 |
(handler-case |
| 27 |
(ecl-curl:download-url-to-file url filename) |
| 28 |
(ecl-curl:download-error (c) |
| 29 |
(format t "~&;;;~%;;; Unable to download quicklisp. Aborting. ~%;;;") |
| 30 |
(ext:quit 1))) |
| 31 |
filename) |
| 32 |
|
| 33 |
(defun install-quicklisp (target-directory) |
| 34 |
(let ((file (merge-pathnames "_installer.lisp" target-directory))) |
| 35 |
(ensure-directories-exist file) |
| 36 |
(ecl-curl:download-url-to-file *quicklisp-url* file) |
| 37 |
(load file) |
| 38 |
(eval (read-from-string |
| 39 |
(format nil "(quicklisp-quickstart:install :path ~S)" |
| 40 |
(namestring (truename target-directory)))) |
| 41 |
))) |
| 42 |
|
| 43 |
(handler-case |
| 44 |
(progn |
| 45 |
(unless (probe-file *quicklisp-setup*) |
| 46 |
(install-quicklisp *quicklisp-directory*)) |
| 47 |
(unless (find-package "QL") |
| 48 |
(load *quicklisp-setup*)) |
| 49 |
(eval (read-from-string " |
| 50 |
(pushnew #'(ext:lambda-block quicklisp-require (module) |
| 51 |
(let* ((module (string-downcase module))) |
| 52 |
(when (find module (ql:provided-systems t) |
| 53 |
:test #'string-equal |
| 54 |
:key #'ql-dist:name) |
| 55 |
(and (ql:quickload module) |
| 56 |
(provide module))))) |
| 57 |
sys::*module-provider-functions*) |
| 58 |
"))) |
| 59 |
(error (c) |
| 60 |
(format t "~%;;; Unable to load / install quicklisp. Error message follows:~%~A" |
| 61 |
c))) |
| 62 |
|
| 63 |
(provide '#:ecl-quicklisp) |