ffi/build.scm.in: Install compile-file:sf-only?ed options.
authorMatt Birkholz <matt@birkholz.chandler.az.us>
Thu, 31 Oct 2013 19:05:52 +0000 (12:05 -0700)
committerMatt Birkholz <matt@birkholz.chandler.az.us>
Thu, 31 Oct 2013 19:05:52 +0000 (12:05 -0700)
Copy the .bin if there is no .com.  Copy .ext too.

src/ffi/build.scm.in

index 4f094f57291ad1fdf10a2597006f78f3f6c63a9b..2696812c5baf95ae101511c741c3e7322cbd3b4c 100644 (file)
@@ -58,7 +58,7 @@ USA.
       (run-command (list "mkdir" library-dir))
       (run-command (list "chmod" "755" library-dir))
       (run-command (append (list "install" "-m644")
-                          (command-line) (list library-dir))))
+                          (files) (list library-dir))))
     (rewrite-file (string-append
                   destdir
                   (->namestring
@@ -67,6 +67,29 @@ USA.
                  (lambda (in out)
                    (rewrite-optiondb name dir in out)))))
 
+(define (files)
+  (append-map!
+   (lambda (arg)
+     (let ((p (->pathname arg)))
+       (if (pathname-type p)
+          (if (file-exists? p)
+              (list arg)
+              (error "Could not find file:" p))
+          (let ((files
+                 (let ((com (pathname-new-type p "com")))
+                   (if (file-exists? com)
+                       (list (->namestring com)
+                             (->namestring (pathname-new-type p "bci")))
+                       (let ((bin (pathname-new-type p "bin")))
+                         (if (file-exists? bin)
+                             (list (->namestring bin))
+                             (error "Could not find .com nor .bin:" p))))))
+                (ext (pathname-new-type p "ext")))
+            (if (file-exists? ext)
+                (cons (->namestring ext) files)
+                files)))))
+   (command-line)))
+
 (define (rewrite-file name rewriter)
   (let ((tmp (pathname-new-type name "tmp")))
     (call-with-exclusive-output-file tmp