It's unknown to me if the archive accepts packages built using this method, but it can be useful when building "local" packages for low-performance semi-embedded devices, where you have access to multiple identical machines.

First on one machine, lets call it master, we install the usual build tools. Then install the packages distcc and ccache. On all the slaves, you should install distcc and g++ (if you will ever only compile c code, you can install only gcc instead). On all slaves, edit their /etc/default/distcc and set STARTDISTCC to true, ALLOWEDNETS to your sub-network (i.e. ""), and LISTENER to the LAN interface (i.e. ""). If you want to use avahi, let ZEROCONF be true. You don't need to do this modification on the master, as we don't want to use that server for actual remote building. After modification don't forget to start the daemons.

If you dont want to use avahi, then on the master, add all the IP:s to $HOME/.distcc/hosts.

Even though you can use distcc without ccache I recommend this combination, as you can easly hook distcc to the call of ccache.

Now we create two scripts in /usr/local/bin:

First /usr/local/bin/distbuild:

export MAKE="/usr/local/bin/distmake"
export DISTCC_HOSTS="+zeroconf"
export CCACHE_PREFIX="distcc"
export DISTCC_JOBS=`distcc -j`
export CC="ccache gcc"
export CXX="ccache g++"

echo "Building with $DISTCC_JOBS parallel jobs on following servers:"
for server in `distcc --show-hosts`; do
                server=$(echo $server | sed 's/:.*//')
                echo -e "\t$server"

BCMD="debuild -rfakeroot"
if [ -d .svn ]; then
                BCMD="svn-buildpackage --svn-builder $BCMD"

And again, if you don't want to use zeroconf, don't export DISTCC_HOSTS with "+zeroconf". The SVN check I added to easily use same command on both normal builds as subversion builds.

Second we need a make (/usr/local/bin/makebuild) wrapper, as debhelper might choke otherwise:

make --jobs=${DISTCC_JOBS:-1} "$@"

Now we can build package as following:

$ bbuild -uc -us -tc
Building with 16 parallel jobs on following servers:
debuild -rfakeroot -eCC -eCXX -eCCACHE_PREFIX -eMAKE -eDISTCC_HOSTS -eDISTCC_JOBS -uc -us

CategorySoftware | CategoryProgramming | CategoryPackaging