beautify message FAIL
fi
}
+
+distccd_start() {
+ echo "Running distcc daemon"
+ TOOLS_DIR=$TOOLS_DIR $BASEDIR/tools/make-compilers &
+ if [ "$?" -eq "0" ]; then
+ beautify message DONE
+ else
+ beautify message FAIL
+ fi
+}
+
+distccd_stop() {
+ echo "Stopping distcc daemon"
+ killall distccd
+ if [ "$?" -eq "0" ]; then
+ beautify message DONE
+ else
+ beautify message FAIL
+ fi
+}
+
+if [ "$(basename $0)" == "make-compilers" ]; then
+ # Exit, when distccd is already running
+ pidof distccd >/dev/null && exit 1
+
+ # Run distccd
+ DISTCCD_PATH=$TOOLS_DIR/bin:$(ls $TOOLS_DIR/libexec/gcc/*-pc-linux-gnu/*/) \
+ $TOOLS_DIR/usr/bin/distccd --daemon --allow 0.0.0.0/0 \
+ --user nobody --nice 10 --jobs 4 &>/dev/null
+
+ # When $TOOLS_DIR is not available (esp. gcc) --> exit
+ while pidof distccd >/dev/null && [ -x $TOOLS_DIR/bin/gcc ]; do
+ sleep 10
+ done
+
+ distccd_stop
+fi