From 32510822e9d83fba79c52e49f14a7b5de3cdb20d Mon Sep 17 00:00:00 2001 From: Jerome Duval Date: Sat, 30 Sep 2017 11:24:43 +0200 Subject: [PATCH] teeworlds: add recipe for version 0.6.4. * on x86_64 crash on start up (as for 0.6.3). --- .../patches/teeworlds-0.6.4.patchset | 379 ++++++++++++++++++ games-action/teeworlds/teeworlds-0.6.4.recipe | 55 +++ 2 files changed, 434 insertions(+) create mode 100644 games-action/teeworlds/patches/teeworlds-0.6.4.patchset create mode 100644 games-action/teeworlds/teeworlds-0.6.4.recipe diff --git a/games-action/teeworlds/patches/teeworlds-0.6.4.patchset b/games-action/teeworlds/patches/teeworlds-0.6.4.patchset new file mode 100644 index 000000000..2239334c1 --- /dev/null +++ b/games-action/teeworlds/patches/teeworlds-0.6.4.patchset @@ -0,0 +1,379 @@ +From 27950899779fdeb095267cb224cddf0cf616a1d7 Mon Sep 17 00:00:00 2001 +From: Adrien Destugues +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 + #include + +@@ -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 ++ ++ 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 + 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 ++#include + + #include + +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 ++#include + + #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 ++ #include ++ ++ 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 +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 + #endif + ++#if defined(CONF_FAMILY_BEOS) ++ #include ++#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 +- +- 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 +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 + diff --git a/games-action/teeworlds/teeworlds-0.6.4.recipe b/games-action/teeworlds/teeworlds-0.6.4.recipe new file mode 100644 index 000000000..898787c01 --- /dev/null +++ b/games-action/teeworlds/teeworlds-0.6.4.recipe @@ -0,0 +1,55 @@ +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:libGL$secondaryArchSuffix + lib:libGLU$secondaryArchSuffix + lib:libfreetype$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:gcc$secondaryArchSuffix + cmd:bam == 0.4.0 + cmd:python + " + +BUILD() +{ + bam release +} + +INSTALL() +{ + mkdir -p $binDir + cp teeworlds $binDir + + mkdir -p $dataDir + cp -r data $dataDir/Teeworlds +}