Mercurial > hg > aboriginal
annotate sources/toys/run-with-distcc.sh @ 380:d840968ff9a3
Added tag 0.9.0 for changeset 2925f71bce99
author | Rob Landley <rob@landley.net> |
---|---|
date | Wed, 06 Aug 2008 16:44:02 -0500 |
parents | 66d43620e29f |
children | b15809a0af09 |
rev | line source |
---|---|
306
358ef8a27085
Break up run-$ARCH.sh, move more temp files into temp dir, fix deletion logic.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
1 #!/bin/bash |
358ef8a27085
Break up run-$ARCH.sh, move more temp files into temp dir, fix deletion logic.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
2 |
358ef8a27085
Break up run-$ARCH.sh, move more temp files into temp dir, fix deletion logic.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
3 # Wrapper script that sets up distcc on the host and tells the native build |
358ef8a27085
Break up run-$ARCH.sh, move more temp files into temp dir, fix deletion logic.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
4 # where to find it, then hands off to run-with-home.sh |
358ef8a27085
Break up run-$ARCH.sh, move more temp files into temp dir, fix deletion logic.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
5 |
358ef8a27085
Break up run-$ARCH.sh, move more temp files into temp dir, fix deletion logic.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
6 if [ ! -f "$1"/distcc/gcc ] |
358ef8a27085
Break up run-$ARCH.sh, move more temp files into temp dir, fix deletion logic.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
7 then |
358ef8a27085
Break up run-$ARCH.sh, move more temp files into temp dir, fix deletion logic.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
8 echo "Usage: $0 cross-compiler-path" >&2 |
358ef8a27085
Break up run-$ARCH.sh, move more temp files into temp dir, fix deletion logic.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
9 exit 1 |
358ef8a27085
Break up run-$ARCH.sh, move more temp files into temp dir, fix deletion logic.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
10 fi |
358ef8a27085
Break up run-$ARCH.sh, move more temp files into temp dir, fix deletion logic.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
11 |
358ef8a27085
Break up run-$ARCH.sh, move more temp files into temp dir, fix deletion logic.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
12 # Run the distcc daemon on the host system with $PATH restricted to the |
358ef8a27085
Break up run-$ARCH.sh, move more temp files into temp dir, fix deletion logic.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
13 # cross compiler's symlinks. |
358ef8a27085
Break up run-$ARCH.sh, move more temp files into temp dir, fix deletion logic.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
14 |
342
66d43620e29f
Background the distcc daemon ourselves so we can kill it at the end.
Rob Landley <rob@landley.net>
parents:
336
diff
changeset
|
15 # Note that we tell it --no-detach and background it oursleves so jobs -p can |
66d43620e29f
Background the distcc daemon ourselves so we can kill it at the end.
Rob Landley <rob@landley.net>
parents:
336
diff
changeset
|
16 # find it later to kill it after the emulator exits. |
66d43620e29f
Background the distcc daemon ourselves so we can kill it at the end.
Rob Landley <rob@landley.net>
parents:
336
diff
changeset
|
17 |
306
358ef8a27085
Break up run-$ARCH.sh, move more temp files into temp dir, fix deletion logic.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
18 DCC="$(which distccd)" |
358ef8a27085
Break up run-$ARCH.sh, move more temp files into temp dir, fix deletion logic.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
19 if [ -z "$DCC" ] |
358ef8a27085
Break up run-$ARCH.sh, move more temp files into temp dir, fix deletion logic.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
20 then |
358ef8a27085
Break up run-$ARCH.sh, move more temp files into temp dir, fix deletion logic.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
21 echo 'No distccd in $PATH' |
358ef8a27085
Break up run-$ARCH.sh, move more temp files into temp dir, fix deletion logic.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
22 exit 1 |
358ef8a27085
Break up run-$ARCH.sh, move more temp files into temp dir, fix deletion logic.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
23 fi |
358ef8a27085
Break up run-$ARCH.sh, move more temp files into temp dir, fix deletion logic.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
24 |
358ef8a27085
Break up run-$ARCH.sh, move more temp files into temp dir, fix deletion logic.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
25 PATH="$(readlink -f "$1/distcc")" "$DCC" --listen 127.0.0.1 --log-stderr \ |
342
66d43620e29f
Background the distcc daemon ourselves so we can kill it at the end.
Rob Landley <rob@landley.net>
parents:
336
diff
changeset
|
26 --log-level error --daemon -a 127.0.0.1 --no-detach 2>distccd.log & |
306
358ef8a27085
Break up run-$ARCH.sh, move more temp files into temp dir, fix deletion logic.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
27 |
358ef8a27085
Break up run-$ARCH.sh, move more temp files into temp dir, fix deletion logic.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
28 # Prepare some environment variables for run-qemu.sh |
358ef8a27085
Break up run-$ARCH.sh, move more temp files into temp dir, fix deletion logic.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
29 |
358ef8a27085
Break up run-$ARCH.sh, move more temp files into temp dir, fix deletion logic.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
30 export DISTCC_PATH_PREFIX=/tools/distcc: |
358ef8a27085
Break up run-$ARCH.sh, move more temp files into temp dir, fix deletion logic.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
31 CPUS=$[$(echo /sys/devices/system/cpu/cpu[0-9]* | wc -w)+1] |
336 | 32 export KERNEL_EXTRA="DISTCC_HOSTS=10.0.2.2 CPUS=$CPUS $KERNEL_EXTRA" |
306
358ef8a27085
Break up run-$ARCH.sh, move more temp files into temp dir, fix deletion logic.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
33 |
358ef8a27085
Break up run-$ARCH.sh, move more temp files into temp dir, fix deletion logic.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
34 # Hand off to run-with-home.sh in the directory this script's running from. |
358ef8a27085
Break up run-$ARCH.sh, move more temp files into temp dir, fix deletion logic.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
35 |
358ef8a27085
Break up run-$ARCH.sh, move more temp files into temp dir, fix deletion logic.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
36 "$(readlink -f "$(which $0)" | sed -e 's@\(.*/\).*@\1@')"run-with-home.sh |
358ef8a27085
Break up run-$ARCH.sh, move more temp files into temp dir, fix deletion logic.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
37 |
358ef8a27085
Break up run-$ARCH.sh, move more temp files into temp dir, fix deletion logic.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
38 # Cleanup afterwards: Kill child processes we started (I.E. distccd). |
358ef8a27085
Break up run-$ARCH.sh, move more temp files into temp dir, fix deletion logic.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
39 |
342
66d43620e29f
Background the distcc daemon ourselves so we can kill it at the end.
Rob Landley <rob@landley.net>
parents:
336
diff
changeset
|
40 echo |
306
358ef8a27085
Break up run-$ARCH.sh, move more temp files into temp dir, fix deletion logic.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
41 kill `jobs -p` |