mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-07-04 03:36:36 +02:00
Add support for --foreign-depends args. Fix library install compilation bug.
This commit is contained in:
parent
bde4f34733
commit
e2dbcf3ff2
3 changed files with 21 additions and 20 deletions
|
@ -1613,6 +1613,11 @@ can specify any option, for example:
|
||||||
(license gpl))))
|
(license gpl))))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
\itemlist[
|
||||||
|
\item{\scheme{--foreign-depends} - specify foreign libraries the library
|
||||||
|
depends on (comma-delimited) (for example ffi,sqlite3 for -lffi -lsqlite3)}
|
||||||
|
]
|
||||||
|
|
||||||
Top-level snow options are represented as a flat alist. Options
|
Top-level snow options are represented as a flat alist. Options
|
||||||
specific to a command are nested under \scheme{(command (name ...))},
|
specific to a command are nested under \scheme{(command (name ...))},
|
||||||
with most options here being for \scheme{package}. Here unless
|
with most options here being for \scheme{package}. Here unless
|
||||||
|
|
|
@ -129,7 +129,8 @@
|
||||||
declarations ...)
|
declarations ...)
|
||||||
(let* ((dir (library-path-base file name))
|
(let* ((dir (library-path-base file name))
|
||||||
(lib-file (path-relative file dir))
|
(lib-file (path-relative file dir))
|
||||||
(lib-dir (path-directory lib-file)))
|
(lib-dir (path-directory lib-file))
|
||||||
|
(foreign-depends (conf-get-list cfg 'foreign-depends)))
|
||||||
(define (resolve file)
|
(define (resolve file)
|
||||||
(let ((dest-path (if (equal? lib-dir ".")
|
(let ((dest-path (if (equal? lib-dir ".")
|
||||||
file
|
file
|
||||||
|
@ -158,7 +159,8 @@
|
||||||
(warn "couldn't find ffi stub or c source" base)
|
(warn "couldn't find ffi stub or c source" base)
|
||||||
'()))))
|
'()))))
|
||||||
(let lp ((ls declarations)
|
(let lp ((ls declarations)
|
||||||
(info `(,@(cond
|
(info `((foreign-depends ,@foreign-depends)
|
||||||
|
,@(cond
|
||||||
((conf-get cfg '(command package author))
|
((conf-get cfg '(command package author))
|
||||||
=> (lambda (x) (list (list 'author x))))
|
=> (lambda (x) (list (list 'author x))))
|
||||||
(else '()))
|
(else '()))
|
||||||
|
@ -210,7 +212,8 @@
|
||||||
files
|
files
|
||||||
chibi-ffi?))
|
chibi-ffi?))
|
||||||
(('cond-expand clauses ...)
|
(('cond-expand clauses ...)
|
||||||
(let ((libs+files (map (lambda (c) (lp c '() '() '() #f)) clauses)))
|
(let ((libs+files (map (lambda (c)
|
||||||
|
(lp c '() '() '() #f)) clauses)))
|
||||||
(lp (cdr ls)
|
(lp (cdr ls)
|
||||||
(cons (cons 'cond-expand
|
(cons (cons 'cond-expand
|
||||||
(map cons
|
(map cons
|
||||||
|
@ -2045,34 +2048,26 @@
|
||||||
(so-file (string-append base (cond-expand (macosx ".dylib")
|
(so-file (string-append base (cond-expand (macosx ".dylib")
|
||||||
(else ".so"))))
|
(else ".so"))))
|
||||||
(so-flags (cond-expand (macosx '("-dynamiclib" "-Oz"))
|
(so-flags (cond-expand (macosx '("-dynamiclib" "-Oz"))
|
||||||
(else '("-fPIC" "-shared" "-Os"))))
|
(else '("-fPIC" "-shared""-Os"))))
|
||||||
(lib-flags
|
(lib-flags
|
||||||
(map (lambda (lib) (string-append "-l" lib))
|
(map (lambda (lib)
|
||||||
|
(string-append "-l" lib))
|
||||||
(library-foreign-dependencies impl cfg library)))
|
(library-foreign-dependencies impl cfg library)))
|
||||||
(ffi-cmd
|
(ffi-cmd `(,@chibi-ffi ,stub-file))
|
||||||
`(,@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-cmd
|
||||||
`(,@cc ,@cflags ,@so-flags
|
`(,@cc ,@cflags ,@so-flags
|
||||||
,@(if local-test? '("-Iinclude" "-L.") '())
|
,@(if local-test? '("-Iinclude" "-L.") '())
|
||||||
"-o" ,so-file ,c-file "-lchibi-scheme"
|
"-o" ,so-file ,c-file "-lchibi-scheme"
|
||||||
,@lib-flags)))
|
,@lib-flags)))
|
||||||
(when (or (and (file-exists? c-file)
|
(when (or (and (file-exists? stub-file)
|
||||||
|
(or (system? ffi-cmd)
|
||||||
|
(yes-or-no? cfg "couldn't compile stub: "
|
||||||
|
stub-file " - install anyway?")))
|
||||||
|
(and (file-exists? c-file)
|
||||||
(or (system? cc-cmd)
|
(or (system? cc-cmd)
|
||||||
(yes-or-no?
|
(yes-or-no?
|
||||||
cfg "couldn't compile chibi ffi c code: "
|
cfg "couldn't compile chibi ffi c code: "
|
||||||
c-file " - install anyway?")))
|
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: "
|
(yes-or-no? cfg "can't find ffi stub or c source for: "
|
||||||
base " - install anyway?"))
|
base " - install anyway?"))
|
||||||
(lp (cdr ls))))))))
|
(lp (cdr ls))))))))
|
||||||
|
|
|
@ -90,6 +90,7 @@
|
||||||
(chibi-path filename "path to chibi-scheme executable")
|
(chibi-path filename "path to chibi-scheme executable")
|
||||||
(cc string "path to c compiler")
|
(cc string "path to c compiler")
|
||||||
(cflags string "flags for c compiler")
|
(cflags string "flags for c compiler")
|
||||||
|
(foreign-depends (list string) "foreign libraries library depends on")
|
||||||
(use-curl? boolean ("use-curl") "use curl for file uploads")
|
(use-curl? boolean ("use-curl") "use curl for file uploads")
|
||||||
(sexp? boolean ("sexp") "output information in sexp format")
|
(sexp? boolean ("sexp") "output information in sexp format")
|
||||||
))
|
))
|
||||||
|
|
Loading…
Add table
Reference in a new issue