mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-19 05:39:18 +02:00
Supporting foreign library dependencies for chibi.
This commit is contained in:
parent
2f27dbb5bc
commit
d96f1c9fc5
3 changed files with 36 additions and 16 deletions
|
@ -1781,21 +1781,36 @@
|
|||
(else ".so"))))
|
||||
(so-flags (cond-expand (macosx '("-dynamiclib" "-Oz"))
|
||||
(else '("-fPIC" "-shared" "-Os"))))
|
||||
(cc-cmd (append cc cflags so-flags
|
||||
(if local-test? '("-Iinclude" "-L.") '())
|
||||
`("-o" ,so-file ,c-file "-lchibi-scheme"))))
|
||||
(and (or (file-exists? c-file)
|
||||
(and (file-exists? stub-file)
|
||||
(or (and (system? (append chibi-ffi (list stub-file)))
|
||||
(file-exists? c-file))
|
||||
(yes-or-no? cfg "couldn't generate c from stub: "
|
||||
stub-file " - install anyway?")))
|
||||
(yes-or-no? cfg "can't find ffi stub or c source for: "
|
||||
base " - install anyway?"))
|
||||
(or (system? cc-cmd)
|
||||
(yes-or-no? cfg "couldn't compile chibi ffi c code: "
|
||||
c-file " - install anyway?"))
|
||||
(lp (cdr ls))))))))
|
||||
(lib-flags
|
||||
(map (lambda (lib) (string-append "-l" lib))
|
||||
(library-foreign-dependencies impl cfg library)))
|
||||
(ffi-cmd
|
||||
`(,@chibi-ffi
|
||||
"-c" "-cc" ,(car cc)
|
||||
"-f" ,(string-join cflags " ")
|
||||
"-f" ,(string-join lib-flags " ")
|
||||
,@(if local-test? '("-f" "-Iinclude -L.") '())
|
||||
,@(if (pair? (cdr cc))
|
||||
(list "-f" (string-join (cdr cc) " "))
|
||||
'())
|
||||
,stub-file))
|
||||
(cc-cmd
|
||||
`(,@cc ,@cflags ,@so-flags
|
||||
,@(if local-test? '("-Iinclude" "-L.") '())
|
||||
"-o" ,so-file ,c-file "-lchibi-scheme"
|
||||
,@lib-flags)))
|
||||
(when (or (and (file-exists? c-file)
|
||||
(or (system? cc-cmd)
|
||||
(yes-or-no?
|
||||
cfg "couldn't compile chibi ffi c code: "
|
||||
c-file " - install anyway?")))
|
||||
(and (file-exists? stub-file)
|
||||
(or (system? ffi-cmd)
|
||||
(yes-or-no? cfg "couldn't compile stub: "
|
||||
stub-file " - install anyway?")))
|
||||
(yes-or-no? cfg "can't find ffi stub or c source for: "
|
||||
base " - install anyway?"))
|
||||
(lp (cdr ls))))))))
|
||||
|
||||
(define (chicken-builder impl cfg library dir)
|
||||
(let* ((library-file (make-path dir (get-library-file cfg library)))
|
||||
|
|
|
@ -394,6 +394,11 @@
|
|||
(lambda (x) (or (and (pair? x) (eq? 'depends (car x)) (cdr x)) '()))
|
||||
(cdr (library-for-impl impl cfg lib))))
|
||||
|
||||
(define (library-foreign-dependencies impl cfg lib)
|
||||
(append-map
|
||||
(lambda (x) (or (and (pair? x) (eq? 'foreign-depends (car x)) (cdr x)) '()))
|
||||
(cdr (library-for-impl impl cfg lib))))
|
||||
|
||||
(define (parse-library-name str)
|
||||
(cond
|
||||
((pair? str) str)
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
library-name->path library->path get-library-file find-library-file
|
||||
library-url library-name parse-library-name library-name->path
|
||||
library-analyze library-include-files library-dependencies
|
||||
library-shared-include-files
|
||||
library-shared-include-files library-foreign-dependencies
|
||||
library-rewrite-includes library-file-name
|
||||
get-program-file program-name program-install-name
|
||||
invalid-package-reason valid-package?
|
||||
|
|
Loading…
Add table
Reference in a new issue