change #:lib-path to #:collects-path

svn: r2964
This commit is contained in:
Matthew Flatt 2006-05-18 16:09:15 +00:00
parent 595c3bd546
commit c5e94b7ab2
3 changed files with 48 additions and 48 deletions

View File

@ -402,7 +402,7 @@ _embedr-sig.ss_ library provides the signature, _compiler:embed^_.
[#:mred? mred?] [#:mred? mred?]
[#:variant variant] [#:variant variant]
[#:aux aux] [#:aux aux]
[#:lib-path lib-path-or-list] [#:collects-path path-or-list]
[#:launcher? launcher?] [#:launcher? launcher?]
[#:verbose? verbose?]) [#:verbose? verbose?])
- Copies the MzScheme (if `mred?' is #f) or MrEd (otherwise) binary, - Copies the MzScheme (if `mred?' is #f) or MrEd (otherwise) binary,
@ -534,21 +534,20 @@ _embedr-sig.ss_ library provides the signature, _compiler:embed^_.
See also `build-aux-from-path' in the "launcher" collection. The See also `build-aux-from-path' in the "launcher" collection. The
default `aux' is `null'. default `aux' is `null'.
If `lib-path-or-list' is #f, then the created executable maintains If the #:collects-path argument is #f, then the created executable
its built-in (relative) path to the main "collects" directory --- maintains its built-in (relative) path to the main "collects"
which will be the result of `(find-system-path 'collects-dir)' when directory --- which will be the result of `(find-system-path
the executable is run --- plus a potential list of other 'collects-dir)' when the executable is run --- plus a potential
directories for finding library collections --- which are used to list of other directories for finding library collections --- which
initialize the `current-library-collection-paths' list in are used to initialize the `current-library-collection-paths' list
combination with "PLTCOLLECTS" environment variable. Otherwise, in combination with "PLTCOLLECTS" environment variable. Otherwise,
`lib-path-or-list' specifies a replacement; it must be either a the argument specifies a replacement; it must be either a path,
path, string, or non-empty list of paths and strings. In the last string, or non-empty list of paths and strings. In the last case,
case, the first path or string specifies the main collection the first path or string specifies the main collection directory,
directory, and the rest are additional directories for the and the rest are additional directories for the collection search
collection search path (placed, in order, after the user-specific path (placed, in order, after the user-specific "collects"
"collects" directory, but before the main "collects" directory; directory, but before the main "collects" directory; then the
then the search list is combined with "PLTCOLLECTS", if it is search list is combined with "PLTCOLLECTS", if it is defined).
defined).
If `launcher?' is #t, then no `modules' should be null, If `launcher?' is #t, then no `modules' should be null,
`literal-file-list' should be null, `literal-sexp' should be #f, `literal-file-list' should be null, `literal-sexp' should be #f,

View File

@ -534,7 +534,7 @@
[aux null] [aux null]
[launcher? #f] [launcher? #f]
[variant 'normal] [variant 'normal]
[lib-path #f]) [collects-path #f])
(define keep-exe? (and launcher? (define keep-exe? (and launcher?
(let ([m (assq 'forget-exe? aux)]) (let ([m (assq 'forget-exe? aux)])
(or (not m) (or (not m)
@ -543,18 +543,18 @@
(and mred? (eq? 'macosx (system-type))))) (and mred? (eq? 'macosx (system-type)))))
(define relative? (let ([m (assq 'relative? aux)]) (define relative? (let ([m (assq 'relative? aux)])
(and m (cdr m)))) (and m (cdr m))))
(define lib-path-bytes (and lib-path (define collects-path-bytes (and collects-path
(cond (cond
[(path? lib-path) (path->bytes lib-path)] [(path? collects-path) (path->bytes collects-path)]
[(string? lib-path) (string->bytes/locale lib-path)] [(string? collects-path) (string->bytes/locale collects-path)]
[(and (list? lib-path) [(and (list? collects-path)
(pair? lib-path)) (pair? collects-path))
(let ([l (map (lambda (p) (let ([l (map (lambda (p)
(cond (cond
[(path? p) (path->bytes p)] [(path? p) (path->bytes p)]
[(string? p) (string->bytes/locale p)] [(string? p) (string->bytes/locale p)]
[else #""])) [else #""]))
lib-path)]) collects-path)])
(let loop ([l l]) (let loop ([l l])
(if (null? (cdr l)) (if (null? (cdr l))
(car l) (car l)
@ -565,13 +565,14 @@
(bytes-length (string->bytes/utf-8 s))) (bytes-length (string->bytes/utf-8 s)))
cmdline)) . < . 50)) cmdline)) . < . 50))
(error 'create-embedding-executable "command line too long")) (error 'create-embedding-executable "command line too long"))
(when lib-path (when collects-path
(unless (or (path-string? lib-path) (unless (or (path-string? collects-path)
(and (list? lib-path) (and (list? collects-path)
(pair? lib-path) (pair? collects-path)
(andmap path-string? lib-path))) (andmap path-string? collects-path)))
(raise-type-error 'create-embedding-executable "path, string, non-empty list of paths and strings, or #f" lib-path)) (raise-type-error 'create-embedding-executable "path, string, non-empty list of paths and strings, or #f"
(unless ((bytes-length lib-path-bytes) . <= . 1024) collects-path))
(unless ((bytes-length collects-path-bytes) . <= . 1024)
(error 'create-embedding-executable "collects path list is too long"))) (error 'create-embedding-executable "collects path list is too long")))
(let ([exe (find-exe mred? variant)]) (let ([exe (find-exe mred? variant)])
(when verbose? (when verbose?
@ -661,7 +662,7 @@
null) null)
(list "-k" start-s end-s)) (list "-k" start-s end-s))
cmdline)] cmdline)]
[libpos (and lib-path [libpos (and collects-path
(let ([tag #"coLLECTs dIRECTORy:"]) (let ([tag #"coLLECTs dIRECTORy:"])
(+ (with-input-from-file dest-exe (+ (with-input-from-file dest-exe
(lambda () (find-cmdline (lambda () (find-cmdline
@ -674,7 +675,7 @@
(when libpos (when libpos
(call-with-output-file* dest-exe (call-with-output-file* dest-exe
(lambda (out) (lambda (out)
(write-lib out libpos lib-path-bytes)) (write-lib out libpos collects-path-bytes))
'update))) 'update)))
(let ([cmdpos (with-input-from-file dest-exe (let ([cmdpos (with-input-from-file dest-exe
(lambda () (find-cmdline (lambda () (find-cmdline
@ -696,7 +697,7 @@
(file-position out anotherpos) (file-position out anotherpos)
(write-bytes #"no," out)) (write-bytes #"no," out))
(when libpos (when libpos
(write-lib out libpos lib-path-bytes)) (write-lib out libpos collects-path-bytes))
(if long-cmdline? (if long-cmdline?
;; write cmdline at end: ;; write cmdline at end:
(file-position out end) (file-position out end)

View File

@ -43,7 +43,7 @@
(define exe-embedded-flags (make-parameter '("-mvq-"))) (define exe-embedded-flags (make-parameter '("-mvq-")))
(define exe-embedded-libraries (make-parameter null)) (define exe-embedded-libraries (make-parameter null))
(define exe-aux (make-parameter null)) (define exe-aux (make-parameter null))
(define exe-embedded-lib-path (make-parameter #f)) (define exe-embedded-collects-path (make-parameter #f))
(define module-mode (make-parameter #f)) (define module-mode (make-parameter #f))
@ -267,8 +267,8 @@
[once-each [once-each
[("--collects") [("--collects")
,(lambda (f i) ,(lambda (f i)
(exe-embedded-lib-path i)) (exe-embedded-collects-path i))
("Path to libraries relative to --[gui-]exe executable" "path")] ("Path to collects relative to --[gui-]exe executable" "path")]
[("--ico") [("--ico")
,(lambda (f i) (exe-aux ,(lambda (f i) (exe-aux
(cons (cons 'ico i) (cons (cons 'ico i)
@ -536,7 +536,7 @@
(if (eq? mode 'gui-exe) (if (eq? mode 'gui-exe)
(cons "-Z" flags) (cons "-Z" flags)
flags)) flags))
#:lib-path (exe-embedded-lib-path) #:collects-path (exe-embedded-collects-path)
#:aux (exe-aux)) #:aux (exe-aux))
(printf " [output to \"~a\"]~n" dest))] (printf " [output to \"~a\"]~n" dest))]
[(plt) [(plt)