Fix a test.
[sbcl.git] / crossbuild-runner / pass-1.lisp
blobece76b88583195b135714e9a205495a5eb0c9fa4
1 ;; (setq *default-pathname-defaults* #p"") ; FIXME: causes redefinition warnings!
2 (sb-int:binding*
3 (((configuration-name target-name features)
4 (destructuring-bind (first second third) (cdr *posix-argv*)
5 (values first second third)))
6 (arch-symbol (intern (string-upcase target-name) "KEYWORD"))
7 (features (read-from-string features))
8 (subtract-features
9 (mapcan (lambda (x) (if (typep x '(cons (eql not))) (list (cadr x))))
10 features))
11 (add-features (remove-if-not #'symbolp features))
12 (build-dir (format nil "obj/xbuild/~A/" configuration-name))
13 (ltf (format nil "~A/local-target-features" build-dir))
14 (objroot (format nil "~A/from-host/" build-dir)))
15 (ensure-directories-exist objroot)
16 (defvar *sbcl-host-obj-prefix* objroot)
17 (let ((makeflags (sb-ext:posix-getenv "MAKEFLAGS")))
18 (when (search "--jobserver" makeflags)
19 (setq sb-sys:*stdout* (open (format nil "~A/stdout" objroot) :direction :output
20 :if-does-not-exist :create :if-exists :supersede)
21 sb-sys:*stderr* (open (format nil "~A/stderr" objroot) :direction :output
22 :if-does-not-exist :create :if-exists :supersede))))
23 (defvar *sbcl-local-target-features-file* ltf)
24 (with-open-file (*standard-output* ltf :direction :output
25 :if-does-not-exist :create
26 :if-exists :supersede)
27 (format t "(lambda (features)
28 (set-difference (union features (list :crossbuild-test :os-provides-dlopen ~s~{ ~s~}~%"
29 arch-symbol add-features)
30 ;; "features" contains the mandatory set of symbols for any build of that target.
31 (let ((features-filename "features"))
32 (with-open-file (f (format nil "crossbuild-runner/backends/~a/~a"
33 target-name features-filename))
34 (let ((string (make-string (file-length f))))
35 (read-sequence string f)
36 (write-string string))))
37 (format t ")) '~S))~%" subtract-features))
38 (load "make-host-1.lisp")
39 (finish-output sb-sys:*stdout*)
40 (finish-output sb-sys:*stderr*)
41 (save-lisp-and-die (format nil "~A/xc.core" build-dir)))