301.13 (the beginning of the end for PLTHOME)

svn: r2740
This commit is contained in:
Matthew Flatt 2006-04-23 02:36:55 +00:00
parent 4edd6f5b4f
commit 1d77707ef1
25 changed files with 2066 additions and 1765 deletions

View File

@ -394,7 +394,16 @@ The _embedr-unit.ss_ library provides a signed unit, _compiler:embed@_
that imports nothing and exports the functions below. The
_embedr-sig.ss_ library provides the signature, _compiler:embed^_.
> (make-embedding-executable dest mred? verbose? mod-list literal-file-list literal-sexpr cmdline-list [aux launcher? variant])
> (create-embedding-executable dest
[#:modules mod-list]
[#:literal-files literal-file-list]
[#:literal-expression literal-sexp]
[#:cmdline cmdline-list]
[#:mred? mred?]
[#:variant variant]
[#:aux aux]
[#:launcher? launcher?]
[#:verbose? verbose?])
- Copies the MzScheme (if `mred?' is #f) or MrEd (otherwise) binary,
embedding code into the copied executable to be loaded on startup.
The source executable is located relative to the "mzlib" collection.
@ -526,6 +535,9 @@ _embedr-sig.ss_ library provides the signature, _compiler:embed^_.
the only other possibility is '3m. See `current-launcher-variant'
in the "launcher" collection for more information.
> (make-embedding-executable dest mred? verbose? mod-list literal-file-list literal-sexpr cmdline-list [aux launcher? variant])
Old (keywordless) interface to `create-embedding-executable'.
> (write-module-bundle verbose? mod-list literal-file-list literal-sexpr)
- Like `make-embedding-executable', but the module bundle is written

View File

@ -4,7 +4,8 @@
(provide compiler:embed^)
(define-signature compiler:embed^
(make-embedding-executable
(create-embedding-executable
make-embedding-executable
write-module-bundle
embedding-executable-is-directory?
embedding-executable-is-actually-directory?

View File

@ -8,6 +8,7 @@
(lib "moddep.ss" "syntax")
(lib "plist.ss" "xml")
(lib "plthome.ss" "setup")
(lib "kw.ss")
"embed-sig.ss"
"private/winicon.ss"
"private/winsubsys.ss"
@ -63,7 +64,7 @@
[base (build-path c-path 'up 'up)]
[fail
(lambda ()
(error 'make-embedding-executable
(error 'create-embedding-executable
"can't find ~a executable"
(if mred? "MrEd" "MzScheme")))]
[variant-suffix (case variant
@ -111,7 +112,7 @@
(if m
(caar m)
(error
'make-embedding-executable
'create-embedding-executable
(format
"can't find ~a position in executable"
what)))))
@ -477,7 +478,7 @@
(when literal-expression
(write literal-expression))))
;; Use `write-module-bundle', but figure out how to put it into an executable
;; The old interface:
(define make-embedding-executable
(opt-lambda (dest mred? verbose?
modules
@ -486,17 +487,52 @@
[aux null]
[launcher? #f]
[variant 'normal])
(create-embedding-executable dest
#:mred? mred?
#:verbose? verbose?
#:modules modules
#:literal-files literal-files
#:literal-expression literal-expression
#:cmdline cmdline
#:aux aux
#:launcher? launcher?
#:variant variant)))
;; Use `write-module-bundle', but figure out how to put it into an executable
(define/kw (create-embedding-executable dest
#:key
[mred? #f]
[verbose? #f]
[modules null]
[literal-files null]
[literal-expression #f]
[cmdline null]
[aux null]
[launcher? #f]
[variant 'normal]
[lib-path #f])
(define keep-exe? (and launcher?
(let ([m (assq 'forget-exe? aux)])
(or (not m)
(not (cdr m))))))
(define long-cmdline? (or (eq? (system-type) 'windows)
(and mred? (eq? 'macosx (system-type)))))
(define lib-path-bytes (and lib-path
(if (path? lib-path)
(path->bytes lib-path)
(if (string? lib-path)
(string->bytes/locale lib-path)
#f))))
(unless (or long-cmdline?
((apply + (length cmdline) (map (lambda (s)
(bytes-length (string->bytes/utf-8 s)))
cmdline)) . < . 50))
(error 'make-embedding-executable "command line too long"))
(error 'create-embedding-executable "command line too long"))
(when lib-path
(unless (path-string? lib-path)
(raise-type-error 'create-embedding-executable "path, string, or #f" lib-path))
(unless ((bytes-length lib-path-bytes) . <= . 512)
(error 'create-embedding-executable "'collects-path value is too long")))
(let ([exe (find-exe mred? variant)])
(when verbose?
(fprintf (current-error-port) "Copying to ~s~n" dest))
@ -564,6 +600,13 @@
(lambda () (find-cmdline
"cmdline"
#"\\[Replace me for EXE hack")))]
[libpos (and lib-path
(let ([tag #"coLLECTs dIRECTORy:"])
(+ (with-input-from-file dest-exe
(lambda () (find-cmdline
"collects path"
tag)))
(bytes-length tag))))]
[anotherpos (and mred?
(eq? 'windows (system-type))
(let ([m (assq 'single-instance? aux)])
@ -579,6 +622,10 @@
(when anotherpos
(file-position out anotherpos)
(write-bytes #"no," out))
(when libpos
(file-position out libpos)
(write-bytes lib-path-bytes out)
(write-byte 0 out))
(if long-cmdline?
;; write cmdline at end:
(file-position out end)
@ -614,4 +661,4 @@
(let ([m (and (eq? 'windows (system-type))
(assq 'subsystem aux))])
(when m
(set-subsystem dest-exe (cdr m))))))))))))))))))
(set-subsystem dest-exe (cdr m)))))))))))))))))

View File

@ -25,6 +25,7 @@
symbol?)
void?)])
(provide write-module-bundle
create-embedding-executable
embedding-executable-is-directory?
embedding-executable-put-file-extension+style+filters
embedding-executable-add-suffix))

View File

@ -1,7 +1,7 @@
(module embed mzscheme
(require (lib "embed.ss" "compiler"))
(define mzc:make-embedding-executable make-embedding-executable)
(define mzc:create-embedding-executable create-embedding-executable)
(define mzc:embedding-executable-add-suffix embedding-executable-add-suffix)
(provide mzc:make-embedding-executable
(provide mzc:create-embedding-executable
mzc:embedding-executable-add-suffix))

View File

@ -3,21 +3,32 @@
(require (lib "process.ss"))
(provide update-framework-path
get-current-framework-path)
get-current-framework-path
update-framework-path/cmdline)
(define (update-framework-path/cmdline)
(let ([v (current-command-line-arguments)])
(update-framework-path (vector-ref v 0)
(vector-ref v 1)
(equal? (vector-ref v 2) "mred"))))
(define (update-framework-path fw-path dest mred?)
(let ([dest (if (path? dest)
(path->string dest)
dest)])
(for-each (lambda (p)
(system* "/usr/bin/install_name_tool"
"-change"
(or (get-current-framework-path dest p)
(format "~a.framework/Versions/~a/~a" p (version) p))
(format "~a~a.framework/Versions/~a/~a"
fw-path
p (version) p)
dest))
(let* ([orig (get-current-framework-path dest p)]
[3m (if (and orig (regexp-match #rx"_3m" orig))
"_3m"
"")])
(system* "/usr/bin/install_name_tool"
"-change"
(or orig
(format "~a.framework/Versions/~a~a/~a" p (version) 3m p))
(format "~a~a.framework/Versions/~a~a/~a"
fw-path
p (version) 3m p)
dest)))
(if mred?
'("PLT_MrEd")
'("PLT_MzScheme")))))

View File

@ -43,6 +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 module-mode (make-parameter #f))
@ -256,6 +257,10 @@
[help-labels
"--------------------- executable configuration flags ------------------------"]
[once-each
[("--collects")
,(lambda (f i)
(exe-embedded-lib-path i))
("Path to libraries relative to --[gui-]exe executable" "path")]
[("--ico")
,(lambda (f i) (exe-aux
(cons (cons 'ico i)
@ -496,26 +501,26 @@
(exe-output)
(eq? mode 'gui-exe))])
((dynamic-require '(lib "embed.ss" "compiler" "private")
'mzc:make-embedding-executable)
'mzc:create-embedding-executable)
dest
(eq? mode 'gui-exe)
(compiler:option:verbose)
(cons
`(#%mzc: (file ,(car source-files)))
(map (lambda (l)
`(#t (lib ,@l)))
(exe-embedded-libraries)))
null
`(require ,(string->symbol
(format
"#%mzc:~a"
(let-values ([(base name dir?) (split-path (car source-files))])
(path->bytes (path-replace-suffix name #""))))))
(let ([flags (exe-embedded-flags)])
(if (eq? mode 'gui-exe)
(cons "-Z" flags)
flags))
(exe-aux))
#:mred? (eq? mode 'gui-exe)
#:verbose? (compiler:option:verbose)
#:modules (cons
`(#%mzc: (file ,(car source-files)))
(map (lambda (l)
`(#t (lib ,@l)))
(exe-embedded-libraries)))
#:literal-expression `(require ,(string->symbol
(format
"#%mzc:~a"
(let-values ([(base name dir?) (split-path (car source-files))])
(path->bytes (path-replace-suffix name #""))))))
#:cmdline (let ([flags (exe-embedded-flags)])
(if (eq? mode 'gui-exe)
(cons "-Z" flags)
flags))
#:lib-path (exe-embedded-lib-path)
#:aux (exe-aux))
(printf " [output to \"~a\"]~n" dest))]
[(plt)
(for-each (lambda (fd)

View File

@ -37,6 +37,11 @@ executables.
script will call (ignoring `args'); if this name is not
provided, the script will go through the MrEd executable
_'relative?_ (Unix, Mac OS X Mzscheme or 'script[-3m] variant,
or Windows in 'independent? mode) - a boolean, where #t
means that the generate shell script should launch the
executable through a relative path
See also `build-aux-from-path' below. The default `aux' is `null'.
For Unix/X, the script created by `make-mred-launcher' detects and

View File

@ -234,6 +234,73 @@
no-arg-x-flags)))
args))))))
(define (protect-shell-string s)
(regexp-replace* #rx"\"" s "\\\\\""))
(define (make-relative-path-header dest bindir)
(let ([dirname (find-executable-path "dirname")]
[basename (find-executable-path "basename")]
[readlink (find-executable-path "readlink")]
[dest-explode (explode-path (normalize-path dest))]
[bindir-explode (explode-path (normalize-path bindir))]
[newline "\n"])
(if (and dirname basename readlink
(equal? (car dest-explode) (car bindir-explode)))
(format
(string-append
"# Programs we need (avoid depending on user's PATH):" newline
"dirname=\"~a\"" newline
"basename=\"~a\"" newline
"readlink=\"~a\"" newline
newline
"# Remember current directory" newline
"saveD=`pwd`" newline
newline
"# Find absolute path to this script," newline
"# resolving symbolic references to the end" newline
"# (changes the current directory):" newline
"D=`$dirname \"$0\"`" newline
"F=`$basename \"$0\"`" newline
"cd \"$D\"" newline
"while [ -L \"$F\" ]; do" newline
" P=`$readlink \"$F\"`" newline
" D=`$dirname \"$P\"`" newline
" F=`$basename \"$P\"`" newline
" cd \"$D\"" newline
"done" newline
"D=`pwd`" newline
newline
"# Restore current directory" newline
"cd \"$saveD\"" newline
newline
"bindir=\"$D/~a\"" newline
newline)
(protect-shell-string (path->string dirname))
(protect-shell-string (path->string basename))
(protect-shell-string (path->string readlink))
(protect-shell-string (path->string
(apply
build-path
(let loop ([b bindir-explode]
[d dest-explode])
(cond
[(and (pair? b)
(equal? (car b) (car d)))
(loop (cdr b) (cdr d))]
[else
(append (map (lambda (x)
'up)
(cdr d))
b
(list 'same))]))))))
(make-absolute-path-header bindir))))
(define (make-absolute-path-header bindir)
(format
"bindir=\"~a\"\n\n"
(protect-shell-string
(path->string bindir))))
(define (make-unix-launcher kind variant flags dest aux)
(install-template dest kind "sh" "sh") ; just for something that's executable
(let* ([newline (string #\newline)]
@ -244,13 +311,15 @@
(format "~a~a.app/Contents/MacOS/~a~a"
(cdr m) (variant-suffix variant)
(cdr m) (variant-suffix variant))))]
[post-flags (if (and (eq? kind 'mred)
(not (memq variant '(script script-3m))))
(skip-x-flags flags)
null)]
[x-flags? (and (eq? kind 'mred)
(eq? (system-type) 'unix)
(not (memq variant '(script script-3m))))]
[post-flags (cond
[x-flags? (skip-x-flags flags)]
[alt-exe null]
[else flags])]
[pre-flags (cond
[alt-exe null]
[(null? post-flags) flags]
[(not x-flags?) null]
[else
(let loop ([f flags])
(if (eq? f post-flags)
@ -262,22 +331,24 @@
(string-append
"#!/bin/sh" newline
"# This script was created by make-~a-launcher" newline
newline
"if [ \"$PLTHOME\" = '' ] ; then" newline
" PLTHOME=\"~a\"" newline
" export PLTHOME" newline
"fi" newline
newline)
kind (regexp-replace* "\""
(path->string plthome)
"\\\\\""))]
kind )]
[dir-finder
(let ([bindir (if alt-exe
plthome
(build-path plthome "bin"))])
(if (let ([a (assq 'relative? aux)])
(and a (cdr a)))
(make-relative-path-header dest bindir)
(make-absolute-path-header bindir)))]
[exec (format
"exec \"${PLTHOME}/~a~a~a\" ~a"
(if alt-exe "" "bin/")
"exec \"${bindir}/~a~a\" ~a"
(or alt-exe kind)
(if alt-exe "" (variant-suffix variant)) pre-str)]
(if alt-exe "" (variant-suffix variant))
pre-str)]
[args (format
" ~a ${1+\"$@\"}~n"
"~a ~a ${1+\"$@\"}~n"
(if alt-exe "" " -N \"$0\"")
post-str)]
[assemble-exec (if (and (eq? kind 'mred)
(not (memq variant '(script scrip-3m)))
@ -287,8 +358,9 @@
(unless plthome
(error 'make-unix-launcher "unable to locate PLTHOME"))
(let ([p (open-output-file dest 'truncate)])
(fprintf p "~a~a"
(fprintf p "~a~a~a"
header
dir-finder
(assemble-exec exec args))
(close-output-port p))))

View File

@ -743,6 +743,7 @@
(let ([p (program-launcher-path mzln)]
[aux (list* `(exe-name . ,mzln)
'(framework-root . #f)
'(relative? . #t)
(build-aux-from-path
(build-path (cc-path cc)
(path-replace-suffix (or mzll mzln) #""))))])

View File

@ -8,9 +8,14 @@
(or n
(let ([s (syntax-source stx)])
(and s
(let ([s (cond
[(path? s) (path->string s)]
[else s])]
(let ([s (let ([s (format
"~a"
(cond
[(path? s) (path->string s)]
[else s]))])
(if ((string-length s) . > . 20)
(string-append "..." (substring s (- (string-length s) 20)))
s))]
[l (syntax-line stx)]
[c (syntax-column stx)])
(if l

View File

@ -42,17 +42,13 @@ First, install the Mac OS X Developer Tools from Apple. Then, follow
the Unix instructions below, but note the following:
* The MzScheme build creates a framework, PLT_MzScheme.framework,
which is installed into ~/Library/Frameworks. This framework is
used by the executable `mzscheme' that goes into plt/bin.
which is installed into plt/lib. This framework is used by the
executable `mzscheme' that goes into plt/bin.
* The MrEd build creates a framework, PLT_MrEd.framework, which is
installed into ~/Library/Frameworks. This framework is used by the
executable bundle MrEd.app that goes into the `plt' directory.
Installation creates a script, plt/bin/mred, that runs the bundle.
* If you build frequently from the Subversion-based sources, beware
that you may accumlate many old, unused versions of the framework
in ~/Library/Frameworks.
installed into plt/lib. This framework is used by the executable
bundle MrEd.app that goes into the `plt' directory. Installation
creates a script, plt/bin/mred, that runs the bundle.
* The --enable-shared flag for `configure' is redundant (i.e., builds
create and use frameworks by default), and --disable-shared is not

View File

@ -143,7 +143,7 @@ static void parse_commandline(char *s, char *src, int addon)
#endif
count++;
}
}
scheme_mac_argc = 1 + count + (addon ? 1 : 0);
scheme_mac_argv = (char **)malloc(scheme_mac_argc * sizeof(char *));
@ -494,13 +494,15 @@ void GetStarterInfo()
CFStringRef execName;
CFArrayRef storedArgsArray;
CFIndex count;
char **storedArgs, *tmps;
char **storedArgs, *tmps, *orig_argv0 = NULL;
int name_offset;
if (CFDictionaryContainsKey((CFDictionaryRef)propertyList,
(const void *)(CFSTR("executable name")))) {
execName = (CFStringRef)CFDictionaryGetValue((CFDictionaryRef)propertyList,
(CFSTR("executable name")));
tmps = ConvertCFStringRef(execName);
orig_argv0 = scheme_mac_argv[0];
scheme_mac_argv[0] = tmps;
}
@ -514,22 +516,30 @@ void GetStarterInfo()
count = CFArrayGetCount(storedArgsArray);
storedArgs = (char **)malloc(sizeof(char *) * (scheme_mac_argc + count));
name_offset = (orig_argv0 ? 2 : 0);
storedArgs = (char **)malloc(sizeof(char *) * (scheme_mac_argc + count + name_offset));
storedArgs[0] = scheme_mac_argv[0];
if (orig_argv0) {
/* Preserve the "run" name for a launcher: */
storedArgs[1] = "-N";
storedArgs[2] = orig_argv0;
}
for (i = 0; i < count; i++) {
CFStringRef arg;
char *tmps;
arg = (CFStringRef)CFArrayGetValueAtIndex(storedArgsArray,i);
tmps = ConvertCFStringRef(arg);
storedArgs[i + 1] = tmps;
storedArgs[i + 1 + name_offset] = tmps;
}
for (i = 1; i < scheme_mac_argc; i++) {
storedArgs[count + i] = scheme_mac_argv[i];
storedArgs[count + i + name_offset] = scheme_mac_argv[i];
}
scheme_mac_argv = storedArgs;
scheme_mac_argc += count;
scheme_mac_argc += count + name_offset;
}
}

View File

@ -69,7 +69,7 @@ LOCALFLAGS = $(LOCALFLAGS_@WXVARIANT@)
MREDOBJECTS = mrmain.@LTO@
MZSCHEME = ../mzscheme/libmzscheme.@LIBSFX@ ../mzscheme/libmzgc.@LIBSFX@
MZSCHEMEDEPS = ../mzscheme/libmzscheme.@LIBSFX@ ../mzscheme/libmzgc.@LIBSFX@
WXSCHEME = wxs/libwxscheme.@LIBSFX@
WXME = wxme/libwxme.@LIBSFX@
@ -98,7 +98,7 @@ all:
bin:
$(MAKE) $(LINKRESULT)
mred : $(MZSCHEME) mrmain.@LTO@ $(MREDOBJECTS) $(@WXLIBS@) $(MRSTATIC_STUB)
mred : $(MZSCHEMEDEPS) mrmain.@LTO@ $(MREDOBJECTS) $(@WXLIBS@) $(MRSTATIC_STUB)
$(MREDLINKER) $(MREDLDFLAGS) $(MRSTATIC) -o mred $(MREDOBJECTS) $(MREDLDLIBS) $(MRSTATIC_STUB)
libmred.@LIBSFX@: $(WXLIBSNORM)
@ -107,11 +107,12 @@ libmred.@LIBSFX@: $(WXLIBSNORM)
MRFW = PLT_MrEd.framework/Versions/$(FWVERSION)/PLT_MrEd
MRFWRES = PLT_MrEd.framework/Versions/$(FWVERSION)/Resources/PLT_MrEd.rsrc
$(MRFW) : $(MZSCHEME) $(MREDOBJECTS) $(@WXLIBS@) $(MRSTATIC_STUB)
$(MRFW) : $(MZSCHEMEDEPS) $(MREDOBJECTS) $(@WXLIBS@) $(MRSTATIC_STUB)
$(MREDLINKER) $(MREDLDFLAGS) -dynamiclib -o $(MRFW) -Wl,-headerpad_max_install_names ../mzscheme/libmzscheme.@LIBSFX@ ../mzscheme/libmzgc.@LIBSFX@ $(@WXLIBS@) $(GUILIBS_@WXVARIANT@) @X_EXTRA_LIBS@
MrEd.app/Contents/MacOS/MrEd: $(MRFWRES) $(MRFW) mrmain.@LTO@
$(MREDLINKER) -o MrEd.app/Contents/MacOS/MrEd mrmain.@LTO@ -Wl,-headerpad_max_install_names -F. -framework PLT_MrEd -framework Carbon @PROFFLAGS@
/usr/bin/install_name_tool -change "PLT_MrEd.framework/Versions/$(FWVERSION)/PLT_MrEd" "@executable_path/../../../PLT_MrEd.framework/Versions/$(FWVERSION)/PLT_MrEd" MrEd.app/Contents/MacOS/MrEd
$(MRFWRES): $(srcdir)/../mac/osx_appl.ss $(srcdir)/../mac/cw/MrEd.r
rm -rf PLT_MrEd.framework/Resources PLT_MrEd.framework/PLT_MrEd
@ -119,6 +120,8 @@ $(MRFWRES): $(srcdir)/../mac/osx_appl.ss $(srcdir)/../mac/cw/MrEd.r
ln -s Versions/$(FWVERSION)/PLT_MrEd PLT_MrEd.framework/PLT_MrEd
ln -s Versions/$(FWVERSION)/Resources PLT_MrEd.framework/Resources
MZSCHEME = ../mzscheme/mzscheme
ee-app: mred mrmain_ee.@LTO@
if [ "$(EEAPP)" = '' ] ; then echo "ERROR: You must specify EEAPP" ; else $(MREDLINKER) $(MREDLDFLAGS) $(MRSTATIC) -o $(EEAPP) mrmain_ee.@LTO@ $(EEOBJECTS) $(MREDLDLIBS) $(MRSTATIC_STUB) ; fi
@ -144,13 +147,15 @@ mred.@LTO@ : $(srcdir)/mred.cxx $(srcdir)/wxme/wx_media.h $(srcdir)/wxme/wx_med
$(srcdir)/../wxcommon/wx_list.h
$(CXX) $(CXXFLAGS) $(LOCALFLAGS) -c $(srcdir)/mred.cxx -o mred.@LTO@
DEF_COLLECTS_DIR = -DINITIAL_COLLECTS_DIRECTORY='"'"`cd $(srcdir)/../../collects; pwd`"'"'
mrmain.@LTO@ : $(srcdir)/mrmain.cxx $(srcdir)/mred.h $(srcdir)/wxs/wxsmred.h \
$(srcdir)/../mzscheme/cmdline.inc $(srcdir)/../mzscheme/src/stypes.h \
$(srcdir)/../mzscheme/include/scheme.h $(srcdir)/../mzscheme/src/schvers.h
$(CXX) $(CXXFLAGS) $(LOCALFLAGS) -c $(srcdir)/mrmain.cxx -o mrmain.@LTO@
$(CXX) $(CXXFLAGS) $(LOCALFLAGS) $(DEF_COLLECTS_DIR) -c $(srcdir)/mrmain.cxx -o mrmain.@LTO@
mrmain_ee.@LTO@ : mred.@LTO@
$(CXX) $(CXXFLAGS) $(LOCALFLAGS) -DSTANDALONE_WITH_EMBEDDED_EXTENSION -c $(srcdir)/mrmain.cxx -o mrmain_ee.@LTO@
$(CXX) $(CXXFLAGS) $(LOCALFLAGS) -DSTANDALONE_WITH_EMBEDDED_EXTENSION $(DEF_COLLECTS_DIR) -c $(srcdir)/mrmain.cxx -o mrmain_ee.@LTO@
ee-main:
$(MAKE) mrmain_ee.@LTO@
@ -233,6 +238,7 @@ install_wx_xt:
cd ..; rm -f $(prefix)/bin/mred
$(MAKE) @MRLIBINSTALL@
cd ..; $(ICP) mred/mred `(cd $(prefix); pwd)`/bin/
$(MZSCHEME) -e '(use-compiled-file-paths null)' -mvqL private/collects-path.ss compiler -e '(set-collects-path)' "$(prefix)/bin/mred" ../collects
LIBIDIR=$(prefix)/lib
BUILDINFO=$(LIBIDIR)/buildinfo
@ -244,7 +250,7 @@ install_wx_mac:
rm -rf $(MRFWDIR)/Versions/$(FWVERSION)/Resources
rm -f $(MRFWDIR)/PLT_MrEd
rm -rf $(MRFWDIR)/Resources
if [ @FRAMEWORK_REL_INSTALL@ = yes ] ; then rm -rf $(MZFWDIR) ; fi
if [ @FRAMEWORK_REL_INSTALL@ = yes ] ; then rm -rf $(MRFWDIR) ; fi
if [ ! -d @FRAMEWORK_INSTALL_DIR@ ] ; then mkdir @FRAMEWORK_INSTALL_DIR@ ; fi
if [ ! -d $(MRFWDIR) ] ; then mkdir $(MRFWDIR) ; fi
if [ ! -d $(MRFWDIR)/Versions ] ; then mkdir $(MRFWDIR)/Versions ; fi
@ -259,7 +265,8 @@ install_wx_mac:
if [ ! -d $(prefix)/collects ] ; then mkdir $(prefix)/collects ; fi
if [ ! -d $(prefix)/collects/launcher ] ; then mkdir $(prefix)/collects/launcher ; fi
cd ..; $(ICP) -r mred/Starter.app $(prefix)/collects/launcher/.
if [ @FRAMEWORK_REL_INSTALL@ = yes ] ; then /usr/bin/install_name_tool -change "PLT_MrEd.framework/Versions/$(FWVERSION)/PLT_MrEd" "@executable_path/../../../lib/PLT_MrEd.framework/Versions/$(FWVERSION)/PLT_MrEd" "$(prefix)/MrEd.app/Contents/MacOS/MrEd" ; fi
if [ @FRAMEWORK_REL_INSTALL@ = yes ] ; then /usr/bin/install_name_tool -change "@executable_path/../../../PLT_MrEd.framework/Versions/$(FWVERSION)/PLT_MrEd" "@executable_path/../../../lib/PLT_MrEd.framework/Versions/$(FWVERSION)/PLT_MrEd" "$(prefix)/MrEd.app/Contents/MacOS/MrEd" ; fi
$(MZSCHEME) -e '(use-compiled-file-paths null)' -mvqL private/collects-path.ss compiler -e '(set-collects-path)' "$(prefix)/MrEd.app/Contents/MacOS/MrEd" ../../../collects
install:
$(MAKE) install_@WXVARIANT@
@ -283,6 +290,7 @@ install-lib3m:
install-3m_wx_xt:
cd ..; $(ICP) mred/mred3m $(prefix)/bin/
$(MZSCHEME) -e '(use-compiled-file-paths null)' -mvqL private/collects-path.ss compiler -e '(set-collects-path)' "$(prefix)/bin/mred" ../collects
$(MAKE) @MRLIBINSTALL@3m
install-3m_wx_mac:
@ -297,7 +305,8 @@ install-3m_wx_mac:
if [ ! -d $(prefix)/collects ] ; then mkdir $(prefix)/collects ; fi
if [ ! -d $(prefix)/collects/launcher ] ; then mkdir $(prefix)/collects/launcher ; fi
cd ..; $(ICP) -r mred/Starter3m.app $(prefix)/collects/launcher/.
if [ @FRAMEWORK_REL_INSTALL@ = yes ] ; then /usr/bin/install_name_tool -change "PLT_MrEd.framework/Versions/$(FWVERSION)_3m/PLT_MrEd" "@executable_path/../../../lib/PLT_MrEd.framework/Versions/$(FWVERSION)_3m/PLT_MrEd" "$(prefix)/MrEd3m.app/Contents/MacOS/MrEd3m" ; fi
if [ @FRAMEWORK_REL_INSTALL@ = yes ] ; then /usr/bin/install_name_tool -change "@executable_path/../../../PLT_MrEd.framework/Versions/$(FWVERSION)_3m/PLT_MrEd" "@executable_path/../../../lib/PLT_MrEd.framework/Versions/$(FWVERSION)_3m/PLT_MrEd" "$(prefix)/MrEd3m.app/Contents/MacOS/MrEd3m" ; fi
$(MZSCHEME) -e '(use-compiled-file-paths null)' -mvqL private/collects-path.ss compiler -e '(set-collects-path)' "$(prefix)/MrEd3m.app/Contents/MacOS/MrEd3m" ../../../collects
install-3m:
$(MAKE) install-3m_@WXVARIANT@

View File

@ -54,7 +54,7 @@ XFORM_INC_wx_xt = -Dwx_xt -I$(WXDIR)/src/XWidgets -I$(WXDIR)/src
XFORM_INC_wx_mac = -Dwx_mac -DOS_X -MMD -DWX_CARBON -I$(WXMACDIR)/../utils/image/src -I$(WXMACDIR)/../contrib/wxxpm/libxpm.34b/lib -I$(WXMACDIR)/../../mac/mzscheme
MZMMM_wx_xt = ../../mzscheme/mzscheme3m
MZMMM_wx_mac = env DYLD_FRAMEWORK_PATH="`pwd`/../../mzscheme" ../../mzscheme/mzscheme3m
MZMMM_wx_mac = ../../mzscheme/mzscheme3m
MZMMM = $(MZMMM_@WXVARIANT@)
XFORM_CMD = $(MZMMM) -rq $(srcdir)/../../mzscheme/gc2/xform.ss --setup
@ -69,6 +69,8 @@ WXMACBDIR=../../wxmac/src
MREDLDFLAGS = -L$(WXBDIR)/utils/image/src -L$(WXBDIR)/contrib/xpm/lib $(LDFLAGS) -L../../mzscheme -L../wxs -L../wxme -L$(WXBDIR)/src
DEF_COLLECTS_DIR = +D INITIAL_COLLECTS_DIRECTORY='"'"`cd $(srcdir)/../../../collects; pwd`"'"'
xsrc/Window.cc: $(WXDIR)/src/Windows/Window.cc $(WXBDIR)/src/Windows/Window.@LTO@ $(XFORMDEP)
$(XFORM) xsrc/Window.cc $(WXDIR)/src/Windows/Window.cc
xsrc/Button.cc: $(WXDIR)/src/Windows/Button.cc $(WXBDIR)/src/Windows/Button.@LTO@ $(XFORMDEP)
@ -408,7 +410,7 @@ xsrc/mred.cc: $(srcdir)/../mred.cxx ../mred.@LTO@ $(XFORMDEP) $(XPRECOMP)
$(XFORMWP) xsrc/mred.cc $(srcdir)/../mred.cxx
xsrc/mrmain.cc: $(srcdir)/../mrmain.cxx ../mrmain.@LTO@ $(XFORMDEP) $(XPRECOMP)
$(XFORMWP) xsrc/mrmain.cc $(srcdir)/../mrmain.cxx
$(XFORMWP) xsrc/mrmain.cc $(DEF_COLLECTS_DIR) $(srcdir)/../mrmain.cxx
xsrc/mredx.cc: $(srcdir)/../mredx.cxx ../mredx.@LTO@ $(XFORMDEP) $(XPRECOMP)
$(XFORMWP) xsrc/mredx.cc $(srcdir)/../mredx.cxx
@ -1370,6 +1372,7 @@ MRFWRES = PLT_MrEd.framework/Versions/$(FWVERSION)_3m/Resources/PLT_MrEd.rsrc
if [ ! -d ../PLT_MrEd.framework/Versions/$(FWVERSION)_3m ] ; then mkdir ../PLT_MrEd.framework/Versions/$(FWVERSION)_3m ; fi
cp $(MRFW) ../$(MRFW)
cp -r PLT_MrEd.framework/Versions/$(FWVERSION)_3m/Resources ../PLT_MrEd.framework/Versions/$(FWVERSION)_3m/Resources
/usr/bin/install_name_tool -change "PLT_MrEd.framework/Versions/$(FWVERSION)_3m/PLT_MrEd" "@executable_path/../../../PLT_MrEd.framework/Versions/$(FWVERSION)_3m/PLT_MrEd" ../MrEd3m.app/Contents/MacOS/MrEd3m
$(MRFW) : $(XOBJS) $(@WXVARIANT@_PLAIN_OBJS) ../../mzscheme/libmzscheme3m.@LIBSFX@
$(MREDLINKER) -dynamiclib -o $(MRFW) -Wl,-headerpad_max_install_names $(XOBJS) $(@WXVARIANT@_PLAIN_OBJS) ../../mzscheme/libmzscheme3m.@LIBSFX@ $(@WXVARIANT@_LIBS)

View File

@ -150,6 +150,7 @@ $(MZFW): libmzscheme.@LIBSFX@ libmzgc.@LIBSFX@ $(SPECIALIZINGOBJECTS)
mzscheme@OSX@: $(MZFW) main.@LTO@
$(CC) -o mzscheme @PROFFLAGS@ main.@LTO@ -Wl,-headerpad_max_install_names -F. -framework PLT_MzScheme
/usr/bin/install_name_tool -change "PLT_MzScheme.framework/Versions/$(FWVERSION)/PLT_MzScheme" "@executable_path/PLT_MzScheme.framework/Versions/$(FWVERSION)/PLT_MzScheme" mzscheme
# OSKit ----------------------------------------
@ -165,11 +166,13 @@ mzscheme.multiboot : libmzscheme.@LIBSFX@ libmzgc.@LIBSFX@ main.@LTO@
# ----------------------------------------
DEF_COLLECTS_DIR = -DINITIAL_COLLECTS_DIRECTORY='"'"`cd $(srcdir)/../../collects; pwd`"'"'
main.@LTO@: $(srcdir)/main.c $(srcdir)/include/scheme.h $(srcdir)/sconfig.h $(srcdir)/src/stypes.h $(srcdir)/cmdline.inc $(srcdir)/oskglue.inc
$(CC) @CFLAGS@ @COMPFLAGS@ @PREFLAGS@ @PROFFLAGS@ @OPTIONS@ @MZOPTIONS@ -I$(builddir) -I$(srcdir)/include -c $(srcdir)/main.c -o main.@LTO@
$(CC) @CFLAGS@ @COMPFLAGS@ @PREFLAGS@ @PROFFLAGS@ @OPTIONS@ @MZOPTIONS@ $(DEF_COLLECTS_DIR) -I$(builddir) -I$(srcdir)/include -c $(srcdir)/main.c -o main.@LTO@
main_ee.@LTO@: main.@LTO@
$(CC) @CFLAGS@ @COMPFLAGS@ @PREFLAGS@ @PROFFLAGS@ @OPTIONS@ @MZOPTIONS@ -I$(builddir) -I$(srcdir)/include -DSTANDALONE_WITH_EMBEDDED_EXTENSION -c $(srcdir)/main.c -o main_ee.@LTO@
$(CC) @CFLAGS@ @COMPFLAGS@ @PREFLAGS@ @PROFFLAGS@ @OPTIONS@ @MZOPTIONS@ $(DEF_COLLECTS_DIR) -I$(builddir) -I$(srcdir)/include -DSTANDALONE_WITH_EMBEDDED_EXTENSION -c $(srcdir)/main.c -o main_ee.@LTO@
ee-main:
$(MAKE) main_ee.@LTO@
@ -263,6 +266,7 @@ install:
install-3m-basic:
cd ..; $(ICP) mzscheme/mzscheme3m $(prefix)/bin/mzscheme3m
cd ..; $(ICP) mzscheme/mzdyn3m.o $(prefix)/lib/mzdyn3m.o
./mzscheme -e '(use-compiled-file-paths null)' -mvqL private/collects-path.ss compiler -e '(set-collects-path)' "$(prefix)/bin/mzscheme3m" ../collects
install-3m@NOT_OSX@:
$(MAKE) install-3m-basic
@ -278,6 +282,7 @@ unix-install:
cd ..; $(ICP) mzscheme/libmzgc.@LIBSFX@ $(LIBIDIR)/libmzgc.@LIBSFX@
cd ..; $(ICP) mzscheme/libmzscheme.@LIBSFX@ $(LIBIDIR)/libmzscheme.@LIBSFX@
cd ..; $(ICP) mzscheme/mzscheme "$(BINDIR)/mzscheme"
./mzscheme -e '(use-compiled-file-paths null)' -mvqL private/collects-path.ss compiler -e '(set-collects-path)' "$(BINDIR)/mzscheme" ../collects
cd ..; echo 'CC=@CC@' > $(BUILDINFO)
cd ..; echo 'CFLAGS=@CFLAGS@ @PREFLAGS@ @COMPFLAGS@' >> $(BUILDINFO)
cd ..; echo 'OPTIONS=@OPTIONS@' >> $(BUILDINFO)
@ -302,7 +307,7 @@ osx-install:
if [ ! -d $(MZFWDIR)/Versions/$(FWVERSION) ] ; then mkdir $(MZFWDIR)/Versions/$(FWVERSION) ; fi
cp $(MZFW) $(MZFWDIR)/Versions/$(FWVERSION)/
ln -s Versions/$(FWVERSION)/PLT_MzScheme $(MZFWDIR)/
if [ @FRAMEWORK_REL_INSTALL@ = yes ] ; then /usr/bin/install_name_tool -change "PLT_MzScheme.framework/Versions/$(FWVERSION)/PLT_MzScheme" "@executable_path/../lib/PLT_MzScheme.framework/Versions/$(FWVERSION)/PLT_MzScheme" "$(BINDIR)/mzscheme" ; fi
if [ @FRAMEWORK_REL_INSTALL@ = yes ] ; then /usr/bin/install_name_tool -change "@executable_path/PLT_MzScheme.framework/Versions/$(FWVERSION)/PLT_MzScheme" "@executable_path/../lib/PLT_MzScheme.framework/Versions/$(FWVERSION)/PLT_MzScheme" "$(BINDIR)/mzscheme" ; fi
MZFWMMM = PLT_MzScheme.framework/Versions/$(FWVERSION)_3m/PLT_MzScheme
@ -311,7 +316,7 @@ install-3m@OSX@:
rm -f $(MZFWDIR)/Versions/$(FWVERSION)_3m/PLT_MzScheme
if [ ! -d $(MZFWDIR)/Versions/$(FWVERSION)_3m ] ; then mkdir $(MZFWDIR)/Versions/$(FWVERSION)_3m ; fi
cp $(MZFWMMM) $(MZFWDIR)/Versions/$(FWVERSION)_3m/
if [ @FRAMEWORK_REL_INSTALL@ = yes ] ; then /usr/bin/install_name_tool -change "PLT_MzScheme.framework/Versions/$(FWVERSION)_3m/PLT_MzScheme" "@executable_path/../lib/PLT_MzScheme.framework/Versions/$(FWVERSION)_3m/PLT_MzScheme" "$(BINDIR)/mzscheme3m" ; fi
if [ @FRAMEWORK_REL_INSTALL@ = yes ] ; then /usr/bin/install_name_tool -change "@executable_path/PLT_MzScheme.framework/Versions/$(FWVERSION)_3m/PLT_MzScheme" "@executable_path/../lib/PLT_MzScheme.framework/Versions/$(FWVERSION)_3m/PLT_MzScheme" "$(BINDIR)/mzscheme3m" ; fi
WLIBIDIR=`(cd $(prefix); pwd)`/lib
WBUILDINFO=$(WLIBIDIR)/buildinfo

View File

@ -8,6 +8,31 @@
char *cmdline_exe_hack = "[Replace me for EXE hack ]";
char *binary_type_hack = "bINARy tYPe:" INITIAL_BIN_TYPE;
#ifndef INITIAL_COLLECTS_DIRECTORY
# ifdef DOS_FILE_SYSTEM
# define INITIAL_COLLECTS_DIRECTORY "collects"
# else
# define INITIAL_COLLECTS_DIRECTORY "../collects"
# endif
#endif
static char *_coldir = "coLLECTs dIRECTORy:" /* <- this tag stays, so we can find it again */
INITIAL_COLLECTS_DIRECTORY "\0"
/* Pad with at least 512 bytes: */
"****************************************************************"
"****************************************************************"
"****************************************************************"
"****************************************************************"
"****************************************************************"
"****************************************************************"
"****************************************************************"
"****************************************************************";
static int _coldir_offset = 19; /* Skip permanent tag */
#ifndef MZ_PRECISE_GC
# define XFORM_OK_PLUS +
#endif
#ifdef DOS_FILE_SYSTEM
# include <Windows.h>
# ifdef MZ_PRECISE_GC
@ -502,8 +527,8 @@ static int run_from_cmd_line(int argc, char *_argv[],
{
GC_CAN_IGNORE char **argv = _argv;
Scheme_Env *global_env;
char *prog;
Scheme_Object *sch_argv;
char *prog, *sprog = NULL;
Scheme_Object *sch_argv, *collects_path = NULL;
int i;
#ifndef DONT_PARSE_COMMAND_LINE
char **evals_and_loads, *real_switch = NULL, *runner;
@ -585,7 +610,7 @@ static int run_from_cmd_line(int argc, char *_argv[],
The cmdline is appended to the end of the binary.
The long integer at cmdline_exe_hack[4] says
where the old end was, and cmdline_exe_hack[8]
says how long the cmdoine string is. */
says how long the cmdline string is. */
char *path;
HANDLE fd;
@ -612,6 +637,7 @@ static int run_from_cmd_line(int argc, char *_argv[],
p = (unsigned char *)"\0\0\0";
else if (cmdline_exe_hack[0] == '*') {
/* "*" means that the first item is argv[0] replacement: */
sprog = prog;
prog = (char *)p + 4;
p += (p[0]
+ (((long)p[1]) << 8)
@ -727,6 +753,8 @@ static int run_from_cmd_line(int argc, char *_argv[],
argv[0] = "-u";
else if (!strcmp("--main", argv[0]))
argv[0] = "-I";
else if (!strcmp("--name", argv[0]))
argv[0] = "-N";
else if (!strcmp("--no-lib-path", argv[0]))
argv[0] = "-x";
else if (!strcmp("--version", argv[0]))
@ -743,6 +771,8 @@ static int run_from_cmd_line(int argc, char *_argv[],
argv[0] = "-w";
else if (!strcmp("--binary", argv[0]))
argv[0] = "-b";
else if (!strcmp("--collects", argv[0]))
argv[0] = "-X";
# ifndef MZSCHEME_CMD_LINE
else if (!strcmp("--nogui", argv[0]))
argv[0] = "-Z";
@ -796,6 +826,16 @@ static int run_from_cmd_line(int argc, char *_argv[],
evals_and_loads[num_enl] = argv[0];
eval_kind[num_enl++] = mzcmd_EVAL;
break;
case 'X':
if (argc < 2) {
PRINTF("%s: missing path after %s switch\n",
prog, real_switch);
goto show_need_help;
}
argv++;
--argc;
collects_path = scheme_make_path(argv[0]);
break;
case 'x':
no_lib_path = 1;
break;
@ -936,6 +976,17 @@ static int run_from_cmd_line(int argc, char *_argv[],
--argc;
eval_kind[num_enl++] = mzcmd_EVAL;
break;
case 'N':
if (argc < 2) {
PRINTF("%s: missing name after %s switch\n",
prog,
real_switch);
goto show_need_help;
}
argv++;
--argc;
sprog = argv[0];
break;
case 'A':
no_argv = 1;
break;
@ -1046,7 +1097,10 @@ static int run_from_cmd_line(int argc, char *_argv[],
scheme_add_global("argv", sch_argv, global_env);
{
Scheme_Object *ps;
ps = scheme_set_exec_cmd(prog);
scheme_set_exec_cmd(prog);
if (!sprog)
sprog = prog;
ps = scheme_set_run_cmd(sprog);
#ifndef DONT_PARSE_COMMAND_LINE
if (!no_argv)
#endif
@ -1055,8 +1109,12 @@ static int run_from_cmd_line(int argc, char *_argv[],
#ifndef NO_FILE_SYSTEM_UTILS
/* Setup path for "collects" collection directory: */
if (!no_lib_path)
if (!no_lib_path) {
if (!collects_path)
collects_path = scheme_make_path(_coldir XFORM_OK_PLUS _coldir_offset);
scheme_set_collects_path(collects_path);
init_collection_paths(global_env);
}
#endif /* NO_FILE_SYSTEM_UTILS */
#ifndef MZSCHEME_CMD_LINE
@ -1114,7 +1172,6 @@ static int run_from_cmd_line(int argc, char *_argv[],
" -l <file>, --mzlib <file> : Same as -e '(require (lib \"<file>\"))'.\n"
" -L <file> <coll> : Same as -e '(require (lib \"<file>\" \"<coll>\"))'.\n"
" -M <coll> : Same as -e '(require (lib \"<coll>.ss\" \"<coll>\"))'.\n"
" -M errortrace : Report locations in uncompiled source for run-time errors.\n"
" -r, --script : Script mode: use as last switch for scripts. Same as -fmv-.\n"
" -i, --script-cd : Like -r, but also sets the directory. Same as -dmv-.\n"
" -u, --require-script : Like -r, but requires a module. Same as -tmv-.\n"
@ -1129,8 +1186,10 @@ static int run_from_cmd_line(int argc, char *_argv[],
" -k <n> <m> : Load executable-embedded code from file offset <n> to <m>.\n"
" -C, --main : Like -r, then call `main' w/argument list; car is file name.\n"
" Initialization switches:\n"
" -X <dir>, --collects <dir> : libraries at <dir> relative to executable.\n"
" -x, --no-lib-path : Skips trying to set current-library-collection-paths.\n"
" -q, --no-init-file : Skips trying to load " INIT_FILENAME ".\n"
" -N <file>, --name <file> : Set `program' to <file>.\n"
" -A : Skips defining `argv' and `program'.\n"
# ifdef MZ_USE_JIT
" -j, --no-jit : Disables just-in-time compiler.\n"

View File

@ -17,6 +17,8 @@ CPPFLAGS = @PREFLAGS@ @OPTIONS@ @GC2OPTIONS@ @MZOPTIONS@ -I$(builddir)/.. -I$(sr
CFLAGS = @CFLAGS@ $(CPPFLAGS) @COMPFLAGS@ @PROFFLAGS@
LIBS = @LIBS@
DEF_COLLECTS_DIR = +D INITIAL_COLLECTS_DIRECTORY='"'"`cd $(srcdir)/../../../collects; pwd`"'"'
PRE_MZ@OSX@ = env DYLD_FRAMEWORK_PATH="`pwd`/.."
PRE_MZ@NOT_OSX@ =
XFORM_SETUP = $(PRE_MZ) ../mzscheme -rq $(srcdir)/xform.ss --setup
@ -197,7 +199,7 @@ $(XSRCDIR)/vector.c: ../src/vector.@LTO@ $(XFORMDEP)
$(XSRCDIR)/foreign.c: ../../foreign/foreign.@LTO@ $(XFORMDEP)
$(XFORM_SETUP) --cpp "$(CPP) $(CPPFLAGS) -I../../foreign/gcc/libffi/include -I${SRCDIR}/../../mzscheme/src" -o $(XSRCDIR)/foreign.c $(SRCDIR)/../../foreign/foreign.c
$(XSRCDIR)/main.c: ../main.@LTO@ $(XFORMDEP)
$(XFORM) $(XSRCDIR)/main.c $(srcdir)/../main.c
$(XFORM) $(XSRCDIR)/main.c $(DEF_COLLECTS_DIR) $(srcdir)/../main.c
salloc.@LTO@: $(XSRCDIR)/salloc.c
@ -314,6 +316,8 @@ $(MZFWMMM): ../libmzscheme3m.@LIBSFX@
$(CC) -o ../mzscheme3m @PROFFLAGS@ main.@LTO@ -Wl,-headerpad_max_install_names -F. -framework PLT_MzScheme
if [ ! -d ../PLT_MzScheme.framework/Versions/$(FWVERSION)_3m ] ; then mkdir ../PLT_MzScheme.framework/Versions/$(FWVERSION)_3m ; fi
cp PLT_MzScheme.framework/Versions/$(FWVERSION)_3m/PLT_MzScheme ../PLT_MzScheme.framework/Versions/$(FWVERSION)_3m/PLT_MzScheme
/usr/bin/install_name_tool -change "PLT_MzScheme.framework/Versions/$(FWVERSION)_3m/PLT_MzScheme" "@executable_path/PLT_MzScheme.framework/Versions/$(FWVERSION)_3m/PLT_MzScheme" ../mzscheme3m
clean:
/bin/rm -f ../mzscheme3m *.@LTO@ $(XSRCDIR)/*

View File

@ -40,7 +40,10 @@
[("--cpp") cmdline "set CPP command line"
(set! cpp cmdline)]
[("-o") dest-file "name destination file"
(set! file-out dest-file)]]
(set! file-out dest-file)]
[("+D") def "add CPP -D flag"
(set! cpp (string-append cpp " -D"
(regexp-replace* "[ \"]" def "'\\0'")))]]
[args (file)
(set! file-in file)])

View File

@ -1563,6 +1563,8 @@ MZ_EXTERN Scheme_Object *(*scheme_make_stderr)(void);
MZ_EXTERN void scheme_set_banner(char *s);
MZ_EXTERN Scheme_Object *scheme_set_exec_cmd(char *s);
MZ_EXTERN Scheme_Object *scheme_set_run_cmd(char *s);
MZ_EXTERN void scheme_set_collects_path(Scheme_Object *p);
/* Initialization */
MZ_EXTERN Scheme_Env *scheme_basic_env(void);

File diff suppressed because it is too large Load Diff

View File

@ -184,9 +184,10 @@ static Scheme_Object *read_symbol, *write_symbol, *execute_symbol;
static Scheme_Object *temp_dir_symbol, *home_dir_symbol, *pref_dir_symbol;
static Scheme_Object *doc_dir_symbol, *desk_dir_symbol;
static Scheme_Object *init_dir_symbol, *init_file_symbol, *sys_dir_symbol;
static Scheme_Object *exec_file_symbol, *pref_file_symbol, *addon_dir_symbol;
static Scheme_Object *exec_file_symbol, *run_file_symbol, *collects_dir_symbol;
static Scheme_Object *pref_file_symbol, *addon_dir_symbol;
static Scheme_Object *exec_cmd;
static Scheme_Object *exec_cmd, *run_cmd, *collects_path;
#endif
void scheme_init_file(Scheme_Env *env)
@ -209,6 +210,8 @@ void scheme_init_file(Scheme_Env *env)
REGISTER_SO(sys_dir_symbol);
REGISTER_SO(pref_file_symbol);
REGISTER_SO(exec_file_symbol);
REGISTER_SO(run_file_symbol);
REGISTER_SO(collects_dir_symbol);
REGISTER_SO(addon_dir_symbol);
#endif
@ -231,6 +234,8 @@ void scheme_init_file(Scheme_Env *env)
sys_dir_symbol = scheme_intern_symbol("sys-dir");
pref_file_symbol = scheme_intern_symbol("pref-file");
exec_file_symbol = scheme_intern_symbol("exec-file");
run_file_symbol = scheme_intern_symbol("run-file");
collects_dir_symbol = scheme_intern_symbol("collects-dir");
addon_dir_symbol = scheme_intern_symbol("addon-dir");
#endif
@ -4472,6 +4477,18 @@ find_system_path(int argc, Scheme_Object **argv)
exec_cmd = scheme_make_path("mzscheme");
}
return exec_cmd;
} else if (argv[0] == run_file_symbol) {
if (!run_cmd) {
REGISTER_SO(run_cmd);
run_cmd = scheme_make_path("mzscheme");
}
return run_cmd;
} else if (argv[0] == collects_dir_symbol) {
if (!collects_path) {
REGISTER_SO(collects_path);
collects_path = scheme_make_path("collects");
}
return collects_path;
} else if (argv[0] == addon_dir_symbol) {
which = id_addon_dir;
} else {
@ -4709,6 +4726,18 @@ Scheme_Object *scheme_set_exec_cmd(char *s)
#endif
}
Scheme_Object *scheme_set_run_cmd(char *s)
{
#ifndef NO_FILE_SYSTEM_UTILS
if (!run_cmd) {
REGISTER_SO(run_cmd);
run_cmd = scheme_make_path(s);
}
return run_cmd;
#endif
}
char *scheme_get_exec_path(void)
{
if (exec_cmd)
@ -4717,6 +4746,12 @@ char *scheme_get_exec_path(void)
return NULL;
}
void scheme_set_collects_path(Scheme_Object *p)
{
REGISTER_SO(collects_path);
collects_path = p;
}
/********************************************************************************/
#ifdef DOS_FILE_SYSTEM

View File

@ -9,6 +9,6 @@
#define MZSCHEME_VERSION_MAJOR 301
#define MZSCHEME_VERSION_MINOR 12
#define MZSCHEME_VERSION_MINOR 13
#define MZSCHEME_VERSION "301.12" _MZ_SPECIAL_TAG
#define MZSCHEME_VERSION "301.13" _MZ_SPECIAL_TAG

View File

@ -2646,7 +2646,8 @@
"(cons-path default(cadr m)(loop(caddr m)))"
"(cons-path default s null)))))))"
"(define find-executable-path"
"(lambda(program libpath)"
"(case-lambda "
"((program libpath reverse?)"
"(unless(path-string? program) "
" (raise-type-error 'find-executable-path \"path or string (sans nul)\" program))"
"(unless(or(not libpath)(and(path-string? libpath) "
@ -2656,18 +2657,22 @@
"(lambda(exec-name)"
"(if libpath"
"(let-values(((base name isdir?)(split-path exec-name)))"
"(if(path? base)"
"(let((lib(build-path base libpath)))"
"(if(or(directory-exists? lib) "
"(file-exists? lib))"
" lib"
"(let((next"
"(lambda()"
"(let((resolved(resolve-path exec-name)))"
"(cond"
"((equal? resolved exec-name) #f)"
"((relative-path? resolved)"
"(found-exec(build-path base resolved)))"
"(else(found-exec resolved))))))"
" #f))"
"(else(found-exec resolved)))))))"
"(or(and reverse?(next))"
"(if(path? base)"
"(let((lib(build-path base libpath)))"
"(and(or(directory-exists? lib) "
"(file-exists? lib))"
" lib))"
" #f)"
"(and(not reverse?)(next)))))"
" exec-name))))"
"(if(and(relative-path? program)"
"(let-values(((base name dir?)(split-path program)))"
@ -2687,7 +2692,9 @@
"(found-exec name)"
"(loop(cdr paths)))))))"
"(let((p(path->complete-path program)))"
"(and(file-exists? p)(found-exec p)))))))"
"(and(file-exists? p)(found-exec p))))))"
"((program libpath)(find-executable-path program libpath #f))"
"((program)(find-executable-path program #f #f))))"
"(define-syntax memory-trace-lambda"
"(lambda(x)"
"(syntax-case x()"
@ -3048,16 +3055,18 @@
"(build-path(find-system-path 'addon-dir)"
"(version)"
" \"collects\")"
"(or(ormap"
"(lambda(f)(let((p(f)))(and p(directory-exists? p)(list(simplify-path p)))))"
"(list"
" (lambda () (let ((v (getenv \"PLTHOME\")))"
" (and v (build-path v \"collects\"))))"
" (lambda () (find-executable-path (find-system-path 'exec-file) \"collects\"))"
" (lambda () (find-executable-path (find-system-path 'exec-file) (build-path 'up \"collects\")))"
" (lambda () (find-executable-path (find-system-path 'exec-file) (build-path 'up 'up \"collects\")))"
" (lambda () (find-executable-path (find-system-path 'exec-file) (build-path 'up 'up 'up \"collects\")))))"
" null))))"
"(let*((collects-path(find-system-path 'collects-dir))"
"(v"
"(cond"
"((complete-path? collects-path) collects-path)"
"((absolute-path? collects-path)"
"(path->complete-path collects-path"
"(find-executable-path(find-system-path 'exec-file) #f #t)))"
"(else"
"(find-executable-path(find-system-path 'exec-file) collects-path #t)))))"
"(if v"
"(list(simplify-path(path->complete-path v(current-directory))))"
" null)))))"
"(define(port? x)(or(input-port? x)(output-port? x)))"
"(define-values(struct:guard make-guard guard? guard-ref guard-set!)"
"(make-struct-type 'evt #f 1 0 #f(list(cons prop:evt 0))(current-inspector) #f '(0)))"

View File

@ -3063,7 +3063,8 @@
(cons-path default s null)))))))
(define find-executable-path
(lambda (program libpath)
(case-lambda
[(program libpath reverse?)
(unless (path-string? program)
(raise-type-error 'find-executable-path "path or string (sans nul)" program))
(unless (or (not libpath) (and (path-string? libpath)
@ -3073,18 +3074,22 @@
(lambda (exec-name)
(if libpath
(let-values ([(base name isdir?) (split-path exec-name)])
(if (path? base)
(let ([lib (build-path base libpath)])
(if (or (directory-exists? lib)
(file-exists? lib))
lib
(let ([resolved (resolve-path exec-name)])
(cond
[(equal? resolved exec-name) #f]
[(relative-path? resolved)
(found-exec (build-path base resolved))]
[else (found-exec resolved)]))))
#f))
(let ([next
(lambda ()
(let ([resolved (resolve-path exec-name)])
(cond
[(equal? resolved exec-name) #f]
[(relative-path? resolved)
(found-exec (build-path base resolved))]
[else (found-exec resolved)])))])
(or (and reverse? (next))
(if (path? base)
(let ([lib (build-path base libpath)])
(and (or (directory-exists? lib)
(file-exists? lib))
lib))
#f)
(and (not reverse?) (next)))))
exec-name))])
(if (and (relative-path? program)
(let-values ([(base name dir?) (split-path program)])
@ -3104,7 +3109,9 @@
(found-exec name)
(loop (cdr paths)))))))
(let ([p (path->complete-path program)])
(and (file-exists? p) (found-exec p)))))))
(and (file-exists? p) (found-exec p)))))]
[(program libpath) (find-executable-path program libpath #f)]
[(program) (find-executable-path program #f #f)]))
;; ------------------------------ Memtrace ------------------------------
@ -3497,19 +3504,18 @@
(build-path (find-system-path 'addon-dir)
(version)
"collects")
(or (ormap
(lambda (f) (let ([p (f)]) (and p (directory-exists? p) (list (simplify-path p)))))
(list
(lambda () (let ((v (getenv "PLTHOME")))
(and v (build-path v "collects"))))
(lambda () (find-executable-path (find-system-path 'exec-file) "collects"))
;; When binary is in bin/ subdir:
(lambda () (find-executable-path (find-system-path 'exec-file) (build-path 'up "collects")))
;; When binary is in .bin/<platform> subdir:
(lambda () (find-executable-path (find-system-path 'exec-file) (build-path 'up 'up "collects")))
;; When binary is in bin/<appname>.app/Contents/Macos subdir:
(lambda () (find-executable-path (find-system-path 'exec-file) (build-path 'up 'up 'up "collects")))))
null))))
(let* ([collects-path (find-system-path 'collects-dir)]
[v
(cond
[(complete-path? collects-path) collects-path]
[(absolute-path? collects-path)
(path->complete-path collects-path
(find-executable-path (find-system-path 'exec-file) #f #t))]
[else
(find-executable-path (find-system-path 'exec-file) collects-path #t)])])
(if v
(list (simplify-path (path->complete-path v (current-directory))))
null)))))
;; -------------------------------------------------------------------------