# This is a working example of a script that you may wish to add to your system's
# /etc/rc.d/rc.local in order to start distcc with the Cross compiler toolchain.

# Distcc:
case "$( uname -m )" in
   i?86) export DISTCCARCH=i486 ;;
   # Unless $ARCH is already set, use uname -m for all other archs:
      *) export DISTCCARCH=$( uname -m ) ;;
esac

#DISTCC_SAVE_TEMPS=1 \
DISTCC_BASEDIR=/devel/build-servers/ \
LD_LIBRARY_PATH=$DISTCC_BASEDIR/$DISTCCARCH/arm/$DISTCCARCH-slackware-linux/arm-slackware-linux-gnueabihf/lib/ \
DISTCCD_PATH=$DISTCC_BASEDIR/$DISTCCARCH/arm/bin \
/usr/bin/distccd \
   --verbose \
   --log-file /tmp/distcc.log \
   -j 20 \
   --daemon \
   --allow 192.168.1.0/24
#     --log-level debug \

# With distcc v3.3, there is a whitelist notion, composed of symlinks.
if [ -d /usr/lib64/distcc ]; then
   DISTCCWHITELISTDIR=/usr/lib64/distcc
 elif [ -d /usr/lib/distcc ]; then
   DISTCCWHITELISTDIR=/usr/lib/distcc
fi
# Some distcc hosts may have an older distcc release that doesn't have these dirs,
# so we'll only make the symlinks if the dir exists.
# Ideally we'd confirm their existance before blatting them, but these are build machines not
# production so I'm not going to over-engineer it.
if [ ! -z "$DISTCCWHITELISTDIR" ]; then
   ln -frs $DISTCC_BASEDIR/$DISTCCARCH/arm/bin/arm-slackware-linux-gnueabihf-gcc $DISTCCWHITELISTDIR/
   ln -frs $DISTCC_BASEDIR/$DISTCCARCH/arm/bin/arm-slackware-linux-gnueabihf-g++ $DISTCCWHITELISTDIR/
   ln -frs $DISTCC_BASEDIR/$DISTCCARCH/arm/bin/arm-slackware-linux-gnueabihf-c++ $DISTCCWHITELISTDIR/ 
fi

