add Haiku OS cross-compile support

x86 and x86_64 both tested and working.
This commit is contained in:
Jaycie Ewald 2023-05-23 00:52:43 -05:00
parent 00d36583e7
commit c1e8a1e692
5 changed files with 54 additions and 3 deletions

View file

@ -10,6 +10,9 @@ DO_USERDIRS=0
### Enable/Disable SDL2 ### Enable/Disable SDL2
USE_SDL2=0 USE_SDL2=0
### Do we need to link the math library?
LINK_M=1
### Enable/Disable codecs for streaming music support ### Enable/Disable codecs for streaming music support
USE_CODEC_WAVE=1 USE_CODEC_WAVE=1
USE_CODEC_FLAC=0 USE_CODEC_FLAC=0
@ -109,6 +112,8 @@ SDL_LIBS := $(shell $(SDL_CONFIG) --libs)
ifeq ($(HOST_OS),sunos) ifeq ($(HOST_OS),sunos)
NET_LIBS :=-lsocket -lnsl -lresolv NET_LIBS :=-lsocket -lnsl -lresolv
else ifdef HAIKU_OS
NET_LIBS :=-lnetwork
else else
NET_LIBS := NET_LIBS :=
endif endif
@ -180,7 +185,11 @@ ifeq ($(USE_CODEC_UMX),1)
CFLAGS+= -DUSE_CODEC_UMX CFLAGS+= -DUSE_CODEC_UMX
endif endif
COMMON_LIBS:= -lm -lGL COMMON_LIBS:= -lGL
ifeq ($(LINK_M),1)
COMMON_LIBS += -lm
endif
LIBS := $(COMMON_LIBS) $(NET_LIBS) $(CODECLIBS) LIBS := $(COMMON_LIBS) $(NET_LIBS) $(CODECLIBS)

View file

@ -72,6 +72,12 @@
# define PLATFORM_RISCOS 1 # define PLATFORM_RISCOS 1
# endif # endif
#elif defined(__HAIKU__)
# if !defined(PLATFORM_HAIKU)
# define PLATFORM_HAIKU 1
# endif
#else /* here goes the unix platforms */ #else /* here goes the unix platforms */
#if defined(__unix) || defined(__unix__) || defined(unix) || \ #if defined(__unix) || defined(__unix__) || defined(unix) || \
@ -159,6 +165,8 @@
# define PLATFORM_STRING "RiscOS" # define PLATFORM_STRING "RiscOS"
#elif defined(__GNU__) #elif defined(__GNU__)
# define PLATFORM_STRING "GNU/Hurd" # define PLATFORM_STRING "GNU/Hurd"
#elif defined(PLATFORM_HAIKU)
# define PLATFORM_STRING "Haiku"
#elif defined(PLATFORM_UNIX) #elif defined(PLATFORM_UNIX)
# define PLATFORM_STRING "Unix" # define PLATFORM_STRING "Unix"
#else #else

View file

@ -0,0 +1,17 @@
#!/bin/sh
# Change this script to meet your needs and/or environment.
TARGET=i586-pc-haiku
MAKE_CMD=make
CC="$TARGET-gcc"
AS="$TARGET-as"
RANLIB="$TARGET-ranlib"
AR="$TARGET-ar"
STRIP="$TARGET-strip"
LDFLAGS=-L/usr/lib32 # hack
export CC AS AR RANLIB STRIP LDFLAGS
exec $MAKE_CMD HAIKU_OS=1 LINK_M=0 USE_SDL2=1 LDFLAGS=$LDFLAGS CC=$CC AS=$AS RANLIB=$RANLIB AR=$AR STRIP=$STRIP -f Makefile $*

View file

@ -0,0 +1,16 @@
#!/bin/sh
# Change this script to meet your needs and/or environment.
TARGET=x86_64-unknown-haiku
MAKE_CMD=make
CC="$TARGET-gcc"
AS="$TARGET-as"
RANLIB="$TARGET-ranlib"
AR="$TARGET-ar"
STRIP="$TARGET-strip"
export CC AS AR RANLIB STRIP
exec $MAKE_CMD HAIKU_OS=1 LINK_M=0 USE_SDL2=1 CC=$CC AS=$AS RANLIB=$RANLIB AR=$AR STRIP=$STRIP -f Makefile $*

View file

@ -31,7 +31,8 @@
#if defined(PLATFORM_BSD) || defined(PLATFORM_OSX) || \ #if defined(PLATFORM_BSD) || defined(PLATFORM_OSX) || \
defined(PLATFORM_AMIGA) /* bsdsocket.library */ || \ defined(PLATFORM_AMIGA) /* bsdsocket.library */ || \
defined(__GNU__) /* GNU/Hurd */ || defined(__riscos__) defined(__GNU__) /* GNU/Hurd */ || defined(__riscos__) || \
defined(PLATFORM_HAIKU) /* Haiku OS */
/* struct sockaddr has unsigned char sa_len as the first member in BSD /* struct sockaddr has unsigned char sa_len as the first member in BSD
* variants and the family member is also an unsigned char instead of an * variants and the family member is also an unsigned char instead of an
* unsigned short. This should matter only when PLATFORM_UNIX is defined, * unsigned short. This should matter only when PLATFORM_UNIX is defined,
@ -47,7 +48,7 @@
#endif /* BSD, sockaddr */ #endif /* BSD, sockaddr */
/* unix includes and compatibility macros */ /* unix includes and compatibility macros */
#if defined(PLATFORM_UNIX) || defined(PLATFORM_RISCOS) #if defined(PLATFORM_UNIX) || defined(PLATFORM_RISCOS) || defined(PLATFORM_HAIKU)
#include <sys/param.h> #include <sys/param.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>