Turn distcc into recipe format.

* Not tested, a bug in haikuporter prevents from building it
 * the tests fail on haiku because a path is hardcoded to /usr/include
in them. an upstream issue has been opened.
This commit is contained in:
Adrien Destugues
2013-10-02 09:00:55 +02:00
parent 401f2a18da
commit 574085e273
6 changed files with 272 additions and 109 deletions

View File

@@ -1,5 +0,0 @@
cd distcc-3.1
libtoolize --force --copy --install
./autogen.sh
./configure LDFLAGS=-L/boot/common/lib/python2.6/config --prefix=`finddir B_COMMON_DIRECTORY`
make

View File

@@ -1,2 +0,0 @@
cd distcc-3.1
make install

View File

@@ -1,100 +0,0 @@
diff -Naur distcc-3.1/Makefile.in distcc-3.1-haiku/Makefile.in
--- distcc-3.1/Makefile.in 2008-12-02 21:50:31.066060288 +0000
+++ distcc-3.1-haiku/Makefile.in 2011-05-21 01:10:21.995098624 +0000
@@ -554,7 +554,7 @@
# The include-server is a python app, so we use Python's build system. We pass
# the distcc version, the source location, the CPP flags (for location of the
-# includes), and the build location.
+# includes), LD flags and the build location.
include-server:
if test -z "$(INCLUDESERVER_PYTHON)"; then \
echo "Not building $@: No suitable python found"; \
@@ -564,6 +564,7 @@
SRCDIR="$(srcdir)" \
CFLAGS="$(CFLAGS) $(PYTHON_CFLAGS)" \
CPPFLAGS="$(CPPFLAGS)" \
+ LDFLAGS="$(LDFLAGS)" \
$(INCLUDESERVER_PYTHON) "$(srcdir)/include_server/setup.py" \
build \
--build-base="$(include_server_builddir)" \
diff -Naur distcc-3.1/configure.ac distcc-3.1-haiku/configure.ac
--- distcc-3.1/configure.ac 2008-12-02 21:50:31.066846720 +0000
+++ distcc-3.1-haiku/configure.ac 2011-05-21 01:10:34.207618048 +0000
@@ -329,9 +329,12 @@
# only looks in /etc/hosts), so we only look for -lsocket if we need
# it.
AC_SEARCH_LIBS(gethostent, [nsl])
-AC_SEARCH_LIBS(setsockopt, [socket])
+AC_SEARCH_LIBS(setsockopt, [socket network])
AC_SEARCH_LIBS(hstrerror, [resolv])
AC_SEARCH_LIBS(inet_aton, [resolv])
+AC_SEARCH_LIBS(strsep, [bsd])
+AC_SEARCH_LIBS(wait3, [bsd])
+AC_SEARCH_LIBS(wait4, [bsd])
if test x"$with_included_popt" != x"yes" && test x"$with_included_popt" != xno
then
@@ -379,6 +382,7 @@
AC_CHECK_FUNCS([getrusage strsignal gettimeofday])
AC_CHECK_FUNCS([getaddrinfo getnameinfo inet_ntop inet_ntoa])
AC_CHECK_FUNCS([strndup strsep mmap strlcpy])
+AC_CHECK_FUNCS([nice])
AC_CHECK_FUNCS([getloadavg])
@@ -471,6 +475,8 @@
AC_DEFINE(HAVE_SOCKADDR_STORAGE, 1, [define if you have struct sockaddr_storage]),,
[#include <sys/socket.h>])
+AC_CHECK_MEMBERS([struct rusage.ru_minflt, struct rusage.ru_majflt])
+
AC_ARG_WITH(avahi,
AC_HELP_STRING([--without-avahi], [build without avahi]))
diff -Naur distcc-3.1/src/daemon.c distcc-3.1-haiku/src/daemon.c
--- distcc-3.1/src/daemon.c 2008-12-02 21:50:25.053739520 +0000
+++ distcc-3.1-haiku/src/daemon.c 2011-05-21 01:11:07.709361664 +0000
@@ -172,15 +172,19 @@
if ((ret = dcc_set_lifetime()) != 0)
dcc_exit(ret);
+#ifdef HAVE_NICE
/* do this before giving away root */
if (nice(opt_niceness) == -1) {
rs_log_warning("nice %d failed: %s", opt_niceness,
strerror(errno));
/* continue anyhow */
}
+#endif
+#ifndef __HAIKU__
if ((ret = dcc_discard_root()) != 0)
dcc_exit(ret);
+#endif
/* Discard privileges before opening log so that if it's created, it has
* the right ownership. */
diff -Naur distcc-3.1/src/exec.c distcc-3.1-haiku/src/exec.c
--- distcc-3.1/src/exec.c 2008-12-02 21:50:24.054263808 +0000
+++ distcc-3.1-haiku/src/exec.c 2011-05-21 01:10:57.257687552 +0000
@@ -488,12 +488,19 @@
* critique_status(). */
rs_trace("%s child %ld terminated with status %#x",
what, (long) ret_pid, *wait_status);
+#if defined HAVE_RUSAGE_RU_MINFLT && defined HAVE_RUSAGE_RU_MAJFLT
rs_log_info("%s times: user %ld.%06lds, system %ld.%06lds, "
"%ld minflt, %ld majflt",
what,
ru.ru_utime.tv_sec, (long) ru.ru_utime.tv_usec,
ru.ru_stime.tv_sec, (long) ru.ru_stime.tv_usec,
ru.ru_minflt, ru.ru_majflt);
+#else
+ rs_log_info("%s times: user %ld.%06lds, system %ld.%06lds",
+ what,
+ ru.ru_utime.tv_sec, (long) ru.ru_utime.tv_usec,
+ ru.ru_stime.tv_sec, (long) ru.ru_stime.tv_usec);
+#endif
return 0;
}

