From d5b906ba41f20ba28ea7044c8933c069dd915616 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Thu, 3 Oct 2013 10:06:13 +0200
Subject: Add minimal Haiku support


diff --git a/platform_helper.py b/platform_helper.py
index b7447a1..bf7a99e 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', 'bitrig']
+            'mingw', 'msvc', 'gnukfreebsd8', 'bitrig', 'haiku']
 
 class Platform( object ):
     def __init__( self, platform):
@@ -43,6 +43,8 @@ class Platform( object ):
             self._platform = 'msvc'
         elif self._platform.startswith('bitrig'):
             self._platform = 'bitrig'
+        elif self._platform.startswith('haiku'):
+            self._platform = 'haiku'
 
     def platform(self):
         return self._platform
@@ -73,3 +75,6 @@ class Platform( object ):
 
     def is_bitrig(self):
         return self._platform == 'bitrig'
+
+    def is_haiku(self):
+        return self._platform == 'haiku'
diff --git a/src/util.cc b/src/util.cc
index 6ba3c6c..7142d13 100644
--- a/src/util.cc
+++ b/src/util.cc
@@ -310,7 +310,7 @@ int GetProcessorCount() {
 #endif
 }
 
-#if defined(_WIN32) || defined(__CYGWIN__)
+#if defined(_WIN32) || defined(__CYGWIN__) || defined(__HAIKU__)
 double GetLoadAverage() {
   // TODO(nicolas.despres@gmail.com): Find a way to implement it on Windows.
   // Remember to also update Usage() when this is fixed.
-- 
1.8.3.4


From ae6f3e8c5b4d18198ef0c798c4609ac9607ea16f Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Sun, 13 Oct 2013 22:39:03 +0200
Subject: Disable has_re2c test

 * The test triggers some bug in our python port, leading to a corrupted
build.ninja file (first 40 lines are written twice to the file).
 * re2c is not needed when just building ninja anyway.

diff --git a/configure.py b/configure.py
index 9fe3be8..61ac9dd 100755
--- a/configure.py
+++ b/configure.py
@@ -241,12 +241,7 @@ if not platform.is_windows() and not platform.is_solaris():
 
 n.comment('the depfile parser and ninja lexers are generated using re2c.')
 def has_re2c():
-    import subprocess
-    try:
-        proc = subprocess.Popen(['re2c', '-V'], stdout=subprocess.PIPE)
-        return int(proc.communicate()[0], 10) >= 1103
-    except OSError:
-        return False
+    return False
 if has_re2c():
     n.rule('re2c',
            command='re2c -b -i --no-generation-date -o $out $in',
-- 
1.8.3.4

