From 3114837a171dc36063a524f710ce875efd6198e5 Mon Sep 17 00:00:00 2001
From: TURX <turx2003@gmail.com>
Date: Thu, 23 Jan 2020 11:26:46 +0800
Subject: [PATCH 1/2] add includedir support for cmake

---
 CMakeLists.txt              | 2 +-
 p8-platform-config.cmake.in | 2 +-
 p8-platform.pc.in           | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7144b0b..9111041 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -22,7 +22,7 @@ if(WIN32)
                    src/windows/os-threads.cpp)
 endif()
 
-set(p8-platform_INCLUDE_DIRS "${CMAKE_INSTALL_PREFIX}/include/p8-platform")
+set(p8-platform_INCLUDE_DIRS "${CMAKE_INSTALL_INCLUDEDIR}/p8-platform")
 IF(WIN32)
   LIST(APPEND p8-platform_INCLUDE_DIRS "${CMAKE_INSTALL_PREFIX}/include/p8-platform/windows")
 ENDIF(WIN32)
diff --git a/p8-platform-config.cmake.in b/p8-platform-config.cmake.in
index 47f30f1..abdd905 100644
--- a/p8-platform-config.cmake.in
+++ b/p8-platform-config.cmake.in
@@ -10,7 +10,7 @@
 #
 # propagate these properties from one build system to the other
 set (p8-platform_VERSION "@p8-platform_VERSION_MAJOR@.@p8-platform_VERSION_MINOR@")
-set (p8-platform_INCLUDE_DIRS @p8-platform_INCLUDE_DIRS@ @CMAKE_INSTALL_PREFIX@/include)
+set (p8-platform_INCLUDE_DIRS @p8-platform_INCLUDE_DIRS@ @CMAKE_INSTALL_INCLUDEDIR@)
 set (p8-platform_LIBRARY_DIRS "@CMAKE_LIBRARY_OUTPUT_DIRECTORY@")
 set (p8-platform_LINKER_FLAGS "@p8-platform_LINKER_FLAGS@")
 set (p8-platform_CONFIG_VARS "@p8-platform_CONFIG_VARS@")
diff --git a/p8-platform.pc.in b/p8-platform.pc.in
index f97a2d4..611edb7 100644
--- a/p8-platform.pc.in
+++ b/p8-platform.pc.in
@@ -1,6 +1,6 @@
 prefix=@CMAKE_INSTALL_PREFIX@
 libdir=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@
-includedir=@CMAKE_INSTALL_PREFIX@/include
+includedir=@CMAKE_INSTALL_INCLUDEDIR@
 DEPENDENCIES=@p8-platform_LIBRARIES@
 
 Name: @p8-platform_NAME@
-- 
2.20.1


From 367a56a405e6611a4c287be3dacc8dbcadc02a59 Mon Sep 17 00:00:00 2001
From: TURX <turx2003@gmail.com>
Date: Thu, 23 Jan 2020 11:26:59 +0800
Subject: [PATCH 2/2] fix Haiku support

---
 src/posix/os-types.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/posix/os-types.h b/src/posix/os-types.h
index 7fb832c..be38edd 100644
--- a/src/posix/os-types.h
+++ b/src/posix/os-types.h
@@ -36,9 +36,12 @@
 #include <string.h>
 #include <errno.h>
 #include <sys/time.h>
-#if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__NetBSD__)
+#if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__HAIKU__)
 #include <sys/prctl.h>
 #endif
+#if defined(__HAIKU__)
+#include <OS.h>
+#endif
 #include <pthread.h>
 #include <poll.h>
 #include <semaphore.h>
-- 
2.20.1

