ResidualVM: add recipe for trunk version 0.4.0

This commit is contained in:
Gerasim Troeglazov
2021-09-06 23:59:00 +10:00
parent 02e697e4b0
commit 7b84fa8dba
2 changed files with 319 additions and 0 deletions

View File

@@ -0,0 +1,188 @@
From 776540f0b19e30ac07f90fa7b6e54a68689c9aa4 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Mon, 6 Sep 2021 23:50:35 +1000
Subject: Fixes for Haiku
diff --git a/backends/platform/sdl/posix/posix.cpp b/backends/platform/sdl/posix/posix.cpp
index 8a8aeaa..a192d89 100644
--- a/backends/platform/sdl/posix/posix.cpp
+++ b/backends/platform/sdl/posix/posix.cpp
@@ -52,6 +52,10 @@
#include <sys/wait.h>
#include <unistd.h>
+#ifdef __HAIKU__
+#include <FindDirectory.h>
+#endif
+
#ifdef HAS_POSIX_SPAWN
#include <spawn.h>
#endif
@@ -138,6 +142,16 @@ Common::String OSystem_POSIX::getDefaultConfigFileName() {
// On POSIX systems we follow the XDG Base Directory Specification for
// where to store files. The version we based our code upon can be found
// over here: http://standards.freedesktop.org/basedir-spec/basedir-spec-0.8.html
+#ifdef __HAIKU__
+ static char settingsDir[PATH_MAX] = "";
+ if (find_directory(B_USER_SETTINGS_DIRECTORY, -1, false, settingsDir, sizeof(settingsDir)) == B_OK) {
+ prefix = settingsDir;
+ prefix += "/ResidualVM";
+ } else {
+ prefix = "/boot/home/config/settings/ResidualVM";
+ }
+ mkdir(prefix.c_str(), 0755);
+#else
envVar = getenv("XDG_CONFIG_HOME");
if (!envVar || !*envVar) {
envVar = getenv("HOME");
@@ -156,6 +170,7 @@ Common::String OSystem_POSIX::getDefaultConfigFileName() {
if (!prefix.empty() && Posix::assureDirectoryExists("residualvm", prefix.c_str())) {
prefix += "/residualvm";
}
+#endif
if (!prefix.empty() && (prefix.size() + 1 + baseConfigName.size()) < MAXPATHLEN) {
configFile = prefix;
@@ -180,7 +195,15 @@ Common::String OSystem_POSIX::getXdgUserDir(const char *name) {
configHome = Common::String::format("%s/.config", home);
}
-
+#if defined(__HAIKU__)
+ static char settingsDir[PATH_MAX] = "";
+ if (find_directory(B_USER_SETTINGS_DIRECTORY, -1, false, settingsDir, sizeof(settingsDir)) == B_OK) {
+ configHome = settingsDir;
+ configHome += "/ResidualVM";
+ } else {
+ configHome = "/boot/home/config/settings/ResidualVM";
+ }
+#endif
// Find the requested directory line in the xdg-user-dirs configuration file
// Example line value: XDG_PICTURES_DIR="$HOME/Pictures"
Common::FSNode userDirsFile(configHome + "/user-dirs.dirs");
@@ -296,9 +319,17 @@ Common::String OSystem_POSIX::getDefaultLogFileName() {
logFile = ".cache/";
}
-
+#if defined(__HAIKU__)
+ static char cacheDir[PATH_MAX] = "";
+ if (find_directory(B_USER_CACHE_DIRECTORY, -1, false, cacheDir, sizeof(cacheDir)) == B_OK) {
+ prefix = cacheDir;
+ } else {
+ prefix = "/boot/home/config/cache";
+ }
+ logFile = "ResidualVM/logs";
+#else
logFile += "residualvm/logs";
-
+#endif
if (!Posix::assureDirectoryExists(logFile, prefix)) {
return Common::String();
}
@@ -361,6 +392,11 @@ bool OSystem_POSIX::openUrl(const Common::String &url) {
#ifdef HAS_POSIX_SPAWN
// inspired by Qt's "qdesktopservices_x11.cpp"
+#ifdef __HAIKU__
+ if (launchBrowser("open", url))
+ return true;
+#endif
+
// try "standards"
if (launchBrowser("xdg-open", url))
return true;
diff --git a/backends/saves/posix/posix-saves.cpp b/backends/saves/posix/posix-saves.cpp
index 7b83154..8636b83 100644
--- a/backends/saves/posix/posix-saves.cpp
+++ b/backends/saves/posix/posix-saves.cpp
@@ -26,7 +26,9 @@
#define FORBIDDEN_SYMBOL_EXCEPTION_time_h //On IRIX, sys/stat.h includes sys/time.h
#define FORBIDDEN_SYMBOL_EXCEPTION_mkdir
#define FORBIDDEN_SYMBOL_EXCEPTION_getenv
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+#include "config.h"
#include "common/scummsys.h"
#if defined(POSIX) && !defined(DISABLE_DEFAULT_SAVEFILEMANAGER)
@@ -40,6 +42,10 @@
#include <sys/stat.h>
+#ifdef __HAIKU__
+#include <FindDirectory.h>
+#endif
+
POSIXSaveFileManager::POSIXSaveFileManager() {
// Register default savepath.
Common::String savePath;
@@ -52,7 +58,16 @@ POSIXSaveFileManager::POSIXSaveFileManager() {
ConfMan.registerDefault("savepath", savePath);
}
-
+#elif defined(__HAIKU__)
+ static char settingsDir[PATH_MAX] = "";
+ if (find_directory(B_USER_SETTINGS_DIRECTORY, -1, false, settingsDir, sizeof(settingsDir)) == B_OK) {
+ savePath = settingsDir;
+ savePath += "/ResidualVM/Savegames";
+ } else {
+ savePath = "/boot/home/config/settings/ResidualVM/Savegames";
+ }
+ mkdir(savePath.c_str(), 0755);
+ ConfMan.registerDefault("savepath", savePath);
#else
const char *envVar;
diff --git a/configure b/configure
index eb50f9e..c5f5a50 100755
--- a/configure
+++ b/configure
@@ -6220,6 +6220,9 @@ $_config_h_data
/* Data types */
#ifndef SCUMMVM_DONT_DEFINE_TYPES
typedef unsigned $type_1_byte byte;
+#ifdef __HAIKU__
+#include <SupportDefs.h>
+#else
typedef unsigned int uint;
typedef unsigned $type_1_byte uint8;
typedef unsigned $type_2_byte uint16;
@@ -6230,6 +6233,7 @@ typedef signed $type_2_byte int16;
typedef signed $type_4_byte int32;
typedef signed $type_8_byte int64;
#endif
+#endif
typedef $type_ptr uintptr;
diff --git a/engines/icb/jpeg.h b/engines/icb/jpeg.h
index 6c0f57b..0cb4a41 100644
--- a/engines/icb/jpeg.h
+++ b/engines/icb/jpeg.h
@@ -40,6 +40,8 @@ static uint32 *_end_buf;
#ifdef _WIN32
static __int64 safeMM0 = 0;
+#elif defined(__HAIKU__)
+static int64_t safeMM0 = 0;
#else
static __int64_t safeMM0 = 0;
#endif
diff --git a/engines/wintermute/base/gfx/opengl/base_render_opengl3d.cpp b/engines/wintermute/base/gfx/opengl/base_render_opengl3d.cpp
index 1a0ed7d..8928b70 100644
--- a/engines/wintermute/base/gfx/opengl/base_render_opengl3d.cpp
+++ b/engines/wintermute/base/gfx/opengl/base_render_opengl3d.cpp
@@ -28,6 +28,7 @@
#include "engines/wintermute/base/gfx/3ds/light3d.h"
#include "graphics/opengl/system_headers.h"
#include "math/glmath.h"
+#include <GL/glew.h>
#if defined(USE_OPENGL) && !defined(USE_GLES2)
--
2.30.2

View File

@@ -0,0 +1,131 @@
SUMMARY="A cross-platform 3D game interpreter"
DESCRIPTION="ResidualVM is a program which allows you to run certain classic \
3D games, provided you already have their data files. ResidualVM just \
replaces the executables shipped with the game, allowing you to play them on \
systems for which they were never designed!"
HOMEPAGE="https://www.residualvm.org/"
COPYRIGHT="2003-2020 ResidualVM Team"
LICENSE="GNU GPL v2"
REVISION="1"
srcGitRev="48875a1d3dbc7bdbbc3d648a55c930cd3eb30583"
SOURCE_URI="https://github.com/residualvm/residualvm/archive/$srcGitRev.tar.gz"
SOURCE_DIR="residualvm-$srcGitRev"
CHECKSUM_SHA256="d139389146d5cc373999cda7c581c5ca2f4059cc24c29f82ea7ac8c90c2e52c1"
PATCHES="residualvm-$portVersion.patchset"
ADDITIONAL_FILES="residualvm.rdef.in"
ARCHITECTURES="!x86_gcc2 x86_64"
SECONDARY_ARCHITECTURES="x86"
PROVIDES="
residualvm$secondaryArchSuffix = $portVersion
app:ResidualVM$secondaryArchSuffix = $portVersion
"
REQUIRES="
haiku$secondaryArchSuffix
lib:libbz2$secondaryArchSuffix
lib:libcrypto$secondaryArchSuffix
lib:libcurl$secondaryArchSuffix
lib:libfaad$secondaryArchSuffix
lib:libflac$secondaryArchSuffix
lib:libfluidsynth$secondaryArchSuffix >= 2
lib:libfreetype$secondaryArchSuffix
lib:libgl$secondaryArchSuffix
lib:libglew$secondaryArchSuffix
lib:libglu$secondaryArchSuffix
lib:libiconv$secondaryArchSuffix
lib:libintl$secondaryArchSuffix
lib:libjpeg$secondaryArchSuffix
lib:libmad$secondaryArchSuffix
lib:libmpeg2$secondaryArchSuffix
lib:libnghttp2$secondaryArchSuffix
lib:libogg$secondaryArchSuffix
lib:libpng16$secondaryArchSuffix
lib:libreadline$secondaryArchSuffix
lib:libSDL2_2.0$secondaryArchSuffix
lib:libSDL2_net_2.0$secondaryArchSuffix
lib:libssl$secondaryArchSuffix
lib:libtheoradec$secondaryArchSuffix
lib:libvorbis$secondaryArchSuffix
lib:libvorbisfile$secondaryArchSuffix
lib:libz$secondaryArchSuffix
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
devel:libbz2$secondaryArchSuffix
devel:libcrypto$secondaryArchSuffix
devel:libcurl$secondaryArchSuffix
devel:libfaad$secondaryArchSuffix
devel:libflac$secondaryArchSuffix
devel:libfluidsynth$secondaryArchSuffix >= 2
devel:libfreetype$secondaryArchSuffix
devel:libgl$secondaryArchSuffix
devel:libglew$secondaryArchSuffix
devel:libglu$secondaryArchSuffix
devel:libiconv$secondaryArchSuffix
devel:libintl$secondaryArchSuffix
devel:libjpeg$secondaryArchSuffix
devel:libmad$secondaryArchSuffix
devel:libmpeg2$secondaryArchSuffix
devel:libnghttp2$secondaryArchSuffix
devel:libogg$secondaryArchSuffix
devel:libpng16$secondaryArchSuffix
devel:libreadline$secondaryArchSuffix
devel:libSDL2_2.0$secondaryArchSuffix
devel:libSDL2_net_2.0$secondaryArchSuffix
devel:libssl$secondaryArchSuffix
devel:libtheoradec$secondaryArchSuffix
devel:libvorbis$secondaryArchSuffix
devel:libvorbisfile$secondaryArchSuffix
devel:libz$secondaryArchSuffix
"
BUILD_PREREQUIRES="
cmd:gcc$secondaryArchSuffix
cmd:ld$secondaryArchSuffix
cmd:make
cmd:nasm
cmd:pkg_config$secondaryArchSuffix
"
BUILD()
{
CPPFLAGS=`freetype-config --cflags` ./configure --prefix=$appsDir/ResidualVM \
--enable-all-engines \
--enable-all-unstable-engines \
--enable-release \
--enable-libcurl \
--enable-flac \
--enable-faad \
--enable-text-console \
--enable-cloud \
--disable-debug \
--disable-updates
make $jobArgs
}
INSTALL()
{
make install
mv $appsDir/ResidualVM/bin/residualvm $appsDir/ResidualVM/ResidualVM
rm -R $appsDir/ResidualVM/bin
local APP_SIGNATURE="application/x-vnd.residualvm"
local MAJOR="`echo "$portVersion" | cut -d. -f1`"
local MIDDLE="`echo "$portVersion" | cut -d. -f2`"
local MINOR="`echo "$portVersion" | cut -d. -f3 | cut -d~ -f1`"
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/residualvm.rdef.in > $sourceDir/residualvm.rdef
addResourcesToBinaries $sourceDir/residualvm.rdef \
$appsDir/ResidualVM/ResidualVM
addAppDeskbarSymlink $appsDir/ResidualVM/ResidualVM
}