Store boot image inside main executable
Previously the boot image was kept in the separate file "flisp.boot". This caused all kinds of problems, as bootstrapping is wont to do. The biggest problem was finding a portable and convenient pathname for it. Instead of dealing with all that stuff about how to find the file, just store the image in a huge C string constant that goes into the main executable. This necessitates adding a C-string hex dumper into the Lisp system, and making build.sh slightly more complicated, but that's a small price to pay for not having to carry a separate file everywhere we go. Also, flmain.c is a lot simpler now and we don't have to play around with symlinks.
This commit is contained in:
+35
-12
@@ -5,6 +5,13 @@ CFLAGS="$CFLAGS -O2" # -falign-functions
|
||||
CFLAGS="$CFLAGS -I ../c -D NDEBUG -D USE_COMPUTED_GOTO"
|
||||
LFLAGS="-lm"
|
||||
os="$(uname | tr A-Z- a-z_)"
|
||||
read -d '' o_files <<EOF || true
|
||||
bitvector-ops.o bitvector.o buf.o builtins.o dump.o env_unix.o
|
||||
equalhash.o flisp.o flmain.o fs_$os.o fs_unix.o
|
||||
hashing.o htable.o int2str.o
|
||||
ios.o iostream.o libraries.o lltinit.o ptrhash.o random.o socket.o
|
||||
string.o table.o time_unix.o utf8.o
|
||||
EOF
|
||||
case "$os" in
|
||||
darwin)
|
||||
default_cc="clang"
|
||||
@@ -54,7 +61,6 @@ find "$builddir" -mindepth 1 -delete
|
||||
cd "$builddir"
|
||||
echo "Entering directory '$PWD'"
|
||||
set -x
|
||||
ln -s ../scheme-boot/flisp.boot flisp.boot
|
||||
$CC $CFLAGS -c ../c/bitvector-ops.c
|
||||
$CC $CFLAGS -c ../c/bitvector.c
|
||||
$CC $CFLAGS -c ../c/buf.c
|
||||
@@ -63,7 +69,6 @@ $CC $CFLAGS -c ../c/dump.c
|
||||
$CC $CFLAGS -c ../c/env_unix.c
|
||||
$CC $CFLAGS -c ../c/equalhash.c
|
||||
$CC $CFLAGS -c ../c/flisp.c
|
||||
$CC $CFLAGS -c ../c/flmain.c
|
||||
$CC $CFLAGS -c ../c/fs_"$os".c
|
||||
$CC $CFLAGS -c ../c/fs_unix.c
|
||||
$CC $CFLAGS -c ../c/hashing.c
|
||||
@@ -80,24 +85,42 @@ $CC $CFLAGS -c ../c/string.c
|
||||
$CC $CFLAGS -c ../c/table.c
|
||||
$CC $CFLAGS -c ../c/time_unix.c
|
||||
$CC $CFLAGS -c ../c/utf8.c
|
||||
$CC $LFLAGS -o upscheme -lm \
|
||||
bitvector-ops.o bitvector.o buf.o builtins.o dump.o env_unix.o \
|
||||
equalhash.o flisp.o flmain.o fs_"$os".o fs_unix.o \
|
||||
hashing.o htable.o int2str.o \
|
||||
ios.o iostream.o libraries.o lltinit.o ptrhash.o random.o socket.o \
|
||||
string.o table.o time_unix.o utf8.o
|
||||
|
||||
$CC $CFLAGS -c ../c/flmain.c
|
||||
|
||||
echo $o_files
|
||||
$CC $LFLAGS -o upscheme -lm $o_files
|
||||
|
||||
{ set +x; } 2>/dev/null
|
||||
cd ../scheme-core
|
||||
echo "Entering directory '$PWD'"
|
||||
echo "Creating stage 0 boot file..."
|
||||
set -x
|
||||
../"$builddir"/upscheme mkboot0.scm system.scm compiler.scm >flisp.boot.new
|
||||
mv flisp.boot.new ../scheme-boot/flisp.boot
|
||||
../"$builddir"/upscheme mkboot0.scm system.scm compiler.scm >boot_image.h.new
|
||||
mv boot_image.h.new ../scheme-boot/boot_image.h
|
||||
|
||||
{ set +x; } 2>/dev/null
|
||||
cd ../"$builddir"
|
||||
echo "Entering directory '$PWD'"
|
||||
set -x
|
||||
$CC $CFLAGS -c ../c/flmain.c
|
||||
$CC $LFLAGS -o upscheme -lm $o_files
|
||||
|
||||
{ set +x; } 2>/dev/null
|
||||
cd ../scheme-core
|
||||
echo "Entering directory '$PWD'"
|
||||
echo "Creating stage 1 boot file..."
|
||||
set -x
|
||||
../"$builddir"/upscheme mkboot1.scm
|
||||
mv flisp.boot.new ../scheme-boot/flisp.boot
|
||||
../"$builddir"/upscheme mkboot1.scm >boot_image.h.new
|
||||
mv boot_image.h.new ../scheme-boot/boot_image.h
|
||||
|
||||
{ set +x; } 2>/dev/null
|
||||
cd ../"$builddir"
|
||||
echo "Entering directory '$PWD'"
|
||||
set -x
|
||||
$CC $CFLAGS -c ../c/flmain.c
|
||||
$CC $LFLAGS -o upscheme -lm $o_files
|
||||
|
||||
{ set +x; } 2>/dev/null
|
||||
cd ../scheme-tests
|
||||
echo "Entering directory '$PWD'"
|
||||
|
||||
Reference in New Issue
Block a user