aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTijl Coosemans <tijl@FreeBSD.org>2018-03-28 17:37:38 +0800
committerTijl Coosemans <tijl@FreeBSD.org>2018-03-28 17:37:38 +0800
commit6b416cc75e725d33caf81aaab64605fac61ec481 (patch)
tree94bbd251125d372d3b367504a4057bbe9477fce3
parentde2cbf8d3144fc478a1391aee3caa5841992fd1b (diff)
downloadfreebsd-ports-6b416cc75e725d33caf81aaab64605fac61ec481.tar.gz
freebsd-ports-6b416cc75e725d33caf81aaab64605fac61ec481.tar.zst
freebsd-ports-6b416cc75e725d33caf81aaab64605fac61ec481.zip
- Add a patch to make bjam call poll with timeout -1 instead of 0 so it
doesn't use so much CPU time. This cuts the build time of boost-libs in half for non-parallel builds. - Add support for WITH_DEBUG.
Notes
Notes: svn path=/head/; revision=465789
-rw-r--r--devel/boost-jam/Makefile3
-rw-r--r--devel/boost-jam/files/patch-debugger.c20
-rw-r--r--devel/boost-jam/files/patch-execunix.c56
3 files changed, 78 insertions, 1 deletions
diff --git a/devel/boost-jam/Makefile b/devel/boost-jam/Makefile
index 87fae1aded92..6eece79a6480 100644
--- a/devel/boost-jam/Makefile
+++ b/devel/boost-jam/Makefile
@@ -2,13 +2,14 @@
# $FreeBSD$
PORTNAME= boost-jam
+PORTREVISION= 1
COMMENT= Build tool from the boost.org
PLIST_FILES= bin/bjam
EXTRACT_AFTER_ARGS= ${DISTNAME}/${WRKSRC_SUBDIR}
MAKE_CMD= ./build.sh
-ALL_TARGET= cc
+ALL_TARGET= cc ${WITH_DEBUG:D--debug}
MAKE_FLAGS= #
_MAKE_JOBS= #
MAKEFILE= #
diff --git a/devel/boost-jam/files/patch-debugger.c b/devel/boost-jam/files/patch-debugger.c
new file mode 100644
index 000000000000..42091af8aba8
--- /dev/null
+++ b/devel/boost-jam/files/patch-debugger.c
@@ -0,0 +1,20 @@
+--- debugger.c.orig 2017-12-13 23:56:50 UTC
++++ debugger.c
+@@ -1102,7 +1102,7 @@ static void debug_start_child( int argc, const char *
+ PROCESS_INFORMATION pi = { NULL, NULL, 0, 0 };
+ STARTUPINFO si = { sizeof( STARTUPINFO ), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0 };
+- assert( DEBUG_STATE == DEBUG_NO_CHILD );
++ assert( debug_state == DEBUG_NO_CHILD );
+ if ( ! CreatePipe( &pipe1[ 0 ], &pipe1[ 1 ], &sa, 0 ) )
+ {
+ printf("internal error\n");
+@@ -1189,7 +1189,7 @@ static void debug_start_child( int argc, const char *
+ int read_fd;
+ int pid;
+ int i;
+- assert( DEBUG_STATE == DEBUG_NO_CHILD );
++ assert( debug_state == DEBUG_NO_CHILD );
+ pipe(pipe1);
+ pipe(pipe2);
+ pid = fork();
diff --git a/devel/boost-jam/files/patch-execunix.c b/devel/boost-jam/files/patch-execunix.c
new file mode 100644
index 000000000000..1d0e0db798be
--- /dev/null
+++ b/devel/boost-jam/files/patch-execunix.c
@@ -0,0 +1,56 @@
+--- execunix.c.orig 2017-12-13 23:56:50 UTC
++++ execunix.c
+@@ -445,9 +445,7 @@ void exec_wait()
+ while ( !finished )
+ {
+ int i;
+- struct timeval tv;
+- struct timeval * ptv = NULL;
+- int select_timeout = globs.timeout;
++ int poll_timeout = -1;
+
+ /* Check for timeouts:
+ * - kill children that already timed out
+@@ -457,6 +455,7 @@ void exec_wait()
+ {
+ struct tms buf;
+ clock_t const current = times( &buf );
++ poll_timeout = globs.timeout;
+ for ( i = 0; i < globs.jobs; ++i )
+ if ( cmdtab[ i ].pid )
+ {
+@@ -467,28 +466,21 @@ void exec_wait()
+ killpg( cmdtab[ i ].pid, SIGKILL );
+ cmdtab[ i ].exit_reason = EXIT_TIMEOUT;
+ }
+- else if ( globs.timeout - consumed < select_timeout )
+- select_timeout = globs.timeout - consumed;
++ else if ( globs.timeout - consumed < poll_timeout )
++ poll_timeout = globs.timeout - consumed;
+ }
+-
+- /* If nothing else causes our select() call to exit, force it after
+- * however long it takes for the next one of our child processes to
+- * crossed its alloted processing time so we can terminate it.
+- */
+- tv.tv_sec = select_timeout;
+- tv.tv_usec = 0;
+- ptv = &tv;
++ poll_timeout *= 1000;
+ }
+
+- /* select() will wait for I/O on a descriptor, a signal, or timeout. */
++ /* poll() will wait for I/O on a descriptor, a signal, or timeout. */
+ {
+- /* disable child termination signals while in select */
++ /* disable child termination signals while in poll */
+ int ret;
+ sigset_t sigmask;
+ sigemptyset(&sigmask);
+ sigaddset(&sigmask, SIGCHLD);
+ sigprocmask(SIG_BLOCK, &sigmask, NULL);
+- while ( ( ret = poll( wait_fds, WAIT_FDS_SIZE, select_timeout * 1000 ) ) == -1 )
++ while ( ( ret = poll( wait_fds, WAIT_FDS_SIZE, poll_timeout ) ) == -1 )
+ if ( errno != EINTR )
+ break;
+ /* restore original signal mask by unblocking sigchld */