mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-16 16:50:06 +02:00
120 lines
4.2 KiB
Plaintext
120 lines
4.2 KiB
Plaintext
From 56a7340a68473a078cc321d4c50bf8a0d1628efd Mon Sep 17 00:00:00 2001
|
|
From: Puck Meerburg <puck@puckipedia.nl>
|
|
Date: Sat, 17 Jan 2015 19:54:22 +0100
|
|
Subject: Fix Haiku build
|
|
|
|
|
|
diff --git a/Makefile b/Makefile
|
|
index 70f3e6d..96e38da 100644
|
|
--- a/Makefile
|
|
+++ b/Makefile
|
|
@@ -47,6 +47,9 @@ ifeq ($(findstring libretro,$(ui)),)
|
|
ifeq ($(platform),x)
|
|
flags += -march=native
|
|
link += -Wl,-export-dynamic -ldl -lX11 -lXext
|
|
+ else ifeq ($(platform),haiku)
|
|
+ flags += -march=native
|
|
+ link += -Wl,-export-dynamic
|
|
else ifeq ($(platform),win)
|
|
ifeq ($(arch),win32)
|
|
flags += -m32
|
|
diff --git a/nall/Makefile b/nall/Makefile
|
|
index 4e12a39..051cfe2 100755
|
|
--- a/nall/Makefile
|
|
+++ b/nall/Makefile
|
|
@@ -25,6 +25,9 @@ ifeq ($(platform),)
|
|
else ifneq ($(findstring Darwin,$(uname)),)
|
|
platform := osx
|
|
delete = rm -f $1
|
|
+ else ifneq ($(findstring Haiku,$(uname)),)
|
|
+ platform := haiku
|
|
+ delete = rm -f $1
|
|
else
|
|
platform := unix
|
|
delete = rm -f $1
|
|
diff --git a/nall/directory.hpp b/nall/directory.hpp
|
|
index 45a062c..d711554 100644
|
|
--- a/nall/directory.hpp
|
|
+++ b/nall/directory.hpp
|
|
@@ -190,12 +190,18 @@ private:
|
|
while(ep = readdir(dp)) {
|
|
if(!strcmp(ep->d_name, ".")) continue;
|
|
if(!strcmp(ep->d_name, "..")) continue;
|
|
+#if defined(PLATFORM_HAIKU)
|
|
+ struct stat sp = {0};
|
|
+ stat(string{pathname, ep->d_name}, &sp);
|
|
+ bool is_directory = S_ISDIR(sp.st_mode);
|
|
+#else
|
|
bool is_directory = ep->d_type & DT_DIR;
|
|
if(ep->d_type & DT_UNKNOWN) {
|
|
struct stat sp = {0};
|
|
stat(string{pathname, ep->d_name}, &sp);
|
|
is_directory = S_ISDIR(sp.st_mode);
|
|
}
|
|
+#endif
|
|
if(is_directory) {
|
|
if(strmatch(ep->d_name, pattern)) list.append(ep->d_name);
|
|
}
|
|
@@ -215,7 +221,13 @@ private:
|
|
while(ep = readdir(dp)) {
|
|
if(!strcmp(ep->d_name, ".")) continue;
|
|
if(!strcmp(ep->d_name, "..")) continue;
|
|
+#if defined(PLATFORM_HAIKU)
|
|
+ struct stat sp = {0};
|
|
+ stat(string{pathname, ep->d_name}, &sp);
|
|
+ if(S_ISDIR(sp.st_mode)) {
|
|
+#else
|
|
if((ep->d_type & DT_DIR) == 0) {
|
|
+#endif
|
|
if(strmatch(ep->d_name, pattern)) list.append(ep->d_name);
|
|
}
|
|
}
|
|
diff --git a/nall/intrinsics.hpp b/nall/intrinsics.hpp
|
|
index db44996..e3dc078 100755
|
|
--- a/nall/intrinsics.hpp
|
|
+++ b/nall/intrinsics.hpp
|
|
@@ -3,7 +3,7 @@
|
|
|
|
struct Intrinsics {
|
|
enum class Compiler : unsigned { Clang, GCC, VisualCPP, Unknown };
|
|
- enum class Platform : unsigned { Windows, MacOSX, X, Unknown }; //X = Linux, BSD, etc
|
|
+ enum class Platform : unsigned { Windows, MacOSX, X, BeAPI, Unknown }; //X = Linux, BSD, etc
|
|
enum class Architecture : unsigned { x86, amd64, ARM, Unknown };
|
|
enum class Endian : unsigned { LSB, MSB, Unknown };
|
|
|
|
@@ -38,6 +38,9 @@ struct Intrinsics {
|
|
#elif defined(linux) || defined(__linux__) || defined(__sun__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__GNU__)
|
|
#define PLATFORM_X
|
|
Intrinsics::Platform Intrinsics::platform() { return Intrinsics::Platform::X; }
|
|
+#elif defined(__HAIKU__)
|
|
+ #define PLATFORM_HAIKU
|
|
+ Intrinsics::Platform Intrinsics::platform() { return Intrinsics::Platform::BeAPI; }
|
|
#else
|
|
#warning "unable to detect platform"
|
|
#define PLATFORM_UNKNOWN
|
|
diff --git a/target-libretro/Makefile b/target-libretro/Makefile
|
|
index b923e2b..66bf743 100755
|
|
--- a/target-libretro/Makefile
|
|
+++ b/target-libretro/Makefile
|
|
@@ -7,6 +7,8 @@ output := libretro
|
|
|
|
ifeq ($(platform),unix)
|
|
flags += -fPIC
|
|
+else ifeq ($(platform),haiku)
|
|
+ flags += -fPIC
|
|
else ifeq ($(platform),osx)
|
|
flags += -fPIC
|
|
else ifeq ($(platform),ios)
|
|
@@ -35,6 +37,8 @@ obj/libretro.o: $(ui)/libretro.cpp $(ui)/*
|
|
build: $(objects)
|
|
ifeq ($(platform),unix)
|
|
$(compiler) -o out/bsnes_libretro.so -shared $(objects) -ldl -Wl,--no-undefined -Wl,--version-script=$(ui)/link.T
|
|
+else ifeq ($(platform),haiku)
|
|
+ $(compiler) -o out/bsnes_libretro.so -shared $(objects) -lnetwork -Wl,--no-undefined -Wl,--version-script=$(ui)/link.T
|
|
else ifeq ($(platform),ios)
|
|
$(compiler) -o out/bsnes_libretro_ios.dylib -dynamiclib $(objects) -isysroot $(IOSSDK) -arch armv7
|
|
else ifeq ($(platform),osx)
|
|
--
|
|
1.8.3.4
|
|
|