Newer
Older
1
2
3
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
;;; -*- Mode: Lisp ; Syntax: ANSI-Common-Lisp -*-
#+xcvb (module (:depends-on ("specials")))
(in-package :asdf)
(eval-when (:compile-toplevel :load-toplevel :execute)
;; Make sure we have strict ANSI class redefinition semantics.
(setq clos::*redefine-class-in-place* t))
;;;
;;; BUNDLE-SUB-OPERATIONS
;;;
;;; Builds a list of pairs (operation . component) which contains all the
;;; dependencies of this bundle.
;;;
(defun mkcl-bundle-sub-operations (sys)
(gather-components 'compile-op sys
:filter-system sys
:filter-type '(not system)))
(defun files-to-bundle (sys &aux files)
(loop :for (op . comp) :in (mkcl-bundle-sub-operations sys)
:for files = (output-files op comp)
:when sub-files
:collect (first sub-files)))
(defmethod component-depends-on ((o bundle-op) (c system))
(cons `(compile-op ,(component-name c)) (call-next-method)))
(defmethod output-files ((o bundle-op) (c system))
(let* ((name (component-name c))
(static-lib-name (merge-pathnames
(compiler::builder-internal-pathname name :static-library)
(component-relative-pathname c)))
(fasl-bundle-name (merge-pathnames
(compiler::builder-internal-pathname name :fasb)
(component-relative-pathname c))))
(list static-lib-name fasl-bundle-name)))
(defmethod perform ((o bundle-op) (c system))
(let* ((object-files (files-to-bundle c))
(output (output-files o c)))
(ensure-directories-exist (first output))
(when (bundle-op-do-static-library-p o)
(apply #'compiler::build-static-library (first output)
:lisp-object-files object-files (bundle-op-build-args o)))
(when (bundle-op-do-fasb-p o)
(apply #'compiler::build-bundle (second output)
:lisp-object-files object-files (bundle-op-build-args o)))))
(defun bundle-system (system &rest args &key force (verbose t) version &allow-other-keys)
(declare (ignore force verbose version))
(apply #'operate 'bundle-op system args))
(export '(bundle-system))
;;;
;;; BUNDLED FILES
;;;
;;; This component can be used to distribute ASDF libraries in bundled form.
;;;
(defclass bundle (component) ())
(defmethod source-file-type ((c bundle) (s system))
"fasb")
(defmethod perform ((o load-op) (c bundle))
(load (component-pathname c)))
(defmethod perform (o (c bundle))
(declare (ignore o))
nil)
(pushnew '("fasb" . si::load-binary) ext:*load-hooks* :test 'equal :key 'car)