summaryrefslogtreecommitdiff
path: root/cross-make.sh
blob: 817776b7eeb9028aac22d00606c9479f945f40c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/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.

#config_options="--without-gencgc --with-cheneygc"
if [ $1 = -p ]
then
  ssh_port_opt="-p $2"
  scp_port_opt="-P $2"
  shift ; shift
else
  ssh_port_opt=""
  scp_port_opt=""
fi
case $1 in
  sync)
   # Perform configuration on the target machine at the same git revision
   local_rev=`git rev-parse HEAD`
   checkout="git checkout $local_rev"
   ;;
  head)
   checkout="git checkout master"
   ;;
  nosync)
   checkout="echo not syncing remote"
   ;;
  *)
   echo "Usage error: cross-make.sh {sync|head|nosync} host dir [env]"
   exit 1
esac
shift
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

set -ex

./generate-version.sh
ssh $ssh_port_opt $host cd $root \; $checkout '&&' \
  $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 the generated C headers to the target machine
sh make-host-1.sh
tar cf - src/runtime/genesis output/ucd | ssh $ssh_port_opt $host cd $root \; tar xf -

# 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/output/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 and the two contribs required to execute 'core.test.sh'
ssh $ssh_port_opt $host cd $root \; sh make-target-2.sh '&&' \
   sh make-target-contrib.sh sb-posix sb-bsd-sockets