mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-17 09:10:22 +02:00
Add -L'/
--load-path' option to "guile-tools compile".
* scripts/compile (%options): Add `-L'/`--load-path'. (parse-args): Have `load-path' default to '(). (compile): Handle `--load-path' option.
This commit is contained in:
parent
2308dce1be
commit
6d77c6efa0
1 changed files with 15 additions and 2 deletions
|
@ -47,6 +47,11 @@ exec ${GUILE-guile} -e '(@ (scripts compile) compile)' -s $0 "$@"
|
||||||
(lambda (opt name arg result)
|
(lambda (opt name arg result)
|
||||||
(alist-cons 'help? #t result)))
|
(alist-cons 'help? #t result)))
|
||||||
|
|
||||||
|
(option '(#\L "load-path") #t #f
|
||||||
|
(lambda (opt name arg result)
|
||||||
|
(let ((load-path (assoc-ref result 'load-path)))
|
||||||
|
(alist-cons 'load-path (cons arg load-path)
|
||||||
|
result))))
|
||||||
(option '(#\O "optimize") #f #f
|
(option '(#\O "optimize") #f #f
|
||||||
(lambda (opt name arg result)
|
(lambda (opt name arg result)
|
||||||
(alist-cons 'optimize? #t result)))
|
(alist-cons 'optimize? #t result)))
|
||||||
|
@ -71,7 +76,10 @@ options."
|
||||||
(let ((input-files (assoc-ref result 'input-files)))
|
(let ((input-files (assoc-ref result 'input-files)))
|
||||||
(alist-cons 'input-files (cons file input-files)
|
(alist-cons 'input-files (cons file input-files)
|
||||||
result)))
|
result)))
|
||||||
'((input-files))))
|
|
||||||
|
;; default option values
|
||||||
|
'((input-files)
|
||||||
|
(load-path))))
|
||||||
|
|
||||||
|
|
||||||
(define (compile args)
|
(define (compile args)
|
||||||
|
@ -81,13 +89,16 @@ options."
|
||||||
(expand-only? (assoc-ref options 'expand-only?))
|
(expand-only? (assoc-ref options 'expand-only?))
|
||||||
(translate-only? (assoc-ref options 'translate-only?))
|
(translate-only? (assoc-ref options 'translate-only?))
|
||||||
(compile-only? (assoc-ref options 'compile-only?))
|
(compile-only? (assoc-ref options 'compile-only?))
|
||||||
(input-files (assoc-ref options 'input-files)))
|
(input-files (assoc-ref options 'input-files))
|
||||||
|
(load-path (assoc-ref options 'load-path)))
|
||||||
(if (or help? (null? input-files))
|
(if (or help? (null? input-files))
|
||||||
(begin
|
(begin
|
||||||
(format #t "Usage: compile [OPTION] FILE...
|
(format #t "Usage: compile [OPTION] FILE...
|
||||||
Compile each Guile Scheme source file FILE into a Guile object.
|
Compile each Guile Scheme source file FILE into a Guile object.
|
||||||
|
|
||||||
-h, --help print this help message
|
-h, --help print this help message
|
||||||
|
|
||||||
|
-L, --load-path=DIR add DIR to the front of the module load path
|
||||||
-O, --optimize turn on optimizations
|
-O, --optimize turn on optimizations
|
||||||
-e, --expand-only only go through the code expansion stage
|
-e, --expand-only only go through the code expansion stage
|
||||||
-t, --translate-only stop after the translation to GHIL
|
-t, --translate-only stop after the translation to GHIL
|
||||||
|
@ -96,6 +107,8 @@ Compile each Guile Scheme source file FILE into a Guile object.
|
||||||
Report bugs to <guile-user@gnu.org>.~%")
|
Report bugs to <guile-user@gnu.org>.~%")
|
||||||
(exit 0)))
|
(exit 0)))
|
||||||
|
|
||||||
|
(set! %load-path (append load-path %load-path))
|
||||||
|
|
||||||
(let ((compile-opts (append (if optimize? '(#:O) '())
|
(let ((compile-opts (append (if optimize? '(#:O) '())
|
||||||
(if expand-only? '(#:e) '())
|
(if expand-only? '(#:e) '())
|
||||||
(if translate-only? '(#:t) '())
|
(if translate-only? '(#:t) '())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue