From eccba2ae33ebba6a68cfe297996e1785d6dbff92 Mon Sep 17 00:00:00 2001 From: Christophe Rhodes Date: Thu, 8 May 2014 14:14:48 +0100 Subject: [PATCH] support target-driven cross-compilation Running ./make-config.sh --host-location="host:path/to/sbcl" on the target causes the make-target-N.sh scripts to do all the copying of files to and from the host using rsync on the target to the specified host location. Because this is rsync, managing the reverse ssh to do this on heavily-firewalled targets is not straightforward; we might have to extend the syntax, or have an extra --host-port argument. But this should I think make the port to arm64 more straightforward. --- make-config.sh | 18 ++++++++++++++++++ make-target-1.sh | 13 +++++++++++++ make-target-2.sh | 5 +++++ 3 files changed, 36 insertions(+) diff --git a/make-config.sh b/make-config.sh index 179cede9c..9b998fe21 100755 --- a/make-config.sh +++ b/make-config.sh @@ -81,6 +81,12 @@ do --xc-host=) $optarg_ok && SBCL_XC_HOST=$optarg ;; + --host-location=) + $optarg_ok && SBCL_HOST_LOCATION=$optarg + ;; + --target-location=) + $optarg_ok && SBCL_TARGET_LOCATION=$optarg + ;; --dynamic-space-size=) $optarg_ok && SBCL_DYNAMIC_SPACE_SIZE=$optarg ;; @@ -247,6 +253,12 @@ echo "DEVNULL=\"$DEVNULL\"; export DEVNULL" > output/build-config echo "GNUMAKE=\"$GNUMAKE\"; export GNUMAKE" >> output/build-config echo "SBCL_XC_HOST=\"$SBCL_XC_HOST\"; export SBCL_XC_HOST" >> output/build-config echo "legacy_xc_spec=\"$legacy_xc_spec\"; export legacy_xc_spec" >> output/build-config +if [ -n "$SBCL_HOST_LOCATION" ]; then + echo "SBCL_HOST_LOCATION=\"$SBCL_HOST_LOCATION\"; export SBCL_HOST_LOCATION" >> output/build-config +fi +if [ -n "$SBCL_TARGET_LOCATION" ]; then + echo "SBCL_TARGET_LOCATION=\"$SBCL_TARGET_LOCATION\"; export SBCL_TARGET_LOCATION" >> output/build-config +fi # And now, sorting out the per-target dependencies... @@ -701,3 +713,9 @@ if [ `uname` = "SunOS" ] ; then PATH=/usr/xpg4/bin:$PATH fi echo '"'`hostname`-`id -un`-`date +%Y-%m-%d-%H-%M-%S`'"' > output/build-id.tmp + +if [ -n "$SBCL_HOST_LOCATION" ]; then + echo //setting up host configuration + rsync --delete-after -a output/ "$SBCL_HOST_LOCATION/output/" + rsync -a local-target-features.lisp-expr version.lisp-expr "$SBCL_HOST_LOCATION/" +fi diff --git a/make-target-1.sh b/make-target-1.sh index 423f967b0..b7372f376 100644 --- a/make-target-1.sh +++ b/make-target-1.sh @@ -23,6 +23,13 @@ export LANG LC_ALL # Load our build configuration . output/build-config +if [ -n "$SBCL_HOST_LOCATION" ]; then + echo //copying host-1 output files to target + rsync -a "$SBCL_HOST_LOCATION/output/" output/ + rsync -a "$SBCL_HOST_LOCATION/src/runtime/genesis" src/runtime + rsync -a "$SBCL_HOST_LOCATION/src/runtime/ldso-stubs.S" src/runtime/ +fi + # Build the runtime system and symbol table (.nm) file. # # (This C build has to come after the first genesis in order to get @@ -48,3 +55,9 @@ $GNUMAKE -C tools-for-build -I../src/runtime grovel-headers tools-for-build/grovel-headers > output/stuff-groveled-from-headers.lisp $GNUMAKE -C src/runtime after-grovel-headers + +if [ -n "$SBCL_HOST_LOCATION" ]; then + echo //copying target-1 output files to host + rsync -a src/runtime/sbcl.nm "$SBCL_HOST_LOCATION/src/runtime/" + rsync -a output/stuff-groveled-from-headers.lisp "$SBCL_HOST_LOCATION/output" +fi diff --git a/make-target-2.sh b/make-target-2.sh index fd1071084..1f5a46023 100644 --- a/make-target-2.sh +++ b/make-target-2.sh @@ -23,6 +23,11 @@ export LANG LC_ALL # Load our build configuration . output/build-config +if [ -n "$SBCL_HOST_LOCATION" ]; then + echo //copying host-2 files to target + rsync -a "$SBCL_HOST_LOCATION/output/" output/ +fi + # Do warm init stuff, e.g. building and loading CLOS, and stuff which # can't be done until CLOS is running. # -- 2.11.4.GIT