From 621149fd3f5b0720be2a020561e22a6b29cea328 Mon Sep 17 00:00:00 2001
From: TURX <turx2003@gmail.com>
Date: Thu, 23 Jan 2020 02:34:28 +0800
Subject: [PATCH 1/2] add includedir support for cmake

---
 CMakeLists.txt    | 12 ++++++------
 p8-platform.pc.in |  2 +-
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7144b0b..8f09ba8 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)
@@ -42,7 +42,7 @@ set_target_properties(p8-platform PROPERTIES VERSION ${p8-platform_VERSION_MAJOR
                                               SOVERSION ${p8-platform_VERSION_MAJOR})
 
 install(TARGETS p8-platform DESTINATION ${CMAKE_INSTALL_LIBDIR})
-install(FILES src/os.h DESTINATION include/p8-platform)
+install(FILES src/os.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/p8-platform)
 IF(WIN32)
   INSTALL(FILES src/windows/dlfcn-win32.h
                 src/windows/os-socket.h
@@ -53,23 +53,23 @@ ELSE(WIN32)
   install(FILES src/posix/os-socket.h
                 src/posix/os-threads.h
                 src/posix/os-types.h
-          DESTINATION include/p8-platform/posix)
+          DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/p8-platform/posix)
 ENDIF(WIN32)
 install(FILES src/sockets/cdevsocket.h
               src/sockets/socket.h
               src/sockets/tcp.h
-        DESTINATION include/p8-platform/sockets)
+        DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/p8-platform/sockets)
 install(FILES src/threads/atomics.h
               src/threads/mutex.h
               src/threads/threads.h
-        DESTINATION include/p8-platform/threads)
+        DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/p8-platform/threads)
 install(FILES src/util/atomic.h
               src/util/buffer.h
               src/util/StringUtils.h
               src/util/StdString.h
               src/util/timeutils.h
               src/util/util.h
-        DESTINATION include/p8-platform/util)
+        DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/p8-platform/util)
 
 IF(NOT WIN32)
   configure_file(p8-platform.pc.in p8-platform.pc @ONLY)
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 837bc04d661b7c328b0c35fd8b286dac47c04e89 Mon Sep 17 00:00:00 2001
From: TURX <turx2003@gmail.com>
Date: Thu, 23 Jan 2020 02:34:56 +0800
Subject: [PATCH 2/2] fix Haiku support

---
 src/posix/os-types.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/posix/os-types.h b/src/posix/os-types.h
index 7fb832c..dcb8a61 100644
--- a/src/posix/os-types.h
+++ b/src/posix/os-types.h
@@ -36,7 +36,7 @@
 #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
 #include <pthread.h>
-- 
2.20.1

