summaryrefslogtreecommitdiff
path: root/cross-make.sh
diff options
context:
space:
mode:
authorDouglas Katzman <dougk@google.com>2018-04-29 13:03:58 -0400
committerDouglas Katzman <dougk@google.com>2018-04-29 13:07:17 -0400
commitfa0c63416e19ee57227c5b91cb1f154fdc1c051e (patch)
treeb8a52498e78050f49678d722f39c8ac515de0a08 /cross-make.sh
parenta6a03ecc1540f641cede6a4f7c68f5cb62fcf5f2 (diff)
Add handy dandy script
Diffstat (limited to 'cross-make.sh')
-rwxr-xr-xcross-make.sh51
1 files changed, 51 insertions, 0 deletions
diff --git a/cross-make.sh b/cross-make.sh
new file mode 100755
index 000000000..e8d53dc2b
--- /dev/null
+++ b/cross-make.sh
@@ -0,0 +1,51 @@
+#!/bin/sh
+
+# This script is useful primarily when you have a target machine
+# that can make its own 'local-target-features', but you'd rather run
+# the bulk of the compilation on a different (presumably faster) machine.
+
+# The script is to executed on the machine that compiles the Lisp tree.
+# SSH is invoked to compile the C runtime.
+# Passwordless login to the target machine is required.
+
+set -ex
+if [ $1 = -p ]
+then
+ ssh_port_opt="-p $2"
+ scp_port_opt="-P $2"
+ shift ; shift
+else
+ ssh_port_opt=""
+ scp_port_opt=""
+fi
+host=$1 # can have the form 'user@host' if necessary
+root=$2 # path to source directory on $host
+ENV=$3 # if you need to set SBCL_ARCH,CFLAGS,etc remotely
+
+# Perform configuration on the target machine at the same git revision
+local_rev=`git rev-parse HEAD`
+ssh $ssh_port_opt $host cd $root \; \
+ git checkout $local_rev '&&' \
+ $ENV sh make-config.sh $config_options '&&' \
+ mv version.lisp-expr remote-version.lisp-expr
+scp $scp_port_opt $host:$root/{remote-version.lisp-expr,local-target-features.lisp-expr,output/build-id.inc} .
+mv build-id.inc output
+#diff version.lisp-expr remote-version.lisp-expr || exit 1
+
+# make-host-1 and copy over the artifacts
+sh make-host-1.sh
+tar cf - src/runtime/genesis src/runtime/ldso-stubs.S \
+ | ssh $ssh_port_opt $host tar xf - -C $root
+
+# make-target-1 and copy back the artifacts
+ssh $ssh_port_opt $host cd $root \; $ENV sh make-target-1.sh
+scp $scp_port_opt $host:$root/{src/runtime/sbcl.nm,output/stuff-groveled-from-headers.lisp} .
+mv sbcl.nm src/runtime
+mv stuff-groveled-from-headers.lisp output
+
+# make-host-2 and copy over the artifact
+sh make-host-2.sh
+scp $scp_port_opt -C output/cold-sbcl.core $host:$root/output
+
+# make-target-2
+ssh $ssh_port_opt $host cd $root \; sh make-target-2.sh