Added c-flags-from-script to chibi-ffi

This commit is contained in:
Brian Caine 2017-08-06 04:04:08 -04:00
parent 212231dca6
commit 90e2cb1aa6

View file

@ -415,6 +415,23 @@
(define (c-link lib)
(set! *clibs* (cons lib *clibs*)))
(define (c-flags-from-script cmd)
(eval '(import (chibi process)
; lest I clobber the existing string-split:
(prefix (chibi string) imported:)
(chibi char-set full)) ; for char-set:whitespace
(current-environment))
(let ((string-null? (eval 'imported:string-null? (current-environment)))
(string-split (eval 'imported:string-split (current-environment)))
(process->string (eval 'process->string (current-environment)))
(char-set:whitespace
(eval 'char-set:whitespace (current-environment))))
(set! *cflags*
(append *cflags*
(filter
(lambda (x) (not (string-null? x)))
(string-split (process->string cmd) char-set:whitespace))))))
(define (c-declare . args)
(apply cat args)
(newline))