Merge pull request #905 from heuripedes/haiku

Haiku fixes
This commit is contained in:
Twinaphex 2014-08-28 19:14:32 +02:00
commit f8fa302d8a
5 changed files with 59 additions and 15 deletions

View File

@ -74,6 +74,11 @@ HEADERS = $(wildcard */*/*.h) $(wildcard */*.h) $(wildcard *.h)
ifeq ($(findstring Haiku,$(OS)),)
LIBS = -lm
DEBUG_FLAG = -g
else
LIBS = -lroot -lnetwork
# stable and nightly haiku builds are stuck on gdb 6.x but we use gcc4
DEBUG_FLAG = -gdwarf-2
endif
DEFINES = -DHAVE_CONFIG_H -DRARCH_INTERNAL -DHAVE_CC_RESAMPLER -DHAVE_OVERLAY
@ -431,7 +436,7 @@ ifeq ($(GL_DEBUG), 1)
CXXFLAGS += -DGL_DEBUG
endif
CFLAGS += -Wall $(OPTIMIZE_FLAG) $(INCLUDE_DIRS) -g -I.
CFLAGS += -Wall $(OPTIMIZE_FLAG) $(INCLUDE_DIRS) $(DEBUG_FLAG) -I.
ifeq ($(CXX_BUILD), 1)
LINK = $(CXX)
CFLAGS += -std=c++0x -xc++ -D__STDC_CONSTANT_MACROS

View File

@ -23,6 +23,10 @@
#include "compat/posix_string.h"
#include "miscellaneous.h"
#ifdef __HAIKU__
#include <kernel/image.h>
#endif
#if (defined(__CELLOS_LV2__) && !defined(__PSL1GHT__)) || defined(__QNX__) || defined(PSP)
#include <unistd.h> //stat() is defined here
#endif
@ -874,6 +878,18 @@ void fill_pathname_application_path(char *buf, size_t size)
rarch_assert(strlcat(buf, "nobin", size) < size);
return;
}
#elif defined(__HAIKU__)
image_info info;
int32 cookie = 0;
while (get_next_image_info(0, &cookie, &info) == B_OK)
{
if (info.type == B_APP_IMAGE)
{
strlcpy(buf, info.name, size);
return;
}
}
#else
*buf = '\0';
pid_t pid = getpid();

View File

@ -10,12 +10,18 @@ add_define_make NOUNUSED_VARIABLE "$HAVE_NOUNUSED_VARIABLE"
[ -z "$CROSS_COMPILE" ] && [ -d /opt/local/lib ] && add_library_dirs /opt/local/lib
DYLIB=-ldl;
CLIB=-lc
PTHREADLIB=-lpthread
SOCKETLIB=-lc
if [ "$OS" = 'BSD' ]; then
DYLIB=-lc;
elif [ "$OS" = 'Haiku' ]; then
DYLIB="";
else
DYLIB=-ldl;
DYLIB=""
CLIB=-lroot
PTHREADLIB=-lroot
SOCKETLIB=-lnetwork
fi
add_define_make DYLIB_LIB "$DYLIB"
@ -107,13 +113,13 @@ else
add_define_make MAN_DIR "${PREFIX}/share/man/man1"
fi
check_lib THREADS -lpthread pthread_create
check_lib THREADS "$PTHREADLIB" pthread_create
check_lib DYLIB "$DYLIB" dlopen
check_lib NETPLAY -lc socket
check_lib NETPLAY "$SOCKETLIB" socket
if [ "$HAVE_NETPLAY" = 'yes' ]; then
HAVE_GETADDRINFO=auto
check_lib GETADDRINFO -lc getaddrinfo
check_lib GETADDRINFO "$SOCKETLIB" getaddrinfo
if [ "$HAVE_GETADDRINFO" = 'yes' ]; then
HAVE_SOCKET_LEGACY='no'
else
@ -124,7 +130,7 @@ else
HAVE_NETWORK_CMD='no'
fi
check_lib STDIN_CMD -lc fcntl
check_lib STDIN_CMD "$CLIB" fcntl
if [ "$HAVE_NETWORK_CMD" = "yes" ] || [ "$HAVE_STDIN_CMD" = "yes" ]; then
HAVE_COMMAND='yes'
@ -132,7 +138,7 @@ else
HAVE_COMMAND='no'
fi
check_lib GETOPT_LONG -lc getopt_long
check_lib GETOPT_LONG "$CLIB" getopt_long
if [ "$HAVE_DYLIB" = 'no' ] && [ "$HAVE_DYNAMIC" = 'yes' ]; then
echo "Dynamic loading of libretro is enabled, but your platform does not appear to have dlopen(), use --disable-dynamic or --with-libretro=\"-lretro\"".
@ -277,9 +283,9 @@ if [ "$HAVE_UDEV" != "no" ]; then
fi
fi
check_lib STRL -lc strlcpy
check_lib STRCASESTR -lc strcasestr
check_lib MMAP -lc mmap
check_lib STRL "$CLIB" strlcpy
check_lib STRCASESTR "$CLIB" strcasestr
check_lib MMAP "$CLIB" mmap
check_pkgconf PYTHON python3

