Arx-Libertatis: add recipe

This commit is contained in:
Gerasim Troeglazov
2019-08-19 23:15:36 +10:00
parent d190ea7ec5
commit 71b3750e6f
3 changed files with 468 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
resource vector_icon array {
$"6E6369660303CA8462050004007C020214B8C5B59EB90FB537B161BFEFBB20CB"
$"8DB728C85FB5E2C3E5BEA4B5DDB708B976BF31B59ABFC6B6A0BFC6B603BFC6B6"
$"A0BFC6B928BFC6B928BFC6B9A8BEE5B9D3BF46B9D6BEE5B9D3BB1FB99ABB1FB9"
$"9ABB1FB99ABA3FBB83BA3FBB83BADBBB4CBC0CBB27BB42BB27BC0CBB27BFC6BB"
$"27BFC6BB27BFC6BB27BFC6C695BFC6C695BFC6C7ACBE2BC954BF17C8AFBE2BC9"
$"54C73AC954C73AC954C84AC954C8FACA6CC877C9BDCA1DC83DCB71C4F2CAC5C7"
$"1BC97CC73BC5E4C851C734C851C479C852C302C616C302C7D8C302C616C302B7"
$"5BC302B75BC302B640C46FB458C325B5B6C46FB458B785B458B785B458B875B4"
$"D002143026B9C1B513AE06BEB9265CB16BC7BAB026C340BEA4B5DDB708B976BF"
$"31B59ABFC6B6A0BFC6B603BFC6B6A0BFC6B928BFC6B928BFC6B9A8BEE5B9D3BF"
$"46B9D6BEE5B9D3BB1FB99ABB1FB99ABB1FB99ABA3FBB83BA3FBB83BADBBB4CBC"
$"0CBB27BB42BB27BC0CBB27BFC6BB27BFC6BB27BFC6BB273157315731CA012C5B"
$"B8B3C9DD2C5B435B435BC2015B485EC26DCB05C413C985504DC573C716C42AC7"
$"364358C242C94FBF8658395739CAAC3957C302B75BC302B75BC302B6405024C4"
$"D5B5F650242D232D23B91DB4AA030A020101023F621E0000000000003DDEAF48"
$"7A444A08990A010100123F621E0000000000003F762C3E0BDA422F5801158400"
$"040A000100023F621E0000000000003F762C3E0BDA422F58"
};

View File

