diff options
author | Zack Welch <zwelch@gentoo.org> | 2003-02-11 22:42:48 +0000 |
---|---|---|
committer | Zack Welch <zwelch@gentoo.org> | 2003-02-11 22:42:48 +0000 |
commit | 992085985aa78e5b42a01e4fe247b51b18f4c454 (patch) | |
tree | 08580fa1517006fa661cb4bc26c0ae7be2f4ec28 | |
parent | add new net-msc/netpipe ebuild (~arch masked) (diff) | |
download | gentoo-2-992085985aa78e5b42a01e4fe247b51b18f4c454.tar.gz gentoo-2-992085985aa78e5b42a01e4fe247b51b18f4c454.tar.bz2 gentoo-2-992085985aa78e5b42a01e4fe247b51b18f4c454.zip |
add new distcc-1.1-r8 ebuild (~arch masked for all)
-rw-r--r-- | sys-devel/distcc/distcc-1.1-r8.ebuild | 64 | ||||
-rw-r--r-- | sys-devel/distcc/files/digest-distcc-1.1-r8 | 1 | ||||
-rw-r--r-- | sys-devel/distcc/files/distccd.2 | 30 | ||||
-rw-r--r-- | sys-devel/distcc/files/wrapper-1.1.patch | 201 |
4 files changed, 296 insertions, 0 deletions
diff --git a/sys-devel/distcc/distcc-1.1-r8.ebuild b/sys-devel/distcc/distcc-1.1-r8.ebuild new file mode 100644 index 000000000000..e4388af2be9c --- /dev/null +++ b/sys-devel/distcc/distcc-1.1-r8.ebuild @@ -0,0 +1,64 @@ +# Copyright 2002 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-devel/distcc/distcc-1.1-r8.ebuild,v 1.1 2003/02/11 22:42:48 zwelch Exp $ + +inherit eutils + +IUSE="" + +HOMEPAGE="http://distcc.samba.org/" +SRC_URI="http://distcc.samba.org/ftp/distcc/distcc-${PV}.tar.bz2" +DESCRIPTION="a program to distribute compilation of C code across several machines on a network" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~x86 ~ppc ~sparc ~alpha" + +DEPEND=">=sys-apps/portage-2.0.46-r11 + >=sys-devel/gcc-config-1.3.1 + dev-libs/popt" + +src_unpack() { + unpack distcc-${PV}.tar.bz2 + cp -a distcc-${PV} distcc-${PV}.orig + epatch "${FILESDIR}/wrapper-${PV}.patch" +} + +src_compile() { + econf || die "econf failed" + emake || die "emake failed" +} + +src_install() { + make DESTDIR="${D}" install + + cd "${D}/usr/share/info" && rm -f distcc.info.gz + + docinto "../${PN}" + dodoc "${S}/survey.txt" + + exeinto /etc/init.d + newexe "${FILESDIR}/distccd.2" distccd + + # Search the PATH now that gcc doesn't live in /usr/bin + # ztw - this needs to be moved into an installed script so + # users/portage can re-run it after installing new compilers + einfo "Scanning for compiler front-ends" + dodir /usr/lib/distcc/bin + diropts -m0755 + for a in gcc cc c++ g++ ${CHOST}-gcc ${CHOST}-c++ ${CHOST}-g++; do + if [ -n "$(type -p ${a})" ]; then + dosym /usr/bin/distcc /usr/lib/distcc/bin/${a} + fi + done +} + +pkg_postinst() { + einfo "To use distcc with **non-Portage** C compiling, add" + einfo "/usr/lib/distcc/bin to your path before /usr/bin. If you're" + einfo "combining this with ccache, put the distcc dir AFTER ccache." + einfo "Portage 2.0.26-r11+ will take advantage of distcc if you put" + einfo "distcc into the FEATURES setting in make.conf (and define" + einfo "DISTCC_HOSTS as well)." +} + diff --git a/sys-devel/distcc/files/digest-distcc-1.1-r8 b/sys-devel/distcc/files/digest-distcc-1.1-r8 new file mode 100644 index 000000000000..cbdb7de8f495 --- /dev/null +++ b/sys-devel/distcc/files/digest-distcc-1.1-r8 @@ -0,0 +1 @@ +MD5 ad2a433dbe4361baffa8dc5f24ba2be7 distcc-1.1.tar.bz2 207370 diff --git a/sys-devel/distcc/files/distccd.2 b/sys-devel/distcc/files/distccd.2 new file mode 100644 index 000000000000..e1ac5ec2b760 --- /dev/null +++ b/sys-devel/distcc/files/distccd.2 @@ -0,0 +1,30 @@ +#!/sbin/runscript + +depend() { + need net +} + +start() { + rm -rf /var/tmp/distccd.pid + ebegin "Starting distccd" + PATH="$(gcc-config --get-bin-path):${PATH}" \ + /sbin/start-stop-daemon --start --quiet \ + --startas /usr/bin/distccd \ + -c nobody --pidfile /var/tmp/distccd.pid \ + -- --pid-file /var/tmp/distccd.pid + eend $? "Failed to Start distccd" +} + +stop() { + ebegin "Stopping distccd" + start-stop-daemon --stop --quiet --pidfile /var/tmp/distccd.pid + rm -rf /var/tmp/distccd.pid + eend $? "Failed to Stop distccd" +} + +restart() { + ebegin "Restarting distccd" + svc_stop + svc_start + eend $? "Failed to Restart distccd" +} diff --git a/sys-devel/distcc/files/wrapper-1.1.patch b/sys-devel/distcc/files/wrapper-1.1.patch new file mode 100644 index 000000000000..d3e7e79d07d7 --- /dev/null +++ b/sys-devel/distcc/files/wrapper-1.1.patch @@ -0,0 +1,201 @@ +diff -auNr distcc-1.1.orig/src/distcc.c distcc-1.1/src/distcc.c +--- distcc-1.1.orig/src/distcc.c 2003-01-27 04:13:06.000000000 -0800 ++++ distcc-1.1/src/distcc.c 2003-02-06 15:59:45.000000000 -0800 +@@ -477,6 +477,154 @@ + } + } + ++static char *dcc_safe_getcwd() ++{ ++ char *cwdstr; ++ size_t len = 200; ++ ++ do { ++ cwdstr = malloc(len); ++ if (NULL == cwdstr) break; ++ ++ if (NULL == getcwd(cwdstr, len)) { ++ free(cwdstr); ++ cwdstr = NULL; ++ if (ERANGE == errno) { ++ len += 200; ++ continue; ++ } ++ } ++ } while(0); ++ ++ if (NULL == cwdstr) { ++ rs_log_error("can't get working directory"); ++ exit(1); ++ } ++ ++ return cwdstr; ++} ++ ++/** ++ * Filter PATH past point that wrapper was called ++ */ ++static void dcc_wrapper_trunc_path(char *progname, char *path, char *argv[]) ++{ ++ static const char *envpath = "PATH="; ++ char *p, *n, *str; ++ char *ppath = NULL; ++ int len, maxlen, plen; ++ ++ maxlen = strlen(path) + strlen(envpath) + 1; ++ str = malloc(maxlen); ++ if (NULL == str) exit(1); ++ ++ /* if we were called explicitly, find the (partial) path */ ++ if (progname != argv[0]) { ++ /* eliminate this explicit path from PATH */ ++ char *cwdstr = NULL; ++ size_t cwdlen = 0; ++ ++ if ('/' != argv[0][0]) { ++ cwdstr = dcc_safe_getcwd(); ++ cwdlen = strlen(cwdstr); ++ /* or we could just error out and exit??? */ ++ } ++ ++ plen = progname - argv[0] - 1; ++ len = cwdlen + plen; ++ ppath = malloc(len); ++ if (NULL == ppath) exit(1); ++ ++ ppath[0] = 0; ++ if (NULL != cwdstr) { ++ strncpy(ppath, cwdstr, len); ++ ppath[cwdlen++] = '/'; ++ ppath[cwdlen] = 0; ++ free(cwdstr); ++ } ++ strncat(ppath, argv[0], cwdlen + plen); ++ rs_trace("looking for explicit path: %s\n", ppath); ++ } ++ else ++ ppath = NULL; ++ ++ for (n = p = path; NULL != n; p = n ? n + 1 : NULL) { ++ n = strchr(p, ':'); ++ if (NULL != n) ++ len = n - p; ++ else ++ len = strlen(p); ++ ++ if (NULL != ppath) { ++ /* check for partial path name match, ++ pmatch is last portion of path */ ++ rs_trace("checking for ppath in %s\n", p); ++ if (len != plen || 0 != strncmp(p, ppath, len)) ++ continue; ++ } ++ else { ++ strncpy(str, p, len); ++ snprintf(str + len, maxlen - len, "/%s", progname); ++ rs_trace("checking %s\n", str); ++ if (0 != access(str, X_OK)) ++ continue; ++ rs_trace("found %s\n", str); ++ } ++ /* getting here means either we found the path we ran in, or ++ we found the target program we're trying to run; ++ so PATH now starts at next entry */ ++ if (NULL != n) ++ p = n + 1; ++ else ++ p = ""; ++ break; ++ } ++ ++ /* if temp path, p, still contains something, reset PATH; ++ p will be NULL if relative or non-PATH invocation, so ++ the current path is probably free from recursion */ ++ if (NULL != p) { ++ strncpy(str, envpath, maxlen); ++ strncat(str, p, maxlen); ++ rs_trace("wrapper is setting %s\n", str); ++ n = strdup(str); ++ if ((NULL == n) || (-1 == putenv(n))) { ++ rs_log_error("putenv PATH failed"); ++ exit(1); ++ } ++ } ++ else ++ rs_trace("wrapper not modifying PATH"); ++ ++ free(str); ++ free(ppath); ++} ++ ++static char *dcc_support_wrapper(char *argv[]) ++{ ++ char *progname, *envstr; ++ ++ /* see if program was called with a full or partial path */ ++ if ((progname = strrchr(argv[0], '/')) != NULL) ++ progname++; ++ else ++ progname = argv[0]; ++ ++ if (NULL == (envstr = getenv("DISTCC_HOSTS"))) { ++ if (-1 == putenv("DISTCC_HOSTS=localhost")) { ++ rs_log_error("unable to set default DISTCC_HOSTS"); ++ exit(1); ++ } ++ } ++ ++ /* right now, we're only playing with path... but ++ wouldn't it be interesting to look at CHOST, too? */ ++ if (NULL != (envstr = getenv("PATH"))) ++ dcc_wrapper_trunc_path(progname, envstr, argv); ++ ++ return progname; ++} ++ + + /** + * distcc client entry point. +@@ -486,6 +634,7 @@ + * Performs basic setup and checks for distcc arguments, and then kicks of + * dcc_build_somewhere(). + **/ ++#include <libgen.h> + int main(int argc, char **argv) + { + int status; +@@ -495,17 +644,25 @@ + + dcc_set_trace_from_env(); + +- if (argc <= 1 || !strcmp(argv[1], "--help")) { +- dcc_show_usage(); +- exit(0); +- } else if (!strcmp(argv[1], "--version")) { +- dcc_show_version("distcc"); +- exit(0); +- } +- + dcc_recursion_safeguard(); + +- dcc_find_compiler(argv, &compiler_args); ++ if (NULL != strstr(basename(argv[0]), "distcc")) { ++ ++ if (argc <= 1 || !strcmp(argv[1], "--help")) { ++ dcc_show_usage(); ++ exit(0); ++ } else if (!strcmp(argv[1], "--version")) { ++ dcc_show_version("distcc"); ++ exit(0); ++ } ++ ++ dcc_find_compiler(argv, &compiler_args); ++ } ++ else { ++ char *progname = dcc_support_wrapper(argv); ++ dcc_shallowcopy_argv(argv, &compiler_args, 0); ++ compiler_args[0] = progname; ++ } + + dcc_exit(dcc_build_somewhere(compiler_args, &status)); + } |