diff options
author | csilvers <csilvers@01de4be4-8c4a-0410-9132-4925637da917> | 2008-04-11 22:36:40 +0000 |
---|---|---|
committer | csilvers <csilvers@01de4be4-8c4a-0410-9132-4925637da917> | 2008-04-11 22:36:40 +0000 |
commit | 6b117b70f948dc72b107dab6d3e9ac99be297b6d (patch) | |
tree | 1726969de95d86fc5647af1eeb99ea0489ba91c4 /contrib | |
parent | 204634dc3c7d4662fab0132140f1ac59e8c9312b (diff) | |
download | distcc-6b117b70f948dc72b107dab6d3e9ac99be297b6d.tar.gz |
The first step of moving everything in the distcc directory to the top
level. I'm doing this in two stages, because I don't understand svn
enough to be confident to do it in one. This first stage just copies
all the files from distcc/FOO to FOO. Now there are two copies of
each file under distcc; the Makefile/etc uses the one in distcc and
ignores the one at the top level.
The next commit will delete everything under distcc, and rewrite the
Makefile/etc to use the top-level versions instead.
git-svn-id: http://distcc.googlecode.com/svn/trunk@22 01de4be4-8c4a-0410-9132-4925637da917
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/distcc-absolutify | 47 | ||||
-rw-r--r-- | contrib/distcc.sh | 40 | ||||
-rw-r--r-- | contrib/distccd-init | 70 | ||||
-rwxr-xr-x | contrib/distccd-on-servers | 145 | ||||
-rw-r--r-- | contrib/dmake | 16 | ||||
-rw-r--r-- | contrib/make-j | 21 | ||||
-rw-r--r-- | contrib/netpwd | 26 | ||||
-rw-r--r-- | contrib/redhat/init | 83 | ||||
-rw-r--r-- | contrib/redhat/logrotate | 5 | ||||
-rw-r--r-- | contrib/redhat/sysconfig | 8 | ||||
-rw-r--r-- | contrib/redhat/xinetd | 17 | ||||
-rw-r--r-- | contrib/stage-cc-wrapper.patch | 81 |
12 files changed, 559 insertions, 0 deletions
diff --git a/contrib/distcc-absolutify b/contrib/distcc-absolutify new file mode 100644 index 0000000..a3d2beb --- /dev/null +++ b/contrib/distcc-absolutify @@ -0,0 +1,47 @@ +#! /bin/sh +# Copyright 2002 Free Software Foundation +# by Alexandre Oliva <aoliva@redhat.com> + +# This script is Free Software, and it can be copied, distributed and +# modified as defined in the GNU General Public License. A copy of +# its license can be downloaded from http://www.gnu.org/copyleft/gpl.html + +# This is a wrapper for distcc that turns relative pathnames into +# network-neutral ones. It modifies anything containing a slash and +# not starting with dash or slash, as well as -B flags. We need not +# be concerned about -I and -L, since distcc always does preprocessing +# and linking locally. + + +# If the first pathname is relative (.../xgcc, ./libtool, etc), +case "$1" in +[^/]*/*) + nargs=$# + basedir=`${NETPWD-netpwd}` + # then process arguments + for arg + do + case $arg in + -B[^/]*) + arg=-B$basedir/`echo "X$arg" | sed -e '1s/^X-B//'` + ;; + [^-/]*/*) + arg=$basedir/$arg + ;; + esac + set fnord ${1+"$@"} "$arg" + done + shift $nargs # take list of fnords out + shift $nargs # take original args out + ;; +esac + +# Now run the real distcc thingie, or just run the program directly if +# distcc is found to be missing. +if test -x ${REAL_DISTCC-/usr/bin/distcc}; then + x=${REAL_DISTCC-/usr/bin/distcc} +else + x=$1 + shift +fi +exec $x ${1+"$@"} diff --git a/contrib/distcc.sh b/contrib/distcc.sh new file mode 100644 index 0000000..b6b3307 --- /dev/null +++ b/contrib/distcc.sh @@ -0,0 +1,40 @@ +#! /bin/sh + +# This file, contributed by Dimitri PAPADOPOULOS-ORFANOS <papadopo@shfj.cea.fr> +# may be installed as "cc" somewhere on your $PATH ahead of the real gcc. That +# allows you to just use regular Makefiles without modifying them to change +# hardcoded calls to cc. + +# This script will be a bit slow because of the overhead of running +# things through a shell. In a future release, this function should +# be supported directly by distcc, which should be a bit faster. + +DISTCC_HOME=/usr/local/distcc + +name=`basename $0` + +if [ "$name" = distcc ]; then + echo "In normal use distcc is not called by its real name." 1>&2 + echo "Instead create links to the actual compiler you wish to run, e.g." 1>&2 + echo " ln -s distcc gcc" 1>&2 + echo "and make sure the link is before the real compiler in your path." 1>&2 + exit 1 +fi + +unset found +IFS=: +for item in $PATH; do + if [ -x "$item/$name" -a ! -d "$item/$name" ]; then + if [ `cd $item; /bin/pwd` != `/bin/pwd` ]; then + found=true + break + fi + fi +done + +if [ -n "$found" ]; then + exec "distcc $item/$name $@" +else + echo "$name: not found" 1>&2 +fi +exit 1 diff --git a/contrib/distccd-init b/contrib/distccd-init new file mode 100644 index 0000000..46938a2 --- /dev/null +++ b/contrib/distccd-init @@ -0,0 +1,70 @@ +#! /bin/sh +# +# distccd Debian init.d script contributed by Jason Thomas. (Debian #161136) +# +# skeleton example file to build /etc/init.d/ scripts. +# This file should be used to construct scripts for /etc/init.d. +# +# Written by Miquel van Smoorenburg <miquels@cistron.nl>. +# Modified for Debian GNU/Linux +# by Ian Murdock <imurdock@gnu.ai.mit.edu>. +# +# Version: @(#)skeleton 1.9.1 08-Apr-2002 miquels@cistron.nl +# + +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +DAEMON=/usr/bin/distccd +NAME=distccd +DESC="Distributed Compiler Daemon" +DAEMON_ARGS="--nice=10 --port=4200 --pid-file=/var/run/$NAME.pid \ + --log-file=/var/log/$NAME.log --daemon" + +test -x $DAEMON || exit 0 + +set -e + +# we need permission to write to the pid file +touch /var/run/$NAME.pid +chown distccd /var/run/$NAME.pid + +case "$1" in + start) + echo -n "Starting $DESC: $NAME" + start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \ + --chuid distccd \ + --exec $DAEMON -- $DAEMON_ARGS + echo "." + ;; + stop) + echo -n "Stopping $DESC: $NAME " + start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid \ + --oknodo \ + --exec $DAEMON + echo "." + ;; + restart|force-reload) + # + # If the "reload" option is implemented, move the "force-reload" + # option to the "reload" entry above. If not, "force-reload" is + # just the same as "restart". + # + echo -n "Restarting $DESC: $NAME" + start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid \ + --oknodo \ + --exec $DAEMON + sleep 1 + start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \ + --chuid distccd \ + --exec $DAEMON -- $DAEMON_ARGS + echo "." + ;; + *) + N=/etc/init.d/$NAME + echo "Usage: $N {start|stop|restart|force-reload}" >&2 + exit 1 + ;; +esac + +exit 0 + + diff --git a/contrib/distccd-on-servers b/contrib/distccd-on-servers new file mode 100755 index 0000000..437171c --- /dev/null +++ b/contrib/distccd-on-servers @@ -0,0 +1,145 @@ +#! /bin/bash + + +# Copyright 2007 Google Inc. All Rights Reserved. +# +# A script for installing and controlling distccd on servers. +# +# This script allows for easy testing of distcc. It does not depend on +# RPM, debian or other packaging techniques. + + +function Usage { + printf "Usage: server-test {start|stop|restart|install|ps|status}\n\ +Obligatory environment variables:\n\ + DISTCC_LOC Location of distcc, a path of the form ../distcc.\n\ + DISTCCD_MACHINES Hostnames of compiler servers.\n\ + DISTCCD_REMOTE_LOC Path where distcc_pump/distcc resides on servers.\n\ + DISTCCD_ARGS Arguments and options for distccd command on server.\n\ + DISTCCD_TMPDIR Exported to server as TMPDIR before start.\n\ +See script for details.\n\ +" +} + +trap "Usage" EXIT +: ${DISTCC_LOC:?} +: ${DISTCCD_MACHINES:?} +: ${DISTCCD_REMOTE_LOC:?} +: ${DISTCCD_ARGS:?} +: ${DISTCCD_TMPDIR:?} +trap EXIT + + +function Doing { + printf "\nDOING $1\n" +} + + +function Install { + bad_server=0 + for SERVER in $DISTCCD_MACHINES; do + Doing $SERVER + ssh $SERVER "mkdir --parents $DISTCCD_REMOTE_LOC"\ + || { bad_server=$SERVER; continue; } + ssh $SERVER "rm -rf $DISTCCD_REMOTE_LOC/distcc" \ + || { bad_server=$SERVER; continue; } + scp -r -q $DISTCC_LOC $SERVER:$DISTCCD_REMOTE_LOC/distcc \ + || { bad_server=$SERVER:; continue; } + done + if [ "$bad_server" != 0 ]; then + echo "ERROR: installation on $bad_server failed (and maybe others)" 1>&2 + return 1 + fi + return 0 +} + + +function Start { + bad_server=0 + for SERVER in $DISTCCD_MACHINES; do + Doing $SERVER + ssh $SERVER \ + "TMPDIR=$DISTCCD_TMPDIR; $DISTCCD_REMOTE_LOC/distcc/distccd $DISTCCD_ARGS"\ + || { bad_server=$SERVER; continue; } + done + if [ $bad_server != 0 ]; then + echo "ERROR: starting distccd on $bad_server failed (and maybe others)" 1>&2 + return 1 + fi + return 0 +} + + +function Psing { + for SERVER in $DISTCCD_MACHINES; do + Doing $SERVER + ssh $SERVER \ + "ps ux | grep \"$DISTCCD_REMOTE_LOC.*[d]istccd\"" + done +} + + +function Status { + for SERVER in $DISTCCD_MACHINES; do + Doing $SERVER + # The [d] construct prevents the grep command itself from being recognized. + ssh $SERVER \ + "if ps ux | grep -q \" $DISTCCD_REMOTE_LOC/distcc/distcc[d] \"; then\ + echo $SERVER is running distccd;\ + fi;\ + " + done +} + + +function Stop { + for SERVER in $DISTCCD_MACHINES; do + Doing $SERVER + ssh $SERVER \ + "while grep Stopping \ + <(ps ux | grep \"$DISTCCD_REMOTE_LOC.*[d]istcc\" | \ + (read X PID Z; \ + if [ -n \"\$PID\" ]; then\ + echo \"Stopping process\" \$PID; kill \$PID;\ + fi)); do\ + :;\ + done; " + done +} + + + +case "$1" in + start) + echo "Start" + Start + ;; + stop) + echo "Stop" + Stop + ;; + restart) + echo "Restart" + Stop + sleep 1 + Start + ;; + install) + echo "Install" + Install + ;; + status) + echo "Status" + Status + ;; + ps) + echo "Run 'ps'" + Psing + ;; + *) + Usage + exit 1 + ;; +esac + + diff --git a/contrib/dmake b/contrib/dmake new file mode 100644 index 0000000..8e0ac85 --- /dev/null +++ b/contrib/dmake @@ -0,0 +1,16 @@ +#! /bin/sh + +# Example script contributed by Luke Gorrie + +# "Drop-in" front end to 'make' that uses the distributed compile farm +# via `distcc' + +# Compile farm hosts are stored in ~bluetail/distcc-hosts. We exclude +# the local machine to free up resources for preprocessing and +# linking, since it seems to be the bottleneck (at least on +# kookaburra). + +DISTCC_HOSTS=$(sed s/$(hostname -s)// < /home/share/bluetail/distcc-hosts) + +make CC='/home/share/luke/bin/distcc gcc' -j 7 "$@" + diff --git a/contrib/make-j b/contrib/make-j new file mode 100644 index 0000000..013484f --- /dev/null +++ b/contrib/make-j @@ -0,0 +1,21 @@ +#! /bin/sh + +# make-j script from Alexandre Oliva <aoliva@redhat.com> for use with distcc + +# Tests which machines are up, and runs Make with concurrency set +# appropriately. + +hostlist=$DISTCC_HOSTS +distcc_port=4200 +DISTCC_HOSTS= +count=0 +for h in $hostlist; do + echo trying $h... >&2 + if test "x$h" = xlocalhost || nc -z $h $distcc_port; then + echo added $h... >&2 + DISTCC_HOSTS=`echo $DISTCC_HOSTS $h` # remove leading blank + count=`expr $count + 1` + fi +done +export DISTCC_HOSTS +exec make -j $count ${1+"$@"} diff --git a/contrib/netpwd b/contrib/netpwd new file mode 100644 index 0000000..863cb6e --- /dev/null +++ b/contrib/netpwd @@ -0,0 +1,26 @@ +#! /bin/sh +# Copyright 2002 Free Software Foundation +# by Alexandre Oliva <aoliva@redhat.com> + +# This script is Free Software, and it can be copied, distributed and +# modified as defined in the GNU General Public License. A copy of +# its license can be downloaded from http://www.gnu.org/copyleft/gpl.html + +# Turn a local pathname into a network-neutral one. It assumes +# /net/$HOSTNAME/pathname can access $HOSTNAME's /pathname from other +# machines, and that /net/$HOSTNAME is actually mounted (by amd) +# inside /.automount/$HOSTNAME/root, so it compensates for that. + +dir=`${REAL_PWD-pwd}` +case $dir in +/net/*) + ;; +/.automount/*/root/*) + dir=/net/`echo "$dir" | sed -e '1s,^/\.automount/,,' -e 's,/root/,/,'` + ;; +*) + dir=/net/${HOSTNAME-`uname -n`}$dir + ;; +esac +echo $dir +exit 0 diff --git a/contrib/redhat/init b/contrib/redhat/init new file mode 100644 index 0000000..4df2f6e --- /dev/null +++ b/contrib/redhat/init @@ -0,0 +1,83 @@ +#!/bin/sh +# +# Init file for Distccd - A distributed compilation front-end. +# WARNING: Don't enable on untrusted networks +# +# Written by Dag Wieers <dag@wieers.com>. +# +# chkconfig: - 80 20 +# description: Distccd - distributed compilation front-end (daemon) \ +# WARNING: Don't enable on untrusted networks +# +# processname: distccd +# +# config: /etc/sysconfig/distccd + +source /etc/init.d/functions +source /etc/sysconfig/network + +### Check that networking is up. +[ "${NETWORKING}" == "no" ] && exit 0 + +[ -x "/usr/bin/distccd" ] || exit 1 + +### Default variables +SYSCONFIG="/etc/sysconfig/distccd" +OPTIONS="" +USER="distcc" +DISTCCPATH="$PATH" + +### Read configuration +[ -r "$SYSCONFIG" ] && source "$SYSCONFIG" + +RETVAL=0 +prog="distccd" +desc="Distributed Compiler daemon" + +start() { + echo -n $"Starting $desc ($prog): " + PATH="$DISTCCPATH" daemon --user "$USER" $prog --daemon --log-file="/var/log/distccd.log" $OPTIONS + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog + return $RETVAL +} + +stop() { + echo -n $"Shutting down $desc ($prog): " + killproc $prog + RETVAL=$? + echo + [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog + return $RETVAL +} + +restart() { + stop + start +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart|reload) + restart + ;; + condrestart) + [ -e /var/lock/subsys/$prog ] && restart + RETVAL=$? + ;; + status) + status $prog + RETVAL=$? + ;; + *) + echo $"Usage $0 {start|stop|restart|condrestart|status}" + RETVAL=1 +esac + +exit $RETVAL diff --git a/contrib/redhat/logrotate b/contrib/redhat/logrotate new file mode 100644 index 0000000..edbecae --- /dev/null +++ b/contrib/redhat/logrotate @@ -0,0 +1,5 @@ +/var/log/distccd.log { + missingok + copytruncate + notifempty +} diff --git a/contrib/redhat/sysconfig b/contrib/redhat/sysconfig new file mode 100644 index 0000000..a5ad5bd --- /dev/null +++ b/contrib/redhat/sysconfig @@ -0,0 +1,8 @@ +### See distcc(1) manual page for more information on these options. +### + +#OPTIONS="--nice 5 --jobs 5 --allow 10.0.0.0/24 --port 1234" +#USER="distcc" + +### Set this if don't want distccd to use gcc or g++ by accident. +#DISTCCPATH="/usr/lib/distcc/bin" diff --git a/contrib/redhat/xinetd b/contrib/redhat/xinetd new file mode 100644 index 0000000..023f390 --- /dev/null +++ b/contrib/redhat/xinetd @@ -0,0 +1,17 @@ +# default: off +# description: Distccd - distributed compilation front-end (xinetd) \ +# Please disable the daemon if you enable this. \ +# WARNING: Don't enable on untrusted networks +service distccd +{ + disable = yes + socket_type = stream + protocol = tcp + port = 3632 + type = UNLISTED + wait = no + user = distcc + server = /usr/bin/distccd + server_args = --inetd --log-file="/var/log/distccd.log" + only_from = 127.0.0.1 +} diff --git a/contrib/stage-cc-wrapper.patch b/contrib/stage-cc-wrapper.patch new file mode 100644 index 0000000..cb3d004 --- /dev/null +++ b/contrib/stage-cc-wrapper.patch @@ -0,0 +1,81 @@ +Index: Makefile.in +=================================================================== +RCS file: /cvs/gcc/egcs/Makefile.in,v +retrieving revision 1.110 +diff -u -p -r1.110 Makefile.in +--- Makefile.in 8 Jul 2002 21:40:41 -0000 1.110 ++++ Makefile.in 14 Aug 2002 02:49:35 -0000 +@@ -251,7 +251,7 @@ GCJ_FOR_TARGET = + # variable is passed down to the gcc Makefile, where it is used to + # build libgcc2.a. We define it here so that it can itself be + # overridden on the command line. +-GCC_FOR_TARGET = $$r/gcc/xgcc -B$$r/gcc/ $(FLAGS_FOR_TARGET) ++GCC_FOR_TARGET = $(STAGE_CC_WRAPPER) $$r/gcc/xgcc -B$$r/gcc/ $(FLAGS_FOR_TARGET) + + AS_FOR_TARGET = ` \ + if [ -f $$r/gas/as-new ] ; then \ +Index: configure.in +=================================================================== +RCS file: /cvs/gcc/egcs/configure.in,v +retrieving revision 1.176 +diff -u -p -r1.176 configure.in +--- configure.in 6 Aug 2002 09:26:29 -0000 1.176 ++++ configure.in 14 Aug 2002 02:49:38 -0000 +@@ -1554,10 +1554,10 @@ cat >$sedtemp <<EOF + s:^TARGET_CONFIGDIRS[ ]*=.*$:TARGET_CONFIGDIRS = ${target_configdirs}: + s%^TARGET_CONFIGARGS[ ]*=.*$%TARGET_CONFIGARGS = ${targargs}% + s%^FLAGS_FOR_TARGET[ ]*=.*$%FLAGS_FOR_TARGET = ${FLAGS_FOR_TARGET}% +-s%^CC_FOR_TARGET[ ]*=.*$%CC_FOR_TARGET = ${CC_FOR_TARGET}% +-s%^GCJ_FOR_TARGET[ ]*=.*$%GCJ_FOR_TARGET = ${GCJ_FOR_TARGET}% +-s%^CXX_FOR_TARGET[ ]*=.*$%CXX_FOR_TARGET = ${qCXX_FOR_TARGET}% +-s%^CXX_FOR_TARGET_FOR_RECURSIVE_MAKE[ ]*=.*$%CXX_FOR_TARGET_FOR_RECURSIVE_MAKE = ${qqCXX_FOR_TARGET}% ++s%^CC_FOR_TARGET[ ]*=.*$%CC_FOR_TARGET = \$(STAGE_CC_WRAPPER) ${CC_FOR_TARGET}% ++s%^GCJ_FOR_TARGET[ ]*=.*$%GCJ_FOR_TARGET = \$(STAGE_CC_WRAPPER) ${GCJ_FOR_TARGET}% ++s%^CXX_FOR_TARGET[ ]*=.*$%CXX_FOR_TARGET = \$(STAGE_CC_WRAPPER) ${qCXX_FOR_TARGET}% ++s%^CXX_FOR_TARGET_FOR_RECURSIVE_MAKE[ ]*=.*$%CXX_FOR_TARGET_FOR_RECURSIVE_MAKE = \$(STAGE_CC_WRAPPER) ${qqCXX_FOR_TARGET}% + s%^TARGET_SUBDIR[ ]*=.*$%TARGET_SUBDIR = ${target_subdir}% + s%^BUILD_SUBDIR[ ]*=.*$%BUILD_SUBDIR = ${build_subdir}% + s%^BUILD_CONFIGARGS[ ]*=.*$%BUILD_CONFIGARGS = ${buildargs}% +Index: gcc/Makefile.in +=================================================================== +RCS file: /cvs/gcc/egcs/gcc/Makefile.in,v +retrieving revision 1.933 +diff -u -p -r1.933 Makefile.in +--- gcc/Makefile.in 13 Aug 2002 23:11:37 -0000 1.933 ++++ gcc/Makefile.in 14 Aug 2002 02:49:43 -0000 +@@ -175,7 +175,7 @@ USER_H = $(srcdir)/ginclude/stdarg.h $(s + # The GCC to use for compiling libgcc.a and crt*.o. + # Usually the one we just built. + # Don't use this as a dependency--use $(GCC_PASSES) or $(GCC_PARTS). +-GCC_FOR_TARGET = ./xgcc -B./ -B$(build_tooldir)/bin/ -isystem $(build_tooldir)/include -isystem $(build_tooldir)/sys-include ++GCC_FOR_TARGET = $(STAGE_CC_WRAPPER) ./xgcc -B./ -B$(build_tooldir)/bin/ -isystem $(build_tooldir)/include -isystem $(build_tooldir)/sys-include + + # This is used instead of ALL_CFLAGS when compiling with GCC_FOR_TARGET. + # It omits XCFLAGS, and specifies -B./. +@@ -3330,7 +3330,7 @@ stage1_copy: stage1_build + echo stage2_build > stage_last + + stage2_build: stage1_copy +- $(MAKE) CC="stage1/xgcc$(exeext) -Bstage1/ -B$(build_tooldir)/bin/" \ ++ $(MAKE) CC="$(STAGE_CC_WRAPPER) stage1/xgcc$(exeext) -Bstage1/ -B$(build_tooldir)/bin/" \ + STAGE_PREFIX=stage1/ \ + $(STAGE2_FLAGS_TO_PASS) + $(STAMP) stage2_build +@@ -3342,7 +3342,7 @@ stage2_copy: stage2_build + echo stage3_build > stage_last + + stage3_build: stage2_copy +- $(MAKE) CC="stage2/xgcc$(exeext) -Bstage2/ -B$(build_tooldir)/bin/" \ ++ $(MAKE) CC="$(STAGE_CC_WRAPPER) stage2/xgcc$(exeext) -Bstage2/ -B$(build_tooldir)/bin/" \ + STAGE_PREFIX=stage2/ \ + $(STAGE2_FLAGS_TO_PASS) + $(STAMP) stage3_build +@@ -3355,7 +3355,7 @@ stage3_copy: stage3_build + echo stage4_build > stage_last + + stage4_build: stage3_copy +- $(MAKE) CC="stage3/xgcc$(exeext) -Bstage3/ -B$(build_tooldir)/bin/" \ ++ $(MAKE) CC="$(STAGE_CC_WRAPPER) stage3/xgcc$(exeext) -Bstage3/ -B$(build_tooldir)/bin/" \ + STAGE_PREFIX=stage3/ \ + $(STAGE2_FLAGS_TO_PASS) + $(STAMP) stage4_build |