View File

@ -830,12 +830,17 @@ static int16_t input_state(unsigned port, unsigned device,
return res;
}
#if !defined(_WIN32) && !defined(GLOBAL_CONFIG_DIR)
#if defined(__HAIKU__)
#define GLOBAL_CONFIG_DIR "/system/settings"
#else
#define GLOBAL_CONFIG_DIR "/etc"
#endif
#endif
#ifdef _WIN32
#define RARCH_DEFAULT_CONF_PATH_STR "\n\t\tDefaults to retroarch.cfg in same directory as retroarch.exe.\n\t\tIf a default config is not found, RetroArch will attempt to create one."
#else
#ifndef GLOBAL_CONFIG_DIR
#define GLOBAL_CONFIG_DIR "/etc"
#endif
#define RARCH_DEFAULT_CONF_PATH_STR "\n\t\tBy default looks for config in $XDG_CONFIG_HOME/retroarch/retroarch.cfg,\n\t\t$HOME/.config/retroarch/retroarch.cfg,\n\t\tand $HOME/.retroarch.cfg.\n\t\tIf a default config is not found, RetroArch will attempt to create one based on the skeleton config (" GLOBAL_CONFIG_DIR "/retroarch.cfg)."
#endif

View File

@ -665,7 +665,11 @@ static config_file_t *open_default_config_file(void)
if (xdg)
fill_pathname_join(conf_path, xdg, "retroarch/retroarch.cfg", sizeof(conf_path));
else if (home)
#ifdef __HAIKU__
fill_pathname_join(conf_path, home, "config/settings/retroarch/retroarch.cfg", sizeof(conf_path));
#else
fill_pathname_join(conf_path, home, ".config/retroarch/retroarch.cfg", sizeof(conf_path));
#endif
if (xdg || home)
{
@ -688,7 +692,11 @@ static config_file_t *open_default_config_file(void)
if (xdg)
fill_pathname_join(conf_path, xdg, "retroarch/retroarch.cfg", sizeof(conf_path));
else if (home)
#ifdef __HAIKU__
fill_pathname_join(conf_path, home, "config/settings/retroarch/retroarch.cfg", sizeof(conf_path));
#else
fill_pathname_join(conf_path, home, ".config/retroarch/retroarch.cfg", sizeof(conf_path));
#endif
char basedir[PATH_MAX];
fill_pathname_basedir(basedir, conf_path, sizeof(basedir));
@ -696,7 +704,11 @@ static config_file_t *open_default_config_file(void)
if (path_mkdir(basedir))
{
#ifndef GLOBAL_CONFIG_DIR
#if defined(__HAIKU__)
#define GLOBAL_CONFIG_DIR "/system/settings"
#else
#define GLOBAL_CONFIG_DIR "/etc"
#endif
#endif
char skeleton_conf[PATH_MAX];
fill_pathname_join(skeleton_conf, GLOBAL_CONFIG_DIR, "retroarch.cfg", sizeof(skeleton_conf));