Initial Haiku support (#207)

* Initial Haiku support

* makefile support

* Makefile fix, add genie for Haiku64

* Revert testchanges
This commit is contained in:
miqlas
2019-06-16 18:04:56 +02:00
committed by Бранимир Караџић
parent c3fab81d8d
commit daab5c96e5
8 changed files with 59 additions and 12 deletions

View File

@@ -59,6 +59,7 @@
#define BX_PLATFORM_WINDOWS 0
#define BX_PLATFORM_WINRT 0
#define BX_PLATFORM_XBOXONE 0
#define BX_PLATFORM_HAIKU 0
// http://sourceforge.net/apps/mediawiki/predef/index.php?title=Compilers
#if defined(__clang__)
@@ -219,6 +220,9 @@
#elif defined(__NX__)
# undef BX_PLATFORM_NX
# define BX_PLATFORM_NX 1
#elif defined(__HAIKU__)
# undef BX_PLATFORM_HAIKU
# define BX_PLATFORM_HAIKU 1
#endif //
#if !BX_CRT_NONE
@@ -235,7 +239,7 @@
# elif defined(__MINGW32__) || defined(__MINGW64__)
# undef BX_CRT_MINGW
# define BX_CRT_MINGW 1
# elif defined(__apple_build_version__) || defined(__ORBIS__) || defined(__EMSCRIPTEN__) || defined(__llvm__)
# elif defined(__apple_build_version__) || defined(__ORBIS__) || defined(__EMSCRIPTEN__) || defined(__llvm__) || defined(__HAIKU__)
# undef BX_CRT_LIBCXX
# define BX_CRT_LIBCXX 1
# endif //
@@ -265,6 +269,7 @@
|| BX_PLATFORM_PS4 \
|| BX_PLATFORM_RPI \
|| BX_PLATFORM_STEAMLINK \
|| BX_PLATFORM_HAIKU \
)
///
@@ -283,6 +288,7 @@
|| BX_PLATFORM_WINDOWS \
|| BX_PLATFORM_WINRT \
|| BX_PLATFORM_XBOXONE \
|| BX_PLATFORM_HAIKU \
)
///
@@ -300,6 +306,7 @@
|| BX_PLATFORM_LINUX \
|| BX_PLATFORM_OSX \
|| BX_PLATFORM_WINDOWS \
|| BX_PLATFORM_HAIKU \
)
///
@@ -382,6 +389,8 @@
# define BX_PLATFORM_NAME "WinRT"
#elif BX_PLATFORM_XBOXONE
# define BX_PLATFORM_NAME "Xbox One"
#elif BX_PLATFORM_HAIKU
# define BX_PLATFORM_NAME "Haiku"
#else
# error "Unknown BX_PLATFORM!"
#endif // BX_PLATFORM_

View File

@@ -12,6 +12,7 @@ all:
$(GENIE) --gcc=android-x86 gmake
$(GENIE) --gcc=mingw-gcc gmake
$(GENIE) --gcc=linux-gcc gmake
$(GENIE) --gcc=haiku gmake
$(GENIE) --gcc=osx gmake
$(GENIE) --gcc=ios-arm gmake
$(GENIE) --gcc=ios-simulator gmake
@@ -50,6 +51,14 @@ linux-release64: .build/projects/gmake-linux
make -R -C .build/projects/gmake-linux config=release64
linux: linux-debug64 linux-release64
.build/projects/gmake-haiku:
$(GENIE) --gcc=haiku gmake
haiku-debug64: .build/projects/gmake-haiku
make -R -C .build/projects/gmake-haiku config=debug64
haiku-release64: .build/projects/gmake-haiku
make -R -C .build/projects/gmake-haiku config=release64
haiku: haiku-debug64 haiku-release64
.build/projects/gmake-mingw-gcc:
$(GENIE) --gcc=mingw-gcc gmake
mingw-gcc-debug32: .build/projects/gmake-mingw-gcc
@@ -130,7 +139,8 @@ clean:
SILENT ?= @
UNAME := $(shell uname)
ifeq ($(UNAME),$(filter $(UNAME),Linux GNU Darwin))
ifeq ($(UNAME),$(filter $(UNAME),Linux GNU Darwin Haiku))
ifeq ($(UNAME),$(filter $(UNAME),Darwin Haiku))
ifeq ($(UNAME),$(filter $(UNAME),Darwin))
OS=darwin
BUILD_PROJECT_DIR=gmake-osx
@@ -138,6 +148,13 @@ BUILD_OUTPUT_DIR=osx64_clang
BUILD_TOOLS_CONFIG=release64
EXE=
else
OS=haiku
BUILD_PROJECT_DIR=gmake-haiku
BUILD_OUTPUT_DIR=haiku64_gcc
BUILD_TOOLS_CONFIG=release64
EXE=
endif
else
OS=linux
BUILD_PROJECT_DIR=gmake-linux
BUILD_OUTPUT_DIR=linux64_gcc
@@ -165,6 +182,12 @@ tools/bin/darwin/bin2c: .build/osx64_clang/bin/bin2cRelease
tools/bin/linux/bin2c: .build/linux64_gcc/bin/bin2cRelease
$(SILENT) cp $(<) $(@)
.build/haiku64_gcc/bin/bin2cRelease: .build/projects/gmake-haiku
$(SILENT) make -C .build/projects/gmake-haiku bin2c config=$(BUILD_TOOLS_CONFIG)
tools/bin/haiku/bin2c: .build/haiku64_gcc/bin/bin2cRelease
$(SILENT) cp $(<) $(@)
.build/win64_mingw-gcc/bin/bin2cRelease.exe: .build/projects/gmake-mingw-gcc
$(SILENT) make -C .build/projects/gmake-mingw-gcc bin2c config=$(BUILD_TOOLS_CONFIG)
@@ -186,6 +209,12 @@ tools/bin/darwin/lemon: .build/osx64_clang/bin/lemonRelease
tools/bin/linux/lemon: .build/linux64_gcc/bin/lemonRelease
$(SILENT) cp $(<) $(@)
.build/haiku64_gcc/bin/lemonRelease: .build/projects/gmake-haiku
$(SILENT) make -C .build/projects/gmake-haiku lemon config=$(BUILD_TOOLS_CONFIG)
tools/bin/haiku/lemon: .build/haiku64_gcc/bin/lemonRelease
$(SILENT) cp $(<) $(@)
.build/win64_mingw-gcc/bin/lemonRelease.exe: .build/projects/gmake-mingw-gcc
$(SILENT) make -C .build/projects/gmake-mingw-gcc lemon config=$(BUILD_TOOLS_CONFIG)
@@ -199,7 +228,7 @@ lemon: tools/bin/$(OS)/lemon$(EXE) tools/bin/$(OS)/lempar.c
tools: bin2c lemon
dist: tools/bin/darwin/bin2c tools/bin/linux/bin2c tools/bin/windows/bin2c.exe
dist: tools/bin/darwin/bin2c tools/bin/linux/bin2c tools/bin/windows/bin2c.exe tools/bin/haiku/bin2c
.build/$(BUILD_OUTPUT_DIR)/bin/bx.testRelease$(EXE): .build/projects/$(BUILD_PROJECT_DIR)
$(SILENT) make -C .build/projects/$(BUILD_PROJECT_DIR) bx.test config=$(BUILD_TOOLS_CONFIG)

