ChezScheme Self-Hosting Executable The goal of this project is to produce standalone executables that are a complete ChezScheme system and contain a scheme program. This works by embedding the ChezScheme bootfiles and a scheme program into the executable. SUPPORTED SYSTEMS: * Linux * Mac OS X * Windows REQUIREMENTS chez-exe requires a C compiler, make, and ChezScheme to build. On unix systems gcc or compatible will be fine. For Windows, this requires cl.exe. Similarly, on unix systems GNU make is required, while on Windows nmake is needed. BUILDING Building this project requires a working copy of ChezScheme. Chez need not be installed anywhere specific, even building inside the repository should work. Once ChezScheme is ready, you can build chez-exe like so: scheme --script gen-config.ss [--prefix prefix] [--bindir bindir] \ [--libdir libdir] [--bootpath bootpath] [--scheme scheme] make [bootpath=...] [libpath=...] [incdir=...] [scheme=...] Running gen-config.ss will create two files: config.ss and make.in on unix, or config.ss and tools.ini on Windows. These files ease the building process when compiling and installing chez-exe. The options for gen-config are as follows: --prefix - base directory for installing the libraries and binaries --bindir - directory for installing binaries --libdir - directory for installing libraries --bootpath - directory that contains .boot files and scheme.h --scheme - name or command line of scheme executable These --bindir and --libdir behave differently on unix and Windows. On Unix, --bindir defaults to $prefix/bin and --libdir to $prefix/lib, but on Windows they both default to $prefix. Additionally, the default for prefix on Unix is /usr/local while on Windows it is %LOCALAPPDATA%\chez-exe If you use gen-config to specify the bootpath, you may omit from the command line when invoking make. Otherwise, it is required. Bootpath indicates where to find petite.boot and scheme.boot libpath, incdir, and scheme are all optional. libpath controls where to find the kernel.o file. This defaults to $bootpath. incdir controls where to find scheme.h. This defaults to $bootpath. scheme controls the name of the executable used. This defaults to "scheme". Once built, there two important files: compile-chez-program and chez.a chez.a is a static library that contains embed_target.o and the kernel.o from the ChezScheme tree. compile-chez-program is a program that will take a scheme program and produce an executable that will run the given scheme program. It uses ChezScheme's compile-whole-program to generate a single compiled file that contains the given program as well as all reachable source libraries. Any scheme files accessed with (load ...) or not available in source form will need to be distributed with the generated executable. RUNNING: compile-chez-program [--libdirs ...] [--libexts ...] [--srcdirs ...] [--chez-lib-dir /path/to/chezlib] [--optimize-level 0|1|2|3] program-file.ss [...] compile-chez-program understands CHEZSCHEMELIBDIRS and CHEZSCHEMELIBEXTS in the same way that the ChezScheme executables understand them. compile-chez-program also recognizes the following command line arguments: --libdirs (same as ChezScheme) --libexts (same as ChezScheme) --srcdirs --optimize-level (same as ChezScheme) --chez-lib-dir The --srcdirs argument alters the source-directories parameter exactly like --libdirs alters the library-directories parameter. The rest of the arguments behave the same as their counterparts in the ChezScheme executables. All of these arguments are optional. compile-chez-program assumes that the first unknown argument is the filename to compile. Any further arguments are passed to the C compiler. For example: compile-chez-program foo.ss -lGL -lGLU -lGLEW will also link against the OpenGL libraries, allowing the scheme source to access the shared libraries by calling (load-shared-object #f) instead of loading each object file individually.