chiark / gitweb /
cl-fringe.lisp: Fix the `cl-launch' machinery.
[fringe] / sbcl-build
1 #! /bin/sh -e
2 ":"; exec sbcl --script "$0" "$@" # -*-lisp-*-
3
4 (require 'sb-executable)
5
6 (let* ((args (cdr *posix-argv*))
7        (prog (pathname-name *load-pathname*))
8        (cmd (pop args)))
9   (labels ((moan (message &rest arguments)
10              (format *error-output* "~A: ~?~%" prog message arguments))
11            (die (message &rest arguments)
12              (apply #'moan message arguments)
13              (exit :code 1)))
14     (cond
15       ((not cmd)
16        (format *error-output*
17                "Usage: ~A build SOURCE SOURCE ...~%~
18              ~0~       ~:*~A link OUTPUT FASL FASL ...~%"
19                prog)
20        (exit :code 1))
21       ((string= cmd "build")
22        (let ((rc 0))
23          (dolist (file args)
24            (unless (handler-case (compile-file file :verbose nil :print nil)
25                      (error (cond)
26                        (moan "failed to compile `~A':~%~8T~A" file cond)))
27              (setf rc 1)))
28          (exit :code rc)))
29       ((string= cmd "link")
30        (let ((out (pop args)))
31          (handler-case (sb-executable:make-executable out args)
32            (error (cond)
33              (die "failed to make executable:~%~8T~A" cond)))))
34       (t
35        (die "unknown command `~A'" cmd)))))