aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2018-10-06 04:14:22 +0000
committerdec05eba <dec05eba@protonmail.com>2020-07-06 07:39:33 +0200
commit3daf2e03d34ed2c4ab580361673f40f5827bed69 (patch)
tree10ca03a42ef68296c5d720ab298143a7c6f0acc9
parent31aa47522a0e644289ab606236fd5ccb505f9c54 (diff)
Add support for Haiku
-rw-r--r--README.md6
-rw-r--r--include/Conf.hpp45
-rw-r--r--include/Platform.hpp13
-rw-r--r--include/env.hpp6
-rw-r--r--src/FileUtil.cpp2
-rw-r--r--src/Platform.cpp5
6 files changed, 63 insertions, 14 deletions
diff --git a/README.md b/README.md
index 0fb9aeb..0f93b28 100644
--- a/README.md
+++ b/README.md
@@ -15,9 +15,9 @@ To compile under windows you can use vcpkg to install dependencies and then gene
List of packages can be found at https://gitlab.com/DEC05EBA/sibs_packages/raw/master/packages.json
### Supported platforms
-|Linux|Windows|MacOS |OpenBSD |... |
-|-----|-------|-----------|-----------|-----------|
-|✓ |✓ |✓ |✓ |TBD* |
+|Linux|Windows|MacOS |OpenBSD |Haiku|... |
+|-----|-------|-----------|-----------|-----|-----------|
+|✓ |✓ |✓ |✓ | |TBD* |
\* Sibs is intended to work on as many platforms as possible, you can help by porting sibs to another platform. Should only be minor changes if the platform is unix-like.
diff --git a/include/Conf.hpp b/include/Conf.hpp
index 3cd8cd5..bae0153 100644
--- a/include/Conf.hpp
+++ b/include/Conf.hpp
@@ -160,6 +160,10 @@ namespace sibs
"config.openbsd.static.debug",
"config.openbsd.static.release",
+ "config.haiku",
+ "config.haiku.static.debug",
+ "config.haiku.static.release",
+
"config.win32",
"config.win32.static.debug",
"config.win32.static.release",
@@ -190,10 +194,18 @@ namespace sibs
"config.openbsd64",
"config.openbsd64.static.debug",
- "config.openbsd64.static.release"
+ "config.openbsd64.static.release",
+
+ "config.haiku32",
+ "config.haiku32.static.debug",
+ "config.haiku32.static.release",
+
+ "config.haiku64",
+ "config.haiku64.static.debug",
+ "config.haiku64.static.release"
};
- const int NUM_CONFIGS = 3 * 13;
- const int CONFIGS_GENERIC_OFFSET = 3 * 5;
+ const int NUM_CONFIGS = 3 * 16;
+ const int CONFIGS_GENERIC_OFFSET = 3 * 6;
#if OS_TYPE == OS_TYPE_WINDOWS
#ifdef SIBS_ENV_32BIT
@@ -277,9 +289,30 @@ namespace sibs
// TODO: Also add "bsd" platform
#define SYSTEM_GENERIC_PLATFORM_NAME "openbsd"
- #define CONFIG_GENERIC_SYSTEM_PLATFORM 9
- #define CONFIG_GENERIC_STATIC_DEBUG_PLATFORM 10
- #define CONFIG_GENERIC_STATIC_RELEASE_PLATFORM 11
+ #define CONFIG_GENERIC_SYSTEM_PLATFORM 12
+ #define CONFIG_GENERIC_STATIC_DEBUG_PLATFORM 13
+ #define CONFIG_GENERIC_STATIC_RELEASE_PLATFORM 14
+ #elif OS_TYPE == OS_TYPE_HAIKU
+ #ifdef SIBS_ENV_32BIT
+ const Platform SYSTEM_PLATFORM = PLATFORM_HAIKU32;
+ #define SYSTEM_PLATFORM_NAME "haiku32"
+ #define CONFIG_SYSTEM_PLATFORM CONFIGS_GENERIC_OFFSET + 24
+ #define CONFIG_STATIC_DEBUG_PLATFORM CONFIGS_GENERIC_OFFSET + 25
+ #define CONFIG_STATIC_RELEASE_PLATFORM CONFIGS_GENERIC_OFFSET + 26
+ #else
+ const Platform SYSTEM_PLATFORM = PLATFORM_HAIKU64;
+ #define SYSTEM_PLATFORM_NAME "haiku64"
+ #define CONFIG_SYSTEM_PLATFORM CONFIGS_GENERIC_OFFSET + 27
+ #define CONFIG_STATIC_DEBUG_PLATFORM CONFIGS_GENERIC_OFFSET + 28
+ #define CONFIG_STATIC_RELEASE_PLATFORM CONFIGS_GENERIC_OFFSET + 29
+ #endif
+ #define CONFIG_STATIC_LIB_FILE_EXTENSION "a"
+ #define CONFIG_DYNAMIC_LIB_FILE_EXTENSION "so"
+
+ #define SYSTEM_GENERIC_PLATFORM_NAME "haiku"
+ #define CONFIG_GENERIC_SYSTEM_PLATFORM 15
+ #define CONFIG_GENERIC_STATIC_DEBUG_PLATFORM 16
+ #define CONFIG_GENERIC_STATIC_RELEASE_PLATFORM 17
#endif
const char* asString(OptimizationLevel optLevel);
diff --git a/include/Platform.hpp b/include/Platform.hpp
index 74b3a3d..ffe7038 100644
--- a/include/Platform.hpp
+++ b/include/Platform.hpp
@@ -27,7 +27,11 @@ namespace sibs
PLATFORM_BSD = 1 << 10,
PLATFORM_OPENBSD = 1 << 11 | PLATFORM_BSD,
PLATFORM_OPENBSD32 = 1 << 12 | PLATFORM_OPENBSD,
- PLATFORM_OPENBSD64 = 1 << 13 | PLATFORM_OPENBSD
+ PLATFORM_OPENBSD64 = 1 << 13 | PLATFORM_OPENBSD,
+
+ PLATFORM_HAIKU = 1 << 20,
+ PLATFORM_HAIKU32 = 1 << 21 | PLATFORM_HAIKU,
+ PLATFORM_HAIKU64 = 1 << 22 | PLATFORM_HAIKU
};
const StringViewMap<Platform> PLATFORM_BY_NAME = {
@@ -44,11 +48,14 @@ namespace sibs
{ "bsd", PLATFORM_BSD },
{ "openbsd", PLATFORM_OPENBSD },
{ "openbsd32", PLATFORM_OPENBSD32 },
- { "openbsd64", PLATFORM_OPENBSD64 }
+ { "openbsd64", PLATFORM_OPENBSD64 },
+ { "haiku", PLATFORM_HAIKU },
+ { "haiku32", PLATFORM_HAIKU32 },
+ { "haiku64", PLATFORM_HAIKU64 },
};
bool containsPlatform(const std::vector<Platform> &platforms, Platform platform);
const char* asString(Platform platform);
Platform getPlatformByName(StringView name);
bool isSamePlatformFamily(Platform a, Platform b);
-} \ No newline at end of file
+}
diff --git a/include/env.hpp b/include/env.hpp
index d8b444b..9cdaf9d 100644
--- a/include/env.hpp
+++ b/include/env.hpp
@@ -8,6 +8,7 @@
#define OS_TYPE_LINUX 1
#define OS_TYPE_APPLE 2
#define OS_TYPE_OPENBSD 2
+#define OS_TYPE_HAIKU 10
#if defined(_WIN32) || defined(_WIN64)
#if defined(_WIN64)
@@ -48,6 +49,11 @@
#define OS_TYPE OS_TYPE_OPENBSD
#endif
+#ifdef __HAIKU__
+ #define OS_FAMILY OS_FAMILY_POSIX
+ #define OS_TYPE OS_TYPE_HAIKU
+#endif
+
#if defined(__GNUC__)
#if defined(__x86_64__) || defined(__pc64__)
#define SIBS_ENV_64BIT
diff --git a/src/FileUtil.cpp b/src/FileUtil.cpp
index ae24996..4485878 100644
--- a/src/FileUtil.cpp
+++ b/src/FileUtil.cpp
@@ -16,7 +16,7 @@
using namespace std;
-#if OS_TYPE == OS_TYPE_OPENBSD
+#if OS_TYPE == OS_TYPE_OPENBSD || OS_TYPE == OS_TYPE_HAIKU
#define stat64 stat
#endif
diff --git a/src/Platform.cpp b/src/Platform.cpp
index 2df019c..9b02ca5 100644
--- a/src/Platform.cpp
+++ b/src/Platform.cpp
@@ -30,6 +30,9 @@ namespace sibs
case PLATFORM_OPENBSD: return "openbsd";
case PLATFORM_OPENBSD32: return "openbsd32";
case PLATFORM_OPENBSD64: return "openbsd64";
+ case PLATFORM_HAIKU: return "haiku";
+ case PLATFORM_HAIKU32: return "haiku32";
+ case PLATFORM_HAIKU64: return "haiku64";
default: return nullptr;
}
}
@@ -46,4 +49,4 @@ namespace sibs
{
return a & b;
}
-} \ No newline at end of file
+}