Next: , Previous: , Up: Building SCM   [Contents][Index]


2.3.1 Invoking Build

This section teaches how to use build, a Scheme program for creating compilation scripts to produce SCM executables and library modules. The options accepted by ‘build’ are documented in Build Options.

Use the any method if you encounter problems with the other two methods (MS-DOS, Unix).

MS-DOS

From the SCM source directory, type ‘build’ followed by up to 9 command line arguments.

Unix

From the SCM source directory, type ‘./build’ followed by command line arguments.

any

From the SCM source directory, start ‘scm’ or ‘scmlit’ and type (load "build"). Alternatively, start ‘scm’ or ‘scmlit’ with the command line argument ‘-ilbuild’. This method will also work for MS-DOS and Unix.

After loading various SLIB modules, the program will print:

type (b "build <command-line>") to build
type (b*) to enter build command loop

The ‘b*’ procedure enters into a build shell where you can enter commands (with or without the ‘build’). Blank lines are ignored. To create a build script with all defaults type ‘build’.

If the build-shell encouters an error, you can reenter the build-shell by typing ‘(b*)’. To exit scm type ‘(quit)’.

Here is a transcript of an interactive (b*) build-shell.

bash$ scmlit
SCM version 5e7, Copyright (C) 1990-2006 Free Software Foundation.
SCM comes with ABSOLUTELY NO WARRANTY; for details type `(terms)'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `(terms)' for details.
> (load "build")
;loading build
;  loading /home/jaffer/slib/getparam
;    loading /home/jaffer/slib/coerce
...
;  done loading build.scm
type (b "build <command-line>") to build
type (b*) to enter build command loop
;done loading build
#<unspecified>
> (b*)
;loading /home/jaffer/slib/comparse
;done loading /home/jaffer/slib/comparse.scm
build> -t exe
#! /bin/sh
# unix (linux) script created by SLIB/batch Wed Oct 26 17:14:23 2011
# [-p linux]
# ================ Write file with C defines
rm -f scmflags.h
echo '#define IMPLINIT "Init5e7.scm"'>>scmflags.h
echo '#define BIGNUMS'>>scmflags.h
echo '#define FLOATS'>>scmflags.h
echo '#define ARRAYS'>>scmflags.h
# ================ Compile C source files
gcc -c continue.c scm.c scmmain.c findexec.c script.c time.c repl.c scl.c eval.c sys.c subr.c debug.c unif.c rope.c
# ================ Link C object files
gcc -rdynamic -o scm continue.o scm.o scmmain.o findexec.o script.o time.o repl.o scl.o eval.o sys.o subr.o debug.o unif.o rope.o -lm -lc
"scm"
build> -t exe -w myscript.sh
"scm"
build> (quit)

No compilation was done. The ‘-t exe’ command shows the compile script. The ‘-t exe -w myscript.sh’ line creates a file myscript.sh containing the compile script. To actually compile and link it, type ‘./myscript.sh’.

Invoking build without the ‘-F’ option will build or create a shell script with the arrays, inexact, and bignums options as defaults. Invoking ‘build’ with ‘-F lit -o scmlit’ will make a script for compiling ‘scmlit’.

bash$ ./build
-|
#! /bin/sh
# unix (linux) script created by SLIB/batch 
# ================ Write file with C defines
rm -f scmflags.h
echo '#define IMPLINIT "Init5f3.scm"'>>scmflags.h
echo '#define BIGNUMS'>>scmflags.h
echo '#define FLOATS'>>scmflags.h
echo '#define ARRAYS'>>scmflags.h
# ================ Compile C source files
gcc -O2 -c continue.c scm.c scmmain.c findexec.c script.c time.c repl.c scl.c eval.c sys.c subr.c debug.c unif.c rope.c
# ================ Link C object files
gcc -rdynamic -o scm continue.o scm.o scmmain.o findexec.o script.o time.o repl.o scl.o eval.o sys.o subr.o debug.o unif.o rope.o -lm -lc

To cross compile for another platform, invoke build with the ‘-p’ or ‘--platform=’ option. This will create a script for the platform named in the ‘-p’ or ‘--platform=’ option.

bash$ ./build -o scmlit -p darwin -F lit
-|
#! /bin/sh
# unix (darwin) script created by SLIB/batch 
# ================ Write file with C defines
rm -f scmflags.h
echo '#define IMPLINIT "Init5f3.scm"'>>scmflags.h
# ================ Compile C source files
cc -O3 -c continue.c scm.c scmmain.c findexec.c script.c time.c repl.c scl.c eval.c sys.c subr.c debug.c unif.c rope.c
# ================ Link C object files
mv -f scmlit scmlit~
cc -o scmlit continue.o scm.o scmmain.o findexec.o script.o time.o repl.o scl.o eval.o sys.o subr.o debug.o unif.o rope.o

Next: , Previous: , Up: Building SCM   [Contents][Index]