summaryrefslogtreecommitdiffstats
path: root/stage1
diff options
context:
space:
mode:
authorDJ Delorie <dj@delorie.com>2012-06-28 16:25:53 -0400
committerDJ Delorie <dj@delorie.com>2012-06-28 16:25:53 -0400
commit3d5366a613c9b6b5f76dd091c1b4b46ca3d5710e (patch)
tree0630ba35343539852f0b118c847526d20daaa041 /stage1
parentfe297468611eecdbc52d6dd9256284d572d1009b (diff)
downloadbootstrap.git.DONOTUSE-3d5366a613c9b6b5f76dd091c1b4b46ca3d5710e.tar.gz
bootstrap.git.DONOTUSE-3d5366a613c9b6b5f76dd091c1b4b46ca3d5710e.tar.xz
bootstrap.git.DONOTUSE-3d5366a613c9b6b5f76dd091c1b4b46ca3d5710e.zip
Add distcc support
By default, stage2 will run with distcc client enabled, with DISTCC_HOSTS set to the original stage1 machine. It will generate a "distccd.script" to run on the stage1 host that uses the stage1 cross compilers and a matching port configuration (not the default port) with an unmodified distccd. This script is to be manually run by whoever is running stage2. Some editing of distccd.script and the stage2 local.conf may be needed.
Diffstat (limited to 'stage1')
-rwxr-xr-xstage151
1 files changed, 50 insertions, 1 deletions
diff --git a/stage1 b/stage1
index 993d303..0c63513 100755
--- a/stage1
+++ b/stage1
@@ -35,6 +35,8 @@ STAGE2=$MYDIR/stage2
SRPMDIR=$TOP/SRPMs
SRPMDIR_LOCAL=$TOP/SRPMlocal
J=-j12
+# default port for native builds is 3632, don't use that
+DISTCC_PORT=3639
BUILDDIR=$TOP/builds
PREFIX=$TOP/install
@@ -356,6 +358,7 @@ case "$1" in
go which
go xz
go grep
+ go distcc
go stage2
@@ -557,6 +560,10 @@ fi
ln -s usr/$i $ROOTFS/$i
mkdir $ROOTFS/usr/$i
done
+ for i in etc
+ do
+ mkdir $ROOTFS/$i
+ done
;;
"dev" )
@@ -894,6 +901,22 @@ EOF
rm bzegrep; ln -s bzgrep bzegrep
;;
+ distcc )
+ srpm distcc
+ mcd $BUILDDIR distcc
+ $SRC/${1}-*/configure $TCONFIGARGS --disable-Werror
+ notparallel
+ make $J V=1
+ make $J install DESTDIR=${ROOTFS}
+
+ mcd $ROOTFS/stage2/distcc-bin
+ for p in gcc cc g++ c++ as ${TARGET}-gcc ${TARGET}-g++ ${TARGET}-as
+ do
+ test -f $p && rm $p
+ ln -s /usr/bin/distcc $p
+ done
+ ;;
+
stage2 )
# install source trees in rootfs, so stage2 will have them for
# its builds.
@@ -938,7 +961,11 @@ EOF
cp $STAGE2 $ROOTFS/stage2/stage2
(
- grep '^J=' local.conf || true
+ newJ=$(echo $J | sed 's/-j//')
+ echo J=-j$newJ
+ echo DISTCC_HOSTS=$(host $(hostname) | sed 's/.* //'):${DISTCC_PORT}/999
+ echo DISTCC_BACKOFF_PERIOD=0
+ echo PATH=/stage2/distcc-bin:\$PATH
echo TARGET=$TARGET
echo RPMTARGET=$RPMTARGET
echo TCONFIGARGS=\"$TCONFIGARGS\" \
@@ -947,9 +974,31 @@ EOF
| sed 's/--target=[^ ]*//' \
| sed 's/--with-sysroot=[^ ]*//' \
| sed 's/--with-build-sysroot=[^ ]*//'
+
+ echo export J DISTCC_HOSTS DISTCC_BACKOFF_PERIOD PATH
echo export TARGET RPMTARGET TCONFIGARGS
) > $ROOTFS/stage2/local.conf
+ mcd $PREFIX/distccd-bin
+ rm -f gcc cc g++ c++ as
+ ln -s $PREFIX/bin/${TARGET}-gcc gcc
+ ln -s $PREFIX/bin/${TARGET}-gcc ${TARGET}-gcc
+ ln -s $PREFIX/bin/${TARGET}-gcc cc
+ ln -s $PREFIX/bin/${TARGET}-g++ ${TARGET}-g++
+ ln -s $PREFIX/bin/${TARGET}-g++ g++
+ ln -s $PREFIX/bin/${TARGET}-g++ c++
+ ln -s $PREFIX/bin/${TARGET}-as as
+ ln -s $PREFIX/bin/${TARGET}-as ${TARGET}-as
+ cd $TOP
+ (
+ echo #!/bin/sh
+ echo export PATH=$PREFIX/distccd-bin:\$PATH
+ # The allow means "anyone" since we don't know which host the target is.
+ # add --wizard to shut off background mode and logs info to stdout
+ echo distccd --daemon --allow 0.0.0.0/0 --port $DISTCC_PORT '"$@"'
+ ) > distccd.script
+ chmod a+x distccd.script
+
echo stage2 ready
;;