@@ -0,0 +1,115 @@
SUMMARY="Cross-platform port of Arx Fatalis, a first-person role-playing game"
DESCRIPTION="Arx Libertatis is a cross-platform, open source port of Arx Fatalis, \
a 2002 first-person role-playing game/dungeon crawler developed by Arkane Studios. \
Arx Fatalis features crafting, melee and ranged combat, as well as a unique casting \
system where the player draws runes in real time to effect the desired spell. \
Arx Libertatis updates and improves Arx Fatalis by supporting modern systems, \
porting the game to new systems as well as eliminating bugs and limitations."
HOMEPAGE="https://arx-libertatis.org/"
COPYRIGHT="2012-2019 Arx-Libertatis team"
LICENSE="GNU GPL v3"
REVISION="1"
srcGitRev="db77aa26bb8612f711b65e72b1cd8cf6481700c7"
SOURCE_URI="https://github.com/arx/ArxLibertatis/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256="19bbd1cd5a5577e362079b73947d89e551a987cd976d85969d48e2ed38a70091"
SOURCE_DIR="ArxLibertatis-$srcGitRev"
srcGitRev2="b23fa86080717e52c862f586c858d825a281d26a"
SOURCE_URI_2="https://github.com/EXL/BeGameLauncher/archive/$srcGitRev2.tar.gz"
CHECKSUM_SHA256_2="3121426ca772b694a4510a208cfd5b76fec943f8b4ecacbe0d79daffb7b81665"
SOURCE_DIR_2="BeGameLauncher-$srcGitRev2"
PATCHES="arx_libertatis-$portVersion.patchset"
ADDITIONAL_FILES="arx_libertatis.rdef"
ARCHITECTURES="!x86_gcc2 x86_64"
SECONDARY_ARCHITECTURES="x86"
PROVIDES="
arx_libertatis$secondaryArchSuffix = $portVersion
app:ArxLibertatis$secondaryArchSuffix
"
REQUIRES="
haiku$secondaryArchSuffix
lib:libboost_filesystem$secondaryArchSuffix
lib:libboost_system$secondaryArchSuffix
lib:libfreetype$secondaryArchSuffix
lib:libGL$secondaryArchSuffix
lib:libglew$secondaryArchSuffix
lib:libopenal$secondaryArchSuffix
lib:libpng16$secondaryArchSuffix
lib:libSDL2_2.0$secondaryArchSuffix
lib:libvorbis$secondaryArchSuffix
lib:libz$secondaryArchSuffix
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
glm${secondaryArchSuffix}_devel
devel:libboost_filesystem$secondaryArchSuffix
devel:libboost_system$secondaryArchSuffix
devel:libfreetype$secondaryArchSuffix
devel:libGL$secondaryArchSuffix
devel:libglew$secondaryArchSuffix
devel:libopenal$secondaryArchSuffix
devel:libpng$secondaryArchSuffix
devel:libSDL2_2.0$secondaryArchSuffix
devel:libvorbis$secondaryArchSuffix
devel:libz$secondaryArchSuffix
"
BUILD_PREREQUIRES="
cmd:cmake
cmd:gcc$secondaryArchSuffix
cmd:make
cmd:python
"
BUILD()
{
mkdir -p build
cd build
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DUSER_DIR="ArxLibertatis" \
-DUSER_DIR_PREFIXES=`finddir B_USER_SETTINGS_DIRECTORY`/ \
-DCONFIG_DIR="ArxLibertatis" \
-DCONFIG_DIR_PREFIXES=`finddir B_USER_SETTINGS_DIRECTORY`/ \
-DDATA_DIR="games/arx:arx" \
-DDATA_DIR_PREFIXES="$appsDir/Arx-Libertatis/" \
-DCMAKE_INSTALL_PREFIX=$appsDir/Arx-Libertatis \
-DCMAKE_INSTALL_BINDIR=$appsDir/Arx-Libertatis \
-DCMAKE_INSTALL_DATAROOTDIR=$appsDir/Arx-Libertatis \
-DCMAKE_INSTALL_LIBDIR=$appsDir/Arx-Libertatis/lib \
-DSDL2_INCLUDE_DIR=/system/$relativeIncludeDir/SDL2 \
-DBUILD_TOOLS=OFF \
-DBUILD_IO_LIBRARY=OFF \
-DBUILD_CRASHHANDLER=OFF \
-DBUILD_CRASHREPORTER=OFF \
-DBUILD_PROFILER=OFF \
-DBUILD_TESTS=OFF
make $jobArgs
cd $sourceDir2
mkdir -p build
cd build
cmake .. \
-DCMAKE_BUILD_TYPE=Debug \
-DLAUNCHER=arx_libertatis
make $jobArgs
}
INSTALL()
{
cd build
make install
strip $appsDir/Arx-Libertatis/arx
mv $appsDir/Arx-Libertatis/arx $appsDir/Arx-Libertatis/Arx-Libertatis
rm -rf $appsDir/Arx-Libertatis/{applications,blender,include,man}
cp $sourceDir2/build/ArxLibertatisLauncher $appsDir/Arx-Libertatis/Arx-Libertatis-Launcher
settype -t application/x-vnd.Be-elfexecutable $appsDir/Arx-Libertatis/Arx-Libertatis
rc $portDir/additional-files/arx_libertatis.rdef -o arx_libertatis.rsrc
resattr -o $appsDir/Arx-Libertatis/Arx-Libertatis arx_libertatis.rsrc
addAppDeskbarSymlink $appsDir/Arx-Libertatis/Arx-Libertatis-Launcher "Arx-Libertatis"
}

View File

