~ubuntu-branches/ubuntu/raring/cl-asdf/raring

« back to all changes in this revision

Viewing changes to asdf-ecl.lisp

  • Committer: Package Import Robot
  • Author(s): Francois-Rene Rideau
  • Date: 2012-08-25 08:05:21 UTC
  • mfrom: (1.1.27)
  • Revision ID: package-import@ubuntu.com-20120825080521-zt7ezhntbjqoelu3
Tags: 2:2.24-1
* ACL: handle SMP vs non-SMP builds in Allegro 9.0
* MKCL: add support for ManKai Common Lisp
* ECL: merge improvements from ECL git. Refactor ECL support somewhat.
* Remove broken-fasl-support: first, cormanlisp is supposed to have fixed it;
  second, cormanlisp is dead;
  third, one can now (setf *load-system-operation* 'load-source-op) instead
  while using asdf:load-system.
* renaming ends-with to string-suffix-p to avoid conflict with alexandria.
* Refactor load-system to use *load-system-operation*,
  and change require-system and module-provide-asdf to use that.

Also note:
* We recommend you use asdf-utils to access the utilities in asdf.
  Some time next year, we may stop exporting the utilities from asdf itself.
* To avoid conflicts between alexandria, fare-utils, xcvb-driver,
  asdf-utils, etc., you can use xcvb-utils that solves the conflicts.
  Or you can use fare-utils:define-package-mix that will help you
  automatically resolve them.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
;;; Copyright (c) 2005 - 2007, Michael Goffioul (michael dot goffioul at swing dot be)
2
 
;;; Copyright (c) 2008 - 2011, Juan Jose Garcia Ripoll
 
2
;;; Copyright (c) 2008 - 2012, Juan Jose Garcia Ripoll
3
3
;;;
4
4
;;;   This program is free software; you can redistribute it and/or
5
5
;;;   modify it under the terms of the GNU Library General Public
36
36
  ((type :reader bundle-op-type)
37
37
   (monolithic :initform nil :reader bundle-op-monolithic-p)
38
38
   (name-suffix :initarg :name-suffix :initform nil)
39
 
   (build-args :initarg :args :initform nil :accessor bundle-op-build-args)))
 
39
   (build-args :initarg :args :initform nil :accessor bundle-op-build-args)
 
40
   (lisp-files :initform nil :accessor bundle-op-lisp-files)))
 
41
 
40
42
 
41
43
(defclass fasl-op (bundle-op)
42
44
  ((type :initform :fasl)))
72
74
          (if (bundle-op-monolithic-p instance) "-mono" "")))
