[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: Re: C++ Support for distcc
From: Rik Hemsley <rik () kde ! org>
Date: 2002-05-24 5:01:46
[Download RAW message or body]
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
#if Ian Reinhart Geiser
> The attached patch allows distcc to compile most known C++
> extentions supported by gcc, these include cxx, cpp, cc, C and cp.
> There are also attached two scripts that allow distcc to interact
> with libtool a little better. For some reason libtool is not a fan
> of distcc g++ in some instances in our build system. To use them,
> put them in your path and do an: export CC='distc'
> export CXX='distc++'
(before you run 'configure')
And here's my patch for making it work on FreeBSD. Not completely
clean, but I'll send it to the author anyway.
Rik
- --
http://rikkus.info
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org
iD8DBQE87ck66rehpl6X9l0RAj7oAJ98lQzfMbTLui5vIcFAbRci/MOmzQCdE5Lr
UU/a3bPrrlbQuzEWTqBibHA=
=ON/D
-----END PGP SIGNATURE-----
["distcc-0.2-freebsd-patch" (text/x-diff)]
diff -Nurd src/GNUmakefile freebsd-src/GNUmakefile
--- src/GNUmakefile Fri May 17 06:45:54 2002
+++ freebsd-src/GNUmakefile Thu May 23 04:47:31 2002
@@ -4,7 +4,7 @@
# and have the GNUmakefile just link to that.
CPPFLAGS = -DPACKAGE=\"distcc\" -DVERSION=\"0.2\"
-CFLAGS = -Wall -W -g -O2 -Wshadow -Wpointer-arith -Wcast-align
+CFLAGS = $(CPPFLAGS) -Wall -W -g -O2 -Wshadow -Wpointer-arith -Wcast-align -I/usr/local/include
distcc_sources = distcc.c clinet.c where.c
common_sources = trace.c util.c io.c exec.c arg.c rpc.c tempfile.c \
@@ -19,9 +19,9 @@
all_sources = $(distcc_sources) $(daemon_sources) $(common_sources)
all_h = distcc.h io.h rpc.h trace.h util.h
-LIBS = -lpopt
+LIBS = -L/usr/local/lib -lpopt
-all: distcc distccd docs
+all: distcc distccd
distcc: $(distcc_objs) $(common_objs)
$(CC) $(CFLAGS) -o $@ $(distcc_objs) $(common_objs) $(LIBS)
@@ -56,6 +56,6 @@
install distccd /usr/local/sbin/
-docs:
- $(MAKE) -C linuxdoc alldocs
+#docs:
+# $(MAKE) -C linuxdoc alldocs
diff -Nurd src/arg.c freebsd-src/arg.c
--- src/arg.c Thu May 16 08:56:34 2002
+++ freebsd-src/arg.c Thu May 23 04:47:29 2002
@@ -35,7 +35,6 @@
#include <errno.h>
#include <sys/stat.h>
-#include <sys/sendfile.h>
#include "distcc.h"
#include "trace.h"
@@ -67,7 +66,7 @@
char *slash;
char *o;
int l;
-
+ char *s;
if ((slash = strrchr(sfile, '/')))
sfile = slash+1;
if ((l = strlen(sfile)) < 3) {
@@ -76,7 +75,8 @@
}
o = strdup(sfile);
- strcpy(&o[l - 2], ".o");
+ s = rindex(o,'.');
+ strcpy(s, ".o");
*ofile = o;
return 0;
@@ -134,8 +134,12 @@
goto GOT_OUTPUT;
}
} else {
- if (str_endswith(".i", a) || str_endswith(".c", a)) {
+ if (str_endswith(".i", a) || str_endswith(".c", a)
+ || str_endswith(".cpp",a) || str_endswith(".cc",a)
+ || str_endswith(".cxx",a) || str_endswith(".C",a)
+ || str_endswith(".cp", a) || str_endswith("c++",a)) {
rs_trace("found input file \"%s\"", a);
+ rs_log_notice("found input file \"%s\"", a);
if (*input_file) {
rs_log_notice("do we have two inputs? i give up");
return -1;
@@ -309,7 +313,10 @@
rs_trace("command before: %s", dcc_argv_tostr(a));
for (i =0; a[i]; i++)
- if (str_endswith(".c", a[i]) || str_endswith(".i", a[i])) {
+ if (str_endswith(".c", a[i]) || str_endswith(".i", a[i])
+ || str_endswith(".cpp",a[i]) || str_endswith(".cc",a[i])
+ || str_endswith(".cxx",a[i]) || str_endswith(".C",a[i])
+ || str_endswith(".cp", a[i]) || str_endswith("c++",a[i])) {
rs_trace("changed input from \"%s\" to \"%s\"", a[i], ifname);
a[i] = ifname;
rs_trace("command after: %s", dcc_argv_tostr(a));
diff -Nurd src/bulk.c freebsd-src/bulk.c
--- src/bulk.c Wed May 15 07:15:01 2002
+++ freebsd-src/bulk.c Thu May 23 04:47:30 2002
@@ -40,7 +40,6 @@
#include <errno.h>
#include <sys/stat.h>
-#include <sys/sendfile.h>
#include "distcc.h"
#include "trace.h"
diff -Nurd src/clinet.c freebsd-src/clinet.c
--- src/clinet.c Mon Apr 29 11:08:00 2002
+++ freebsd-src/clinet.c Thu May 23 04:47:30 2002
@@ -37,7 +37,6 @@
#include <signal.h>
#include <sys/stat.h>
-#include <sys/sendfile.h>
#include <sys/types.h>
#include <sys/socket.h>
diff -Nurd src/daemon.c freebsd-src/daemon.c
--- src/daemon.c Fri May 17 04:45:42 2002
+++ freebsd-src/daemon.c Thu May 23 04:47:30 2002
@@ -61,7 +61,6 @@
#include <syslog.h>
#include <sys/stat.h>
-#include <sys/sendfile.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/socket.h>
diff -Nurd src/distcc.c freebsd-src/distcc.c
--- src/distcc.c Fri May 17 05:09:01 2002
+++ freebsd-src/distcc.c Thu May 23 04:47:30 2002
@@ -40,7 +40,6 @@
#include <errno.h>
#include <sys/stat.h>
-#include <sys/sendfile.h>
#include <sys/types.h>
#include <sys/wait.h>
diff -Nurd src/exec.c freebsd-src/exec.c
--- src/exec.c Tue Apr 30 09:17:26 2002
+++ freebsd-src/exec.c Thu May 23 04:47:30 2002
@@ -57,7 +57,6 @@
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/stat.h>
-#include <sys/sendfile.h>
#include "distcc.h"
#include "trace.h"
diff -Nurd src/io.c freebsd-src/io.c
--- src/io.c Wed May 15 06:27:30 2002
+++ freebsd-src/io.c Thu May 23 04:47:29 2002
@@ -43,7 +43,11 @@
#include <assert.h>
#include <sys/stat.h>
+#ifdef __FreeBSD__
+#include <sys/uio.h>
+#else
#include <sys/sendfile.h>
+#endif
#include <sys/types.h>
#include <sys/socket.h>
@@ -63,7 +67,11 @@
**/
int dcc_pump_sendfile(int ofd, int ifd, size_t size)
{
+#ifdef __FreeBSD__
+ if (sendfile(ifd, ofd, 0, size, 0, 0, 0) != 0) {
+#else
if (sendfile(ofd, ifd, 0, size) != (int) size) {
+#endif
rs_log_error("sendfile failed: %s", strerror(errno));
return -1;
}
@@ -248,9 +256,11 @@
**/
int tcp_cork_sock(int fd, int corked)
{
+#ifndef __FreeBSD__
if (setsockopt(fd, SOL_TCP, TCP_CORK, &corked, sizeof corked) == -1) {
rs_log_notice("setsockopt failed: %s", strerror(errno));
return -1;
}
+#endif
return 0;
}
diff -Nurd src/rpc.c freebsd-src/rpc.c
--- src/rpc.c Wed May 15 06:01:16 2002
+++ freebsd-src/rpc.c Thu May 23 04:47:29 2002
@@ -38,7 +38,6 @@
#include <errno.h>
#include <sys/stat.h>
-#include <sys/sendfile.h>
#include "distcc.h"
#include "trace.h"
diff -Nurd src/serve.c freebsd-src/serve.c
--- src/serve.c Wed May 15 07:15:01 2002
+++ freebsd-src/serve.c Thu May 23 04:47:30 2002
@@ -42,7 +42,6 @@
#include <errno.h>
#include <sys/stat.h>
-#include <sys/sendfile.h>
#include <sys/types.h>
#include <sys/wait.h>
diff -Nurd src/srvnet.c freebsd-src/srvnet.c
--- src/srvnet.c Tue Apr 30 09:05:23 2002
+++ freebsd-src/srvnet.c Thu May 23 04:47:30 2002
@@ -40,7 +40,6 @@
#include <sys/stat.h>
-#include <sys/sendfile.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/param.h>
diff -Nurd src/tempfile.c freebsd-src/tempfile.c
--- src/tempfile.c Wed May 15 09:19:49 2002
+++ freebsd-src/tempfile.c Thu May 23 04:47:30 2002
@@ -40,7 +40,6 @@
#include <errno.h>
#include <sys/stat.h>
-#include <sys/sendfile.h>
#include <sys/types.h>
#include "distcc.h"
diff -Nurd src/trace.c freebsd-src/trace.c
--- src/trace.c Wed May 15 06:09:48 2002
+++ freebsd-src/trace.c Thu May 23 04:47:30 2002
@@ -48,8 +48,6 @@
#include "trace.h"
-
-
#ifdef UNUSED
/* nothing */
#elif defined(__GNUC__)
@@ -66,10 +64,14 @@
int rs_trace_level = RS_LOG_INFO;
-#if defined(__GNUC__) || defined(HAVE_PROGRAM_INVOCATION_NAME)
-# define MY_NAME program_invocation_short_name
+#ifdef __FreeBSD__
+# define MY_NAME "distcc"
#else
-# define MY_NAME "librsync"
+# if defined(__GNUC__) || defined(HAVE_PROGRAM_INVOCATION_NAME)
+# define MY_NAME program_invocation_short_name
+# else
+# define MY_NAME "librsync"
+# endif
#endif
static void rs_log_va(int level, char const *fn, char const *fmt, va_list va);
@@ -199,13 +201,13 @@
/* NOTE NO TRAILING NUL */
char buf[4090];
int len;
-
+ memset(buf, 0, sizeof(buf));
/* you're never going to want program or pid in a syslog message,
* because it's redundant. */
rs_format_msg(buf, sizeof buf,
flags | RS_LOG_NO_PROGRAM | RS_LOG_NO_PID,
fn, fmt, va);
- len = strnlen(buf, sizeof buf - 2);
+ len = strlen(buf);
syslog(flags & RS_LOG_PRIMASK, "%s", buf);
}
@@ -216,8 +218,9 @@
/* NOTE NO TRAILING NUL */
char buf[4090];
int len;
+ memset(buf, 0, sizeof(buf));
rs_format_msg(buf, sizeof buf, flags, fn, fmt, va);
- len = strnlen(buf, sizeof buf - 2);
+ len = strlen(buf);
strcpy(&buf[len], "\n");
(void) write(rs_trace_fd, buf, len+1);
diff -Nurd src/util.c freebsd-src/util.c
--- src/util.c Sun Apr 28 10:27:10 2002
+++ freebsd-src/util.c Thu May 23 04:47:30 2002
@@ -31,7 +31,6 @@
#include <errno.h>
#include <sys/stat.h>
-#include <sys/sendfile.h>
#include "distcc.h"
#include "trace.h"
diff -Nurd src/where.c freebsd-src/where.c
--- src/where.c Wed May 15 09:19:49 2002
+++ freebsd-src/where.c Thu May 23 04:47:30 2002
@@ -78,7 +78,6 @@
#include <sys/stat.h>
#include <sys/file.h>
-#include <sys/sendfile.h>
#include "distcc.h"
#include "trace.h"
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic