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?]
[#:variant variant]
[#:aux aux]
[#:lib-path lib-path-or-list]
[#:collects-path path-or-list]
[#:launcher? launcher?]
[#:verbose? verbose?])
- 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
default `aux' is `null'.
If `lib-path-or-list' is #f, then the created executable maintains
its built-in (relative) path to the main "collects" directory ---
which will be the result of `(find-system-path 'collects-dir)' when
the executable is run --- plus a potential list of other
directories for finding library collections --- which are used to
initialize the `current-library-collection-paths' list in
combination with "PLTCOLLECTS" environment variable. Otherwise,
`lib-path-or-list' specifies a replacement; it must be either a
path, string, or non-empty list of paths and strings. In the last
case, the first path or string specifies the main collection
directory, and the rest are additional directories for the
collection search path (placed, in order, after the user-specific
"collects" directory, but before the main "collects" directory;
then the search list is combined with "PLTCOLLECTS", if it is
defined).
If the #:collects-path argument is #f, then the created executable
maintains its built-in (relative) path to the main "collects"
directory --- which will be the result of `(find-system-path
'collects-dir)' when the executable is run --- plus a potential
list of other directories for finding library collections --- which
are used to initialize the `current-library-collection-paths' list
in combination with "PLTCOLLECTS" environment variable. Otherwise,
the argument specifies a replacement; it must be either a path,
string, or non-empty list of paths and strings. In the last case,
the first path or string specifies the main collection directory,
and the rest are additional directories for the collection search
path (placed, in order, after the user-specific "collects"
directory, but before the main "collects" directory; then the
search list is combined with "PLTCOLLECTS", if it is defined).
If `launcher?' is #t, then no `modules' should be null,
`literal-file-list' should be null, `literal-sexp' should be #f,

View File

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

View File

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