From d7d59de2f79e0ce06043f56c29d0202569b88e62 Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Tue, 15 Jul 2014 10:39:30 -0400 Subject: Add minimal Haiku support; based on Adrien's patch. diff --git a/configure.py b/configure.py index 2eacbfe..97919db 100755 --- a/configure.py +++ b/configure.py @@ -55,13 +55,15 @@ class Platform(object): self._platform = 'msvc' elif self._platform.startswith('bitrig'): self._platform = 'bitrig' + elif self._platform.startswith('haiku'): + self._platform = 'haiku' elif self._platform.startswith('netbsd'): self._platform = 'netbsd' @staticmethod def known_platforms(): return ['linux', 'darwin', 'freebsd', 'openbsd', 'solaris', 'sunos5', - 'mingw', 'msvc', 'gnukfreebsd', 'bitrig', 'netbsd'] + 'mingw', 'msvc', 'gnukfreebsd', 'bitrig', 'netbsd', 'haiku'] def platform(self): return self._platform @@ -88,6 +90,9 @@ class Platform(object): def is_solaris(self): return self._platform == 'solaris' + def is_haiku(self): + return self._platform == 'is_haiku' + def uses_usr_local(self): return self._platform in ('freebsd', 'openbsd', 'bitrig') @@ -427,11 +432,7 @@ if platform.supports_ninja_browse(): n.comment('the depfile parser and ninja lexers are generated using re2c.') def has_re2c(): - 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', diff --git a/src/util.cc b/src/util.cc index aa47f2f..3308025 100644 --- a/src/util.cc +++ b/src/util.cc @@ -507,7 +507,7 @@ int GetProcessorCount() { #endif } -#if defined(_WIN32) || defined(__CYGWIN__) +#if defined(_WIN32) || defined(__CYGWIN__) || defined(__HAIKU__) static double CalculateProcessorLoad(uint64_t idle_ticks, uint64_t total_ticks) { static uint64_t previous_idle_ticks = 0; -- 2.11.0 From 364a8621f81fdab928ea41791463ed66787b7e4f Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Sat, 19 Dec 2015 23:30:47 +0000 Subject: Add include of sys/select.h to get FD_* definitions. Apparently these are pulled in by one of the already present headers on other platforms. A cursory look at the POSIX specs did not reveal a requirement to expose these types with the given headers though. diff --git a/src/subprocess-posix.cc b/src/subprocess-posix.cc index f3baec2..6b27d7e 100644 --- a/src/subprocess-posix.cc +++ b/src/subprocess-posix.cc @@ -21,6 +21,7 @@ #include #include #include +#include #include #include "util.h" -- 2.11.0 From 5ec9e60993a9c93634371aa06fcae454fa364ce6 Mon Sep 17 00:00:00 2001 From: Jerome Duval Date: Sun, 16 Apr 2017 13:39:04 +0200 Subject: GetLoadAvg to be implemented for Haiku diff --git a/src/util.cc b/src/util.cc index 3308025..bc9739c 100644 --- a/src/util.cc +++ b/src/util.cc @@ -507,7 +507,7 @@ int GetProcessorCount() { #endif } -#if defined(_WIN32) || defined(__CYGWIN__) || defined(__HAIKU__) +#if defined(_WIN32) || defined(__CYGWIN__) static double CalculateProcessorLoad(uint64_t idle_ticks, uint64_t total_ticks) { static uint64_t previous_idle_ticks = 0; @@ -573,6 +573,10 @@ double GetLoadAverage() { return posix_compatible_load; } +#elif defined(__HAIKU__) +double GetLoadAverage() { + return -0.0f; +} #else double GetLoadAverage() { double loadavg[3] = { 0.0f, 0.0f, 0.0f }; -- 2.11.0