Skip to content
Chez Scheme self hosting executable
Branch: master
Clone or download
Latest commit 04b8ce8 May 17, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore Allow linking only against petite, on Windows Jan 19, 2019
LICENSE Add LICENSE and NOTICE Feb 8, 2018
Makefile Provide logical program name, not temp file (#7) Apr 30, 2019
Makefile.win Provide logical program name, not temp file (#7) Apr 30, 2019
NOTICE Add LICENSE and NOTICE Feb 8, 2018
README Additional arguments to gen-config.ss are passed to the C compiler Apr 20, 2019
build-included-binary-file.ss Adding support for windows Mar 20, 2018
compile-chez-program.ss
console_main.c Adding support for windows Mar 20, 2018
custom-boot.ss Remove debugging text May 17, 2019
embed_target.c Provide logical program name, not temp file (#7) Apr 30, 2019
embed_target_windows.c Provide logical program name, not temp file (#7) Apr 30, 2019
gen-config.ss Additional arguments to gen-config.ss are passed to the C compiler Apr 20, 2019
gui_main.c Adding support for windows Mar 20, 2018
make-boot-file.ss Allow linking only against petite, on Windows Jan 19, 2019
make.cmd Slim down make.cmd Mar 20, 2018
setup.c Provide logical program name, not temp file (#7) Apr 30, 2019
setup.h Provide logical program name, not temp file (#7) Apr 30, 2019
stubs.c Add stubs for tinfo/ncurses functions Feb 16, 2018
utils.ss Allow linking only against petite, on Windows Jan 19, 2019

README

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. The trailing
arguments to gen-config.ss are stored to be passed to the C compiler.

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

NOTE: When building on Windows, make sure to use the matching bitsize of the
MSVC compiler and Chez Scheme. If you see errors similar to:
    unresolved external symbol _Sscheme_init
    unresolved external symbol _Sregister_boot_file
    unresolved external symbol _Sbuild_heap
    unresolved external symbol _Sscheme_program
double check that you're running "make" from the correct "Native Tools Command Prompt".

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.
You can’t perform that action at this time.