View File

@@ -1,2 +0,0 @@
cd distcc-3.1
make check

View File

@@ -0,0 +1,75 @@
SUMMARY="Distribute compilation of C code across several machines on a network"
HOMEPAGE="http://distcc.org/"
COPYRIGHT="Copyright (C) 2002, 2003, 2004 by Martin Pool <mbp@samba.org>
Portions Copyright 2005 Google Inc."
LICENSE="GNU GPL v2"
SRC_URI="http://distcc.googlecode.com/files/distcc-3.1.tar.bz2"
CHECKSUM_MD5="a1a9d3853df7133669fffec2a9aab9f3"
REVISION="1"
ARCHITECTURES="?x86_gcc2 ?x86"
PROVIDES="
distcc = $portVersion
cmd:distcc = $portVersion
cmd:distccd = $portVersion
cmd:distccmon_text = $portVersion
cmd:lsdistcc = $portVersion
cmd:pump =$portVersion
"
GLOBAL_WRITABLE_FILES="
settings/default/distcc keep-old
settings/distcc/hosts keep-old
settings/distcc/clients.allow keep-old
settings/distcc/commands.allow.sh keep-old
"
REQUIRES="
haiku
lib:libpython2.6
"
# second part only for tests. Where to put that ?
BUILD_REQUIRES="
devel:libpython2.6
"
BUILD_PREREQUIRES="
cmd:libtoolize
cmd:which
cmd:aclocal
cmd:autoconf
cmd:gcc
cmd:gdb
cmd:g++
cmd:make
"
PATCHES="distcc-3.1.patchset"
BUILD()
{
libtoolize --copy --force --install
./autogen.sh
runConfigure ./configure \
LDFLAGS=-L/boot/common/lib/python2.6/config
make $jobArgs
}
INSTALL()
{
make install
}
TEST()
{
make check RESTRICTED_PATH=/sources/distcc-3.3:/boot/common/develop/tools/bin:/bin
}
DESCRIPTION="
distcc is a program to distribute builds of C, C++, Objective C or Objective C++ code
across several machines on a network. distcc should always generate the same results
as a local build, is simple to install and use, and is usually much faster than a local compile.
distcc does not require all machines to share a filesystem, have synchronized clocks,
or to have the same libraries or header files installed. They can even have different
processors or operating systems, if cross-compilers are installed.
"

View File

