diff --git a/INSTALL-cross-compile.md b/INSTALL-cross-compile.md new file mode 100644 index 00000000..11e376e0 --- /dev/null +++ b/INSTALL-cross-compile.md @@ -0,0 +1,36 @@ +# Cross-compiling STklos + +## How to cross-compile + +Cross-compilation is just like compilation + +``` +./configure prefix=some-tmp-dir CC=some-C-compiler CFLAGS=your-c-flags ... +make +make install +``` + +The relevant environment variables are described in the output +of `configure --help`. + +***However:*** + +* You *need* a STklos binary in order to compile STklos. When not + cross-compiling, + - the binary is generated as `src/stklos` + - the build proceeds using `src/stklos` as the STklos binary that + can be used to compile `.stk` files + However, when cross-compiling `src/stklos` will be a binary for a + different (target) architecture, and the build will fail, unless we + have a native STklos in the system that can be used instead. + +* Put the full path of the STklos binary in the `STKLOS_BINARY` + variable when calling `make`: + +``` +./configure --prefix=/usr/some/place +make `STKLOS_BINARY=/usr/local/bin/stklos` +make install +``` + +Now you can copy the `usr/some/place` directory to the target machine. diff --git a/lib/scheme/Makefile.am b/lib/scheme/Makefile.am index 9cbaaba7..e23c651f 100644 --- a/lib/scheme/Makefile.am +++ b/lib/scheme/Makefile.am @@ -151,8 +151,11 @@ SUFFIXES = .stk .ostk .stk -incl.c .$(SO) .c stream.ostk: ../streams/primitive.ostk ../streams/derived.ostk -../streams/derived.ostk ../streams/primitive.ostk: - (cd ../streams && $(MAKE) $@) +../streams/derived.ostk: + (cd ../streams && $(MAKE) derived.ostk) + +../streams/primitive.ostk: + (cd ../streams && $(MAKE) primitive.ostk) set.ostk: ../srfi/69.ostk comparator.ostk diff --git a/lib/scheme/Makefile.in b/lib/scheme/Makefile.in index c699179e..6a289b5d 100644 --- a/lib/scheme/Makefile.in +++ b/lib/scheme/Makefile.in @@ -875,8 +875,11 @@ STKLOS_BINARY ?= ../../src/stklos stream.ostk: ../streams/primitive.ostk ../streams/derived.ostk -../streams/derived.ostk ../streams/primitive.ostk: - (cd ../streams && $(MAKE) $@) +../streams/derived.ostk: + (cd ../streams && $(MAKE) derived.ostk) + +../streams/primitive.ostk: + (cd ../streams && $(MAKE) primitive.ostk) set.ostk: ../srfi/69.ostk comparator.ostk diff --git a/utils/tmpcomp b/utils/tmpcomp index 0ddfe6a5..f1c7c701 100755 --- a/utils/tmpcomp +++ b/utils/tmpcomp @@ -62,12 +62,14 @@ case $# in esac prefix="$(cd -- "$(dirname "$0")/.." >/dev/null 2>&1 && pwd)" +[ "x$STKLOS_BINARY" != "x" ] || STKLOS_BINARY=${prefix}/src/stklos STKLOS_LOAD_PATH=".:../lib:${prefix}/lib:" STKLOS_BUILDING=1 export STKLOS_LOAD_PATH STKLOS_BUILDING -${prefix}/src/stklos -c -q -f ${prefix}/utils/stklos-compile.stk -- \ + +${STKLOS_BINARY} -c -q -f ${prefix}/utils/stklos-compile.stk -- \ --no-time $Copt --output=$out $in status=$? diff --git a/utils/tmpgenlex b/utils/tmpgenlex index e5b5f410..4579f32a 100755 --- a/utils/tmpgenlex +++ b/utils/tmpgenlex @@ -24,10 +24,11 @@ # Creation date: 1-Jan-2002 18:57 (eg) # +prefix="$(cd -- "$(dirname "$0")/.." >/dev/null 2>&1 && pwd)" +[ "x$STKLOS_BINARY" != "x" ] || STKLOS_BINARY=${prefix}/src/stklos -STKLOS_LOAD_PATH="../lib" -export STKLOS_LOAD_PATH - -../src/stklos -c -q -b ../src/boot.img -f ../utils/stklos-genlex -- $* +STKLOS_LOAD_PATH=".:../lib:${prefix}/lib:" +export STKLOS_LOAD_PATH +${STKLOS_BINARY} -c -q -b ../src/boot.img -f ../utils/stklos-genlex -- $*