From 3c5cf37a0285f9834c5d12ea8bd719854a5e53ca Mon Sep 17 00:00:00 2001 From: Jerome Duval Date: Sun, 17 May 2015 21:49:11 +0000 Subject: [PATCH] btanks: add recipe for version 0.9.8083. * builds OK, it just displays a black background window atm. --- games-action/btanks/btanks-0.9.8083.recipe | 80 +++++ .../btanks/patches/btanks-0.9.8083.patchset | 339 ++++++++++++++++++ 2 files changed, 419 insertions(+) create mode 100644 games-action/btanks/btanks-0.9.8083.recipe create mode 100644 games-action/btanks/patches/btanks-0.9.8083.patchset diff --git a/games-action/btanks/btanks-0.9.8083.recipe b/games-action/btanks/btanks-0.9.8083.recipe new file mode 100644 index 000000000..7745507e5 --- /dev/null +++ b/games-action/btanks/btanks-0.9.8083.recipe @@ -0,0 +1,80 @@ +SUMMARY="A tanks arcade game" +DESCRIPTION="Battle Tanks is a funny battle on your desk, where you can \ +choose one of three vehicles and eliminate your enemy using the whole arsenal \ +of weapons. It has original cartoon-like graphics and cool music, it's fun \ +and dynamic, it has several network modes for deathmatch and cooperative -- \ +what else is needed to have fun with your friends? +" +LICENSE="GNU GPL v2" +COPYRIGHT=" + 2006-2009 Battle Tanks team + 2007-2008 Netive Media Group + 2005-2007 Vladimir Menshakov + " +HOMEPAGE="http://btanks.sourceforge.net" +REVISION="1" +SRC_URI="http://downloads.sourceforge.net/project/btanks/btanks-source/btanks-$portVersion.tar.bz2" +CHECKSUM_SHA256="3fd2ce6a2b45f7a60c3b114fa9aff13cb3dd9fbb6a65cdc9798b76c4fa2c4341" + +ARCHITECTURES="x86_64" + +PATCHES="btanks-$portVersion.patchset" + +PROVIDES=" + btanks$secondaryArchSuffix = $portVersion + cmd:btanks$secondaryArchSuffix = $portVersion + cmd:bted$secondaryArchSuffix = $portVersion + " + +REQUIRES=" + haiku$secondaryArchSuffix >= $haikuVersion + lib:libexpat$secondaryArchSuffix + lib:liblua$secondaryArchSuffix + lib:libsdl$secondaryArchSuffix + lib:libsdl_image$secondaryArchSuffix + lib:libsmpeg$secondaryArchSuffix + lib:libvorbis$secondaryArchSuffix + lib:libz$secondaryArchSuffix + lib:libGLU$secondaryArchSuffix + " + +BUILD_REQUIRES=" + haiku${secondaryArchSuffix}_devel >= $haikuVersion + devel:libexpat$secondaryArchSuffix + devel:liblua$secondaryArchSuffix + devel:libsdl$secondaryArchSuffix + devel:libsdl_image$secondaryArchSuffix + devel:libsmpeg$secondaryArchSuffix + devel:libvorbis$secondaryArchSuffix + devel:libz$secondaryArchSuffix + devel:libglu$secondaryArchSuffix + " + +BUILD_PREREQUIRES=" + cmd:gcc$secondaryArchSuffix + cmd:ld$secondaryArchSuffix + cmd:scons + cmd:make + cmd:pkg_config$secondaryArchSuffix + cmd:zip + " + +BUILD() +{ + scons $jobArgs . mode=release + sh ./pack-resources.sh +} + +INSTALL() +{ + mkdir -p $appsDir/btanks/lib + cp btanks bted $appsDir/btanks/ + cp build/release/clunk/libclunk.so \ + build/release/engine/libbtanks_engine.so \ + build/release/mrt/libmrt.so \ + build/release/objects/libbt_objects.so \ + build/release/sdlx/libsdlx.so \ + $appsDir/btanks/lib/ + cp data/tiles/icon.png $appsDir/btanks/ + cp resources.dat $appsDir/btanks/ +} diff --git a/games-action/btanks/patches/btanks-0.9.8083.patchset b/games-action/btanks/patches/btanks-0.9.8083.patchset new file mode 100644 index 000000000..6301489c5 --- /dev/null +++ b/games-action/btanks/patches/btanks-0.9.8083.patchset @@ -0,0 +1,339 @@ +From 996dae7f1aefc245cf6c43ae29f6ccaea6066c2e Mon Sep 17 00:00:00 2001 +From: Jerome Duval +Date: Sun, 17 May 2015 18:03:50 +0000 +Subject: Haiku patch + + +diff --git a/SConstruct b/SConstruct +index afdb48f..5637922 100644 +--- a/SConstruct ++++ b/SConstruct +@@ -102,8 +102,8 @@ else: + env.Append(CCFLAGS=['-O3']) + env.Append(CPPFLAGS=['-O3']) + +- env.Append(CPPFLAGS=['-Wall', '-Wno-deprecated', '-pedantic', '-Wno-long-long', '-pipe', '-pthread']) +- env.Append(CCFLAGS=['-Wall', '-Wno-deprecated', '-pedantic', '-Wno-long-long', '-pipe', '-pthread']) ++ env.Append(CPPFLAGS=['-Wall', '-Wno-deprecated', '-pedantic', '-Wno-long-long', '-pipe']) ++ env.Append(CCFLAGS=['-Wall', '-Wno-deprecated', '-pedantic', '-Wno-long-long', '-pipe']) + + + conf_env = env.Clone() +@@ -154,7 +154,10 @@ if sys.platform == 'win32': + Exit(1) + + if sys.platform != 'win32': +- have_sse = conf.CheckLibWithHeader('m', "xmmintrin.h", 'c', '_mm_set_ss(1.0f);', False) ++ if sys.platform != 'haiku1': ++ have_sse = conf.CheckLibWithHeader('m', "xmmintrin.h", 'c', '_mm_set_ss(1.0f);', False) ++ else: ++ have_sse = True + else: + have_sse = conf.CheckLibWithHeader('kernel32', "xmmintrin.h", 'c', '_mm_set_ss(1.0f);', False) # hackish lib :( + +diff --git a/clunk/SConscript b/clunk/SConscript +index d528be8..4211daf 100644 +--- a/clunk/SConscript ++++ b/clunk/SConscript +@@ -17,7 +17,8 @@ clunk_libs = ['SDL'] + + if sys.platform != 'win32': + env.Append(LINKFLAGS=['-Wl,-rpath,'+ lib_dir]) +- clunk_libs.append('m') ++ if sys.platform != 'haiku1': ++ clunk_libs.append('m') + + env.MergeFlags(sdl_cflags, sdl_libs) + +diff --git a/clunk/source.cpp b/clunk/source.cpp +index d7829c8..64bfc5a 100644 +--- a/clunk/source.cpp ++++ b/clunk/source.cpp +@@ -27,7 +27,7 @@ + #include + #include "clunk_assert.h" + +-#if defined _MSC_VER || __APPLE__ || __FreeBSD__ ++#if defined _MSC_VER || __APPLE__ || __FreeBSD__ || __HAIKU__ + # define pow10f(x) powf(10.0f, (x)) + # define log2f(x) (logf(x) / M_LN2) + #endif +diff --git a/engine/luaxx/state.cpp b/engine/luaxx/state.cpp +index 4bd218d..8ac233d 100644 +--- a/engine/luaxx/state.cpp ++++ b/engine/luaxx/state.cpp +@@ -5,6 +5,10 @@ + #include + #include "mrt/chunk.h" + ++#ifndef lua_open ++#define lua_open() luaL_newstate() ++#endif ++ + using namespace luaxx; + /* + static void *l_alloc (void *ud, void *ptr, size_t osize, size_t nsize) { +@@ -59,7 +63,7 @@ static const char * chunk_reader(lua_State *L, void *data, size_t *size) { + void State::load(const std::string &fname, const mrt::Chunk &data) { + //throw_ex(("implement me[%s]", fname.c_str())); + reader_state x(data); +- int err = lua_load(state, chunk_reader, &x, fname.c_str()); ++ int err = lua_load(state, chunk_reader, &x, fname.c_str(), NULL); + check_error(state, err); + } + +diff --git a/engine/sl08/sl08.h b/engine/sl08/sl08.h +index dd06f9e..92fc8dd 100644 +--- a/engine/sl08/sl08.h ++++ b/engine/sl08/sl08.h +@@ -22,6 +22,7 @@ + /* DO NOT MODIFY THIS FILE: IT'S AUTOGENERATED */ + + #include ++#include + + #ifndef NULL + #define NULL ((void*) 0) +@@ -117,7 +118,7 @@ namespace sl08 { + inline slot0 () : object(NULL), func(NULL) {} + inline slot0 (object_type *object, func_t func) : object(object), func(func) {} + inline void assign(object_type *o, func_t f) { object = o; func = f; } +- inline void assign(object_type *o, func_t f, signal_type &signal_ref) { object = o; func = f; connect(signal_ref); } ++ inline void assign(object_type *o, func_t f, signal_type &signal_ref) { object = o; func = f; this->connect(signal_ref); } + + inline void operator() () const { + (object->*func) (); +@@ -271,7 +272,7 @@ namespace sl08 { + inline slot1(object_type *object, func_t func, signal_type * signal = NULL) : object(object), func(func) {} + + inline void assign(object_type *o, func_t f) { object = o; func = f; } +- inline void assign(object_type *o, func_t f, signal_type &signal_ref = NULL) { object = o; func = f; connect(signal_ref); } ++ inline void assign(object_type *o, func_t f, signal_type &signal_ref = NULL) { object = o; func = f; this->connect(signal_ref); } + + inline return_type operator() (arg1_type a1) const { + return (object->*func) (a1) ; +@@ -292,7 +293,7 @@ namespace sl08 { + inline slot1 () : object(NULL), func(NULL) {} + inline slot1 (object_type *object, func_t func) : object(object), func(func) {} + inline void assign(object_type *o, func_t f) { object = o; func = f; } +- inline void assign(object_type *o, func_t f, signal_type &signal_ref) { object = o; func = f; connect(signal_ref); } ++ inline void assign(object_type *o, func_t f, signal_type &signal_ref) { object = o; func = f; this->connect(signal_ref); } + + inline void operator() (arg1_type a1) const { + (object->*func) (a1); +@@ -446,7 +447,7 @@ namespace sl08 { + inline slot2(object_type *object, func_t func, signal_type * signal = NULL) : object(object), func(func) {} + + inline void assign(object_type *o, func_t f) { object = o; func = f; } +- inline void assign(object_type *o, func_t f, signal_type &signal_ref = NULL) { object = o; func = f; connect(signal_ref); } ++ inline void assign(object_type *o, func_t f, signal_type &signal_ref = NULL) { object = o; func = f; this->connect(signal_ref); } + + inline return_type operator() (arg1_type a1, arg2_type a2) const { + return (object->*func) (a1, a2) ; +@@ -467,7 +468,7 @@ namespace sl08 { + inline slot2 () : object(NULL), func(NULL) {} + inline slot2 (object_type *object, func_t func) : object(object), func(func) {} + inline void assign(object_type *o, func_t f) { object = o; func = f; } +- inline void assign(object_type *o, func_t f, signal_type &signal_ref) { object = o; func = f; connect(signal_ref); } ++ inline void assign(object_type *o, func_t f, signal_type &signal_ref) { object = o; func = f; this->connect(signal_ref); } + + inline void operator() (arg1_type a1, arg2_type a2) const { + (object->*func) (a1, a2); +@@ -621,7 +622,7 @@ namespace sl08 { + inline slot3(object_type *object, func_t func, signal_type * signal = NULL) : object(object), func(func) {} + + inline void assign(object_type *o, func_t f) { object = o; func = f; } +- inline void assign(object_type *o, func_t f, signal_type &signal_ref = NULL) { object = o; func = f; connect(signal_ref); } ++ inline void assign(object_type *o, func_t f, signal_type &signal_ref = NULL) { object = o; func = f; this->connect(signal_ref); } + + inline return_type operator() (arg1_type a1, arg2_type a2, arg3_type a3) const { + return (object->*func) (a1, a2, a3) ; +@@ -642,7 +643,7 @@ namespace sl08 { + inline slot3 () : object(NULL), func(NULL) {} + inline slot3 (object_type *object, func_t func) : object(object), func(func) {} + inline void assign(object_type *o, func_t f) { object = o; func = f; } +- inline void assign(object_type *o, func_t f, signal_type &signal_ref) { object = o; func = f; connect(signal_ref); } ++ inline void assign(object_type *o, func_t f, signal_type &signal_ref) { object = o; func = f; this->connect(signal_ref); } + + inline void operator() (arg1_type a1, arg2_type a2, arg3_type a3) const { + (object->*func) (a1, a2, a3); +@@ -796,7 +797,7 @@ namespace sl08 { + inline slot4(object_type *object, func_t func, signal_type * signal = NULL) : object(object), func(func) {} + + inline void assign(object_type *o, func_t f) { object = o; func = f; } +- inline void assign(object_type *o, func_t f, signal_type &signal_ref = NULL) { object = o; func = f; connect(signal_ref); } ++ inline void assign(object_type *o, func_t f, signal_type &signal_ref = NULL) { object = o; func = f; this->connect(signal_ref); } + + inline return_type operator() (arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4) const { + return (object->*func) (a1, a2, a3, a4) ; +@@ -817,7 +818,7 @@ namespace sl08 { + inline slot4 () : object(NULL), func(NULL) {} + inline slot4 (object_type *object, func_t func) : object(object), func(func) {} + inline void assign(object_type *o, func_t f) { object = o; func = f; } +- inline void assign(object_type *o, func_t f, signal_type &signal_ref) { object = o; func = f; connect(signal_ref); } ++ inline void assign(object_type *o, func_t f, signal_type &signal_ref) { object = o; func = f; this->connect(signal_ref); } + + inline void operator() (arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4) const { + (object->*func) (a1, a2, a3, a4); +@@ -971,7 +972,7 @@ namespace sl08 { + inline slot5(object_type *object, func_t func, signal_type * signal = NULL) : object(object), func(func) {} + + inline void assign(object_type *o, func_t f) { object = o; func = f; } +- inline void assign(object_type *o, func_t f, signal_type &signal_ref = NULL) { object = o; func = f; connect(signal_ref); } ++ inline void assign(object_type *o, func_t f, signal_type &signal_ref = NULL) { object = o; func = f; this->connect(signal_ref); } + + inline return_type operator() (arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, arg5_type a5) const { + return (object->*func) (a1, a2, a3, a4, a5) ; +@@ -992,7 +993,7 @@ namespace sl08 { + inline slot5 () : object(NULL), func(NULL) {} + inline slot5 (object_type *object, func_t func) : object(object), func(func) {} + inline void assign(object_type *o, func_t f) { object = o; func = f; } +- inline void assign(object_type *o, func_t f, signal_type &signal_ref) { object = o; func = f; connect(signal_ref); } ++ inline void assign(object_type *o, func_t f, signal_type &signal_ref) { object = o; func = f; this->connect(signal_ref); } + + inline void operator() (arg1_type a1, arg2_type a2, arg3_type a3, arg4_type a4, arg5_type a5) const { + (object->*func) (a1, a2, a3, a4, a5); +diff --git a/math/range_list.h b/math/range_list.h +index 4d73341..c47fc13 100644 +--- a/math/range_list.h ++++ b/math/range_list.h +@@ -53,14 +53,14 @@ public: + return; + } + +- typename parent_type::iterator i = lower_bound(value); ++ typename parent_type::iterator i = this->lower_bound(value); + if (i != parent_type::end()) { + if (i->first == value) + return; + + if (value + 1 == i->first) { + T e = i->second; +- erase(i); ++ this->erase(i); + i = parent_type::insert(typename parent_type::value_type(value, e)).first; //expand beginning + i = pack_left(i); + } +diff --git a/mrt/SConscript b/mrt/SConscript +index 2660d69..8b59e3b 100644 +--- a/mrt/SConscript ++++ b/mrt/SConscript +@@ -10,6 +10,8 @@ libs = ['expat', 'z'] + if sys.platform == "win32": + libs.append('Ws2_32') + libs.append('shell32') ++if sys.platform == "haiku1": ++ libs.append('bnetapi') + + mrt = env.SharedLibrary('mrt', \ + ['exception.cpp', 'fmt.cpp', 'ioexception.cpp', 'logger.cpp', 'chunk.cpp', 'random.cpp', +diff --git a/mrt/sys_socket.cpp b/mrt/sys_socket.cpp +index 4212a76..f276894 100644 +--- a/mrt/sys_socket.cpp ++++ b/mrt/sys_socket.cpp +@@ -34,6 +34,7 @@ + + #include + #include ++#include + + using namespace mrt; + +diff --git a/mrt/udp_socket.cpp b/mrt/udp_socket.cpp +index 19c2756..d352f5d 100644 +--- a/mrt/udp_socket.cpp ++++ b/mrt/udp_socket.cpp +@@ -37,6 +37,8 @@ + # include /* superset of previous */ + # include + # include ++#define _BSD_SOURCE ++# include + #endif + + +diff --git a/sdlx/SConscript b/sdlx/SConscript +index ede453b..dd8bc93 100644 +--- a/sdlx/SConscript ++++ b/sdlx/SConscript +@@ -19,11 +19,12 @@ if sys.platform != "win32": + #c_map_env.Append(CXXFLAGS=['-fforce-addr', '-fprefetch-loop-arrays']) + c_map = c_map_env.SharedObject('c_map.cpp') + #libs.append('GL') +- libs.append('rt') +- libs.append('X11') ++ if sys.platform != "haiku1": ++ libs.append('rt') ++ libs.append('X11') + +- env.Append(LINKFLAGS=['-Wl,-rpath,'+ lib_dir]) +- env.Append(LINKFLAGS=['-Wl,-rpath-link,build/' + env['mode'] + '/mrt']) ++ env.Append(LINKFLAGS=['-Wl,-rpath,'+ lib_dir]) ++ env.Append(LINKFLAGS=['-Wl,-rpath-link,build/' + env['mode'] + '/mrt']) + else: + c_map = env.SharedObject('c_map.cpp') + libs.append('opengl32') +diff --git a/sdlx/system.cpp b/sdlx/system.cpp +index c239b53..1afab0c 100644 +--- a/sdlx/system.cpp ++++ b/sdlx/system.cpp +@@ -41,6 +41,8 @@ static void WIN_FlushMessageQueue() + } + #elif defined __APPLE__ + //nothing here ++#elif defined __HAIKU__ ++ //nothing here + #else + # include + # include +@@ -134,7 +136,7 @@ TRY { + DestroyWindow(hwnd); + WIN_FlushMessageQueue(); + #endif +-#if !defined(_WINDOWS) && !defined(__APPLE__) ++#if !defined(_WINDOWS) && !defined(__APPLE__) && !defined(__HAIKU__) + int errorBase, eventBase; + + if (SDL_GL_LoadLibrary(NULL) != 0) { +-- +1.8.3.4 + + +From 16a043a288475be461646ba5d4fd76205b148177 Mon Sep 17 00:00:00 2001 +From: Jerome Duval +Date: Sun, 17 May 2015 21:20:06 +0000 +Subject: Settings directory + + +diff --git a/mrt/directory.cpp b/mrt/directory.cpp +index dfc672f..bdfafe6 100644 +--- a/mrt/directory.cpp ++++ b/mrt/directory.cpp +@@ -21,6 +21,10 @@ + #include + #include + ++#ifdef __HAIKU__ ++ #include ++#endif ++ + using namespace mrt; + + Directory::Directory() : _handle(0) {} +@@ -195,7 +199,13 @@ const std::string Directory::get_home() { + } + + const std::string Directory::get_app_dir(const std::string &name, const std::string &shortname) { ++#ifdef __HAIKU__ ++ char settingsPath[PATH_MAX]; ++ find_directory(B_USER_SETTINGS_DIRECTORY, -1, false, settingsPath, sizeof(settingsPath)); ++ std::string path = settingsPath + "/" + shortname; ++#else + std::string path = get_home() + "/." + shortname; ++#endif + mrt::Directory dir; + try { + dir.create(path); +-- +1.8.3.4 +