# 02110-1301, USA.
MIT_SCHEME_EXE = mit-scheme
-EXE = '$(MIT_SCHEME_EXE)' --batch-mode
+exe = '$(MIT_SCHEME_EXE)' --batch-mode
CFLAGS = @CFLAGS@
CPPFLAGS = @CPPFLAGS@
LIBS = @LIBS@
all: blowfish-shim.so blowfish-types.bin blowfish-const.bin
- echo '(load "compile")' | $(EXE)
+ echo '(load "compile")' | $(exe)
check:
- echo '(load "check")' | $(EXE)
+ echo '(load "check")' | $(exe)
install:
- echo '(install-shim "blowfish")' | $(EXE) -- *.com *.bci *.pkd make.scm
+ echo '(install-shim "blowfish")' | $(exe) -- *.com *.bci *.pkd make.scm
+ echo '(install-load-option "blowfish")' | $(exe)
clean:
rm -f blowfish-const.scm blowfish-const blowfish-const.c
rm -rf autom4te.cache
blowfish-shim.so: blowfish-shim.o blowfish-adapter.o
- echo "(link-shim)" | $(EXE) -- $(LDFLAGS) -o $@ $^ $(LIBS)
+ echo "(link-shim)" | $(exe) -- $(LDFLAGS) -o $@ $^ $(LIBS)
blowfish-adapter.o: blowfish-adapter.c blowfish-shim.h
- echo '(compile-shim)' | $(EXE) -- $(CPPFLAGS) $(CFLAGS) -c $<
+ echo '(compile-shim)' | $(exe) -- $(CPPFLAGS) $(CFLAGS) -c $<
blowfish-shim.o: blowfish-shim.c blowfish-shim.h
- echo '(compile-shim)' | $(EXE) -- $(CPPFLAGS) $(CFLAGS) -c $<
+ echo '(compile-shim)' | $(exe) -- $(CPPFLAGS) $(CFLAGS) -c $<
blowfish-shim.c blowfish-const.c blowfish-types.bin: \
blowfish.cdecl blowfish-shim.h
echo '(generate-shim "blowfish" "#include \"blowfish-shim.h\"")' \
- | $(EXE)
+ | $(exe)
blowfish-const.bin: blowfish-const.scm
- echo '(sf "blowfish-const")' | $(EXE)
+ echo '(sf "blowfish-const")' | $(exe)
blowfish-const.scm: blowfish-const
./blowfish-const
make all check install
The install target copies a shared library shim and compiled Scheme
-files into the system library path. You can override the default
-command name "mit-scheme" (and thus the system library path) by
-setting MIT_SCHEME_EXE.
+files into the system library path, and re-writes the optiondb.scm
+found there. You can override the default command name "mit-scheme"
+(and thus the system library path) by setting MIT_SCHEME_EXE.
-To load via load-option, install the following in your optiondb.scm:
-
- (define-load-option 'BLOWFISH
- (guarded-system-loader '(blowfish) "blowfish"))
-
-You will need to import the bindings you want to use. They are not
-exported to the global environment because they would conflict with
-the exports from (runtime blowfish).
+To use: (load-option 'BLOWFISH) and import the bindings you want.
+They are not exported to the global environment because they would
+conflict with the exports from (runtime blowfish).
library-dir
(except-last-pair
(pathname-directory library-dir))))))))
+
+(define (install-load-option name #!optional directory)
+ (guarantee-string name 'INSTALL-OPTION)
+ (let ((dir (if (default-object? directory) name directory)))
+ (guarantee-string dir 'INSTALL-OPTION)
+ (rewrite-file (system-library-pathname "optiondb.scm")
+ (lambda (in out)
+ (rewrite-optiondb name dir in out)))))
+
+(define (rewrite-file name rewriter)
+ (let ((tmp (pathname-new-type name "tmp")))
+ (call-with-exclusive-output-file tmp
+ (lambda (out)
+ (call-with-input-file name
+ (lambda (in)
+ (rewriter in out)))))
+ (rename-file tmp name)))
+
+(define (rewrite-optiondb name dirname in out)
+ (do ((line (read-line in) (read-line in)))
+ ((eof-object? line))
+ (write-string line out)
+ (newline out))
+ (fresh-line out)
+ (newline out)
+ (write-string "(define-load-option '" out)
+ (write-string name out)
+ (newline out)
+ (write-string " (standard-system-loader \"" out)
+ (write-string dirname out)
+ (write-string "\"))" out))
\f
(define (parse-words string)
(burst-string string char-set:whitespace #t))
(system-library-pathname "mit-scheme.h")))))
(parse-words "@CFLAGS@ @MODULE_CFLAGS@")))
-(define (working-directory-name)
- (let ((name (pathname-name (directory-pathname-as-file
- (working-directory-pathname)))))
- (if (and (string? name) (not (string-null? name)))
- name
- (error "Could not find the current working directory name."))))
-
(define (run-command command)
(with-notification
(lambda (port)
generate-shim
compile-shim
link-shim
- install-shim))
\ No newline at end of file
+ install-shim
+ install-load-option))
\ No newline at end of file
# 02110-1301, USA.
MIT_SCHEME_EXE = mit-scheme
-EXE = '$(MIT_SCHEME_EXE)' --batch-mode
+exe = '$(MIT_SCHEME_EXE)' --batch-mode
all: gdbm-shim.so gdbm-types.bin gdbm-const.bin
- echo '(load "compile")' | $(EXE)
+ echo '(load "compile")' | $(exe)
check:
- echo '(load "check")' | $(EXE)
+ echo '(load "check")' | $(exe)
install:
- echo '(install-shim "gdbm")' | $(EXE) -- *.com *.bci *.pkd make.scm
+ echo '(install-shim "gdbm")' | $(exe) -- *.com *.bci *.pkd make.scm
+ echo '(install-load-option "gdbm2" "gdbm")' | $(exe)
clean distclean maintainer-clean:
rm -f gdbm-const.scm gdbm-const gdbm-const.c gdbm-shim.c
rm -f gdbm-check.db
gdbm-shim.so: gdbm-shim.o gdbm-adapter.o
- echo "(link-shim)" | $(EXE) -- -o $@ $^ -lgdbm
+ echo "(link-shim)" | $(exe) -- -o $@ $^ -lgdbm
gdbm-adapter.o: gdbm-adapter.c gdbm-shim.h
- echo '(compile-shim)' | $(EXE) -- -c $<
+ echo '(compile-shim)' | $(exe) -- -c $<
gdbm-shim.o: gdbm-shim.c gdbm-shim.h
- echo '(compile-shim)' | $(EXE) -- -c $<
+ echo '(compile-shim)' | $(exe) -- -c $<
gdbm-shim.c gdbm-const.c gdbm-types.bin: gdbm.cdecl gdbm-shim.h
- echo '(generate-shim "gdbm" "#include \"gdbm-shim.h\"")' | $(EXE)
+ echo '(generate-shim "gdbm" "#include \"gdbm-shim.h\"")' | $(exe)
gdbm-const.bin: gdbm-const.scm
- echo '(sf "gdbm-const")' | $(EXE)
+ echo '(sf "gdbm-const")' | $(exe)
gdbm-const.scm: gdbm-const
./gdbm-const
make all check install
The install target copies a shared library shim and compiled Scheme
-files into the system library path. You can override the default
-command name "mit-scheme" (and thus the system library path) by
-setting MIT_SCHEME_EXE.
+files into the system library path, and re-writes the optiondb.scm
+found there. You can override the default command name "mit-scheme"
+(and thus the system library path) by setting MIT_SCHEME_EXE.
-To load via load-option, install the following in your optiondb.scm:
-
- (define-load-option 'GDBM2 (guarded-system-loader '(gdbm) "gdbm"))
-
-You will need to call it GDBM2 while GDBM refers to the original
-microcode module.
-
-You will need to import the bindings you want to use. They are not
-exported to the global environment because they would conflict with
-the exports from (runtime gdbm).
+The option is currently called GDBM2 until GDBM no longer refers to
+the original microcode module. You will need to import the bindings
+you want to use. They are not exported to the global environment
+because they would conflict with the exports from (runtime gdbm).
# 02110-1301, USA.
MIT_SCHEME_EXE = mit-scheme
-EXE = '$(MIT_SCHEME_EXE)' --batch-mode
+exe = '$(MIT_SCHEME_EXE)' --batch-mode
CFLAGS = @CFLAGS@
CPPFLAGS = @CPPFLAGS@
LIBS = @LIBS@
all: md5-shim.so md5-types.bin md5-const.bin
- echo '(load "compile")' | $(EXE)
+ echo '(load "compile")' | $(exe)
check:
- echo '(load "check")' | $(EXE)
+ echo '(load "check")' | $(exe)
install:
- echo '(install-shim "md5")' | $(EXE) -- *.com *.bci *.pkd make.scm
+ echo '(install-shim "md5")' | $(exe) -- *.com *.bci *.pkd make.scm
+ echo '(install-load-option "md5")' | $(exe)
clean:
rm -f md5-const.scm md5-const md5-const.c md5-shim.c
rm -rf autom4te.cache
md5-shim.so: md5-shim.o md5-adapter.o
- echo "(link-shim)" | $(EXE) -- $(LDFLAGS) -o $@ $^ $(LIBS)
+ echo "(link-shim)" | $(exe) -- $(LDFLAGS) -o $@ $^ $(LIBS)
md5-adapter.o: md5-adapter.c md5-shim.h
- echo '(compile-shim)' | $(EXE) -- $(CPPFLAGS) $(CFLAGS) -c $<
+ echo '(compile-shim)' | $(exe) -- $(CPPFLAGS) $(CFLAGS) -c $<
md5-shim.o: md5-shim.c md5-shim.h
- echo '(compile-shim)' | $(EXE) -- $(CPPFLAGS) $(CFLAGS) -c $<
+ echo '(compile-shim)' | $(exe) -- $(CPPFLAGS) $(CFLAGS) -c $<
md5-shim.c md5-const.c md5-types.bin: md5.cdecl md5-shim.h
- echo '(generate-shim "md5" "#include \"md5-shim.h\"")' | $(EXE)
+ echo '(generate-shim "md5" "#include \"md5-shim.h\"")' | $(exe)
md5-const.bin: md5-const.scm
- echo '(sf "md5-const")' | $(EXE)
+ echo '(sf "md5-const")' | $(exe)
md5-const.scm: md5-const
./md5-const
make all check install
The install target copies a shared library shim and compiled Scheme
-files into the system library path. You can override the default
-command name "mit-scheme" (and thus the system library path) by
-setting MIT_SCHEME_EXE.
+files into the system library path, and re-writes the optiondb.scm
+found there. You can override the default command name "mit-scheme"
+(and thus the system library path) by setting MIT_SCHEME_EXE.
-To load via load-option, install the following in your optiondb.scm:
-
- (define-load-option 'MD5
- (guarded-system-loader '(md5) "md5"))
-
-You will need to import the bindings you want to use. They are not
-exported to the global environment because they would conflict with
-the exports from (runtime crypto).
+To use: (load-option 'MD5) and import the bindings you want. They are
+not exported to the global environment because they would conflict
+with the exports from (runtime crypto).
# 02110-1301, USA.
MIT_SCHEME_EXE = mit-scheme
-EXE = '$(MIT_SCHEME_EXE)' --batch-mode
+exe = '$(MIT_SCHEME_EXE)' --batch-mode
CFLAGS = @CFLAGS@
CPPFLAGS = @CPPFLAGS@
LIBS = @LIBS@
all: mhash-shim.so mhash-types.bin mhash-const.bin
- echo '(load "compile")' | $(EXE)
+ echo '(load "compile")' | $(exe)
check:
- echo '(load "check")' | $(EXE)
+ echo '(load "check")' | $(exe)
install:
- echo '(install-shim "mhash")' | $(EXE) -- *.com *.bci *.pkd make.scm
+ echo '(install-shim "mhash")' | $(exe) -- *.com *.bci *.pkd make.scm
+ echo '(install-load-option "mhash")' | $(exe)
clean:
rm -f mhash-const.scm mhash-const mhash-const.c mhash-shim.c
rm -rf autom4te.cache
mhash-shim.so: mhash-shim.o mhash-adapter.o
- echo "(link-shim)" | $(EXE) -- $(LDFLAGS) -o $@ $^ $(LIBS)
+ echo "(link-shim)" | $(exe) -- $(LDFLAGS) -o $@ $^ $(LIBS)
mhash-adapter.o: mhash-adapter.c mhash-shim.h
- echo '(compile-shim)' | $(EXE) -- $(CPPFLAGS) $(CFLAGS) -c $<
+ echo '(compile-shim)' | $(exe) -- $(CPPFLAGS) $(CFLAGS) -c $<
mhash-shim.o: mhash-shim.c mhash-shim.h
- echo '(compile-shim)' | $(EXE) -- $(CPPFLAGS) $(CFLAGS) -c $<
+ echo '(compile-shim)' | $(exe) -- $(CPPFLAGS) $(CFLAGS) -c $<
mhash-shim.c mhash-const.c mhash-types.bin: mhash.cdecl mhash-shim.h
- echo '(generate-shim "mhash" "#include \"mhash-shim.h\"")' | $(EXE)
+ echo '(generate-shim "mhash" "#include \"mhash-shim.h\"")' | $(exe)
mhash-const.bin: mhash-const.scm
- echo '(sf "mhash-const")' | $(EXE)
+ echo '(sf "mhash-const")' | $(exe)
mhash-const.scm: mhash-const
./mhash-const
make all check install
The install target copies a shared library shim and compiled Scheme
-files into the system library path. You can override the default
-command name "mit-scheme" (and thus the system library path) by
-setting MIT_SCHEME_EXE.
+files into the system library path, and re-writes the optiondb.scm
+found there. You can override the default command name "mit-scheme"
+(and thus the system library path) by setting MIT_SCHEME_EXE.
-To load via load-option, install the following in your optiondb.scm:
-
- (define-load-option 'MHASH
- (guarded-system-loader '(mhash) "mhash"))
-
-You will need to import the bindings you want to use. They are not
-exported to the global environment because they would conflict with
-the exports from (runtime crypto).
+To use: (load-option 'MHASH) and import the bindings you want. They
+are not exported to the global environment because they would conflict
+with the exports from (runtime crypto).
(load-ffi-quietly)
((environment-lookup (->environment '(ffi)) 'install-shim) library))
+(define (install-load-option name #!optional directory)
+ (load-ffi-quietly)
+ ((environment-lookup (->environment '(ffi)) 'install-load-option)
+ name directory))
+
(define (load-ffi-quietly)
(if (not (name->package '(FFI)))
(let ((kernel (lambda ()
(define (force* value)
(cond ((procedure? value) (force* (value)))
((promise? value) (force* (force value)))
- (else value)))
\ No newline at end of file
+ (else value)))
+
+(define (standard-system-loader name)
+ (let ((here (merge-pathnames (directory-pathname name)
+ (directory-pathname (current-load-pathname)))))
+ (lambda ()
+ (with-working-directory-pathname here (lambda () (load "make"))))))
\ No newline at end of file
load-option
local-load-options
standard-load-options
- standard-option-loader))
+ standard-option-loader
+ standard-system-loader))
(define-package (runtime parser)
(files "parse")
generate-shim
compile-shim
link-shim
- install-shim)
+ install-shim
+ install-load-option)
(initialization (initialize-package!)))
(define-package (runtime program-copier)