View File

@@ -73,6 +73,7 @@ function toolchain(_buildDir, _libDir)
{ "orbis", "Orbis" },
{ "riscv", "RISC-V" },
{ "rpi", "RaspberryPi" },
{ "haiku", "Haiku" },
},
}

View File

@@ -75,7 +75,8 @@ namespace bx
|| BX_PLATFORM_ANDROID \
|| BX_PLATFORM_BSD \
|| BX_PLATFORM_IOS \
|| BX_PLATFORM_OSX
|| BX_PLATFORM_OSX \
|| BX_PLATFORM_HAIKU
# define fseeko64 fseeko
# define ftello64 ftello
# elif BX_PLATFORM_PS4

View File

@@ -16,7 +16,8 @@
|| BX_PLATFORM_IOS \
|| BX_PLATFORM_OSX \
|| BX_PLATFORM_PS4 \
|| BX_PLATFORM_RPI
|| BX_PLATFORM_RPI \
|| BX_PLATFORM_HAIKU
# include <pthread.h>
#elif BX_PLATFORM_WINDOWS \
|| BX_PLATFORM_WINRT \

View File

@@ -27,13 +27,15 @@
|| BX_PLATFORM_PS4 \
|| BX_PLATFORM_RPI \
|| BX_PLATFORM_STEAMLINK \
|| BX_PLATFORM_NX
|| BX_PLATFORM_NX \
|| BX_PLATFORM_HAIKU
# include <sched.h> // sched_yield
# if BX_PLATFORM_BSD \
|| BX_PLATFORM_IOS \
|| BX_PLATFORM_OSX \
|| BX_PLATFORM_PS4 \
|| BX_PLATFORM_STEAMLINK
# if BX_PLATFORM_BSD \
|| BX_PLATFORM_IOS \
|| BX_PLATFORM_OSX \
|| BX_PLATFORM_PS4 \
|| BX_PLATFORM_STEAMLINK \
|| BX_PLATFORM_HAIKU
# include <pthread.h> // mach_port_t
# endif // BX_PLATFORM_*
@@ -50,6 +52,9 @@
# include <stdio.h> // fopen
# include <unistd.h> // syscall
# include <sys/syscall.h>
# elif BX_PLATFORM_HAIKU
# include <stdio.h> // fopen
# include <unistd.h> // syscall
# elif BX_PLATFORM_OSX
# include <mach/mach.h> // mach_task_basic_info
# elif BX_PLATFORM_HURD

View File

@@ -19,7 +19,8 @@
|| BX_PLATFORM_IOS \
|| BX_PLATFORM_OSX \
|| BX_PLATFORM_PS4 \
|| BX_PLATFORM_RPI
|| BX_PLATFORM_RPI \
|| BX_PLATFORM_HAIKU
# include <pthread.h>
# if defined(__FreeBSD__)
# include <pthread_np.h>

BIN
tools/bin/haiku/genie Executable file

Binary file not shown.