@@ -0,0 +1,334 @@
From 401b0446378d2c3d9e40d19a02694e0fe06348f1 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Sun, 18 Aug 2019 21:52:30 +1000
Subject: Fix build for Haiku
diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt
index 17dd3e0..54f27d8 100644
--- a/data/CMakeLists.txt
+++ b/data/CMakeLists.txt
@@ -1,5 +1,6 @@
-
+if(NOT HAIKU)
include(Icons)
+endif()
set(ICON_BINARY_DIR "${PROJECT_BINARY_DIR}/data.generated/icons")
set(ICON_SOURCE_DIRS "${PROJECT_SOURCE_DIR}/data/icons")
@@ -107,6 +108,7 @@ set(overview_sizes
512
)
+if(NOT HAIKU)
add_icon(arx-libertatis
arx-libertatis.svg 1024
arx-libertatis-32.svg 32@2x 512
@@ -120,6 +122,7 @@ add_icon(arx-libertatis
)
add_icon(TARGET arx-libertatis-logo arx-libertatis-logo.svg 58 512)
+endif()
add_custom_target(data DEPENDS
arx-libertatis-icon
diff --git a/src/core/Config.cpp b/src/core/Config.cpp
index b144890..5ab8cf4 100644
--- a/src/core/Config.cpp
+++ b/src/core/Config.cpp
@@ -81,7 +81,11 @@ const int
quickLevelTransition = JumpToChangeLevel;
const bool
+#if ARX_PLATFORM == ARX_PLATFORM_HAIKU
+ fullscreen = false,
+#else
fullscreen = true,
+#endif
showCrosshair = true,
antialiasing = true,
colorkeyAntialiasing = true,
@@ -435,6 +439,10 @@ bool Config::save() {
// video
writer.beginSection(Section::Video);
writer.writeKey(Key::renderer, video.renderer);
+#if ARX_PLATFORM == ARX_PLATFORM_HAIKU
+ writer.writeKey(Key::resolution, Default::resolution);
+ writer.writeKey(Key::fullscreen, false);
+#else
if(video.mode.resolution == Vec2i(0)) {
writer.writeKey(Key::resolution, Default::resolution);
} else {
@@ -444,6 +452,7 @@ bool Config::save() {
}
writer.writeKey(Key::refreshRate, video.mode.refresh);
writer.writeKey(Key::fullscreen, video.fullscreen);
+#endif
writer.writeKey(Key::levelOfDetail, video.levelOfDetail);
writer.writeKey(Key::fogDistance, video.fogDistance);
writer.writeKey(Key::gamma, video.gamma);
@@ -578,6 +587,10 @@ bool Config::init(const fs::path & file) {
// Get video settings
video.renderer = reader.getKey(Section::Video, Key::renderer, Default::renderer);
+#if ARX_PLATFORM == ARX_PLATFORM_HAIKU
+ video.mode.resolution = Vec2i(0);
+ video.fullscreen = false;
+#else
std::string resolution = reader.getKey(Section::Video, Key::resolution, Default::resolution);
if(resolution == "auto") {
video.mode.resolution = Vec2i(0);
@@ -586,6 +599,7 @@ bool Config::init(const fs::path & file) {
}
video.mode.refresh = reader.getKey(Section::Video, Key::refreshRate, Default::refreshRate);
video.fullscreen = reader.getKey(Section::Video, Key::fullscreen, Default::fullscreen);
+#endif
video.levelOfDetail = reader.getKey(Section::Video, Key::levelOfDetail, Default::levelOfDetail);
video.fogDistance = reader.getKey(Section::Video, Key::fogDistance, Default::fogDistance);
video.gamma = reader.getKey(Section::Video, Key::gamma, Default::gamma);
diff --git a/src/graphics/opengl/OpenGLRenderer.cpp b/src/graphics/opengl/OpenGLRenderer.cpp
index 5cf7b49..f892c3b 100644
--- a/src/graphics/opengl/OpenGLRenderer.cpp
+++ b/src/graphics/opengl/OpenGLRenderer.cpp
@@ -219,7 +219,7 @@ void OpenGLRenderer::initialize() {
void OpenGLRenderer::beforeResize(bool wasOrIsFullscreen) {
-#if ARX_PLATFORM == ARX_PLATFORM_LINUX || ARX_PLATFORM == ARX_PLATFORM_BSD
+#if ARX_PLATFORM == ARX_PLATFORM_LINUX || ARX_PLATFORM == ARX_PLATFORM_BSD || ARX_PLATFORM == ARX_PLATFORM_HAIKU
// No re-initialization needed
ARX_UNUSED(wasOrIsFullscreen);
#else
diff --git a/src/platform/OS.cpp b/src/platform/OS.cpp
index 70fe2ee..176bd4f 100644
--- a/src/platform/OS.cpp
+++ b/src/platform/OS.cpp
@@ -211,6 +211,8 @@ std::string getOSName() {
return "macOS";
#elif ARX_PLATFORM == ARX_PLATFORM_BSD
return "BSD";
+ #elif ARX_PLATFORM == ARX_PLATFORM_HAIKU
+ return "Haiku";
#elif ARX_PLATFORM == ARX_PLATFORM_UNIX
return "UNIX";
#else
diff --git a/src/platform/Platform.h b/src/platform/Platform.h
index b914348..efda886 100644
--- a/src/platform/Platform.h
+++ b/src/platform/Platform.h
@@ -35,6 +35,7 @@
#define ARX_PLATFORM_WIN32 1
#define ARX_PLATFORM_LINUX 2
#define ARX_PLATFORM_MACOS 3
+#define ARX_PLATFORM_HAIKU 4
#define ARX_PLATFORM_BSD 100 // Generic BSD system
#define ARX_PLATFORM_UNIX 101 // Generic UNIX system
@@ -44,6 +45,8 @@
#define ARX_PLATFORM ARX_PLATFORM_WIN32
#elif defined(__MACH__)
#define ARX_PLATFORM ARX_PLATFORM_MACOS
+#elif defined(__HAIKU__)
+ #define ARX_PLATFORM ARX_PLATFORM_HAIKU
#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) \
|| defined(__bsdi__) || defined(__DragonFly__)
#define ARX_PLATFORM ARX_PLATFORM_BSD
diff --git a/src/platform/Thread.cpp b/src/platform/Thread.cpp
index fe5484a..8fcf3f7 100644
--- a/src/platform/Thread.cpp
+++ b/src/platform/Thread.cpp
@@ -41,6 +41,10 @@
#include ARX_INCLUDED_CPUID_H
#endif
+#if ARX_PLATFORM == ARX_PLATFORM_HAIKU
+#include <OS.h>
+#endif
+
#include <boost/static_assert.hpp>
#include "math/Random.h"
@@ -144,6 +148,9 @@ void * Thread::entryPoint(void * param) {
#elif ARX_HAVE_PRCTL && defined(PR_SET_NAME)
// Linux
prctl(PR_SET_NAME, reinterpret_cast<unsigned long>(thread.m_threadName.c_str()), 0, 0, 0);
+ #elif ARX_PLATFORM == ARX_PLATFORM_HAIKU
+ // Haiku
+ rename_thread(get_pthread_thread_id(thread.m_thread), thread.m_threadName.c_str());
#else
// This is non-fatal, but let's print a warning so future ports will be
// reminded to implement it.
diff --git a/src/window/SDL2Window.cpp b/src/window/SDL2Window.cpp
index b20ed83..be93930 100644
--- a/src/window/SDL2Window.cpp
+++ b/src/window/SDL2Window.cpp
@@ -97,6 +97,7 @@ SDL2Window::SDL2Window()
SDL2Window::~SDL2Window() {
+#if ARX_PLATFORM != ARX_PLATFORM_HAIKU
delete m_input;
if(m_renderer) {
@@ -115,6 +116,7 @@ SDL2Window::~SDL2Window() {
if(s_mainWindow) {
SDL_Quit(), s_mainWindow = NULL;
}
+#endif
}
@@ -192,6 +194,7 @@ bool SDL2Window::initializeFramework() {
}
#endif
+ #if ARX_PLATFORM != ARX_PLATFORM_HAIKU
int ndisplays = SDL_GetNumVideoDisplays();
for(int display = 0; display < ndisplays; display++) {
int modes = SDL_GetNumDisplayModes(display);
@@ -206,6 +209,7 @@ bool SDL2Window::initializeFramework() {
std::sort(m_displayModes.begin(), m_displayModes.end());
m_displayModes.erase(std::unique(m_displayModes.begin(), m_displayModes.end()),
m_displayModes.end());
+ #endif
s_mainWindow = this;
@@ -241,6 +245,9 @@ int SDL2Window::createWindowAndGLContext(const char * profile) {
Uint32 windowFlags = getSDLFlagsForMode(m_mode.resolution, m_fullscreen);
windowFlags |= SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE | SDL_WINDOW_HIDDEN;
+#if ARX_PLATFORM == ARX_PLATFORM_HAIKU
+ m_maxMSAALevel = 1;
+#endif
for(int msaa = m_maxMSAALevel; true; msaa--) {
bool lastTry = (msaa == 0);
@@ -509,7 +516,7 @@ bool SDL2Window::initialize() {
}
}
}
- #elif ARX_PLATFORM != ARX_PLATFORM_MACOS
+ #elif ARX_PLATFORM != ARX_PLATFORM_MACOS && ARX_PLATFORM != ARX_PLATFORM_HAIKU
u64 nativeWindow = SDL2X11_getNativeWindowHandle(m_window);
#else
u64 nativeWindow = 0;
diff --git a/src/window/SDL2X11Util.c b/src/window/SDL2X11Util.c
index 72ab23b..21f495f 100644
--- a/src/window/SDL2X11Util.c
+++ b/src/window/SDL2X11Util.c
@@ -26,7 +26,9 @@
#define ARX_STATIC_ASSERT(Cond, Msg) typedef char static_assertion_ ## Msg[(Cond) ? 1 : -1]
uint64_t SDL2X11_getNativeWindowHandle(SDL_Window * window) {
-
+#if ARX_PLATFORM == ARX_PLATFORM_HAIKU
+ return 0;
+#else
/*
* The size of the SDL_SysWMinfo structure depends on the build-time configuration of SDL.
* If Arx is built with a SDL install that was configured without Wayland, but is run on
@@ -49,4 +51,5 @@ uint64_t SDL2X11_getNativeWindowHandle(SDL_Window * window) {
}
return info.data.info.x11.window;
+#endif
}
diff --git a/src/window/SDL2X11Util.h b/src/window/SDL2X11Util.h
index b9432e4..dee2d87 100644
--- a/src/window/SDL2X11Util.h
+++ b/src/window/SDL2X11Util.h
@@ -27,9 +27,9 @@
#ifdef __cplusplus
extern "C" {
#endif
-
+#if ARX_PLATFORM != ARX_PLATFORM_HAIKU
uint64_t SDL2X11_getNativeWindowHandle(SDL_Window * window);
-
+#endif
#ifdef __cplusplus
} // extern "C"
#endif
--
2.23.0
From a59bc8f90f5b2baf0917b2d80c3a89e162b342ad Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Mon, 19 Aug 2019 22:55:02 +1000
Subject: Fix crash in openal player
diff --git a/src/audio/openal/OpenALSource.cpp b/src/audio/openal/OpenALSource.cpp
index de0f8e2..879246b 100644
--- a/src/audio/openal/OpenALSource.cpp
+++ b/src/audio/openal/OpenALSource.cpp
@@ -311,13 +311,15 @@ aalError OpenALSource::fillBuffer(size_t i, size_t size) {
TraceAL("filling buffer " << m_buffers[i] << " with " << size << " bytes");
- char data[StreamLimitBytes * NBUFFERS];
-
- arx_assert(size <= sizeof(data));
+ char * data = new char[size];
+ if(!data) {
+ return AAL_ERROR_MEMORY;
+ }
size_t read;
m_stream->read(data, left, read);
if(read != left) {
+ delete[] data;
return AAL_ERROR_SYSTEM;
}
m_written += read;
@@ -332,6 +334,7 @@ aalError OpenALSource::fillBuffer(size_t i, size_t size) {
if(size > left) {
m_stream->read(data + left, size - left, read);
if(read != size - left) {
+ delete[] data;
return AAL_ERROR_SYSTEM;
}
m_written += read;
@@ -343,6 +346,7 @@ aalError OpenALSource::fillBuffer(size_t i, size_t size) {
const PCMFormat & f = m_sample->getFormat();
if((f.channels != 1 && f.channels != 2) || (f.quality != 8 && f.quality != 16)) {
LogError << "Unsupported audio format: quality=" << f.quality << " channels=" << f.channels;
+ delete[] data;
return AAL_ERROR_SYSTEM;
}
@@ -359,6 +363,7 @@ aalError OpenALSource::fillBuffer(size_t i, size_t size) {
}
alBufferData(m_buffers[i], alformat, data, alsize, f.frequency);
+ delete[] data;
AL_CHECK_ERROR("setting buffer data")
m_bufferSizes[i] = size;
--
2.23.0
From 975fce37e4c37130aa879f52e5b2f1ccc4318197 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Mon, 19 Aug 2019 22:55:28 +1000
Subject: Fix crash on exit
diff --git a/src/core/Startup.cpp b/src/core/Startup.cpp
index 7d88903..b893316 100644
--- a/src/core/Startup.cpp
+++ b/src/core/Startup.cpp
@@ -175,5 +175,7 @@ int utf8_main(int argc, char ** argv) {
Random::shutdown();
+ kill(::getpid(), SIGKILL);
+
return (status == ExitFailure) ? EXIT_FAILURE : EXIT_SUCCESS;
}
--
2.23.0