73
75
  (when (typep instance 'monolithic-bundle-op)
74
76
    (destructuring-bind (&rest original-initargs
75
 
                         &key prologue-code epilogue-code &allow-other-keys)
 
77
                         &key lisp-files prologue-code epilogue-code
 
78
                         &allow-other-keys)
76
79
        (slot-value instance 'original-initargs)
77
80
      (setf (slot-value instance 'original-initargs)
78
 
            (remove-keys '(epilogue-code prologue-code) original-initargs)
 
81
            (remove-keys '(lisp-files epilogue-code prologue-code) original-initargs)
 
82
            (bundle-op-lisp-files instance) lisp-files
79
83
            (monolithic-op-prologue-code instance) prologue-code
80
84
            (monolithic-op-epilogue-code instance) epilogue-code)))
81
85
  (setf (bundle-op-build-args instance)
167
171
  (list (cons (make-instance 'lib-op) c)))
168
172
 
169
173
(defmethod component-depends-on ((o bundle-op) (c system))
170
 
  (loop for (op . dep) in (bundle-sub-operations o c)
171
 
     when (typep dep 'system)
172
 
     collect (list (class-name (class-of op))
 
174
  (loop :for (op . dep) :in (bundle-sub-operations o c)
 
175
    :when (typep dep 'system)
 
176
    :collect (list (class-name (class-of op))
173
177
                   (component-name dep))))
174
178
 
175
179
(defmethod component-depends-on ((o lib-op) (c system))
181
185
  nil)
182
186
 
183
187
(defmethod input-files ((o bundle-op) (c system))
184
 
  (loop for (sub-op . sub-c) in (bundle-sub-operations o c)
185
 
     nconc (output-files sub-op sub-c)))
 
188
  (loop :for (sub-op . sub-c) :in (bundle-sub-operations o c)
 
189
    :nconc (output-files sub-op sub-c)))
186
190
 
187
191
(defmethod output-files ((o bundle-op) (c system))
188
192
  (let ((name (concatenate 'base-string (component-name c)
192
196
 
193
197
(defmethod output-files ((o fasl-op) (c system))
194
198
  (declare (ignorable o c))
195
 
  (loop for file in (call-next-method)
196
 
     collect (make-pathname :type "fasb" :defaults file)))
 
199
  (loop :for file :in (call-next-method)
 
200
    :collect (make-pathname :type "fasb" :defaults file)))
197
201
 
198
202
(defmethod perform ((o bundle-op) (c t))
199
203
  (declare (ignorable o c))
208
212
                               :key #'pathname-type :test #'string=))
209
213
         (output (output-files o c)))
210
214
    (ensure-directories-exist (first output))
211
 
    (apply #'c::builder (bundle-op-type o) (first output) :lisp-files object-files
 
215
    (apply #'c::builder (bundle-op-type o) (first output)
 
216
           :lisp-files (append object-files (bundle-op-lisp-files o))
212
217
           (append (bundle-op-build-args o)
213
218
                   (when (and (typep o 'monolithic-bundle-op)
214
219
                              (monolithic-op-prologue-code o))
245
250
         (files (and system (output-files operation system))))
246
251
    (if (or move-here (and (null move-here-p)
247
252
                           (member operation-name '(:program :binary))))
248
 
        (loop with dest-path = (truename (ensure-directories-exist move-here-path))
249
 
           for f in files
250
 
           for new-f = (make-pathname :name (pathname-name f)
 
253
        (loop :with dest-path = (truename (ensure-directories-exist move-here-path))
 
254
          :for f in files
 
255
          :for new-f = (make-pathname :name (pathname-name f)
251
256
                                      :type (pathname-type f)
252
257
                                      :defaults dest-path)
253
 
           do (progn
 
258
          :do (progn
254
259
                (when (probe-file new-f)
255
260
                  (delete-file new-f))
256
261
                (rename-file f new-f))
257
 
           collect new-f)
 
262
           :collect new-f)
258
263
        files)))
259
264
 
260
265
;;;
288
293
  (let ((l (input-files o c)))
289
294
    (and l
290
295
         (load (first l))
291
 
         (loop for i in (module-components c)
292
 
            do (setf (gethash 'load-op (component-operation-times i))
 
296
         (loop :for i :in (module-components c)
 
297
           :do (setf (gethash 'load-op (component-operation-times i))
293
298
                     (get-universal-time))))))
294
299
 
295
300
;;;
299
304
;;; form. Only useful when the dependencies have also been precompiled.
300
305
;;;
301
306
 
302
 
(defclass compiled-file (component) ())
303
 
(defmethod component-relative-pathname ((component compiled-file))
304
 
  (compile-file-pathname
305
 
   (coerce-pathname
306
 
    (or (slot-value component 'relative-pathname)
307
 
        (component-name component))
308
 
    :type "fas")))
 
307
(defclass compiled-file (component)
 
308
  ((type :initform nil)))
309
309
 
310
310
(defmethod output-files (o (c compiled-file))
311
311
  (declare (ignore o c))
331
331
 
332
332
(defmethod output-files ((o lib-op) (c prebuilt-system))
333
333
  (declare (ignore o))
334
 
  (values (list (compile-file-pathname (prebuilt-system-static-library c)
335
 
                                       :type :lib))
336
 
          t ; Advertise that we do not want this path renamed
337
 
          ))
 
334
  (values (list (prebuilt-system-static-library c))
 
335
          t)) ; Advertise that we do not want this path renamed
338
336
 
339
337
(defmethod perform ((o lib-op) (c prebuilt-system))
340
338
  (car (output-files o c)))
376
374
                s))))
377
375
 
378
376
(defmethod component-depends-on ((o binary-op) (s system))
379
 
  (loop for dep in (binary-op-dependencies o s)
380
 
     append (apply #'component-depends-on dep)))
 
377
  (loop :for dep :in (binary-op-dependencies o s)
 
378
    :append (apply #'component-depends-on dep)))
381
379
 
382
380
(defmethod input-files ((o binary-op) (s system))
383
 
  (loop for dep in (binary-op-dependencies o s)
384
 
     append (apply #'input-files dep)))
 
381
  (loop :for dep :in (binary-op-dependencies o s)
 
382
    :append (apply #'input-files dep)))
385
383
 
386
384
(defmethod output-files ((o binary-op) (s system))
387
385
  (list* (merge-pathnames* (make-pathname :name (component-name s)
388
386
                                          :type "asd")
389
387
                           (component-relative-pathname s))
390
 
         (loop for dep in (binary-op-dependencies o s)
391
 
            append (apply #'output-files dep))))
 
388
         (loop :for dep :in (binary-op-dependencies o s)
 
389
           :append (apply #'output-files dep))))
392
390
 
393
391
(defmethod perform ((o binary-op) (s system))
394
392
  (let* ((dependencies (binary-op-dependencies o s))
397
395
         (filename (first (output-files o s)))
398
396
         (name (component-name s))
399
397
         (name-keyword (intern (string name) (find-package :keyword))))
400
 
    (loop for dep in dependencies
401
 
       do (apply #'perform dep))
 
398
    (loop :for dep :in dependencies
 
399
      :do (apply #'perform dep))
402
400
    (with-open-file (s filename :direction :output :if-exists :supersede
403
401
                       :if-does-not-exist :create)
404
402
      (format s ";;; Prebuilt ASDF definition for system ~A" name)
420
418
;;; Final integration steps
421
419
;;;
422
420
 
423
 
(export '(make-build load-fasl-op prebuilt-system))
424
 
(push '("fasb" . si::load-binary) ext:*load-hooks*)
425
 
 
426
 
(defun register-pre-built-system (name)
427
 
  (register-system (make-instance 'system :name name :source-file nil)))
428
 
 
429
 
(setf ext:*module-provider-functions*
430
 
      (loop :for f :in ext:*module-provider-functions*
431
 
        :unless (eq f 'module-provide-asdf)
432
 
        :collect #'(lambda (name)
433
 
                     (let ((l (multiple-value-list (funcall f name))))
434
 
                       (and (first l) (register-pre-built-system name))
435
 
                       (values-list l)))))
436
 
#+win32 (push '("asd" . si::load-source) ext:*load-hooks*)
 
421
(export '(make-build load-fasl-op))
 
422
 
 
423
(pushnew '("fasb" . si::load-binary) ext:*load-hooks* :test 'equal :key 'car)