summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2013-07-01 21:34:05 (GMT)
committerNico Weber <nicolasweber@gmx.de>2013-07-01 21:34:05 (GMT)
commitda06d2969039ad6a80b4d864fb6c432fef4de47f (patch)
treebf5a09c96b8946ce00f054b1163dd7354f7d22c1
parentc8ac05c871a22cdd3b41ab76e72544524cedafae (diff)
parentb1f96969b7745e936796edf0b4a9b8c2312589e2 (diff)
downloadNinja-da06d2969039ad6a80b4d864fb6c432fef4de47f.zip
Ninja-da06d2969039ad6a80b4d864fb6c432fef4de47f.tar.gz
Ninja-da06d2969039ad6a80b4d864fb6c432fef4de47f.tar.bz2
Merge pull request #607 from dajohi/master
Support Bitrig
-rwxr-xr-xbootstrap.py6
-rwxr-xr-xconfigure.py4
-rw-r--r--platform_helper.py7
-rw-r--r--src/subprocess-posix.cc6
-rw-r--r--src/subprocess_test.cc4
5 files changed, 16 insertions, 11 deletions
diff --git a/bootstrap.py b/bootstrap.py
index 5682bf1..66ec85b 100755
--- a/bootstrap.py
+++ b/bootstrap.py
@@ -37,7 +37,7 @@ parser.add_option('--platform',
help='target platform (' + '/'.join(platform_helper.platforms()) + ')',
choices=platform_helper.platforms())
parser.add_option('--force-pselect', action='store_true',
- help="ppoll() is used by default on Linux and OpenBSD, but older versions might need to use pselect instead",)
+ help="ppoll() is used by default on Linux, OpenBSD and Bitrig, but older versions might need to use pselect instead",)
(options, conf_args) = parser.parse_args()
@@ -53,7 +53,7 @@ def run(*args, **kwargs):
# g++ call as well as in the later configure.py.
cflags = os.environ.get('CFLAGS', '').split()
ldflags = os.environ.get('LDFLAGS', '').split()
-if platform.is_freebsd() or platform.is_openbsd():
+if platform.is_freebsd() or platform.is_openbsd() or platform.is_bitrig():
cflags.append('-I/usr/local/include')
ldflags.append('-L/usr/local/lib')
@@ -109,7 +109,7 @@ else:
cflags.append('-D_WIN32_WINNT=0x0501')
if options.x64:
cflags.append('-m64')
-if (platform.is_linux() or platform.is_openbsd()) and not options.force_pselect:
+if (platform.is_linux() or platform.is_openbsd() or platform.is_bitrig()) and not options.force_pselect:
cflags.append('-DUSE_PPOLL')
if options.force_pselect:
conf_args.append("--force-pselect")
diff --git a/configure.py b/configure.py
index 22eb1e5..c838392 100755
--- a/configure.py
+++ b/configure.py
@@ -48,7 +48,7 @@ parser.add_option('--with-python', metavar='EXE',
help='use EXE as the Python interpreter',
default=os.path.basename(sys.executable))
parser.add_option('--force-pselect', action='store_true',
- help="ppoll() is used by default on Linux and OpenBSD, but older versions might need to use pselect instead",)
+ help="ppoll() is used by default where available, but some platforms may need to use pselect instead",)
(options, args) = parser.parse_args()
if args:
print('ERROR: extra unparsed command-line arguments:', args)
@@ -165,7 +165,7 @@ else:
cflags.append('-fno-omit-frame-pointer')
libs.extend(['-Wl,--no-as-needed', '-lprofiler'])
-if (platform.is_linux() or platform.is_openbsd()) and not options.force_pselect:
+if (platform.is_linux() or platform.is_openbsd() or platform.is_bitrig()) and not options.force_pselect:
cflags.append('-DUSE_PPOLL')
def shell_escape(str):
diff --git a/platform_helper.py b/platform_helper.py
index 5097f49..e615660 100644
--- a/platform_helper.py
+++ b/platform_helper.py
@@ -19,7 +19,7 @@ import sys
def platforms():
return ['linux', 'darwin', 'freebsd', 'openbsd', 'solaris', 'sunos5',
- 'mingw', 'msvc', 'gnukfreebsd8']
+ 'mingw', 'msvc', 'gnukfreebsd8', 'bitrig']
class Platform( object ):
def __init__( self, platform):
@@ -41,6 +41,8 @@ class Platform( object ):
self._platform = 'mingw'
elif self._platform.startswith('win'):
self._platform = 'msvc'
+ elif self._platform.startswith('bitrig'):
+ self._platform = 'bitrig'
def platform(self):
@@ -69,3 +71,6 @@ class Platform( object ):
def is_sunos5(self):
return self._platform == 'sunos5'
+
+ def is_bitrig(self):
+ return self._platform == 'bitrig'
diff --git a/src/subprocess-posix.cc b/src/subprocess-posix.cc
index b396f84..a9af756 100644
--- a/src/subprocess-posix.cc
+++ b/src/subprocess-posix.cc
@@ -41,7 +41,7 @@ bool Subprocess::Start(SubprocessSet* set, const string& command) {
Fatal("pipe: %s", strerror(errno));
fd_ = output_pipe[0];
#if !defined(USE_PPOLL)
- // On Linux and OpenBSD, we use ppoll in DoWork(); elsewhere we use pselect
+ // If available, we use ppoll in DoWork(); otherwise we use pselect
// and so must avoid overly-large FDs.
if (fd_ >= static_cast<int>(FD_SETSIZE))
Fatal("pipe: %s", strerror(EMFILE));
@@ -224,7 +224,7 @@ bool SubprocessSet::DoWork() {
return interrupted_;
}
-#else // linux || __OpenBSD__
+#else // !defined(USE_PPOLL)
bool SubprocessSet::DoWork() {
fd_set set;
int nfds = 0;
@@ -266,7 +266,7 @@ bool SubprocessSet::DoWork() {
return interrupted_;
}
-#endif // linux || __OpenBSD__
+#endif // !defined(USE_PPOLL)
Subprocess* SubprocessSet::NextFinished() {
if (finished_.empty())
diff --git a/src/subprocess_test.cc b/src/subprocess_test.cc
index afd9008..9f8dcea 100644
--- a/src/subprocess_test.cc
+++ b/src/subprocess_test.cc
@@ -152,7 +152,7 @@ TEST_F(SubprocessTest, SetWithMulti) {
// OS X's process limit is less than 1025 by default
// (|sysctl kern.maxprocperuid| is 709 on 10.7 and 10.8 and less prior to that).
-#if defined(linux) || defined(__OpenBSD__)
+#if !defined(__APPLE__) && !defined(_WIN32)
TEST_F(SubprocessTest, SetWithLots) {
// Arbitrary big number; needs to be over 1024 to confirm we're no longer
// hostage to pselect.
@@ -179,7 +179,7 @@ TEST_F(SubprocessTest, SetWithLots) {
}
ASSERT_EQ(kNumProcs, subprocs_.finished_.size());
}
-#endif // linux || __OpenBSD__
+#endif // !__APPLE__ && !_WIN32
// TODO: this test could work on Windows, just not sure how to simply
// read stdin.