@@ -0,0 +1,197 @@
From 0bd21201f254f5d040d88af9a99198109899d2d8 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Mon, 30 Sep 2013 21:16:54 +0200
Subject: Convert existing patch to git patchset.
diff --git a/Makefile.in b/Makefile.in
index 073482e..2759efa 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -554,7 +554,7 @@ distccmon-gnome@EXEEXT@: $(mon_obj) $(gnome_obj)
# The include-server is a python app, so we use Python's build system. We pass
# the distcc version, the source location, the CPP flags (for location of the
-# includes), and the build location.
+# includes), LD flags and the build location.
include-server:
if test -z "$(INCLUDESERVER_PYTHON)"; then \
echo "Not building $@: No suitable python found"; \
@@ -564,6 +564,7 @@ include-server:
SRCDIR="$(srcdir)" \
CFLAGS="$(CFLAGS) $(PYTHON_CFLAGS)" \
CPPFLAGS="$(CPPFLAGS)" \
+ LDFLAGS="$(LDFLAGS)" \
$(INCLUDESERVER_PYTHON) "$(srcdir)/include_server/setup.py" \
build \
--build-base="$(include_server_builddir)" \
diff --git a/configure.ac b/configure.ac
index 757dbe3..8456596 100644
--- a/configure.ac
+++ b/configure.ac
@@ -329,9 +329,12 @@ AC_CHECK_TYPES([in_port_t, in_addr_t], , ,
# only looks in /etc/hosts), so we only look for -lsocket if we need
# it.
AC_SEARCH_LIBS(gethostent, [nsl])
-AC_SEARCH_LIBS(setsockopt, [socket])
+AC_SEARCH_LIBS(setsockopt, [socket network])
AC_SEARCH_LIBS(hstrerror, [resolv])
AC_SEARCH_LIBS(inet_aton, [resolv])
+AC_SEARCH_LIBS(strsep, [bsd])
+AC_SEARCH_LIBS(wait3, [bsd])
+AC_SEARCH_LIBS(wait4, [bsd])
if test x"$with_included_popt" != x"yes" && test x"$with_included_popt" != xno
then
@@ -379,6 +382,7 @@ AC_CHECK_FUNCS([snprintf vsnprintf vasprintf asprintf getcwd getwd mkdtemp])
AC_CHECK_FUNCS([getrusage strsignal gettimeofday])
AC_CHECK_FUNCS([getaddrinfo getnameinfo inet_ntop inet_ntoa])
AC_CHECK_FUNCS([strndup strsep mmap strlcpy])
+AC_CHECK_FUNCS([nice])
AC_CHECK_FUNCS([getloadavg])
@@ -471,6 +475,8 @@ AC_CHECK_MEMBER([struct sockaddr_storage.ss_family],
AC_DEFINE(HAVE_SOCKADDR_STORAGE, 1, [define if you have struct sockaddr_storage]),,
[#include <sys/socket.h>])
+AC_CHECK_MEMBERS([struct rusage.ru_minflt, struct rusage.ru_majflt])
+
AC_ARG_WITH(avahi,
AC_HELP_STRING([--without-avahi], [build without avahi]))
diff --git a/src/daemon.c b/src/daemon.c
index 5b06971..cdfd452 100644
--- a/src/daemon.c
+++ b/src/daemon.c
@@ -172,15 +172,19 @@ int main(int argc, char *argv[])
if ((ret = dcc_set_lifetime()) != 0)
dcc_exit(ret);
+#ifdef HAVE_NICE
/* do this before giving away root */
if (nice(opt_niceness) == -1) {
rs_log_warning("nice %d failed: %s", opt_niceness,
strerror(errno));
/* continue anyhow */
}
+#endif
+#ifndef __HAIKU__
if ((ret = dcc_discard_root()) != 0)
dcc_exit(ret);
+#endif
/* Discard privileges before opening log so that if it's created, it has
* the right ownership. */
diff --git a/src/exec.c b/src/exec.c
index 8d2df86..bd92d4f 100644
--- a/src/exec.c
+++ b/src/exec.c
@@ -488,12 +488,19 @@ int dcc_collect_child(const char *what, pid_t pid,
* critique_status(). */
rs_trace("%s child %ld terminated with status %#x",
what, (long) ret_pid, *wait_status);
+#if defined HAVE_RUSAGE_RU_MINFLT && defined HAVE_RUSAGE_RU_MAJFLT
rs_log_info("%s times: user %ld.%06lds, system %ld.%06lds, "
"%ld minflt, %ld majflt",
what,
ru.ru_utime.tv_sec, (long) ru.ru_utime.tv_usec,
ru.ru_stime.tv_sec, (long) ru.ru_stime.tv_usec,
ru.ru_minflt, ru.ru_majflt);
+#else
+ rs_log_info("%s times: user %ld.%06lds, system %ld.%06lds",
+ what,
+ ru.ru_utime.tv_sec, (long) ru.ru_utime.tv_usec,
+ ru.ru_stime.tv_sec, (long) ru.ru_stime.tv_usec);
+#endif
return 0;
}
--
1.8.3.4
From c7121172e07205189fe1b10e49ab0256863ba1a2 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Tue, 1 Oct 2013 17:26:29 +0200
Subject: C89 fixes for gcc2 compatibility
diff --git a/src/compile.c b/src/compile.c
index 2fc60b7..15bc8ad 100644
--- a/src/compile.c
+++ b/src/compile.c
@@ -89,6 +89,8 @@ int dcc_discrepancy_filename(char **filename)
return 0;
} else if (str_endswith(include_server_port_suffix,
include_server_port)) {
+ int slash_pos;
+
/* We're going to make a longer string from include_server_port: one
* that replaces include_server_port_suffix with discrepancy_suffix. */
int delta = strlen(discrepancy_suffix) -
@@ -100,7 +102,7 @@ int dcc_discrepancy_filename(char **filename)
return EXIT_OUT_OF_MEMORY;
}
strcpy(*filename, include_server_port);
- int slash_pos = strlen(include_server_port)
+ slash_pos = strlen(include_server_port)
- strlen(include_server_port_suffix);
/* Because include_server_port_suffix is a suffix of include_server_port
* we expect to find a '/' at slash_pos in filename. */
@@ -119,8 +121,9 @@ int dcc_discrepancy_filename(char **filename)
**/
static int dcc_read_number_discrepancies(const char *discrepancy_filename)
{
- if (!discrepancy_filename) return 0;
struct stat stat_record;
+
+ if (!discrepancy_filename) return 0;
if (stat(discrepancy_filename, &stat_record) == 0) {
size_t size = stat_record.st_size;
/* Does size fit in an 'int'? */
diff --git a/src/emaillog.c b/src/emaillog.c
index fdb5e37..971e229 100644
--- a/src/emaillog.c
+++ b/src/emaillog.c
@@ -107,12 +107,13 @@ int dcc_add_file_to_log_email(const char *description,
void dcc_maybe_send_email(void) {
int child_pid = 0;
const char *whom_to_blame;
+ char *will_send_message_to;
+ char *cant_send_message_to;
+
if ((whom_to_blame = getenv("DISTCC_EMAILLOG_WHOM_TO_BLAME"))
== NULL) {
whom_to_blame = dcc_emaillog_whom_to_blame;
}
- char *will_send_message_to;
- char *cant_send_message_to;
if (should_send_email == 0) return;
if (never_send_email) return;
diff --git a/src/lsdistcc.c b/src/lsdistcc.c
index 2cbca66..50f10c8 100644
--- a/src/lsdistcc.c
+++ b/src/lsdistcc.c
@@ -920,6 +920,8 @@ int detect_distcc_servers(const char **argv, int argc, int opti,
const char *default_format = DEFAULT_FORMAT;
const char **sformat = &default_format;
const char *domain_name;
+ struct rlimit rlim = {0, 0};
+
if (opt_domain) {
if (dcc_get_dns_domain(&domain_name)) {
fprintf(stderr, "Can't get domain name\n");
@@ -942,7 +944,6 @@ int detect_distcc_servers(const char **argv, int argc, int opti,
* We'll ideally use n + 2 fds in our poll loop, so ask for n + 10
* fds total.
*/
- struct rlimit rlim = {0, 0};
getrlimit(RLIMIT_NOFILE, &rlim);
if (rlim.rlim_cur < (rlim_t)n + 10) {
rlim.rlim_cur = (rlim_t)n + 10;
--
1.8.3.4