Teewolds: bump version

* add application icon
* add haiku platform (don't use beos platform config)
This commit is contained in:
Gerasim Troeglazov
2021-04-13 13:36:54 +10:00
parent ad5c95566e
commit d5f0ac9347
7 changed files with 308 additions and 835 deletions

View File

@@ -0,0 +1,43 @@
resource app_flags B_MULTIPLE_LAUNCH;
resource app_version {
major = @MAJOR@,
middle = @MIDDLE@,
minor = @MINOR@,
variety = B_APPV_FINAL,
internal = 0,
short_info = "TeeWorlds",
long_info = "@LONG_INFO@"
};
resource app_signature "@APP_SIGNATURE@";
resource vector_icon array {
$"6E6369660A020106033D97BB3CFFE1BD2CA43DCD5948CA7448296200FFE9C09B"
$"FFBC36FF94630402000602395DDE3784F5BC4B5A3E31DF48AAA149B90E00FFE9"
$"C0FFA76C04020006023A6CEC38CB15BA30203BCCBD4B51DA4A109400FFE9C0FF"
$"CA82050200060234BB8739918FBC273B374C2D481C7B49E48300FFE9C0FFCA82"
$"05050102000604B6B31638945BBB07F3B92C0F4A858E48EA4C00D9F0FB378E8E"
$"8E63FFFFFFAF00AAFF02000606AE8FC836C3E7BB6A4CB329ED4ABEF2441BEF00"
$"7F4C0038472A01637F4C0093492C01C17F4C00FF4227010200060338D67CB956"
$"193B90063B07C24B43CB45DBA5003B2301777F4C00FF492C0304006801C90505"
$"CC120204412C4C2C362C2C402C352C4B405435544B545440544B543502023648"
$"3144BF12C5952D543E56B3CFC7340202494FC6C6C2493F595159475E5FC6EB02"
$"0244344132C2B5BBE13F3E43403B3C02033B363B363A3A353B373BBA693B3831"
$"3333383106032E55375441C56ABE2C5B475D3C0A0A2F2537283927553555375E"
$"3E5E43563E352F302B061046C446C453222451264F284D532EC637B779563159"
$"33315B2F5D2D5F5926CB09B669C873B46B060CE219394222454628492849B649"
$"49B62529462A2D432A41294128C022B633C029B62C430604FA4D374A355925C9"
$"A8B50BCA2AB4895B275C26C94CB6FF02022740273B27472D3FB7B6C1722F3606"
$"05BA03364639493E47BD11C34B434543453E454544BD45C1FB08075B3E5C3C5A"
$"3A593C5A3A5739563B08015A3A02044030C34530BC3A30304030BC3A30C34540"
$"50BC3A50C34550504050C34550BC3A08023127372A04032E2851295426C75AB7"
$"F8C824375504032E4258485C435CC4CE5C55550F0A08010E0241700000000000"
$"00003EE000C8900049B0000A040900010205060708090A301E2201178422040A"
$"010109201E220A070107201E220A060108201E220A03010A201E220A05010620"
$"1E220A010101201E220A040100301E2201178422040A000100201E220A020202"
$"05201E220A040303040B201E220A03010C301E2201178122040A09010F301E22"
$"01178122040A08021110100117812204"
};

View File

@@ -1,379 +0,0 @@
From 27950899779fdeb095267cb224cddf0cf616a1d7 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Sat, 26 Mar 2016 12:14:46 +0100
Subject: applying patch teeworlds-0.6.3.patch
diff --git a/bam.lua b/bam.lua
index 3ac85f3..f7588bc 100644
--- a/bam.lua
+++ b/bam.lua
@@ -184,6 +184,12 @@ function build(settings)
settings.link.libs:Add("ws2_32")
settings.link.libs:Add("ole32")
settings.link.libs:Add("shell32")
+ elseif family == "beos" and platform == "haiku" then
+ settings.link.libs:Add("be")
+ settings.link.libs:Add("root")
+ settings.link.libs:Add("network")
+ settings.link.libs:Add("GL");
+ settings.link.libs:Add("GLU");
end
-- compile zlib if needed
diff --git a/src/base/detect.h b/src/base/detect.h
index 0e2ef86..948d3aa 100644
--- a/src/base/detect.h
+++ b/src/base/detect.h
@@ -68,7 +68,7 @@
#endif
/* beos family */
-#if defined(__BeOS) || defined(__BEOS__)
+#if defined(__BeOS) || defined(__BEOS__) || defined(__HAIKU__)
#define CONF_FAMILY_BEOS 1
#define CONF_FAMILY_STRING "beos"
#define CONF_PLATFORM_BEOS 1
diff --git a/src/base/system.c b/src/base/system.c
index ca64007..31a2ba9 100644
--- a/src/base/system.c
+++ b/src/base/system.c
@@ -9,7 +9,7 @@
#include "system.h"
-#if defined(CONF_FAMILY_UNIX)
+#if defined(CONF_FAMILY_UNIX) || defined(CONF_FAMILY_BEOS)
#include <sys/time.h>
#include <unistd.h>
@@ -372,7 +372,7 @@ int io_flush(IOHANDLE io)
void *thread_init(void (*threadfunc)(void *), void *u)
{
-#if defined(CONF_FAMILY_UNIX)
+#if defined(CONF_FAMILY_UNIX) || defined(CONF_FAMILY_BEOS)
pthread_t id;
pthread_create(&id, NULL, (void *(*)(void*))threadfunc, u);
return (void*)id;
@@ -385,7 +385,7 @@ void *thread_init(void (*threadfunc)(void *), void *u)
void thread_wait(void *thread)
{
-#if defined(CONF_FAMILY_UNIX)
+#if defined(CONF_FAMILY_UNIX) || defined(CONF_FAMILY_BEOS)
pthread_join((pthread_t)thread, NULL);
#elif defined(CONF_FAMILY_WINDOWS)
WaitForSingleObject((HANDLE)thread, INFINITE);
@@ -396,7 +396,7 @@ void thread_wait(void *thread)
void thread_destroy(void *thread)
{
-#if defined(CONF_FAMILY_UNIX)
+#if defined(CONF_FAMILY_UNIX) || defined(CONF_FAMILY_BEOS)
void *r = 0;
pthread_join((pthread_t)thread, &r);
#else
@@ -406,7 +406,7 @@ void thread_destroy(void *thread)
void thread_yield()
{
-#if defined(CONF_FAMILY_UNIX)
+#if defined(CONF_FAMILY_UNIX) || defined(CONF_FAMILY_BEOS)
sched_yield();
#elif defined(CONF_FAMILY_WINDOWS)
Sleep(0);
@@ -417,7 +417,7 @@ void thread_yield()
void thread_sleep(int milliseconds)
{
-#if defined(CONF_FAMILY_UNIX)
+#if defined(CONF_FAMILY_UNIX) || defined(CONF_FAMILY_BEOS)
usleep(milliseconds*1000);
#elif defined(CONF_FAMILY_WINDOWS)
Sleep(milliseconds);
@@ -428,7 +428,7 @@ void thread_sleep(int milliseconds)
void thread_detach(void *thread)
{
-#if defined(CONF_FAMILY_UNIX)
+#if defined(CONF_FAMILY_UNIX) || defined(CONF_FAMILY_BEOS)
pthread_detach((pthread_t)(thread));
#elif defined(CONF_FAMILY_WINDOWS)
CloseHandle(thread);
@@ -440,7 +440,7 @@ void thread_detach(void *thread)
-#if defined(CONF_FAMILY_UNIX)
+#if defined(CONF_FAMILY_UNIX) || defined(CONF_FAMILY_BEOS)
typedef pthread_mutex_t LOCKINTERNAL;
#elif defined(CONF_FAMILY_WINDOWS)
typedef CRITICAL_SECTION LOCKINTERNAL;
@@ -452,7 +452,7 @@ LOCK lock_create()
{
LOCKINTERNAL *lock = (LOCKINTERNAL*)mem_alloc(sizeof(LOCKINTERNAL), 4);
-#if defined(CONF_FAMILY_UNIX)
+#if defined(CONF_FAMILY_UNIX) || defined(CONF_FAMILY_BEOS)
pthread_mutex_init(lock, 0x0);
#elif defined(CONF_FAMILY_WINDOWS)
InitializeCriticalSection((LPCRITICAL_SECTION)lock);
@@ -464,7 +464,7 @@ LOCK lock_create()
void lock_destroy(LOCK lock)
{
-#if defined(CONF_FAMILY_UNIX)
+#if defined(CONF_FAMILY_UNIX) || defined(CONF_FAMILY_BEOS)
pthread_mutex_destroy((LOCKINTERNAL *)lock);
#elif defined(CONF_FAMILY_WINDOWS)
DeleteCriticalSection((LPCRITICAL_SECTION)lock);
@@ -476,7 +476,7 @@ void lock_destroy(LOCK lock)
int lock_trylock(LOCK lock)
{
-#if defined(CONF_FAMILY_UNIX)
+#if defined(CONF_FAMILY_UNIX) || defined(CONF_FAMILY_BEOS)
return pthread_mutex_trylock((LOCKINTERNAL *)lock);
#elif defined(CONF_FAMILY_WINDOWS)
return !TryEnterCriticalSection((LPCRITICAL_SECTION)lock);
@@ -487,7 +487,7 @@ int lock_trylock(LOCK lock)
void lock_wait(LOCK lock)
{
-#if defined(CONF_FAMILY_UNIX)
+#if defined(CONF_FAMILY_UNIX) || defined(CONF_FAMILY_BEOS)
pthread_mutex_lock((LOCKINTERNAL *)lock);
#elif defined(CONF_FAMILY_WINDOWS)
EnterCriticalSection((LPCRITICAL_SECTION)lock);
@@ -498,7 +498,7 @@ void lock_wait(LOCK lock)
void lock_unlock(LOCK lock)
{
-#if defined(CONF_FAMILY_UNIX)
+#if defined(CONF_FAMILY_UNIX) || defined(CONF_FAMILY_BEOS)
pthread_mutex_unlock((LOCKINTERNAL *)lock);
#elif defined(CONF_FAMILY_WINDOWS)
LeaveCriticalSection((LPCRITICAL_SECTION)lock);
@@ -508,7 +508,7 @@ void lock_unlock(LOCK lock)
}
#if !defined(CONF_PLATFORM_MACOSX)
- #if defined(CONF_FAMILY_UNIX)
+ #if defined(CONF_FAMILY_UNIX) || defined(CONF_FAMILY_BEOS)
void semaphore_init(SEMAPHORE *sem) { sem_init(sem, 0, 0); }
void semaphore_wait(SEMAPHORE *sem) { sem_wait(sem); }
void semaphore_signal(SEMAPHORE *sem) { sem_post(sem); }
@@ -527,7 +527,7 @@ void lock_unlock(LOCK lock)
/* ----- time ----- */
int64 time_get()
{
-#if defined(CONF_FAMILY_UNIX)
+#if defined(CONF_FAMILY_UNIX) || defined(CONF_FAMILY_BEOS)
struct timeval val;
gettimeofday(&val, NULL);
return (int64)val.tv_sec*(int64)1000000+(int64)val.tv_usec;
@@ -546,7 +546,7 @@ int64 time_get()
int64 time_freq()
{
-#if defined(CONF_FAMILY_UNIX)
+#if defined(CONF_FAMILY_UNIX) || defined(CONF_FAMILY_BEOS)
return 1000000;
#elif defined(CONF_FAMILY_WINDOWS)
int64 t;
@@ -1373,6 +1373,16 @@ int fs_storage_path(const char *appname, char *path, int max)
return -1;
_snprintf(path, max, "%s/%s", home, appname);
return 0;
+#elif defined(CONF_FAMILY_BEOS)
+ #include <FindDirectory.h>
+
+ dev_t device = (dev_t)-1;
+ char *datadir;
+
+ status_t status = find_directory(B_USER_DATA_DIRECTORY, device, false, datadir, max);
+ if (status < B_OK) return -1;
+ snprintf(path, max, "%s/%s", datadir, appname);
+ return 0;
#else
char *home = getenv("HOME");
#if !defined(CONF_PLATFORM_MACOSX)
@@ -1814,7 +1824,7 @@ void gui_messagebox(const char *title, const char *message)
&theItem);
RunStandardAlert(theItem, NULL, &itemIndex);
-#elif defined(CONF_FAMILY_UNIX)
+#elif defined(CONF_FAMILY_UNIX) || defined(CONF_FAMILY_BEOS)
static char cmd[1024];
int err;
/* use xmessage which is available on nearly every X11 system */
diff --git a/src/base/system.h b/src/base/system.h
index ec20809..1a1151c 100644
--- a/src/base/system.h
+++ b/src/base/system.h
@@ -411,7 +411,7 @@ void lock_unlock(LOCK lock);
/* Group: Semaphores */
#if !defined(CONF_PLATFORM_MACOSX)
- #if defined(CONF_FAMILY_UNIX)
+ #if defined(CONF_FAMILY_UNIX) || defined(CONF_FAMILY_BEOS)
#include <semaphore.h>
typedef sem_t SEMAPHORE;
#elif defined(CONF_FAMILY_WINDOWS)
diff --git a/src/engine/client/backend_sdl.cpp b/src/engine/client/backend_sdl.cpp
index 821249f..19e4418 100644
--- a/src/engine/client/backend_sdl.cpp
+++ b/src/engine/client/backend_sdl.cpp
@@ -1,6 +1,6 @@
-#include "SDL.h"
-#include "SDL_opengl.h"
+#include <SDL/SDL.h>
+#include <SDL/SDL_opengl.h>
#include <base/tl/threading.h>
diff --git a/src/engine/client/backend_sdl.h b/src/engine/client/backend_sdl.h
index e90f945..676141c 100644
--- a/src/engine/client/backend_sdl.h
+++ b/src/engine/client/backend_sdl.h
@@ -1,12 +1,12 @@
-#include "SDL.h"
-#include "SDL_opengl.h"
+#include <SDL/SDL.h>
+#include <SDL/SDL_opengl.h>
#include "graphics_threaded.h"
-// platform dependent implementations for transfering render context from the main thread to the graphics thread
+// platform dependent implementations for transfering render Context from the main thread to the graphics thread
// TODO: when SDL 1.3 comes, this can be removed
#if defined(CONF_FAMILY_WINDOWS)
struct SGLContext
@@ -49,7 +49,7 @@
{
SGLContext Context;
Class NSOpenGLContextClass = (Class) objc_getClass("NSOpenGLContext");
- SEL selector = sel_registerName("currentContext");
+ SEL selector = sel_reg0isterName("currentContext");
Context.m_Context = objc_msgSend((objc_object*) NSOpenGLContextClass, selector);
return Context;
}
@@ -117,6 +117,29 @@
static void GL_MakeCurrent(const SGLContext &Context) { glXMakeCurrent(Context.m_pDisplay, Context.m_Drawable, Context.m_Context); }
static void GL_ReleaseContext(const SGLContext &Context) { glXMakeCurrent(Context.m_pDisplay, None, 0x0); }
static void GL_SwapBuffers(const SGLContext &Context) { glXSwapBuffers(Context.m_pDisplay, Context.m_Drawable); }
+#elif defined(CONF_FAMILY_BEOS)
+
+ #include <Application.h>
+ #include <opengl/GLView.h>
+
+ struct SGLContext
+ {
+ BGLView* view;
+ };
+
+ static SGLContext GL_GetCurrentContext()
+ {
+ SGLContext Context;
+
+ BApplication *be_app = new BApplication("application/x-vnd.tw-teeworlds");
+
+ Context.view = ((BGLView*) be_app->WindowAt(0)->ChildAt(0));
+ return Context;
+ }
+
+ static void GL_MakeCurrent(const SGLContext &Context) { Context.view->LockGL(); }
+ static void GL_ReleaseContext(const SGLContext &Context) { Context.view->UnlockGL(); }
+ static void GL_SwapBuffers(const SGLContext &Context) { Context.view->SwapBuffers(); }
#else
#error missing implementation
#endif
--
2.13.1
From e1905a7df75721c4940deecc45b18f2ad29c8e5e Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Sat, 26 Mar 2016 12:21:33 +0100
Subject: Fix the build.
- including an header in the middle of a function usually isn't a good
idea.
- use find_path instead of find_directory so the app can find the data
where the package is installed.
diff --git a/src/base/system.c b/src/base/system.c
index 31a2ba9..ed5425c 100644
--- a/src/base/system.c
+++ b/src/base/system.c
@@ -48,6 +48,10 @@
#include <sys/filio.h>
#endif
+#if defined(CONF_FAMILY_BEOS)
+ #include <FindDirectory.h>
+#endif
+
#if defined(__cplusplus)
extern "C" {
#endif
@@ -1374,14 +1378,10 @@ int fs_storage_path(const char *appname, char *path, int max)
_snprintf(path, max, "%s/%s", home, appname);
return 0;
#elif defined(CONF_FAMILY_BEOS)
- #include <FindDirectory.h>
-
- dev_t device = (dev_t)-1;
- char *datadir;
-
- status_t status = find_directory(B_USER_DATA_DIRECTORY, device, false, datadir, max);
- if (status < B_OK) return -1;
- snprintf(path, max, "%s/%s", datadir, appname);
+ status_t status = find_path(fs_storage_path, B_FIND_PATH_DATA_DIRECTORY,
+ appname, path, max);
+ if (status < B_OK)
+ return -1;
return 0;
#else
char *home = getenv("HOME");
--
2.13.1
From 9c7ac8d3b3cdda2516d8d5ab78245ba0d0847bf2 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Fri, 29 Sep 2017 20:19:25 +0200
Subject: fix x86_64
diff --git a/src/base/system.h b/src/base/system.h
index 1a1151c..02fa86c 100644
--- a/src/base/system.h
+++ b/src/base/system.h
@@ -431,10 +431,18 @@ void lock_unlock(LOCK lock);
/* if compiled with -pedantic-errors it will complain about long
not being a C90 thing.
*/
+#ifdef __x86_64__
+__extension__ typedef long int64;
+#else
__extension__ typedef long long int64;
+#endif
+#else
+#ifdef __x86_64__
+typedef long int64;
#else
typedef long long int64;
#endif
+#endif
/*
Function: time_get
Fetches a sample from a high resolution timer.
--
2.13.1

View File

@@ -0,0 +1,172 @@
From 7a12e331f2f9f46df9983796f71d5104ff045c08 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Tue, 13 Apr 2021 12:49:21 +1000
Subject: Add haiku support
diff --git a/CMakeLists.txt b/CMakeLists.txt
old mode 100755
new mode 100644
index 65dfdd3..9cf07fb
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -60,6 +60,8 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
set(TARGET_OS "windows")
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(TARGET_OS "linux")
+elseif(CMAKE_SYSTEM_NAME STREQUAL "Haiku")
+ set(TARGET_OS "haiku")
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set(TARGET_OS "mac")
endif()
@@ -149,7 +151,7 @@ function(add_c_compiler_flag_if_supported VARIABLE FLAG)
endif()
endfunction()
-if(NOT MSVC)
+if(NOT MSVC AND NOT HAIKU)
# Protect the stack pointer.
# -fstack-protector-all doesn't work on MinGW.
add_c_compiler_flag_if_supported(OUR_FLAGS -fstack-protector-strong)
@@ -409,6 +411,10 @@ elseif(TARGET_OS STREQUAL "mac")
)
set(PLATFORM_CLIENT_LIBS ${COCOA} ${OPENGL})
set(PLATFORM_LIBS ${CARBON})
+elseif(TARGET_OS STREQUAL "haiku")
+ set(PLATFORM_CLIENT)
+ find_package(OpenGL)
+ set(PLATFORM_LIBS GL network)
else()
set(PLATFORM_CLIENT)
find_package(OpenGL)
diff --git a/src/base/detect.h b/src/base/detect.h
old mode 100755
new mode 100644
index 5093162..9d68fb8
--- a/src/base/detect.h
+++ b/src/base/detect.h
@@ -82,6 +82,13 @@
#define CONF_PLATFORM_STRING "beos"
#endif
+#if defined(__HAIKU__)
+ #define CONF_FAMILY_UNIX 1
+ #define CONF_FAMILY_STRING "unix"
+ #define CONF_PLATFORM_HAIKU 1
+ #define CONF_PLATFORM_STRING "haiku"
+#endif
+
/* use gcc endianness definitions when available */
#if defined(__GNUC__) && !defined(__APPLE__) && !defined(__MINGW32__) && !defined(__sun)
diff --git a/src/base/system.c b/src/base/system.c
old mode 100755
new mode 100644
index 9a1a042..16c9013
--- a/src/base/system.c
+++ b/src/base/system.c
@@ -1541,6 +1541,11 @@ int fs_storage_path(const char *appname, char *path, int max)
if(!home)
return -1;
+#if defined(CONF_PLATFORM_HAIKU)
+ str_format(path, max, "%s/config/settings/%s", home, appname);
+ return 0;
+#endif
+
#if defined(CONF_PLATFORM_MACOSX)
str_format(path, max, "%s/Library/Application Support/%s", home, appname);
return 0;
@@ -1588,6 +1593,11 @@ int fs_makedir(const char *path)
return 0;
return -1;
#else
+#ifdef CONF_PLATFORM_HAIKU
+ struct stat st;
+ if (stat(path, &st) == 0)
+ return 0;
+#endif
if(mkdir(path, 0755) == 0)
return 0;
if(errno == EEXIST)
diff --git a/src/base/system.h b/src/base/system.h
old mode 100755
new mode 100644
index f08a9e3..a91e611
--- a/src/base/system.h
+++ b/src/base/system.h
@@ -503,7 +503,11 @@ void lock_unlock(LOCK lock);
/* if compiled with -pedantic-errors it will complain about long
not being a C90 thing.
*/
+#ifdef CONF_PLATFORM_HAIKU
+#include <SupportDefs.h>
+#else
__extension__ typedef long long int64;
+#endif
#else
typedef long long int64;
#endif
diff --git a/src/engine/client/backend_sdl.cpp b/src/engine/client/backend_sdl.cpp
old mode 100755
new mode 100644
index 5f92d58..064d65d
--- a/src/engine/client/backend_sdl.cpp
+++ b/src/engine/client/backend_sdl.cpp
@@ -698,7 +698,7 @@ int CGraphicsBackend_SDL_OpenGL::Init(const char *pName, int *pScreen, int *pWin
if(Flags&IGraphicsBackend::INITFLAG_BORDERLESS)
SdlFlags |= SDL_WINDOW_BORDERLESS;
if(Flags&IGraphicsBackend::INITFLAG_FULLSCREEN)
-#if defined(CONF_PLATFORM_MACOSX) // Todo SDL: remove this when fixed (game freezes when losing focus in fullscreen)
+#if defined(CONF_PLATFORM_MACOSX) || defined(CONF_PLATFORM_HAIKU) // Todo SDL: remove this when fixed (game freezes when losing focus in fullscreen)
SdlFlags |= SDL_WINDOW_FULLSCREEN_DESKTOP; // always use "fake" fullscreen
*pWindowWidth = *pDesktopWidth;
*pWindowHeight = *pDesktopHeight;
@@ -829,7 +829,7 @@ void CGraphicsBackend_SDL_OpenGL::Maximize()
bool CGraphicsBackend_SDL_OpenGL::Fullscreen(bool State)
{
-#if defined(CONF_PLATFORM_MACOSX) // Todo SDL: remove this when fixed (game freezes when losing focus in fullscreen)
+#if defined(CONF_PLATFORM_MACOSX) || defined(CONF_PLATFORM_HAIKU) // Todo SDL: remove this when fixed (game freezes when losing focus in fullscreen)
return SDL_SetWindowFullscreen(m_pWindow, State ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0) == 0;
#else
return SDL_SetWindowFullscreen(m_pWindow, State ? SDL_WINDOW_FULLSCREEN : 0) == 0;
diff --git a/src/engine/shared/storage.cpp b/src/engine/shared/storage.cpp
old mode 100755
new mode 100644
index f646f3e..632c895
--- a/src/engine/shared/storage.cpp
+++ b/src/engine/shared/storage.cpp
@@ -5,6 +5,9 @@
#include <engine/storage.h>
#include "linereader.h"
#include <zlib.h>
+#ifdef CONF_PLATFORM_HAIKU
+#include <stdlib.h>
+#endif
// compiled-in data-dir path
#define DATA_DIR "data"
@@ -216,6 +219,9 @@ public:
void FindAppDir(const char *pArgv0)
{
+#ifdef CONF_PLATFORM_HAIKU
+ pArgv0 = realpath(pArgv0, NULL);
+#endif
// check for usable path in argv[0]
unsigned int Pos = ~0U;
for(unsigned i = 0; pArgv0[i]; ++i)
@@ -228,6 +234,9 @@ public:
if(!fs_is_dir(m_aAppDir))
m_aAppDir[0] = 0;
}
+#ifdef CONF_PLATFORM_HAIKU
+ free((void*)pArgv0);
+#endif
}
void FindDataDir()
--
2.30.2

View File

@@ -1,346 +0,0 @@
From e907b27752dc5569fee6d7e91f7138762d433683 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Sat, 26 Mar 2016 12:14:46 +0100
Subject: applying patch teeworlds-0.6.3.patch
diff --git a/bam.lua b/bam.lua
index 11ac7b9..487a672 100644
--- a/bam.lua
+++ b/bam.lua
@@ -184,6 +184,12 @@ function build(settings)
settings.link.libs:Add("ws2_32")
settings.link.libs:Add("ole32")
settings.link.libs:Add("shell32")
+ elseif family == "beos" and platform == "haiku" then
+ settings.link.libs:Add("be")
+ settings.link.libs:Add("root")
+ settings.link.libs:Add("network")
+ settings.link.libs:Add("GL");
+ settings.link.libs:Add("GLU");
end
-- compile zlib if needed
diff --git a/src/base/detect.h b/src/base/detect.h
index 0e2ef86..948d3aa 100644
--- a/src/base/detect.h
+++ b/src/base/detect.h
@@ -68,7 +68,7 @@
#endif
/* beos family */
-#if defined(__BeOS) || defined(__BEOS__)
+#if defined(__BeOS) || defined(__BEOS__) || defined(__HAIKU__)
#define CONF_FAMILY_BEOS 1
#define CONF_FAMILY_STRING "beos"
#define CONF_PLATFORM_BEOS 1
diff --git a/src/base/system.c b/src/base/system.c
index 53af5d0..0974b6b 100644
--- a/src/base/system.c
+++ b/src/base/system.c
@@ -9,7 +9,7 @@
#include "system.h"
-#if defined(CONF_FAMILY_UNIX)
+#if defined(CONF_FAMILY_UNIX) || defined(CONF_FAMILY_BEOS)
#include <sys/time.h>
#include <unistd.h>
@@ -372,7 +372,7 @@ int io_flush(IOHANDLE io)
void *thread_create(void (*threadfunc)(void *), void *u)
{
-#if defined(CONF_FAMILY_UNIX)
+#if defined(CONF_FAMILY_UNIX) || defined(CONF_FAMILY_BEOS)
pthread_t id;
pthread_create(&id, NULL, (void *(*)(void*))threadfunc, u);
return (void*)id;
@@ -385,7 +385,7 @@ void *thread_create(void (*threadfunc)(void *), void *u)
void thread_wait(void *thread)
{
-#if defined(CONF_FAMILY_UNIX)
+#if defined(CONF_FAMILY_UNIX) || defined(CONF_FAMILY_BEOS)
pthread_join((pthread_t)thread, NULL);
#elif defined(CONF_FAMILY_WINDOWS)
WaitForSingleObject((HANDLE)thread, INFINITE);
@@ -396,7 +396,7 @@ void thread_wait(void *thread)
void thread_destroy(void *thread)
{
-#if defined(CONF_FAMILY_UNIX)
+#if defined(CONF_FAMILY_UNIX) || defined(CONF_FAMILY_BEOS)
void *r = 0;
pthread_join((pthread_t)thread, &r);
#else
@@ -406,7 +406,7 @@ void thread_destroy(void *thread)
void thread_yield()
{
-#if defined(CONF_FAMILY_UNIX)
+#if defined(CONF_FAMILY_UNIX) || defined(CONF_FAMILY_BEOS)
sched_yield();
#elif defined(CONF_FAMILY_WINDOWS)
Sleep(0);
@@ -417,7 +417,7 @@ void thread_yield()
void thread_sleep(int milliseconds)
{
-#if defined(CONF_FAMILY_UNIX)
+#if defined(CONF_FAMILY_UNIX) || defined(CONF_FAMILY_BEOS)
usleep(milliseconds*1000);
#elif defined(CONF_FAMILY_WINDOWS)
Sleep(milliseconds);
@@ -428,7 +428,7 @@ void thread_sleep(int milliseconds)
void thread_detach(void *thread)
{
-#if defined(CONF_FAMILY_UNIX)
+#if defined(CONF_FAMILY_UNIX) || defined(CONF_FAMILY_BEOS)
pthread_detach((pthread_t)(thread));
#elif defined(CONF_FAMILY_WINDOWS)
CloseHandle(thread);
@@ -440,7 +440,7 @@ void thread_detach(void *thread)
-#if defined(CONF_FAMILY_UNIX)
+#if defined(CONF_FAMILY_UNIX) || defined(CONF_FAMILY_BEOS)
typedef pthread_mutex_t LOCKINTERNAL;
#elif defined(CONF_FAMILY_WINDOWS)
typedef CRITICAL_SECTION LOCKINTERNAL;
@@ -452,7 +452,7 @@ LOCK lock_create()
{
LOCKINTERNAL *lock = (LOCKINTERNAL*)mem_alloc(sizeof(LOCKINTERNAL), 4);
-#if defined(CONF_FAMILY_UNIX)
+#if defined(CONF_FAMILY_UNIX) || defined(CONF_FAMILY_BEOS)
pthread_mutex_init(lock, 0x0);
#elif defined(CONF_FAMILY_WINDOWS)
InitializeCriticalSection((LPCRITICAL_SECTION)lock);
@@ -464,7 +464,7 @@ LOCK lock_create()
void lock_destroy(LOCK lock)
{
-#if defined(CONF_FAMILY_UNIX)
+#if defined(CONF_FAMILY_UNIX) || defined(CONF_FAMILY_BEOS)
pthread_mutex_destroy((LOCKINTERNAL *)lock);
#elif defined(CONF_FAMILY_WINDOWS)
DeleteCriticalSection((LPCRITICAL_SECTION)lock);
@@ -476,7 +476,7 @@ void lock_destroy(LOCK lock)
int lock_try(LOCK lock)
{
-#if defined(CONF_FAMILY_UNIX)
+#if defined(CONF_FAMILY_UNIX) || defined(CONF_FAMILY_BEOS)
return pthread_mutex_trylock((LOCKINTERNAL *)lock);
#elif defined(CONF_FAMILY_WINDOWS)
return !TryEnterCriticalSection((LPCRITICAL_SECTION)lock);
@@ -487,7 +487,7 @@ int lock_try(LOCK lock)
void lock_wait(LOCK lock)
{
-#if defined(CONF_FAMILY_UNIX)
+#if defined(CONF_FAMILY_UNIX) || defined(CONF_FAMILY_BEOS)
pthread_mutex_lock((LOCKINTERNAL *)lock);
#elif defined(CONF_FAMILY_WINDOWS)
EnterCriticalSection((LPCRITICAL_SECTION)lock);
@@ -498,7 +498,7 @@ void lock_wait(LOCK lock)
void lock_release(LOCK lock)
{
-#if defined(CONF_FAMILY_UNIX)
+#if defined(CONF_FAMILY_UNIX) || defined(CONF_FAMILY_BEOS)
pthread_mutex_unlock((LOCKINTERNAL *)lock);
#elif defined(CONF_FAMILY_WINDOWS)
LeaveCriticalSection((LPCRITICAL_SECTION)lock);
@@ -508,7 +508,7 @@ void lock_release(LOCK lock)
}
#if !defined(CONF_PLATFORM_MACOSX)
- #if defined(CONF_FAMILY_UNIX)
+ #if defined(CONF_FAMILY_UNIX) || defined(CONF_FAMILY_BEOS)
void semaphore_init(SEMAPHORE *sem) { sem_init(sem, 0, 0); }
void semaphore_wait(SEMAPHORE *sem) { sem_wait(sem); }
void semaphore_signal(SEMAPHORE *sem) { sem_post(sem); }
@@ -527,7 +527,7 @@ void lock_release(LOCK lock)
/* ----- time ----- */
int64 time_get()
{
-#if defined(CONF_FAMILY_UNIX)
+#if defined(CONF_FAMILY_UNIX) || defined(CONF_FAMILY_BEOS)
struct timeval val;
gettimeofday(&val, NULL);
return (int64)val.tv_sec*(int64)1000000+(int64)val.tv_usec;
@@ -546,7 +546,7 @@ int64 time_get()
int64 time_freq()
{
-#if defined(CONF_FAMILY_UNIX)
+#if defined(CONF_FAMILY_UNIX) || defined(CONF_FAMILY_BEOS)
return 1000000;
#elif defined(CONF_FAMILY_WINDOWS)
int64 t;
@@ -1354,6 +1354,16 @@ int fs_storage_path(const char *appname, char *path, int max)
return -1;
_snprintf(path, max, "%s/%s", home, appname);
return 0;
+#elif defined(CONF_FAMILY_BEOS)
+ #include <FindDirectory.h>
+
+ dev_t device = (dev_t)-1;
+ char *datadir;
+
+ status_t status = find_directory(B_USER_DATA_DIRECTORY, device, false, datadir, max);
+ if (status < B_OK) return -1;
+ snprintf(path, max, "%s/%s", datadir, appname);
+ return 0;
#else
char *home = getenv("HOME");
#if !defined(CONF_PLATFORM_MACOSX)
@@ -1795,7 +1805,7 @@ void gui_messagebox(const char *title, const char *message)
&theItem);
RunStandardAlert(theItem, NULL, &itemIndex);
-#elif defined(CONF_FAMILY_UNIX)
+#elif defined(CONF_FAMILY_UNIX) || defined(CONF_FAMILY_BEOS)
static char cmd[1024];
int err;
/* use xmessage which is available on nearly every X11 system */
diff --git a/src/base/system.h b/src/base/system.h
index ae37c1a..d59e43b 100644
--- a/src/base/system.h
+++ b/src/base/system.h
@@ -411,7 +411,7 @@ void lock_release(LOCK lock);
/* Group: Semaphores */
#if !defined(CONF_PLATFORM_MACOSX)
- #if defined(CONF_FAMILY_UNIX)
+ #if defined(CONF_FAMILY_UNIX) || defined(CONF_FAMILY_BEOS)
#include <semaphore.h>
typedef sem_t SEMAPHORE;
#elif defined(CONF_FAMILY_WINDOWS)
diff --git a/src/engine/client/backend_sdl.cpp b/src/engine/client/backend_sdl.cpp
index 37d1019..ec6887f 100644
--- a/src/engine/client/backend_sdl.cpp
+++ b/src/engine/client/backend_sdl.cpp
@@ -1,6 +1,6 @@
-#include "SDL.h"
-#include "SDL_opengl.h"
+#include <SDL/SDL.h>
+#include <SDL/SDL_opengl.h>
#include <base/tl/threading.h>
diff --git a/src/engine/client/backend_sdl.h b/src/engine/client/backend_sdl.h
index e90f945..676141c 100644
--- a/src/engine/client/backend_sdl.h
+++ b/src/engine/client/backend_sdl.h
@@ -1,12 +1,12 @@
-#include "SDL.h"
-#include "SDL_opengl.h"
+#include <SDL/SDL.h>
+#include <SDL/SDL_opengl.h>
#include "graphics_threaded.h"
-// platform dependent implementations for transfering render context from the main thread to the graphics thread
+// platform dependent implementations for transfering render Context from the main thread to the graphics thread
// TODO: when SDL 1.3 comes, this can be removed
#if defined(CONF_FAMILY_WINDOWS)
struct SGLContext
@@ -49,7 +49,7 @@
{
SGLContext Context;
Class NSOpenGLContextClass = (Class) objc_getClass("NSOpenGLContext");
- SEL selector = sel_registerName("currentContext");
+ SEL selector = sel_reg0isterName("currentContext");
Context.m_Context = objc_msgSend((objc_object*) NSOpenGLContextClass, selector);
return Context;
}
@@ -117,6 +117,29 @@
static void GL_MakeCurrent(const SGLContext &Context) { glXMakeCurrent(Context.m_pDisplay, Context.m_Drawable, Context.m_Context); }
static void GL_ReleaseContext(const SGLContext &Context) { glXMakeCurrent(Context.m_pDisplay, None, 0x0); }
static void GL_SwapBuffers(const SGLContext &Context) { glXSwapBuffers(Context.m_pDisplay, Context.m_Drawable); }
+#elif defined(CONF_FAMILY_BEOS)
+
+ #include <Application.h>
+ #include <opengl/GLView.h>
+
+ struct SGLContext
+ {
+ BGLView* view;
+ };
+
+ static SGLContext GL_GetCurrentContext()
+ {
+ SGLContext Context;
+
+ BApplication *be_app = new BApplication("application/x-vnd.tw-teeworlds");
+
+ Context.view = ((BGLView*) be_app->WindowAt(0)->ChildAt(0));
+ return Context;
+ }
+
+ static void GL_MakeCurrent(const SGLContext &Context) { Context.view->LockGL(); }
+ static void GL_ReleaseContext(const SGLContext &Context) { Context.view->UnlockGL(); }
+ static void GL_SwapBuffers(const SGLContext &Context) { Context.view->SwapBuffers(); }
#else
#error missing implementation
#endif
--
2.7.0
From 23887287bf14a4cb0395dd8ac40218dc425b2c2f Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Sat, 26 Mar 2016 12:21:33 +0100
Subject: Fix the build.
- including an header in the middle of a function usually isn't a good
idea.
- use find_path instead of find_directory so the app can find the data
where the package is installed.
diff --git a/src/base/system.c b/src/base/system.c
index 0974b6b..e4843e8 100644
--- a/src/base/system.c
+++ b/src/base/system.c
@@ -48,6 +48,10 @@
#include <sys/filio.h>
#endif
+#if defined(CONF_FAMILY_BEOS)
+ #include <FindDirectory.h>
+#endif
+
#if defined(__cplusplus)
extern "C" {
#endif
@@ -1355,14 +1359,10 @@ int fs_storage_path(const char *appname, char *path, int max)
_snprintf(path, max, "%s/%s", home, appname);
return 0;
#elif defined(CONF_FAMILY_BEOS)
- #include <FindDirectory.h>
-
- dev_t device = (dev_t)-1;
- char *datadir;
-
- status_t status = find_directory(B_USER_DATA_DIRECTORY, device, false, datadir, max);
- if (status < B_OK) return -1;
- snprintf(path, max, "%s/%s", datadir, appname);
+ status_t status = find_path(fs_storage_path, B_FIND_PATH_DATA_DIRECTORY,
+ appname, path, max);
+ if (status < B_OK)
+ return -1;
return 0;
#else
char *home = getenv("HOME");
--
2.7.0

View File

@@ -1,55 +0,0 @@
SUMMARY="A retro multiplayer shooter"
DESCRIPTION="Teeworlds is a free online multiplayer game, available for \
all major operating systems. Battle with up to 16 players in a variety of \
game modes, including Team Deathmatch and Capture The Flag. You can even \
design your own maps!"
HOMEPAGE="https://www.teeworlds.com"
COPYRIGHT="2007-2012 Magnus Auvinen"
LICENSE="Zlib"
REVISION="1"
SOURCE_URI="https://downloads.teeworlds.com/teeworlds-0.6.3-src.tar.gz"
CHECKSUM_SHA256="490ee7c372898761c609af8d7b0c6bd55942c6c6fcd7f361eefa00abfc70077b"
SOURCE_DIR="teeworlds-0.6.3-src"
PATCHES="teeworlds_0.6.3.patchset"
ARCHITECTURES="!x86_gcc2 ?x86"
SECONDARY_ARCHITECTURES="?x86"
PROVIDES="
teeworlds$secondaryArchSuffix = $portVersion
cmd:teeworlds$secondaryArchSuffix = $portVersion
"
REQUIRES="
haiku$secondaryArchSuffix
lib:libfreetype$secondaryArchSuffix
lib:libGL$secondaryArchSuffix
lib:libGLU$secondaryArchSuffix
lib:libSDL_1.2$secondaryArchSuffix
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
"
BUILD_PREREQUIRES="
cmd:bam
cmd:gcc$secondaryArchSuffix
cmd:python
devel:libfreetype$secondaryArchSuffix
devel:libglu$secondaryArchSuffix
devel:libsdl$secondaryArchSuffix
devel:libz$secondaryArchSuffix
"
BUILD()
{
bam release
}
INSTALL()
{
mkdir -p $binDir
cp teeworlds $binDir
mkdir -p $dataDir
cp -r data $dataDir/Teeworlds
}

View File

@@ -1,55 +0,0 @@
SUMMARY="A retro multiplayer shooter"
DESCRIPTION="Teeworlds is a free online multiplayer game, available for \
all major operating systems. Battle with up to 16 players in a variety of \
game modes, including Team Deathmatch and Capture The Flag. You can even \
design your own maps!"
HOMEPAGE="https://www.teeworlds.com"
COPYRIGHT="2007-2012 Magnus Auvinen"
LICENSE="Zlib"
REVISION="1"
SOURCE_URI="https://downloads.teeworlds.com/teeworlds-$portVersion-src.tar.gz"
CHECKSUM_SHA256="c261d19ebb00b5451faa2ceb4a7ca945cad2add48b06046eb43b40ccc9fd98e2"
SOURCE_DIR="teeworlds-$portVersion-src"
PATCHES="teeworlds-$portVersion.patchset"
ARCHITECTURES="!x86_gcc2 ?x86 ?x86_64"
SECONDARY_ARCHITECTURES="?x86"
PROVIDES="
teeworlds$secondaryArchSuffix = $portVersion
cmd:teeworlds$secondaryArchSuffix = $portVersion
"
REQUIRES="
haiku$secondaryArchSuffix
lib:libfreetype$secondaryArchSuffix
lib:libGL$secondaryArchSuffix
lib:libGLU$secondaryArchSuffix
lib:libSDL_1.2$secondaryArchSuffix
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
devel:libfreetype$secondaryArchSuffix
devel:libglu$secondaryArchSuffix
devel:libsdl$secondaryArchSuffix
devel:libz$secondaryArchSuffix
"
BUILD_PREREQUIRES="
cmd:bam
cmd:gcc$secondaryArchSuffix
cmd:python
"
BUILD()
{
bam release
}
INSTALL()
{
mkdir -p $binDir
cp teeworlds $binDir
mkdir -p $dataDir
cp -r data $dataDir/Teeworlds
}

View File

@@ -0,0 +1,93 @@
SUMMARY="A retro multiplayer shooter"
DESCRIPTION="Teeworlds is a free online multiplayer game, available for \
all major operating systems. Battle with up to 16 players in a variety of \
game modes, including Team Deathmatch and Capture The Flag. You can even \
design your own maps!"
HOMEPAGE="https://www.teeworlds.com"
COPYRIGHT="2007-2021 Magnus Auvinen"
LICENSE="Zlib"
REVISION="1"
SOURCE_URI="https://downloads.teeworlds.com/teeworlds-$portVersion-src.tar.gz"
CHECKSUM_SHA256="fcde2223398e027434ec96315103e9861fc458161b49b15908dc56b8e7a8ecd9"
SOURCE_DIR="teeworlds-$portVersion-src"
PATCHES="teeworlds-$portVersion.patchset"
ADDITIONAL_FILES="teeworlds.rdef.in"
ARCHITECTURES="!x86_gcc2 x86_64"
SECONDARY_ARCHITECTURES="x86"
PROVIDES="
teeworlds$secondaryArchSuffix = $portVersion
app:Teeworlds = $portVersion
cmd:teeworlds_srv = $portVersion
"
REQUIRES="
haiku$secondaryArchSuffix
lib:libfreetype$secondaryArchSuffix
lib:libGL$secondaryArchSuffix
lib:libGLU$secondaryArchSuffix
lib:libSDL2_2.0$secondaryArchSuffix
lib:libssl$secondaryArchSuffix
lib:libz$secondaryArchSuffix
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
devel:libfreetype$secondaryArchSuffix
devel:libglu$secondaryArchSuffix
devel:libSDL2_2.0$secondaryArchSuffix
devel:libssl$secondaryArchSuffix
devel:libz$secondaryArchSuffix
"
BUILD_PREREQUIRES="
cmd:cmake
cmd:gcc$secondaryArchSuffix
cmd:python
cmd:make
"
BUILD()
{
mkdir -p build
cd build
cmake .. \
-DCMAKE_INSTALL_PREFIX=$appsDir/Teeworlds \
-DCMAKE_BUILD_TYPE=Release
make $jobArgs
}
INSTALL()
{
cd build
make install
mkdir -p $prefix/bin
mv $appsDir/Teeworlds/bin/teeworlds $appsDir/Teeworlds/Teeworlds
mv $appsDir/Teeworlds/bin/teeworlds_srv $appsDir/Teeworlds
mv $appsDir/Teeworlds/share/teeworlds/data/* $appsDir/Teeworlds
rm -rf $appsDir/Teeworlds/{bin,share}
cat >$prefix/bin/teeworlds_srv << EOF
#!/bin/bash
cd $appsDir/Teeworlds
teeworlds_srv "$@"
EOF
chmod +x $prefix/bin/teeworlds_srv
local APP_SIGNATURE="application/x-vnd.teeworlds"
local MAJOR="`echo "$portVersion" | cut -d. -f1`"
local MIDDLE="`echo "$portVersion" | cut -d. -f2`"
local MINOR="`echo "$portVersion" | cut -d. -f3`"
local LONG_INFO="$SUMMARY"
sed \
-e "s|@APP_SIGNATURE@|$APP_SIGNATURE|" \
-e "s|@MAJOR@|$MAJOR|" \
-e "s|@MIDDLE@|$MIDDLE|" \
-e "s|@MINOR@|$MINOR|" \
-e "s|@LONG_INFO@|$LONG_INFO|" \
$portDir/additional-files/teeworlds.rdef.in > $sourceDir/teeworlds.rdef
addResourcesToBinaries $sourceDir/teeworlds.rdef \
$appsDir/Teeworlds/Teeworlds
addAppDeskbarSymlink $appsDir/Teeworlds/Teeworlds
}