-
Notifications
You must be signed in to change notification settings - Fork 0
/
clbuild.lisp
787 lines (624 loc) · 23 KB
/
clbuild.lisp
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
;;; Short script for the Lisp side of clbuild:
;;; Argument parsing and application startup.
;;;
;;; Part of clbuild by Luke Gorrie and contributors:
;;; Luke Gorrie <luke@member.fsf.org>
;;; Anthony Chaumas-Pellet <achaumas@wispery.info>
;;; Christophe Rhodes <csr21@cantab.net>
;;; David Lichteblau <david@lichteblau.com>
;;; Eric Marsden <eric.marsden@free.fr>
(defpackage :clbuild
(:use :cl))
(in-package :clbuild)
#+openmcl
(setf *default-pathname-defaults*
(pathname (concatenate 'string (ccl:getenv "PWD") "/")))
(defparameter *raw-args*
#+sbcl (cdr sb-ext:*posix-argv*)
#-sbcl (with-open-file (s cl-user::*clbuild-args*)
(loop
for line = (read-line s nil)
while line
collect line)))
(defparameter *cmd* (car *raw-args*))
(defparameter *args*
(loop
with args = (cdr *raw-args*)
while args
for arg = (pop args)
if (eql (mismatch arg "--") 2)
collect (intern (string-upcase (subseq arg 2)) :keyword) into keys
and collect (pop args) into keys
else collect arg into normals
finally (return (append normals keys))))
(push (intern (string-upcase *cmd*) :clbuild) *features*)
(defun quit (rc)
(or #+sbcl (sb-ext:quit :unix-status rc)
#+openmcl (ccl:quit rc)
(error "not implemented")))
(defun namify (arg)
(if (listp arg)
(car arg)
arg))
(defun &p (x)
(find x '(&key &optional)))
(defmacro with-application ((&rest args) &body body)
(let* ((keypos (position '&key args))
(non-keys (mapcar #'namify (if keypos (subseq args 0 keypos) args)))
(keys (when keypos (mapcar #'namify (subseq args (1+ keypos))))))
`(let ((non-keys ',non-keys)
(keys ',keys))
#+sbcl (declare (optimize sb-ext:inhibit-warnings))
(flet ((usage ()
(format t "Usage: clbuild ~A~:[~; [KEYS]~]~{ ~(~A~)~}~%"
*cmd* keys non-keys)
(when keys
(format t "Optional keys:~{ --~(~A~) VALUE~}~%"
keys))))
(when (find (car *args*) '("help" "--help" "-help" "-h" "-H")
:test #'equal)
(usage)
(quit 0))
(handler-case
(destructuring-bind ,args *args*
(declare (ignore ,@(mapcar #'namify (remove-if #'&p args)))))
(error ()
(format t "Error: Invalid command line arguments.~%~%")
(usage)
(quit 1))))
(destructuring-bind ,args
*args*
,@body)
(quit 0))))
;; helper function instead of REQUIRE, for the benefit of non-SBCL lisps
(defun make (system)
(let ((*package* (find-package :cl-user)))
(asdf:operate 'asdf:load-op system)))
(defun make-clim (system)
#-(or :clim-graphic-forms :clim-gtkairo)
(unless (find-package :xlib)
(make :clx))
(make :mcclim)
(make system))
#+sbcl
(declaim (optimize sb-ext:inhibit-warnings))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Hunchentoot
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
#+clbuild::hunchentoot
#+clbuild::hunchentoot
(make :hunchentoot-test)
(with-application (&key (port "4242"))
(setf port (parse-integer port))
(setf tbnl:*catch-errors-p* nil)
(hunchentoot:start-server :port port)
(format t "~%Webserver is running at ~
http://localhost:~D/hunchentoot/test~%~
Type RET to quit~%"
port)
(read-line))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; CLPython
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
#+clbuild::clpython
#+clbuild::clpython
(make :clpython)
(with-application ()
(setf common-lisp-user::*clpython-module-search-paths* "/usr/lib/python2.5/")
(clpython:repl))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; WebDAV
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
#+clbuild::webdav
#+clbuild::webdav
(make :cl-webdav)
(with-application (directory &key (port "4242"))
(setf port (parse-integer port))
(setf tbnl:*catch-errors-p* nil)
(setf dav:*file-resource-base-path-namestring* directory)
(push (dav:create-dav-dispatcher 'dav:file-resource) tbnl:*dispatch-table*)
(hunchentoot:start-server :port port)
(format t "~%WebDAV server for ~A is running at http://localhost:~D/~%"
directory
port)
(format t "Type RET to quit~%")
(read-line))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Eclipse
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
#+clbuild::eclipse
#+clbuild::eclipse
(unless (find-package :eclipse)
(make :eclipse))
;;; (eclipse-system:compile-themes \"source/eclipse/themes/microGUI/\"
;;; \"source/eclipse/themes/Step/\"
;;; \"source/eclipse/themes/brushed-metal/\"
;;; \"source/eclipse/themes/CoolClean/\")
(with-application (&optional display)
(defparameter cl-user::*eclipse-initfile* ".eclipse.lisp")
(defparameter cl-user::*eclipse-eclipsedir* nil)
(load (compile-file "source/eclipse/lib/clx-ext/event.lisp"))
(apply #'eclipse:eclipse
(when display
(list :display (parse-integer display)))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; CLIM Listener
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
#+clbuild::listener
#+clbuild::listener
(make-clim :clim-listener)
(with-application ()
(clim-listener:run-listener))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; CLIM Desktop Launcher
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
#+clbuild::clim-launcher
#+clbuild::clim-launcher
(progn
(make-clim :clim-clx) ;closure build order issue
(make-clim :clim-desktop))
(with-application ()
#+clim-gtkairo (cerror "okay, I've been warned"
"this won't work well with gtkairo")
(setf clim:*default-frame-manager*
(make-instance 'climi::pixie/clx-look :port (clim:find-port)))
(clim-launcher::start))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Gsharp
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
#+clbuild::gsharp
#+clbuild::gsharp
(make-clim :gsharp)
(with-application ()
(gsharp::gsharp))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; demo demo
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
#+clbuild::demodemo
#+clbuild::demodemo
(make-clim :clim-examples)
(with-application ()
(clim-demo::demodemo))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; CLIM alerts
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
#+clbuild::clim-alerts
#+clbuild::clim-alerts
(make-clim :clim-alerts)
(with-application ()
(clim-alerts::start :new-thread nil))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; climacs
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
#+clbuild::climacs
#+clbuild::climacs
(make-clim :climacs)
(with-application ()
(climacs:climacs))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; closure
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
#+clbuild::closure
#+clbuild::closure
(make-clim :climacs)
(with-application (&optional url)
(setf gui:*home-page* url)
(clim-user::run-closure :new-process nil))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; beirc
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
#+clbuild::beirc
#+clbuild::beirc
(make-clim :beirc)
(with-application ()
(beirc:beirc :new-process nil))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; climplayer
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
#+clbuild::climplayer
#+clbuild::climplayer
(make-clim :climplayer)
(with-application ()
(climplayer:climplayer))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; parse-xml
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
#+clbuild::parse-xml
#+clbuild::parse-xml
(make :cxml)
(with-application (filename)
(handler-case
(cxml:parse (pathname filename) nil)
(error (c)
(format t "~A~%" c)
(quit 0))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; validate-xml
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
#+clbuild::validate-xml
#+clbuild::validate-xml
(make :cxml)
(with-application (filename)
(handler-case
(cxml:parse (pathname filename) nil :validate t)
(error (c)
(format t "~A~%" c)
(quit 0))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; validate-relax-ng
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
#+clbuild::validate-relax-ng
#+clbuild::validate-relax-ng
(make :cxml-rng)
(with-application (xml-filename rng-filename &key (compact "no"))
(handler-case
(cxml:parse (pathname xml-filename)
(cxml-rng:make-validator
(cond
((equal compact "yes")
(cxml-rng:parse-compact (pathname rng-filename)))
((equal compact "no")
(cxml-rng:parse-schema (pathname rng-filename)))
(t
(error "invalid compact value, must be yes or no")))))
(error (c)
(format t "~A~%" c)
(quit 0))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; xuriella
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
#+clbuild::xuriella
#+clbuild::xuriella
(make :xuriella)
(with-application (xsl-filename xml-filename &key (output nil))
(handler-case
(xuriella:apply-stylesheet (pathname xsl-filename)
(pathname xml-filename)
:output (if output
(pathname output)
*standard-output*))
(error (c)
(format t "~A~%" c)
(quit 1))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; html-to-xhtml
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
#+clbuild::html-to-xhtml
#+clbuild::html-to-xhtml
#+clbuild::html-to-xhtml
(make :closure-html)
(make :cxml)
(with-application (html-filename output-filename)
(with-open-file (out output-filename
:element-type '(unsigned-byte 8)
:if-exists :error
:direction :output)
(chtml:parse (pathname html-filename)
(cxml:make-octet-stream-sink out))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; xhtml-to-html
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
#+clbuild::xhtml-to-html
#+clbuild::xhtml-to-html
#+clbuild::xhtml-to-html
(make :closure-html)
(make :cxml)
(with-application (xml-filename output-filename)
(with-open-file (out output-filename
:element-type '(unsigned-byte 8)
:if-exists :error
:direction :output)
(cxml:parse (pathname xml-filename)
(chtml:make-octet-stream-sink out))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; vecto-demo
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
#+clbuild::vecto-demo
#+clbuild::vecto-demo
(make :vecto)
(with-application
(filename &key (text "Lisp")
(font "/usr/share/fonts/truetype/ttf-bitstream-vera/Vera.ttf"))
(vecto:with-canvas (:width 90 :height 90)
(let ((font (vecto:get-font font))
(step (/ pi 7)))
(vecto:set-font font 40)
(vecto:translate 45 45)
(vecto:draw-centered-string 0 -10 text)
(vecto:set-rgb-stroke 1 0 0)
(vecto:centered-circle-path 0 0 35)
(vecto:stroke)
(vecto:set-rgba-stroke 0 0 1.0 0.5)
(vecto:set-line-width 4)
(dotimes (i 14)
(vecto:with-graphics-state
(vecto:rotate (* i step))
(vecto:move-to 30 0)
(vecto:line-to 40 0)
(vecto:stroke)))
(format t "Writing ~A~%" filename)
(vecto:save-png filename))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; ltk-demo
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
#+clbuild::ltk-demo
#+clbuild::ltk-demo
(make :ltk)
(with-application ()
(setf ltk:*debug-tk* nil)
(ltk:with-ltk ()
(let ((b (make-instance
'ltk:button
:text "Hello World!"
:command (lambda ()
(ltk:do-msg "Bye!" "Hello World!")
(setf ltk:*exit-mainloop* t)))))
(ltk:pack b))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; adw-charting-demo
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
#+clbuild::adw-charting-demo
#+clbuild::adw-charting-demo
(make :adw-charting)
(with-application (filename)
(adw-charting:with-pie-chart (400 200)
(let ((now (get-decoded-time)))
(adw-charting:add-slice "seconds past" now)
(adw-charting:add-slice "seconds left" (- 60 now))
(adw-charting:save-file filename))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; perfectstorm
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
#+clbuild::perfectstorm
#+clbuild::perfectstorm
(make :perfectstorm)
(with-application ()
(storm:storm))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; SWANK (server part only)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
#+clbuild::swank
#+clbuild::swank
(make :swank)
(with-application (&key (port "4005") (address "127.0.0.1"))
(let ((swank::*loopback-interface* address))
(swank:create-server :port (parse-integer port) :dont-close t))
(format t "Swank is running on port ~A. Press RET to exit.~%" port)
(read-line))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; record-dependencies (internal helper command)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
#+(or clbuild::record-dependencies clbuild::recompile-systems)
(progn
;; list of projects that hide their .asd files from us.
;; (We don't search recursively for .asd files unless it's really
;; necessary.)
(defvar *hidden-projects* '("clg" "graphic-forms" "eclipse"))
(defun project-to-systems (name)
(remove-if (lambda (name)
;; I've had it with broken test systems.
;; Let's blacklist them unconditionally.
(search "-test" name))
(mapcar (lambda (x) (pathname-name x))
(directory
(if (find name *hidden-projects* :test #'equal)
(format nil "source/~A/**/*.asd" name)
(format nil "source/~A/*.asd" name)))))))
#+clbuild::record-dependencies
#+clbuild::record-dependencies
(make :cl-ppcre)
(progn
(defun extra-system-dependencies (system)
;; add magic dependencies to ensure that clbuild configuration doesn't
;; leak into the dependency file too easily. In this case, we don't
;; want clim-gtkairo's dependency on cffi to appear or disappear every time
;; some rebuilds dependencies with a different backend.
;;
;; (Better include spurious dependencies than too few.)
;;
;; OpenMCL-specific stuff like acl-compat for hunchentoot might also have
;; to be added here.
(cdr (assoc system
'(("mcclim" "cffi"))
:test #'equal)))
(defun extra-project-dependencies (project)
(cdr (assoc project
'(("redshank" "slime"))
:test #'equal)))
(defun system-to-project (name)
(let* ((pathname (asdf:component-pathname (asdf:find-system name)))
(relative (enough-namestring pathname)))
(cond
((eq :absolute (car (pathname-directory relative)))
(error "found ~A outside of clbuild, can't translate to project"
name))
((equal "target" (second (pathname-directory relative)))
"sbcl")
((equal "source" (second (pathname-directory relative)))
(third (pathname-directory relative)))
(t
(error "found ~A outside of clbuild, can't translate to project"
name)))))
(defmacro without-errors ((error-value description) &body body)
`(handler-case
(progn ,@body)
(error (c)
(format t "Ignoring error ~A: ~A~%~%" ',description c)
,error-value)))
(defun system-dependencies (name)
(let ((dependencies '())
(seen '()))
(labels ((walk-dependency (sym)
(when (and (consp sym) (eq (car sym) :version))
(setf sym (second sym)))
(unless (find sym seen)
(push sym seen)
(let ((name (string-downcase sym)))
(when (asdf::system-definition-pathname name)
(pushnew sym dependencies))
(register-dependencies name))))
(register-dependencies (name)
(let* ((system (asdf:find-system name))
(in-order-to
(slot-value system 'asdf::in-order-to)))
(loop
for (nil (nil . depends-on)) in in-order-to
do (dolist (next depends-on)
(without-errors (nil "while walking dependencies")
(walk-dependency next)))))))
(register-dependencies name))
dependencies))
(defun safe-project-dependencies (project)
(let ((projects
(loop
for system in (project-to-systems project)
append (mapcar (lambda (system)
(without-errors (nil "when looking for system")
(system-to-project system)))
(without-errors
(nil "while scanning dependencies")
(append (extra-system-dependencies system)
(system-dependencies system)))))))
(setf projects (append projects (extra-project-dependencies project)))
(setf projects (remove nil projects))
(setf projects (remove "sbcl" projects :test 'equal))
(setf projects (remove project projects :test 'equal))
(setf projects (remove-duplicates projects :test 'equal))
(sort projects #'string-lessp)))
(with-application (project-string dependency-file-name)
(let ((projects (cl-ppcre:split "\\s+" project-string)))
#+nil
(setf projects
;; requires clx in FIND-SYSTEM:
(remove "eclipse" projects :test 'equal))
(setf projects (sort projects #'string-lessp))
(dolist (project projects)
(dolist (system (project-to-systems project))
(without-errors (nil "in find-system")
(asdf:find-system system nil))))
(with-open-file (s dependency-file-name
:direction :output
:if-exists :rename-and-delete)
(format s
"# Dependencies between projects known to clbuild. If a~@
# project is not listed in this file, it can still be~@
# downloaded, but a warning will be issued.~@
# ~@
# THIS FILE IS AUTOGENERATED. Feel free to edit it if you~@
# must, but never commit a hand-written version. Use~@
# \"clbuild record-dependencies\" to recompute the official~@
# version. Doing so requires a complete check out,~@
# including wnpp projects. Please look out for unintended~@
# changes due to local configuration issues before~@
# committing~@
# ~@
# Quick dependency FAQ:~@
# ~@
# This file is an educated guess and sometimes not perfect.~@
# We prefer to err on the side of too many dependencies~@
# rather than too few.~@
# ~@
# However, the following situations are NOT necessarily bugs:~@
# - circular dependencies~@
# (cffi depends on trivial-features, which depends on~@
# cffi itself. That is NOT a problem.~@
# - non-transitive dependencies~@
# (if A depends on B, which depends on C, it does NOT~@
# follow that A depends on C.)~@
# ~@
# For details, please refer to~@
# http://common-lisp.net/project/clbuild/#faq_dependency_details~@
# ~%")
(dolist (project projects)
(format t "Looking for ~A's dependencies...~%" project)
(format s "~A~{ ~A~} ~%"
project
(safe-project-dependencies project)))))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; recompile-systems (internal helper command)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
#+clbuild::recompile-systems
#+clbuild::recompile-systems
#+clbuild::recompile-systems
(make :cl-ppcre)
(defparameter *blacklisted-systems*
'(
;; need to rip out the theming fasls and configuration file stuff
;; to make it build reliably:
"eclipse"
;; bogus #+sbcl reader conditional:
#+sbcl "cl-typegraph"
#+sbcl "cl-typesetting-test"
;; error due to constant folded reference to function object
"cl-webdav"
;; don't want to depend on foreign libraries unnecessarily:
;; ... yes, this loads only clsql-postgresql-socket!
;; Good enough, I hope.
"clsql-db2" "clsql-mysql" "clsql-aodbc" "clsql-oracle"
"clsql-postgresql" "clsql-sqlite" "clsql-sqlite3" "clsql-odbc"
;; CFFI-GROVEL incompatibility?
"trivial-features-tests"
;; assumes sb-bsd-sockets is already loaded instead of depending on it
"ltk-remote"
;; .asd file assumes cells is already loaded
"cells-test"
;; bogus dependencies in system
"flexichain-test"
;; loads clsql from the asd file (argh!)
"ele-clsql"
;; Require LIFT, which isn't needed otherwise
"metabang-bind-test" "cl-containers-test"
;; windows only:
#-(or windows mswindows win32) "graphic-forms"
#-(or windows mswindows win32) "graphic-forms-tests"
#-(or windows mswindows win32) "graphic-forms-uitoolkit"
;; random extra systems
"mcclim-gif-bitmaps" "mcclim-jpeg-bitmaps"
;; blacklist funny test systems for no particular reason:
"babel-tests" "clpython-test"))
(with-application (projects-string &key dump verbose force)
(let ((projects (cl-ppcre:split "\\s+" projects-string))
;; the perpetual fixme list:
(blacklisted-systems (unless force *blacklisted-systems*))
(skipped-systems '())
(*package* (find-package :cl-user)))
;; FIXME: it would be cooler to guess dependencies just like we do
;; above, and then process the projects in topological order, so
;; that, say, "Loading mcclim" is printed before "Loading beirc".
(setf projects (sort projects #'string-lessp))
(flet ((build ()
(dolist (project projects)
(dolist (system (project-to-systems project))
(cond
((find system blacklisted-systems :test #'equal)
(push system skipped-systems))
(t
(format t "Loading ~A...~%" system)
(asdf:operate 'asdf:load-op system :verbose verbose)))))))
(if verbose
(build)
(handler-bind
;; make SBCL STFU
((style-warning #'muffle-warning)
#+sbcl (sb-ext:compiler-note #'muffle-warning))
(let ((*compile-verbose* nil)
(*compile-print* nil)
(*load-verbose* nil)
(*load-print* nil))
(build)))))
(when skipped-systems
(format t "WARNING: The following black-listed systems were skipped: ~
~{~A~^, ~}~%~
Try --force t to include them.~%"
skipped-systems))
(when dump
(format t "Dumping monster.core...~%")
(force-output)
#+sbcl (sb-ext:save-lisp-and-die "monster.core")
#+clozure-common-lisp (ccl:save-application "monster.core")
#-(or sbcl clozure-common-lisp)
(error "don't know how to save this lisp"))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; fell through
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(error "command not found")