diff options
author | Trevor Johnson <trevor@FreeBSD.org> | 2002-11-25 00:17:28 +0000 |
---|---|---|
committer | Trevor Johnson <trevor@FreeBSD.org> | 2002-11-25 00:17:28 +0000 |
commit | bd902f794fbf2bd3edb125b868ae4b8e2d1d2de4 (patch) | |
tree | 7342a0a36b00a1aebcb548ebe733fcb29c35c316 /devel | |
parent | Upgrade to 5.0.10. (diff) |
Add preliminary port of gecc.
Diffstat (limited to 'devel')
-rw-r--r-- | devel/Makefile | 1 | ||||
-rw-r--r-- | devel/gecc/Makefile | 66 | ||||
-rw-r--r-- | devel/gecc/distinfo | 1 | ||||
-rw-r--r-- | devel/gecc/files/README | 115 | ||||
-rw-r--r-- | devel/gecc/files/dashboard.h | 99 | ||||
-rw-r--r-- | devel/gecc/files/patch-cache.h | 12 | ||||
-rw-r--r-- | devel/gecc/files/patch-con.h | 19 | ||||
-rw-r--r-- | devel/gecc/files/patch-io.cpp | 22 | ||||
-rw-r--r-- | devel/gecc/files/patch-server.cpp | 12 | ||||
-rw-r--r-- | devel/gecc/pkg-comment | 1 | ||||
-rw-r--r-- | devel/gecc/pkg-descr | 6 |
11 files changed, 354 insertions, 0 deletions
diff --git a/devel/Makefile b/devel/Makefile index 83941b931024..b1152649c3e5 100644 --- a/devel/Makefile +++ b/devel/Makefile @@ -190,6 +190,7 @@ SUBDIR += gdb52 SUBDIR += gdb53 SUBDIR += gdbmods + SUBDIR += gecc SUBDIR += gengameng SUBDIR += gengetopt SUBDIR += gettext diff --git a/devel/gecc/Makefile b/devel/gecc/Makefile new file mode 100644 index 000000000000..d6f971dab7a5 --- /dev/null +++ b/devel/gecc/Makefile @@ -0,0 +1,66 @@ +# New ports collection makefile for: gecc +# Date created: 2002-11-07 +# Whom: trevor +# +# $FreeBSD$ +# + +PORTNAME= gecc +PORTVERSION= 20021119 +CATEGORIES= devel +MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} +MASTER_SITE_SUBDIR= gecc + +MAINTAINER= trevor@FreeBSD.org + +.include <bsd.port.pre.mk> +.if ${OSVERSION} < 500039 +LIB_DEPENDS= gnugetopt.1:${PORTSDIR}/devel/libgnugetopt +BROKEN= "only works as a wrapper" +.else +BROKEN= "getopt_long() problems" +.endif + +BINS= gecc geccd +DOCS= AUTHORS COPYING ChangeLog NEWS TODO +DOCDIR= share/doc/${PORTNAME} +.if ${OSVERSION} < 500039 +CONFIGURE_ENV= CPPFLAGS="-I${LOCALBASE}/include" \ + LDFLAGS="-L${LOCALBASE}/lib -lgnugetopt" +.endif +GNU_CONFIGURE= yes +PLIST= ${WRKDIR}/pkg-plist +USE_PYTHON= yes +USE_REINPLACE= yes +REINPLACE_ARGS= -i'' -E + +post-extract: + ${CP} ${FILESDIR}/README ${FILESDIR}/dashboard.h ${WRKSRC} + ${REINPLACE_CMD} "s=usr/bin=${LOCALBASE}/bin=g" ${WRKSRC}/geccmon + +pre-install: + ${RM} -f ${PLIST} +.for ii in ${BINS} geccmon + ${ECHO_CMD} bin/`${BASENAME} ${ii}` >> ${PLIST} +.endfor +.if !defined(NOPORTDOCS) +.for ii in ${DOCS} README + ${ECHO_CMD} ${DOCDIR}/${ii} >> ${PLIST} +.endfor + ${ECHO_CMD} "@dirrm " ${DOCDIR} >> ${PLIST} +.endif + +do-install: +.for ii in ${BINS} + ${INSTALL_PROGRAM} ${WRKSRC}/${ii} ${PREFIX}/bin +.endfor + ${INSTALL_SCRIPT} ${WRKSRC}/geccmon ${PREFIX}/bin +.if !defined(NOPORTDOCS) + ${MKDIR} ${PREFIX}/${DOCDIR} +.for ii in ${DOCS} + ${INSTALL_DATA} ${WRKSRC}/${ii} ${PREFIX}/${DOCDIR} +.endfor + ${INSTALL_DATA} ${FILESDIR}/README ${PREFIX}/${DOCDIR} +.endif + +.include <bsd.port.post.mk> diff --git a/devel/gecc/distinfo b/devel/gecc/distinfo new file mode 100644 index 000000000000..50f232736ca8 --- /dev/null +++ b/devel/gecc/distinfo @@ -0,0 +1 @@ +MD5 (gecc-20021119.tar.gz) = 74ee17b3cf3cd0736377e02e89c39f8b diff --git a/devel/gecc/files/README b/devel/gecc/files/README new file mode 100644 index 000000000000..9b8e96a35275 --- /dev/null +++ b/devel/gecc/files/README @@ -0,0 +1,115 @@ +The group enabled cluster compiler (gecc) is a tool to make build faster. This +tool is inspired by distcc (<URL:http://distcc.samba.org>) and ccache +(<URL:httpd://ccache.samba.org>). It helps in two ways: + +- not doing unneeded compiles and +- distributing builds on a cluster of hosts. + +These two optimizations are unrelated and both of them are optional to gecc. +Not doing unneeded compiles means that gecc caches the build of object files +and distributing means putting compiles on more than one host (not a big +surprise). + +For a more detailed look, please refer to the Web pages at +<URL:http://gecc.sf.net>, which are included in the CVS repository. Take a +look at the htdocs directory. + +building: + +I have compiled gecc with gcc 2.95.3. Then I got a report that gecc does not +compile with gcc-3.2 (thanks for that), so I fixed gecc to compile with both. +There are problems using the std::string::compare member functions. They have +changed from gcc 2.95.x to gcc 3.y (I have been told that gcc3 is correct, but +I have not checked with the ANSI standard). My normal CXX is gcc 2.95.3. If I +break compatibilty with gcc-3.x again, please drop me a note and I will fix it, +if anybody cares. + +The usual commands: + + ./configure + make + +should build two binaries: gecc and geccd. The client is gecc. It's called +instead of your usual C/C++ compiler, which means gcc in almost every case. +There are two ways to call it: + +1.) gecc gcc file.c -c -o file.o -O2 ... +That is, prepend your usual command line with "gecc". gecc will find out which +C/C++ compiler you would have called. It crawls your PATH for the next token on +the command line ("gcc" in our example). It will take a look, which version it +is, by calling it with "--version" as the only parameter. The name and the +version should identify the compiler. There are plans to take also care of the +architecture of your host, so cross compiles could be done (this is one of my +needs, but not implemented now). + +2.) If you make a link from the name of your compiler to gecc, then gecc will +behave as above. The advantage is that this works with libtool, which is a bit +picky about chained tools. I have a ~/bin directory, which is the very first in +my $PATH. There are links like this: + + c++ -> gecc + g++ -> gecc + gcc -> gecc + cc -> gecc + +Also, gecc is in the path. + +Either way, the source file is preprocessed and a hash of the preprocessed file +and your command line is calculated. This hash is looked up in a +on-disk-cache. For a cache hit, the object file, the stderr, and the compiler +return code of the original compiler run are taken from cache and the original +result is "reproduced". On a cache miss the compiler is called and the result +is recorded for the cache. + +If there are nodes registered to help in the compiling than for every cache +miss, the host to do the compilation is calculated by a scheduler algorithm +(right now it's round robin, but there will be feedback on the basis of +compilation speed). + +testing: +To test gecc, you need to start a geccd (the gecc daemon). For example: + + geccd -C /tmp/gecc-cache --compile -d + +will start geccd in debugging mode (-d), that is, without forking. A Ctrl-C +will terminate the program. Then, on another shell, you need to set some +environment variables: + +either: + export GECCD_SOCKFILE=/tmp/geccd.sockfile +or: + export GECCD_HOSTNAME=localhost + export GECCD_PORT=42042 + +Now do this: + + gecc gcc hello.c -o hello.o + +Assuming you have a hello.c, it will be compiled to hello.o. You can see geccd +act and print debugging stuff on stderr. If you now remove the hello.o and +repeat the same command line, hello.o will be taken from cache. + +If you have a second machine available, then you could start a second geccd on +this second machine. Let's assume the first machine is named dilbert and the +second is named asok. Then the command line on asok will be: + + geccd --compile -a dilbert -A 42042 --compile --port 42042 -d + +this means announce yourself to a geccd, running on dilbert (port -A 42042) and +help him to compile. Right now it is important to start the geccd on the helper +host _after_ the main geccd (yes, this has to change). If you now do +compilation of more source files, then they will be distributed on all +machines. + +The compile nodes don't need the includes or libs installed, but the same +version of the compiler. If not all compile nodes have all needed compilers +installed, that's OK, since they only get jobs for the compilers they announce +to the main geccd. For this, they scan the $PATH and collect all known compiler +binaries, which right now is all binaries that gecc installs. + +If you try this out, please be so nice as to mail me your feedback (either +positive or negative, any feedback is better than none). You can reach me as +<j.beyer@web.de>. + + Yours, + Joerg diff --git a/devel/gecc/files/dashboard.h b/devel/gecc/files/dashboard.h new file mode 100644 index 000000000000..a90c358b2506 --- /dev/null +++ b/devel/gecc/files/dashboard.h @@ -0,0 +1,99 @@ +/* + * Group Enabled Cluster Compiler (gecc) + * + * Copyright (C) 2002 by Jörg Beyer <j.beyer@web.de> + * + * This project was inspired by: + * distcc by Martin Pool <mbp@samba.org> http://distcc.samba.org + * ccache by Andrew Tridgell (tridge@samba.org) http://ccache.samba.org + * please visit their projects also! + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA + */ + +/* + * inspired by the apache dashboard, this implements a monitoring + * interface to geccd, the server part of gecc. + * + */ +#ifndef _DASHBOARD_H_ +#define _DASHBOARD_H_ + +struct dashb_cache { + // number of files in cache + unsigned long file_count; + + // number of cache hits + unsigned long hit_counter; + + // number of cache misses + unsigned long miss_counter; +}; + +const int max_compile_node_id_len=50; + +struct dashboard_compile_node { + char name[max_compile_node_id_len+1]; + + // how many files has this special node compiled _for_ _this_ _master_ + unsigned long compiled_files; + // and how many source is that in kilo/mega/giga bytes. + unsigned long compiled_size; +}; + +const int dashboard_max_job_text_size=100; + +struct dashboard_job +{ + // the comandline (or a part of it) + char job_text[dashboard_max_job_text_size+1]; +}; + +const int dashboard_number_of_compile_nodes=20; +const int dashboard_number_of_parallel_compile_jobs=100; + +struct geccd_dashboard_memory_layout { + // make sure that client and server agree about the memory layout. + int version; + + // true if cache is on, false otherwise + bool cache_on; + + // true if local compilation is on, false otherwise + bool compile_on; + + // how many compile jobs are currently running? + int number_of_current_compile_jobs; + + int number_of_compile_nodes; + struct dashboard_compile_node compile_nodes[dashboard_number_of_compile_nodes]; + + int number_of_parallel_compile_jobs; + struct dashboard_job jobs[dashboard_number_of_parallel_compile_jobs]; +}; + +class Dashboard +{ +public: + Dashboard(); + ~Dashboard(); + +private: + struct geccd_dashboard_memory_layout memory; + +}; + +#endif diff --git a/devel/gecc/files/patch-cache.h b/devel/gecc/files/patch-cache.h new file mode 100644 index 000000000000..6cf6f634c462 --- /dev/null +++ b/devel/gecc/files/patch-cache.h @@ -0,0 +1,12 @@ +$FreeBSD$ + +--- cache.h.orig Sun Oct 13 03:42:50 2002 ++++ cache.h Thu Nov 7 15:32:39 2002 +@@ -31,6 +31,7 @@ + + #include <string> + #include <map> ++#include <sys/types.h> + + using std::ostream; + using std::map; diff --git a/devel/gecc/files/patch-con.h b/devel/gecc/files/patch-con.h new file mode 100644 index 000000000000..93970d23385d --- /dev/null +++ b/devel/gecc/files/patch-con.h @@ -0,0 +1,19 @@ +$FreeBSD$ + +--- con.h.orig Fri Oct 25 11:25:17 2002 ++++ con.h Thu Nov 7 15:29:13 2002 +@@ -29,8 +29,14 @@ + #include "config.h" + + #include <string> ++#include <sys/param.h> ++#include <sys/types.h> ++#include <sys/cdefs.h> ++#include <sys/socket.h> + #include <netdb.h> ++#include <arpa/inet.h> + #include <sys/un.h> ++#include <netinet/in.h> + + using std::string; + diff --git a/devel/gecc/files/patch-io.cpp b/devel/gecc/files/patch-io.cpp new file mode 100644 index 000000000000..f75f54620c5b --- /dev/null +++ b/devel/gecc/files/patch-io.cpp @@ -0,0 +1,22 @@ +$FreeBSD$ + +--- io.cpp.orig Sat Oct 19 11:51:21 2002 ++++ io.cpp Thu Nov 7 15:29:13 2002 +@@ -36,7 +36,7 @@ + #include "util.h" + #include <stdio.h> + #ifdef HAVE_SENDFILE +-#include <sys/sendfile.h> ++#include <sys/socket.h> + #endif + + using namespace std; +@@ -162,7 +163,7 @@ size_t write_file(int fd, const string& + throw TransportException(__FILE__, __LINE__, tmp); + } + #ifdef HAVE_SENDFILE +- int rc = sendfile(fd, in, 0, filesize); ++ int rc = sendfile(fd, in, 0, filesize, 0, 0, 0); + if (rc<0) { + perror("sendfile"); + assert(0); diff --git a/devel/gecc/files/patch-server.cpp b/devel/gecc/files/patch-server.cpp new file mode 100644 index 000000000000..4aacc7c54022 --- /dev/null +++ b/devel/gecc/files/patch-server.cpp @@ -0,0 +1,12 @@ +$FreeBSD$ + +--- server.cpp.orig Sat Nov 16 07:55:37 2002 ++++ server.cpp Fri Nov 22 14:20:07 2002 +@@ -24,6 +24,7 @@ + * USA + */ + ++#include <errno.h> + #include <cache.h> + #include <sys/types.h> + #include <sys/stat.h> diff --git a/devel/gecc/pkg-comment b/devel/gecc/pkg-comment new file mode 100644 index 000000000000..d90ef33a024c --- /dev/null +++ b/devel/gecc/pkg-comment @@ -0,0 +1 @@ +Group-enabled cluster compiler, for cached, distributed compilation diff --git a/devel/gecc/pkg-descr b/devel/gecc/pkg-descr new file mode 100644 index 000000000000..ba8eda46019e --- /dev/null +++ b/devel/gecc/pkg-descr @@ -0,0 +1,6 @@ +This is the group-enabled cluster compiler, for cached, distributed compilation. +It is intended to work like ccache, distcc, or a combination of the two (this +port does not yet work). Use it cautiously, because it is at an early stage of +development. + +WWW: http://gecc.sourceforge.net |