bundle.lisp 24.1 KB
Newer Older
1
2
3
;;;; -------------------------------------------------------------------------
;;;; ASDF-Bundle

4
(uiop/package:define-package :asdf/bundle
5
  (:recycle :asdf/bundle :asdf)
6
  (:use :uiop/common-lisp :uiop :asdf/upgrade
7
   :asdf/component :asdf/system :asdf/find-system :asdf/find-component :asdf/operation
8
   :asdf/action :asdf/lisp-action :asdf/plan :asdf/operate :asdf/defsystem)
9
  (:export
10
11
12
13
14
15
   #:bundle-op #:bundle-op-build-args #:bundle-type
   #:bundle-system #:bundle-pathname-type #:bundlable-file-p #:direct-dependency-files
   #:monolithic-op #:monolithic-bundle-op #:operation-monolithic-p
   #:basic-fasl-op #:prepare-fasl-op #:fasl-op #:load-fasl-op #:monolithic-fasl-op
   #:lib-op #:monolithic-lib-op
   #:dll-op #:monolithic-dll-op
16
17
   #:deliver-asd-op #:monolithic-deliver-asd-op
   #:program-op #:image-op #:compiled-file #:precompiled-system #:prebuilt-system
18
   #:user-system-p #:user-system #:trivial-system-p
19
   #+ecl #:make-build
20
   #:register-pre-built-system
21
   #:build-args #:name-suffix #:prologue-code #:epilogue-code #:static-library))
22
23
(in-package :asdf/bundle)

24
(with-upgradability ()
25
  (defclass bundle-op (basic-compile-op)
26
27
28
    ((build-args :initarg :args :initform nil :accessor bundle-op-build-args)
     (name-suffix :initarg :name-suffix :initform nil)
     (bundle-type :initform :no-output-file :reader bundle-type)
29
     #+ecl (lisp-files :initform nil :accessor bundle-op-lisp-files)))
30

31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
  (defclass monolithic-op (operation) ()
    (:documentation "A MONOLITHIC operation operates on a system *and all of its
dependencies*.  So, for example, a monolithic concatenate operation will
concatenate together a system's components and all of its dependencies, but a
simple concatenate operation will concatenate only the components of the system
itself.")) ;; operation on a system and its dependencies

  (defclass monolithic-bundle-op (monolithic-op bundle-op)
    ;; Old style way of specifying prologue and epilogue on ECL: in the monolithic operation
    ((prologue-code :accessor prologue-code)
     (epilogue-code :accessor epilogue-code)))

  (defclass bundle-system (system)
    ;; New style (ASDF3.1) way of specifying prologue and epilogue on ECL: in the system
    ((prologue-code :accessor prologue-code)
     (epilogue-code :accessor epilogue-code)))

48
49
  #+mkcl
  (defclass program (bundle-system)
50
    ((prologue-code :initarg :prologue-code :initform nil :accessor prologue-code)
51
52
53
54
55
56
57
58
59
60
     (epilogue-code :initarg :epilogue-code :initform nil :accessor epilogue-code)
     (prefix-lisp-object-files :initarg :prefix-lisp-object-files
                               :initform nil :accessor program-prefix-lisp-object-files)
     (postfix-lisp-object-files :initarg :postfix-lisp-object-files
                                :initform nil :accessor program-postfix-lisp-object-files)
     (object-files :initarg :object-files
                   :initform nil :accessor program-object-files)
     (extra-build-args :initarg :extra-build-args
                       :initform nil :accessor program-extra-build-args)))

61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
  (defmethod prologue-code ((x t)) nil)
  (defmethod epilogue-code ((x t)) nil)

  (defclass link-op (bundle-op) ()
    (:documentation "Abstract operation for linking files together"))

  (defclass gather-op (bundle-op)
    ((gather-op :initform nil :allocation :class :reader gather-op))
    (:documentation "Abstract operation for gathering many input files from a system"))

  (defun operation-monolithic-p (op)
    (typep op 'monolithic-op))

  (defmethod component-depends-on ((o gather-op) (s system))
    (let* ((mono (operation-monolithic-p o))
           (deps
             (required-components
              s :other-systems mono :component-type (if mono 'system '(not system))
                :goal-operation (find-operation o 'load-op)
                :keep-operation 'compile-op)))
      ;; NB: the explicit make-operation on ECL and MKCL
      ;; ensures that we drop the original-initargs and its magic flags when recursing.
      `((,(make-operation (or (gather-op o) (if mono 'lib-op 'compile-op))) ,@deps)
        ,@(call-next-method))))
85

86
  ;; create a single fasl for the entire library
87
  (defclass basic-fasl-op (bundle-op)
88
    ((bundle-type :initform :fasl)))
89

90
  (defclass prepare-fasl-op (sideway-operation)
91
    ((sideway-operation :initform #+(or ecl mkcl) 'load-fasl-op #-(or ecl mkcl) 'load-op :allocation :class)))
92
93
94
95
96
97

  (defclass lib-op (link-op gather-op non-propagating-operation)
    ((bundle-type :initform :lib))
    (:documentation "compile the system and produce linkable (.a) library for it."))

  (defclass fasl-op (basic-fasl-op selfward-operation #+ecl link-op #-ecl gather-op)
98
    ((selfward-operation :initform '(prepare-fasl-op #+ecl lib-op) :allocation :class)))
99

100
  (defclass load-fasl-op (basic-load-op selfward-operation)
101
    ((selfward-operation :initform '(prepare-fasl-op fasl-op) :allocation :class)))
102
103

  ;; NB: since the monolithic-op's can't be sideway-operation's,
104
  ;; if we wanted lib-op, dll-op, deliver-asd-op to be sideway-operation's,
105
106
107
  ;; we'd have to have the monolithic-op not inherit from the main op,
  ;; but instead inherit from a basic-FOO-op as with basic-fasl-op above.

108
  (defclass dll-op (link-op gather-op non-propagating-operation)
109
    ((bundle-type :initform :dll))
110
    (:documentation "compile the system and produce dynamic (.so/.dll) library for it."))
111

112
113
114
  (defclass deliver-asd-op (basic-compile-op selfward-operation)
    ((selfward-operation :initform '(fasl-op #+(or ecl mkcl) lib-op) :allocation :class))
    (:documentation "produce an asd file for delivering the system as a single fasl"))
115
116


117
118
119
  (defclass monolithic-deliver-asd-op (monolithic-bundle-op deliver-asd-op)
    ((selfward-operation :initform '(monolithic-fasl-op #+(or ecl mkcl) monolithic-lib-op)
                         :allocation :class))
120
121
    (:documentation "produce fasl and asd files for combined system and dependencies."))

122
123
124
  (defclass monolithic-fasl-op (monolithic-bundle-op basic-fasl-op
                                #+ecl link-op gather-op non-propagating-operation)
    ((gather-op :initform #+(or ecl mkcl) 'lib-op #-(or ecl mkcl) 'fasl-op :allocation :class))
125
    (:documentation "Create a single fasl for the system and its dependencies."))
126

127
128
  (defclass monolithic-lib-op (monolithic-bundle-op lib-op non-propagating-operation) ()
    (:documentation "Create a single linkable library for the system and its dependencies."))
129

130
  (defclass monolithic-dll-op (monolithic-bundle-op dll-op non-propagating-operation)
131
132
    ((bundle-type :initform :dll))
    (:documentation "Create a single dynamic (.so/.dll) library for the system and its dependencies."))
133

134
135
136
  (defclass image-op (monolithic-bundle-op selfward-operation
                      #+ecl link-op #+(or ecl mkcl) gather-op)
    ((bundle-type :initform :image)
137
     (selfward-operation :initform '(#-(or ecl mkcl) load-op) :allocation :class))
138
139
140
141
    (:documentation "create an image file from the system and its dependencies"))

  (defclass program-op (image-op)
    ((bundle-type :initform :program))
142
    (:documentation "create an executable file from the system and its dependencies"))
143
144
145

  (defun bundle-pathname-type (bundle-type)
    (etypecase bundle-type
146
      ((eql :no-output-file) nil) ;; should we error out instead?
147
148
149
      ((or null string) bundle-type)
      ((eql :fasl) #-(or ecl mkcl) (compile-file-type) #+(or ecl mkcl) "fasb")
      #+ecl
150
      ((member :dll :lib :shared-library :static-library :program :object :program)
151
       (compile-file-type :type bundle-type))
152
      ((member :image) "image")
153
154
155
      ((member :dll :shared-library) (cond ((os-macosx-p) "dylib") ((os-unix-p) "so") ((os-windows-p) "dll")))
      ((member :lib :static-library) (cond ((os-unix-p) "a")
					   ((os-windows-p) (if (featurep '(:or :mingw32 :mingw64)) "a" "lib"))))
156
157
158
      ((eql :program) (cond ((os-unix-p) nil) ((os-windows-p) "exe")))))

  (defun bundle-output-files (o c)
159
160
161
162
163
164
165
166
    (let ((bundle-type (bundle-type o)))
      (unless (or (eq bundle-type :no-output-file) ;; NIL already means something regarding type.
                  (and (null (input-files o c)) (not (member bundle-type '(:image :program)))))
        (let ((name (or (component-build-pathname c)
                        (format nil "~A~@[~A~]" (component-name c) (slot-value o 'name-suffix))))
              (type (bundle-pathname-type bundle-type)))
          (values (list (subpathname (component-pathname c) name :type type))
                  (eq (type-of o) (component-build-operation c)))))))
167
168
169
170
171

  (defmethod output-files ((o bundle-op) (c system))
    (bundle-output-files o c))

  #-(or ecl mkcl)
172
173
174
175
176
  (progn
    (defmethod perform ((o image-op) (c system))
      (dump-image (output-file o c) :executable (typep o 'program-op)))
    (defmethod perform :before ((o program-op) (c system))
      (setf *image-entry-point* (ensure-function (component-entry-point c)))))
177
178
179
180
181
182
183
184
185
186
187

  (defclass compiled-file (file-component)
    ((type :initform #-(or ecl mkcl) (compile-file-type) #+(or ecl mkcl) "fasb")))

  (defclass precompiled-system (system)
    ((build-pathname :initarg :fasl)))

  (defclass prebuilt-system (system)
    ((build-pathname :initarg :static-library :initarg :lib
                     :accessor prebuilt-system-static-library))))

188
189
190
191
192
193
194
195
196

;;;
;;; BUNDLE-OP
;;;
;;; This operation takes all components from one or more systems and
;;; creates a single output file, which may be
;;; a FASL, a statically linked library, a shared library, etc.
;;; The different targets are defined by specialization.
;;;
197
198
199
200
(with-upgradability ()
  (defmethod initialize-instance :after ((instance bundle-op) &rest initargs
                                         &key (name-suffix nil name-suffix-p)
                                         &allow-other-keys)
Francois-Rene Rideau's avatar
Francois-Rene Rideau committed
201
    (declare (ignore initargs name-suffix))
202
203
204
    (unless name-suffix-p
      (setf (slot-value instance 'name-suffix)
            (unless (typep instance 'program-op)
205
              (if (operation-monolithic-p instance) "--all-systems" #-(or ecl mkcl) "--system")))) ; . no good for Logical Pathnames
206
    (when (typep instance 'monolithic-bundle-op)
207
      (destructuring-bind (&key lisp-files prologue-code epilogue-code
208
209
                           &allow-other-keys)
          (operation-original-initargs instance)
210
211
        (setf (prologue-code instance) prologue-code
              (epilogue-code instance) epilogue-code)
212
        #-ecl (assert (null (or lisp-files #-mkcl epilogue-code #-mkcl prologue-code)))
213
214
        #+ecl (setf (bundle-op-lisp-files instance) lisp-files)))
    (setf (bundle-op-build-args instance)
215
216
217
          (remove-plist-keys
           '(:type :monolithic :name-suffix :epilogue-code :prologue-code :lisp-files)
           (operation-original-initargs instance))))
218
219
220
221

  (defun bundlable-file-p (pathname)
    (let ((type (pathname-type pathname)))
      (declare (ignorable type))
222
223
      (or #+ecl (or (equalp type (compile-file-type :type :object))
                    (equalp type (compile-file-type :type :static-library)))
224
225
226
          #+mkcl (or (equalp type (compile-file-type :fasl-p nil))
                     #+(or unix mingw32 mingw64) (equalp type "a") ;; valid on Unix and MinGW
                     #+(and windows (not (or mingw32 mingw64))) (equalp type "lib"))
227
          #+(or abcl allegro clisp clozure cmu lispworks sbcl scl xcl) (equalp type (compile-file-type)))))
228
229
230
231
232
233

  (defgeneric* (trivial-system-p) (component))

  (defun user-system-p (s)
    (and (typep s 'system)
         (not (builtin-system-p s))
234
         (not (trivial-system-p s)))))
235

236
(eval-when (#-lispworks :compile-toplevel :load-toplevel :execute)
237
  (deftype user-system () '(and system (satisfies user-system-p))))
238
239
240
241
242
243
244
245
246

;;;
;;; First we handle monolithic bundles.
;;; These are standalone systems which contain everything,
;;; including other ASDF systems required by the current one.
;;; A PROGRAM is always monolithic.
;;;
;;; MONOLITHIC SHARED LIBRARIES, PROGRAMS, FASL
;;;
247
248
249
(with-upgradability ()
  (defmethod component-depends-on :around ((o bundle-op) (c component))
    (if-let (op (and (eq (type-of o) 'bundle-op) (component-build-operation c)))
250
251
252
      `((,op ,c))
      (call-next-method)))

253
  (defun direct-dependency-files (o c &key (test 'identity) (key 'output-files) &allow-other-keys)
254
255
    ;; This file selects output files from direct dependencies;
    ;; your component-depends-on method better gathered the correct dependencies in the correct order.
256
257
    (while-collecting (collect)
      (map-direct-dependencies
Francois-Rene Rideau's avatar
Francois-Rene Rideau committed
258
259
260
       t o c #'(lambda (sub-o sub-c)
                 (loop :for f :in (funcall key sub-o sub-c)
                       :when (funcall test f) :do (collect f))))))
261

262
  (defmethod input-files ((o gather-op) (c system))
263
264
    (unless (eq (bundle-type o) :no-output-file)
      (direct-dependency-files o c :test 'bundlable-file-p :key 'output-files)))
265
266
267
268
269
270
271
272
273

  (defun select-bundle-operation (type &optional monolithic)
    (ecase type
      ((:dll :shared-library)
       (if monolithic 'monolithic-dll-op 'dll-op))
      ((:lib :static-library)
       (if monolithic 'monolithic-lib-op 'lib-op))
      ((:fasl)
       (if monolithic 'monolithic-fasl-op 'fasl-op))
274
275
      ((:image)
       'image-op)
276
277
278
      ((:program)
       'program-op)))

279
  ;; This is originally from asdf-ecl.lisp. Does anyone use it?
280
281
282
283
284
285
  (defun make-build (system &rest args &key (monolithic nil) (type :fasl)
                             (move-here nil move-here-p)
                             &allow-other-keys)
    (let* ((operation-name (select-bundle-operation type monolithic))
           (move-here-path (if (and move-here
                                    (typep move-here '(or pathname string)))
286
                               (ensure-pathname move-here :namestring :lisp :ensure-directory t)
287
288
289
290
291
292
293
                               (system-relative-pathname system "asdf-output/")))
           (operation (apply #'operate operation-name
                             system
                             (remove-plist-keys '(:monolithic :type :move-here) args)))
           (system (find-system system))
           (files (and system (output-files operation system))))
      (if (or move-here (and (null move-here-p)
294
                             (member operation-name '(:program :image))))
295
296
297
298
299
300
301
302
          (loop :with dest-path = (resolve-symlinks* (ensure-directories-exist move-here-path))
                :for f :in files
                :for new-f = (make-pathname :name (pathname-name f)
                                            :type (pathname-type f)
                                            :defaults dest-path)
                :do (rename-file-overwriting-target f new-f)
                :collect new-f)
          files))))
303
304
305
306
307
308

;;;
;;; LOAD-FASL-OP
;;;
;;; This is like ASDF's LOAD-OP, but using monolithic fasl files.
;;;
309
310
(with-upgradability ()
  (defmethod component-depends-on ((o load-fasl-op) (c system))
311
    `((,o ,@(loop :for dep :in (component-sideway-dependencies c)
312
313
314
                  :collect (resolve-dependency-spec c dep)))
      (,(if (user-system-p c) 'fasl-op 'load-op) ,c)
      ,@(call-next-method)))
315

316
317
318
  (defmethod input-files ((o load-fasl-op) (c system))
    (when (user-system-p c)
      (output-files (find-operation o 'fasl-op) c)))
319

320
  (defmethod perform ((o load-fasl-op) (c system))
321
322
    (when (input-files o c)
      (perform-lisp-load-fasl o c)))
323

324
325
  (defmethod mark-operation-done :after ((o load-fasl-op) (c system))
    (mark-operation-done (find-operation o 'load-op) c)))
326
327
328
329
330
331
332

;;;
;;; PRECOMPILED FILES
;;;
;;; This component can be used to distribute ASDF systems in precompiled form.
;;; Only useful when the dependencies have also been precompiled.
;;;
333
334
335
336
(with-upgradability ()
  (defmethod trivial-system-p ((s system))
    (every #'(lambda (c) (typep c 'compiled-file)) (component-children s)))

Francois-Rene Rideau's avatar
Francois-Rene Rideau committed
337
  (defmethod input-files ((o operation) (c compiled-file))
338
    (list (component-pathname c)))
339
340
341
342
343
344
  (defmethod perform ((o load-op) (c compiled-file))
    (perform-lisp-load-fasl o c))
  (defmethod perform ((o load-source-op) (c compiled-file))
    (perform (find-operation o 'load-op) c))
  (defmethod perform ((o load-fasl-op) (c compiled-file))
    (perform (find-operation o 'load-op) c))
345
  (defmethod perform ((o operation) (c compiled-file))
346
    nil))
347
348
349
350

;;;
;;; Pre-built systems
;;;
351
352
353
(with-upgradability ()
  (defmethod trivial-system-p ((s prebuilt-system))
    t)
354

355
  (defmethod perform ((o link-op) (c prebuilt-system))
356
    nil)
357

358
  (defmethod perform ((o basic-fasl-op) (c prebuilt-system))
359
    nil)
360

361
  (defmethod perform ((o lib-op) (c prebuilt-system))
362
363
    nil)

364
  (defmethod perform ((o dll-op) (c prebuilt-system))
365
    nil)
366
367

  (defmethod component-depends-on ((o gather-op) (c prebuilt-system))
368
369
370
    nil)

  (defmethod output-files ((o lib-op) (c prebuilt-system))
371
    (values (list (prebuilt-system-static-library c)) t)))
372

373

374
375
376
;;;
;;; PREBUILT SYSTEM CREATOR
;;;
377
(with-upgradability ()
378
  (defmethod output-files ((o deliver-asd-op) (s system))
379
380
381
    (list (make-pathname :name (component-name s) :type "asd"
                         :defaults (component-pathname s))))

382
  (defmethod perform ((o deliver-asd-op) (s system))
383
384
385
    (let* ((inputs (input-files o s))
           (fasl (first inputs))
           (library (second inputs))
386
           (asd (first (output-files o s)))
387
           (name (if (and fasl asd) (pathname-name asd) (return-from perform)))
388
           (version (component-version s))
389
390
391
392
393
394
395
           (dependencies
             (if (operation-monolithic-p o)
                 (remove-if-not 'builtin-system-p
                                (required-components s :component-type 'system
                                                       :keep-operation 'load-op))
                 (while-collecting (x) ;; resolve the sideway-dependencies of s
                   (map-direct-dependencies
Francois-Rene Rideau's avatar
Francois-Rene Rideau committed
396
                    t 'load-op s
397
398
399
400
401
402
403
404
                    #'(lambda (o c)
                        (when (and (typep o 'load-op) (typep c 'system))
                          (x c)))))))
           (depends-on (mapcar 'coerce-name dependencies)))
      (when (pathname-equal asd (system-source-file s))
        (cerror "overwrite the asd file"
                "~/asdf-action:format-action/ is going to overwrite the system definition file ~S which is probably not what you want; you probably need to tweak your output translations."
                (cons o s) asd))
405
406
      (with-open-file (s asd :direction :output :if-exists :supersede
                             :if-does-not-exist :create)
407
408
409
        (format s ";;; Prebuilt~:[~; monolithic~] ASDF definition for system ~A~%"
                (operation-monolithic-p o) name)
        (format s ";;; Built for ~A ~A on a ~A/~A ~A~%"
410
411
412
413
414
                (lisp-implementation-type)
                (lisp-implementation-version)
                (software-type)
                (machine-type)
                (software-version))
415
        (let ((*package* (find-package :asdf-user)))
416
          (pprint `(defsystem ,name
417
                     :class prebuilt-system
418
                     :version ,version
419
                     :depends-on ,depends-on
420
                     :components ((:compiled-file ,(pathname-name fasl)))
421
422
423
                     ,@(when library `(:lib ,(file-namestring library))))
                  s)
          (terpri s)))))
424
425

  #-(or ecl mkcl)
426
  (defmethod perform ((o basic-fasl-op) (c system))
427
    (let* ((input-files (input-files o c))
428
429
           (fasl-files (remove (compile-file-type) input-files :key #'pathname-type :test-not #'equalp))
           (non-fasl-files (remove (compile-file-type) input-files :key #'pathname-type :test #'equalp))
430
431
           (output-files (output-files o c))
           (output-file (first output-files)))
432
      (assert (eq (not input-files) (not output-files)))
433
434
      (when input-files
        (when non-fasl-files
435
          (error "On ~A, asdf/bundle can only bundle FASL files, but these were also produced: ~S"
436
                 (implementation-type) non-fasl-files))
437
438
        (when (or (prologue-code o) (epilogue-code o)
                  (prologue-code c) (epilogue-code c))
439
440
441
442
443
444
445
446
          (error "prologue-code and epilogue-code are not supported on ~A"
                 (implementation-type)))
        (with-staging-pathname (output-file)
          (combine-fasls fasl-files output-file)))))

  (defmethod input-files ((o load-op) (s precompiled-system))
    (bundle-output-files (find-operation o 'fasl-op) s))

447
448
449
  (defmethod perform ((o load-op) (s precompiled-system))
    (perform-lisp-load-fasl o s))

450
  (defmethod component-depends-on ((o load-fasl-op) (s precompiled-system))
451
    #+xcl (declare (ignorable o))
452
453
    `((load-op ,s) ,@(call-next-method))))

454
#| ;; Example use:
455
456
457
458
(asdf:defsystem :precompiled-asdf-utils :class asdf::precompiled-system :fasl (asdf:apply-output-translations (asdf:system-relative-pathname :asdf-utils "asdf-utils.system.fasl")))
(asdf:load-system :precompiled-asdf-utils)
|#

459
#+ecl
460
461
462
463
464
465
466
467
468
469
470
(with-upgradability ()
  (defun uiop-library-file ()
    (or (and (find-system :uiop nil)
             (system-source-directory :uiop)
             (progn
               (operate 'lib-op :uiop)
               (output-file 'lib-op :uiop)))
        (resolve-symlinks* (c::compile-file-pathname "sys:asdf" :type :lib))))
  (defmethod input-files :around ((o program-op) (c system))
    (let ((files (call-next-method))
          (plan (traverse-sub-actions o c :plan-class 'sequential-plan)))
471
      (unless (or (and (system-source-directory :uiop)
472
473
474
475
                       (plan-operates-on-p plan '("uiop")))
                  (and (system-source-directory :asdf)
                       (plan-operates-on-p plan '("asdf"))))
        (pushnew (uiop-library-file) files :test 'pathname-equal))
476
      files)))
477

478
479
#+(or ecl mkcl)
(with-upgradability ()
480
481
482
  (defun register-pre-built-system (name)
    (register-system (make-instance 'system :name (coerce-name name) :source-file nil))))

483
#+ecl
484
(with-upgradability ()
485
486
487
  ;; I think that Juanjo intended for this to be.
  ;; But it might break systems with missing dependencies,
  ;; and there is a weird bug in test-xach-update-bug.script
488
489
  ;;(unless (use-ecl-byte-compiler-p)
  ;;  (setf *load-system-operation* 'load-fasl-op))
490

491
  (defmethod perform ((o link-op) (c system))
492
493
494
    (let* ((object-files (input-files o c))
           (output (output-files o c))
           (bundle (first output))
495
           (targetp (eq (type-of o) (component-build-operation c)))
496
           (kind (bundle-type o)))
497
      (when output
498
499
500
501
502
503
504
        (apply 'create-image
               bundle (append object-files (bundle-op-lisp-files o))
               :kind kind
               :prologue-code (or (prologue-code o) (when targetp (prologue-code c)))
               :epilogue-code (or (epilogue-code o) (when targetp (epilogue-code c)))
               :build-args (bundle-op-build-args o)
               (when targetp `(:entry-point ,(component-entry-point c))))))))
505
506

#+mkcl
507
(with-upgradability ()
508
509
510
511
  (defmethod perform ((o dll-op) (s system))
    (apply #'compiler::build-shared-library (output-file o s)
           :lisp-object-files (input-files o s) (bundle-op-build-args o)))

512
  (defmethod perform ((o lib-op) (s system))
513
    (apply #'compiler::build-static-library (output-file o s)
514
           :lisp-object-files (input-files o s) (bundle-op-build-args o)))
515

516
  (defmethod perform ((o basic-fasl-op) (s system))
517
    (apply #'compiler::build-bundle (output-file o s)
518
           :lisp-object-files (input-files o s) (bundle-op-build-args o)))
519

520
521
522
523
524
525
526
527
528
529
  (defmethod perform ((o program-op) (s system))
    (apply #'compiler::build-program (output-file o s)
           :lisp-object-files (append (program-prefix-lisp-object-files s)
                                      (input-files o s)
                                      (program-postfix-lisp-object-files s))
           :object-files (program-object-files s)
           :prologue-code (prologue-code s)
           :epilogue-code (epilogue-code s)
           (program-extra-build-args s)))

530
  (defun bundle-system (system &rest args &key force (verbose t) version &allow-other-keys)
531
    (declare (ignore force verbose version))
532
    (apply #'operate 'deliver-asd-op system args)))
533
534

#+(and (not asdf-use-unsafe-mac-bundle-op)
535
536
       (or (and ecl darwin)
           (and abcl darwin (not abcl-bundle-op-supported))))
Francois-Rene Rideau's avatar
Francois-Rene Rideau committed
537
538
(defmethod perform :before ((o basic-fasl-op) (c component))
  (unless (featurep :asdf-use-unsafe-mac-bundle-op)
539
    (cerror "Continue after modifying *FEATURES*."
Francois-Rene Rideau's avatar
Francois-Rene Rideau committed
540
541
542
            "BASIC-FASL-OP bundle operations are not supported on Mac OS X for this lisp.~%~T~
To continue, push :asdf-use-unsafe-mac-bundle-op onto *FEATURES*.~%~T~
Please report to ASDF-DEVEL if this works for you.")))