From 32e9dd25b4a27998fa8a0e09c3a77f7dde29b42a Mon Sep 17 00:00:00 2001 From: BenjaminAmos <24301287+BenjaminAmos@users.noreply.github.com> Date: Fri, 15 Nov 2019 20:58:41 +0000 Subject: [PATCH] 0AD: new recipe (#1852) disabled for now. some unresolved issues in the PR still stand. --- games-strategy/0ad/0ad-0.0.23b~alpha.recipe | 127 ++ games-strategy/0ad/0ad-0.0.23~alpha.recipe | 127 ++ games-strategy/0ad/licenses/0ADLicense | 82 + .../0ad/patches/0ad-0.0.23-alpha.patch | 1335 +++++++++++++++++ .../0ad_data/0ad_data-0.0.23b~alpha.recipe | 29 + .../0ad_data/0ad_data-0.0.23~alpha.recipe | 29 + games-strategy/0ad_data/licenses/0ADLicense | 82 + 7 files changed, 1811 insertions(+) create mode 100644 games-strategy/0ad/0ad-0.0.23b~alpha.recipe create mode 100644 games-strategy/0ad/0ad-0.0.23~alpha.recipe create mode 100644 games-strategy/0ad/licenses/0ADLicense create mode 100644 games-strategy/0ad/patches/0ad-0.0.23-alpha.patch create mode 100644 games-strategy/0ad_data/0ad_data-0.0.23b~alpha.recipe create mode 100644 games-strategy/0ad_data/0ad_data-0.0.23~alpha.recipe create mode 100644 games-strategy/0ad_data/licenses/0ADLicense diff --git a/games-strategy/0ad/0ad-0.0.23b~alpha.recipe b/games-strategy/0ad/0ad-0.0.23b~alpha.recipe new file mode 100644 index 000000000..890ae2fb9 --- /dev/null +++ b/games-strategy/0ad/0ad-0.0.23b~alpha.recipe @@ -0,0 +1,127 @@ +SUMMARY="O A.D. - Game" +DESCRIPTION="A free, open-source, Real-Time Strategy (RTS) game." +HOMEPAGE="https://play0ad.com/" +COPYRIGHT="Wildfire Games" +LICENSE="0ADLicense" +REVISION="1" +SOURCE_URI="https://releases.wildfiregames.com/0ad-${portVersion/\~/-}-unix-build.tar.gz" +CHECKSUM_SHA256="bc2db65e09076f8e723c574339e7736b5571d525de3985cbb95ca11f318cc7a8" +SOURCE_DIR="0ad-${portVersion/\~/-}" +PATCHES="0ad-0.0.23-alpha.patch" + +ARCHITECTURES="!x86_gcc2 ?x86 ?x86_64" +SECONDARY_ARCHITECTURES="?x86" + +PROVIDES=" + 0ad$secondaryArchSuffix = $portVersion + app:0ad$secondaryArchSuffix = $portVersion + " +REQUIRES=" + haiku$secondaryArchSuffix + lib:libcurl$secondaryArchSuffix + lib:libnspr4$secondaryArchSuffix + lib:libogg$secondaryArchSuffix + lib:libopenal$secondaryArchSuffix + lib:libpng$secondaryArchSuffix + libsdl2$secondaryArchSuffix + lib:libvorbis$secondaryArchSuffix + lib:libxml2$secondaryArchSuffix + lib:libzlib$secondaryArchSuffix + lib:libminiupnpc$secondaryArchSuffix + lib:libiconv$secondaryArchSuffix + lib:libz$secondaryArchSuffix + lib:libsodium$secondaryArchSuffix + lib:libgloox$secondaryArchSuffix + lib:libicui18n$secondaryArchSuffix >= 57 + lib:libicuuc$secondaryArchSuffix >= 57 + boost169$secondaryArchSuffix + lib:libenet$secondaryArchSuffix + lib:libiconv$secondaryArchSuffix + mesa$secondaryArchSuffix + 0ad_data == $portVersion + " + +BUILD_REQUIRES=" + boost169${secondaryArchSuffix}_devel + devel:libsdl2$secondaryArchSuffix + devel:libxml2$secondaryArchSuffix + devel:libnspr4$secondaryArchSuffix + devel:libicudata$secondaryArchSuffix + devel:libicui18n$secondaryArchSuffix + devel:libicuio$secondaryArchSuffix + devel:libicutest$secondaryArchSuffix + devel:libicutu$secondaryArchSuffix + devel:libicuuc$secondaryArchSuffix + devel:libiconv$secondaryArchSuffix + devel:libplc4$secondaryArchSuffix + devel:libplds4$secondaryArchSuffix + devel:libenet$secondaryArchSuffix + devel:libgloox$secondaryArchSuffix + devel:libminiupnpc$secondaryArchSuffix + devel:libsodium$secondaryArchSuffix + devel:libGL$secondaryArchSuffix + devel:libcurl$secondaryArchSuffix + devel:libopenal$secondaryArchSuffix + devel:libvorbis$secondaryArchSuffix + devel:libpng$secondaryArchSuffix + " + +BUILD_PREREQUIRES=" + haiku${secondaryArchSuffix}_devel + cmd:gcc$secondaryArchSuffix + cmd:g++$secondaryArchSuffix + cmd:ld$secondaryArchSuffix + cmd:make + cmd:pkg_config$secondaryArchSuffix + cmd:perl + cmd:patch + cmd:python + cmd:cmake + cmd:xargs + cmd:awk + cmd:which + cmd:cat + cmd:sed + " + +PATCH() +{ + # HACK: The patch provided for premake4 in the patch file does not apply correctly. + sed -i 's|linkoptions { "-rdynamic" }|linkoptions { "-Wl,--export-dynamic" }|g' build/premake/premake4/premake4.lua + sed -i 's|-rdynamic|-Wl,--export-dynamic|g' build/premake/premake4/build/gmake.unix/Premake4.make + sed -i 's|-ldl| |g' build/premake/premake4/build/gmake.unix/Premake4.make +} + +BUILD() +{ + cd "build/workspaces/" + ./update-workspaces.sh --disable-atlas --minimal-flags --without-pch --datadir=$dataDir/0ad $jobArgs + + cd gcc + make $jobArgs +} + +INSTALL() +{ + mkdir -p $appsDir + mkdir -p $appsDir/0ad + + mkdir -p $dataDir + mkdir -p $dataDir/0ad + + cp -R binaries/data/* $dataDir/0ad + cp -R binaries/system/* $appsDir/0ad + + # HACK: I don't know of a better way to do this but 0 A.D. expects the exact library name "libminiupnpc.so.16". + # The Miniupnpc API 17 only has a single breaking change over API 16 and that only appears to apply on Windows. + # See http://miniupnp.free.fr/files/changelog.php?file=miniupnpc-2.1.tar.gz for more information. + # HaikuPorts does not have a recipe for miniupnpc API 16. + ln -s /system/lib/x86/libminiupnpc.so.17 $appsDir/0ad/libminiupnpc.so.16 + + addAppDeskbarSymlink $appsDir/0ad/pyrogenesis "0 A.D." +} + +TEST() +{ + binaries/system/test -libdir "./binaries/system" +} diff --git a/games-strategy/0ad/0ad-0.0.23~alpha.recipe b/games-strategy/0ad/0ad-0.0.23~alpha.recipe new file mode 100644 index 000000000..cf4bee45e --- /dev/null +++ b/games-strategy/0ad/0ad-0.0.23~alpha.recipe @@ -0,0 +1,127 @@ +SUMMARY="O A.D. - Game" +DESCRIPTION="A free, open-source, Real-Time Strategy (RTS) game." +HOMEPAGE="https://play0ad.com/" +COPYRIGHT="Wildfire Games" +LICENSE="0ADLicense" +REVISION="1" +SOURCE_URI="https://releases.wildfiregames.com/0ad-${portVersion/\~/-}-unix-build.tar.gz" +CHECKSUM_SHA256="7659155d3c85c053d6a2f50a07ea7ba69d2ee3337c9b56b78b226f60a3276014" +SOURCE_DIR="0ad-${portVersion/\~/-}" +PATCHES="0ad-${portVersion/\~/-}.patch" + +ARCHITECTURES="!x86_gcc2 ?x86 ?x86_64" +SECONDARY_ARCHITECTURES="?x86" + +PROVIDES=" + 0ad$secondaryArchSuffix = $portVersion + app:0ad$secondaryArchSuffix = $portVersion + " +REQUIRES=" + haiku$secondaryArchSuffix + lib:libcurl$secondaryArchSuffix + lib:libnspr4$secondaryArchSuffix + lib:libogg$secondaryArchSuffix + lib:libopenal$secondaryArchSuffix + lib:libpng$secondaryArchSuffix + libsdl2$secondaryArchSuffix + lib:libvorbis$secondaryArchSuffix + lib:libxml2$secondaryArchSuffix + lib:libzlib$secondaryArchSuffix + lib:libminiupnpc$secondaryArchSuffix + lib:libiconv$secondaryArchSuffix + lib:libz$secondaryArchSuffix + lib:libsodium$secondaryArchSuffix + lib:libgloox$secondaryArchSuffix + lib:libicui18n$secondaryArchSuffix >= 57 + lib:libicuuc$secondaryArchSuffix >= 57 + boost169$secondaryArchSuffix + lib:libenet$secondaryArchSuffix + lib:libiconv$secondaryArchSuffix + mesa$secondaryArchSuffix + 0ad_data == $portVersion + " + +BUILD_REQUIRES=" + boost169${secondaryArchSuffix}_devel + devel:libsdl2$secondaryArchSuffix + devel:libxml2$secondaryArchSuffix + devel:libnspr4$secondaryArchSuffix + devel:libicudata$secondaryArchSuffix + devel:libicui18n$secondaryArchSuffix + devel:libicuio$secondaryArchSuffix + devel:libicutest$secondaryArchSuffix + devel:libicutu$secondaryArchSuffix + devel:libicuuc$secondaryArchSuffix + devel:libiconv$secondaryArchSuffix + devel:libplc4$secondaryArchSuffix + devel:libplds4$secondaryArchSuffix + devel:libenet$secondaryArchSuffix + devel:libgloox$secondaryArchSuffix + devel:libminiupnpc$secondaryArchSuffix + devel:libsodium$secondaryArchSuffix + devel:libGL$secondaryArchSuffix + devel:libcurl$secondaryArchSuffix + devel:libopenal$secondaryArchSuffix + devel:libvorbis$secondaryArchSuffix + devel:libpng$secondaryArchSuffix + " + +BUILD_PREREQUIRES=" + haiku${secondaryArchSuffix}_devel + cmd:gcc$secondaryArchSuffix + cmd:g++$secondaryArchSuffix + cmd:ld$secondaryArchSuffix + cmd:make + cmd:pkg_config$secondaryArchSuffix + cmd:perl + cmd:patch + cmd:python + cmd:cmake + cmd:xargs + cmd:awk + cmd:which + cmd:cat + cmd:sed + " + +PATCH() +{ + # HACK: The patch provided for premake4 in the patch file does not apply correctly. + sed -i 's|linkoptions { "-rdynamic" }|linkoptions { "-Wl,--export-dynamic" }|g' build/premake/premake4/premake4.lua + sed -i 's|-rdynamic|-Wl,--export-dynamic|g' build/premake/premake4/build/gmake.unix/Premake4.make + sed -i 's|-ldl| |g' build/premake/premake4/build/gmake.unix/Premake4.make +} + +BUILD() +{ + cd "build/workspaces/" + ./update-workspaces.sh --disable-atlas --minimal-flags --without-pch --datadir=$dataDir/0ad $jobArgs + + cd gcc + make $jobArgs +} + +INSTALL() +{ + mkdir -p $appsDir + mkdir -p $appsDir/0ad + + mkdir -p $dataDir + mkdir -p $dataDir/0ad + + cp -R binaries/data/* $dataDir/0ad + cp -R binaries/system/* $appsDir/0ad + + # HACK: I don't know of a better way to do this but 0 A.D. expects the exact library name "libminiupnpc.so.16". + # The Miniupnpc API 17 only has a single breaking change over API 16 and that only appears to apply on Windows. + # See http://miniupnp.free.fr/files/changelog.php?file=miniupnpc-2.1.tar.gz for more information. + # HaikuPorts does not have a recipe for miniupnpc API 16. + ln -s /system/lib/x86/libminiupnpc.so.17 $appsDir/0ad/libminiupnpc.so.16 + + addAppDeskbarSymlink $appsDir/0ad/pyrogenesis "0 A.D." +} + +TEST() +{ + binaries/system/test -libdir "./binaries/system" +} diff --git a/games-strategy/0ad/licenses/0ADLicense b/games-strategy/0ad/licenses/0ADLicense new file mode 100644 index 000000000..22652ac14 --- /dev/null +++ b/games-strategy/0ad/licenses/0ADLicense @@ -0,0 +1,82 @@ + 0 A.D. Licensing Details +========================== + +0 A.D. is released as open source: you can freely use, copy, modify and +distribute the game's source code and data files, as long as you include +attribution to Wildfire Games and let anyone freely modify and distribute any +of your own modifications to the game's files. + +The distribution includes several different types of files, and a number of +third-party components. The details are described here, based on the directory +structure. For any file, see the longest path name below which is a prefix of +the file's path. + +Some files don't yet have licensing details specified - if you care about any +in particular, let us know and we can try to clarify it. + + /binaries/data + GPL version 2 (or later) - see license_gpl-2.0.txt + + /binaries/data/mods/art + /binaries/data/mods/audio + Creative Commons Attribution-Share Alike 3.0 - see + http://creativecommons.org/licenses/by-sa/3.0/ + and also see LICENSE.txt within those directories + + /binaries/system + Various (unspecified) + + /binaries/system/dbghelp.dll + Proprietary - see license_dbghelp.txt for restrictions you must agree to + before distributing this particular file + + /build + Various (unspecified) + + /build/premake/premake4 + /build/premake/premake5 + BSD + + /build/premake/*.lua + MIT - see license_mit.txt + + /docs + Various (unspecified) + + /libraries + Various - see LICENSE.txt within that directory + + /source + GPL version 2 (or later) - see license_gpl-2.0.txt + + /source/lib + MIT - see license_mit.txt + + /source/scriptinterface/third_party + MPL 2.0 + + /source/third_party/cppformat + BSD + + /source/third_party/encryption + GPL version 2 (or later) + ISC (pkcs5_pbkdf2.cpp) + MIT (pkcs5_pbkdf2.h) - see license_mit.txt + + /source/third-party/jsonspirit + MIT - see license_mit.txt + + /source/third_party/mikktspace + zlib + + /source/third_party/mongoose + MIT - see license_mit.txt + + /source/third_party/tinygettext + zlib + + /source/tools + Various - see LICENSE.txt within that directory + + /source/tools/atlas + GPL version 2 (or later) - see license_gpl-2.0.txt diff --git a/games-strategy/0ad/patches/0ad-0.0.23-alpha.patch b/games-strategy/0ad/patches/0ad-0.0.23-alpha.patch new file mode 100644 index 000000000..ac60281d1 --- /dev/null +++ b/games-strategy/0ad/patches/0ad-0.0.23-alpha.patch @@ -0,0 +1,1335 @@ +diff -urdN -E -b -w -B --strip-trailing-cr original/0ad-0.0.23-alpha/build/premake/extern_libs4.lua 0ad-0.0.23-alpha/build/premake/extern_libs4.lua +--- original/0ad-0.0.23-alpha/build/premake/extern_libs4.lua 2018-04-08 21:41:31.011534336 +0000 ++++ 0ad-0.0.23-alpha/build/premake/extern_libs4.lua 2019-06-05 09:51:34.060030976 +0000 +@@ -347,7 +347,7 @@ + elseif os.is("macosx") then + add_default_include_paths("iconv") + defines { "LIBICONV_STATIC" } +- elseif os.getversion().description == "FreeBSD" then ++ elseif os.getversion().description == "FreeBSD" or os.is("haiku") then + defines { "HAVE_ICONV_CONST" } + defines { "ICONV_CONST=const" } + end +@@ -359,6 +359,7 @@ + add_default_links({ + win_names = { "libiconv" }, + osx_names = { "iconv" }, ++ unix_names = { "iconv" }, + dbg_suffix = "", + no_delayload = 1, + }) +@@ -722,14 +723,14 @@ + link_settings = function() + add_default_links({ + win_names = { }, +- unix_names = { "X11" }, ++-- unix_names = { "X11" }, + }) + end, + }, + xcursor = { + link_settings = function() + add_default_links({ +- unix_names = { "Xcursor" }, ++-- unix_names = { "Xcursor" }, + }) + end, + }, +diff -urdN -E -b -w -B --strip-trailing-cr original/0ad-0.0.23-alpha/build/premake/extern_libs5.lua 0ad-0.0.23-alpha/build/premake/extern_libs5.lua +--- original/0ad-0.0.23-alpha/build/premake/extern_libs5.lua 2018-04-29 15:44:48.011272192 +0000 ++++ 0ad-0.0.23-alpha/build/premake/extern_libs5.lua 2019-06-07 17:12:40.761528320 +0000 +@@ -313,6 +313,7 @@ + add_default_links({ + win_names = { "libiconv" }, + osx_names = { "iconv" }, ++ unix_names = { "iconv" }, + dbg_suffix = "", + no_delayload = 1, + }) +@@ -685,17 +686,21 @@ + }, + x11 = { + link_settings = function() ++ if not os.istarget("haiku") then + add_default_links({ + win_names = { }, + unix_names = { "X11" }, + }) ++ end + end, + }, + xcursor = { + link_settings = function() ++ if not os.istarget("haiku") then + add_default_links({ + unix_names = { "Xcursor" }, + }) ++ end + end, + }, + zlib = { +diff -urdN -E -b -w -B --strip-trailing-cr original/0ad-0.0.23-alpha/build/premake/premake4.lua 0ad-0.0.23-alpha/build/premake/premake4.lua +--- original/0ad-0.0.23-alpha/build/premake/premake4.lua 2018-04-29 15:44:48.052428800 +0000 ++++ 0ad-0.0.23-alpha/build/premake/premake4.lua 2019-06-05 11:28:48.069730304 +0000 +@@ -382,7 +382,7 @@ + -- add X11 includes paths after all the others so they don't conflict with + -- bundled libs + function project_add_x11_dirs() +- if not os.is("windows") and not os.is("macosx") then ++ if not os.is("windows") and not os.is("macosx") and not os.is("haiku") then + -- X11 includes may be installed in one of a gadzillion of five places + -- Famous last words: "You can't include too much! ;-)" + includedirs { +@@ -835,6 +835,7 @@ + windows = { "lib/sysdep/os/win", "lib/sysdep/os/win/wposix", "lib/sysdep/os/win/whrt" }, + macosx = { "lib/sysdep/os/osx", "lib/sysdep/os/unix" }, + bsd = { "lib/sysdep/os/bsd", "lib/sysdep/os/unix", "lib/sysdep/os/unix/x" }, ++ haiku = { "lib/sysdep/os/haiku", "lib/sysdep/os/unix" } + } + for i,v in pairs(sysdep_dirs[os.get()]) do + table.insert(source_dirs, v); +@@ -1022,6 +1023,13 @@ + linkoptions { "-framework ApplicationServices", "-framework Cocoa", "-framework CoreFoundation" } + + end ++ ++ if os.is("haiku") then ++ linkoptions { ++ links { "be" } ++ "/boot/system/lib/libnetwork.so" ++ } ++ end + end + + +@@ -1458,6 +1465,13 @@ + + includedirs { source_root .. "pch/test/" } + end ++ ++ if os.is("haiku") then ++ linkoptions { ++ links { "be" } ++ "/boot/system/lib/libnetwork.so" ++ } ++ end + end + + -- must come first, so that VC sets it as the default project and therefore +diff -urdN -E -b -w -B --strip-trailing-cr original/0ad-0.0.23-alpha/build/premake/premake5/build/gmake.unix/Premake5.make 0ad-0.0.23-alpha/build/premake/premake5/build/gmake.unix/Premake5.make +--- original/0ad-0.0.23-alpha/build/premake/premake5/build/gmake.unix/Premake5.make 2017-10-28 16:10:49.040370176 +0000 ++++ 0ad-0.0.23-alpha/build/premake/premake5/build/gmake.unix/Premake5.make 2019-01-10 17:32:02.104857600 +0000 +@@ -22,9 +22,9 @@ + ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -O3 -Wall -Wextra + ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -O3 -Wall -Wextra -fno-stack-protector + ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) +- LIBS += bin/Release/liblua-lib.a bin/Release/libzip-lib.a bin/Release/libzlib-lib.a bin/Release/libcurl-lib.a bin/Release/libmbedtls-lib.a -lm -ldl -lrt ++ LIBS += bin/Release/liblua-lib.a bin/Release/libzip-lib.a bin/Release/libzlib-lib.a bin/Release/libcurl-lib.a bin/Release/libmbedtls-lib.a -lm -lnetwork -lbsd + LDDEPS += bin/Release/liblua-lib.a bin/Release/libzip-lib.a bin/Release/libzlib-lib.a bin/Release/libcurl-lib.a bin/Release/libmbedtls-lib.a +- ALL_LDFLAGS += $(LDFLAGS) -s -rdynamic ++ ALL_LDFLAGS += $(LDFLAGS) -s + LINKCMD = $(CC) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS) + define PREBUILDCMDS + endef +@@ -49,9 +49,9 @@ + ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) -g -Wall -Wextra + ALL_CXXFLAGS += $(CXXFLAGS) $(ALL_CPPFLAGS) -g -Wall -Wextra + ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES) +- LIBS += bin/Debug/liblua-lib.a bin/Debug/libzip-lib.a bin/Debug/libzlib-lib.a bin/Debug/libcurl-lib.a bin/Debug/libmbedtls-lib.a -lm -ldl -lrt ++ LIBS += bin/Debug/liblua-lib.a bin/Debug/libzip-lib.a bin/Debug/libzlib-lib.a bin/Debug/libcurl-lib.a bin/Debug/libmbedtls-lib.a -lm -lnetwork + LDDEPS += bin/Debug/liblua-lib.a bin/Debug/libzip-lib.a bin/Debug/libzlib-lib.a bin/Debug/libcurl-lib.a bin/Debug/libmbedtls-lib.a +- ALL_LDFLAGS += $(LDFLAGS) -rdynamic ++ ALL_LDFLAGS += $(LDFLAGS) + LINKCMD = $(CC) -o "$@" $(OBJECTS) $(RESOURCES) $(ALL_LDFLAGS) $(LIBS) + define PREBUILDCMDS + endef +diff -urdN -E -b -w -B --strip-trailing-cr original/0ad-0.0.23-alpha/build/premake/premake5/contrib/curl/lib/curl_setup.h 0ad-0.0.23-alpha/build/premake/premake5/contrib/curl/lib/curl_setup.h +--- original/0ad-0.0.23-alpha/build/premake/premake5/contrib/curl/lib/curl_setup.h 2017-10-28 16:10:49.057147392 +0000 ++++ 0ad-0.0.23-alpha/build/premake/premake5/contrib/curl/lib/curl_setup.h 2019-01-10 17:03:25.658243584 +0000 +@@ -86,6 +86,10 @@ + # include "config-linux.h" + #endif + ++#ifdef __HAIKU__ ++# include "config-linux.h" ++#endif ++ + #ifdef __APPLE__ && __MACH__ + # include "config-osx.h" + #endif +diff -urdN -E -b -w -B --strip-trailing-cr original/0ad-0.0.23-alpha/build/premake/premake5/contrib/curl/lib/if2ip.c 0ad-0.0.23-alpha/build/premake/premake5/contrib/curl/lib/if2ip.c +--- original/0ad-0.0.23-alpha/build/premake/premake5/contrib/curl/lib/if2ip.c 2017-10-28 16:10:49.063963136 +0000 ++++ 0ad-0.0.23-alpha/build/premake/premake5/contrib/curl/lib/if2ip.c 2019-01-10 17:07:04.829423616 +0000 +@@ -40,6 +40,9 @@ + #ifdef HAVE_SYS_SOCKIO_H + # include + #endif ++#ifdef __HAIKU__ ++# include ++#endif + #ifdef HAVE_IFADDRS_H + # include + #endif +diff -urdN -E -b -w -B --strip-trailing-cr original/0ad-0.0.23-alpha/build/premake/premake5/contrib/curl/premake5.lua 0ad-0.0.23-alpha/build/premake/premake5/contrib/curl/premake5.lua +--- original/0ad-0.0.23-alpha/build/premake/premake5/contrib/curl/premake5.lua 2017-10-28 16:10:49.031457280 +0000 ++++ 0ad-0.0.23-alpha/build/premake/premake5/contrib/curl/premake5.lua 2019-01-10 16:47:35.566493184 +0000 +@@ -27,7 +27,7 @@ + defines { "USE_MBEDTLS" } + + filter { "system:linux or bsd" } +- defines { "CURL_HIDDEN_SYMBOLS" } ++ defines { "CURL_HIDDEN_SYMBOLS", "_BSD_SOURCE" } + + -- find the location of the ca bundle + local ca = nil +diff -urdN -E -b -w -B --strip-trailing-cr original/0ad-0.0.23-alpha/build/premake/premake5/premake5.lua 0ad-0.0.23-alpha/build/premake/premake5/premake5.lua +--- original/0ad-0.0.23-alpha/build/premake/premake5/premake5.lua 2017-10-28 16:10:49.048496640 +0000 ++++ 0ad-0.0.23-alpha/build/premake/premake5/premake5.lua 2019-06-07 15:26:48.134217728 +0000 +@@ -164,12 +164,12 @@ + filter "system:windows" + links { "ole32", "ws2_32", "advapi32" } + +- filter "system:linux or bsd or hurd" ++ filter "system:linux or bsd or hurd or haiku" + defines { "LUA_USE_POSIX", "LUA_USE_DLOPEN" } +- links { "m" } +- linkoptions { "-rdynamic" } ++ links { "m", "dl", "network" } ++ linkoptions { "-Wl,--export-all-symbols" } + +- filter "system:linux or hurd" ++ filter { "system:linux or hurd", "system:not bsd" } + links { "dl", "rt" } + + filter { "system:not windows", "system:not macosx" } +diff -urdN -E -b -w -B --strip-trailing-cr original/0ad-0.0.23-alpha/build/premake/premake5/src/host/os_getversion.c 0ad-0.0.23-alpha/build/premake/premake5/src/host/os_getversion.c +--- original/0ad-0.0.23-alpha/build/premake/premake5/src/host/os_getversion.c 2017-10-28 16:10:49.025427968 +0000 ++++ 0ad-0.0.23-alpha/build/premake/premake5/src/host/os_getversion.c 2019-06-07 15:18:41.352321536 +0000 +@@ -193,7 +193,7 @@ + + /*************************************************************/ + +-#elif defined(PLATFORM_BSD) || defined(PLATFORM_LINUX) || defined(PLATFORM_SOLARIS) || defined(PLATFORM_HURD) ++#elif defined(PLATFORM_BSD) || defined(PLATFORM_LINUX) || defined(PLATFORM_SOLARIS) || defined(PLATFORM_HURD) || defined(__HAIKU__) + + #include + #include +diff -urdN -E -b -w -B --strip-trailing-cr original/0ad-0.0.23-alpha/build/premake/premake5/src/host/premake.c 0ad-0.0.23-alpha/build/premake/premake5/src/host/premake.c +--- original/0ad-0.0.23-alpha/build/premake/premake5/src/host/premake.c 2017-10-28 16:10:49.023592960 +0000 ++++ 0ad-0.0.23-alpha/build/premake/premake5/src/host/premake.c 2019-06-07 16:03:00.429654016 +0000 +@@ -368,6 +370,7 @@ + } + #endif + ++#if !defined(__HAIKU__) + /* As a fallback, search the PATH with argv[0] */ + if (!path) + { +@@ -400,6 +403,11 @@ + + path = lua_tostring(L, -1); + } ++#else ++ /* The fallback logic is broken and always was. This re-implements it correctly IN C. */ ++ getcwd(buffer, PATH_MAX); ++ path = buffer; ++#endif + + lua_pushstring(L, path); + return 1; +diff -urdN -E -b -w -B --strip-trailing-cr original/0ad-0.0.23-alpha/build/premake/premake5/src/host/premake.h 0ad-0.0.23-alpha/build/premake/premake5/src/host/premake.h +--- original/0ad-0.0.23-alpha/build/premake/premake5/src/host/premake.h 2017-10-28 16:10:49.025952256 +0000 ++++ 0ad-0.0.23-alpha/build/premake/premake5/src/host/premake.h 2019-06-07 16:01:49.395051008 +0000 +@@ -43,7 +43,7 @@ + #define PLATFORM_STRING "windows" + #endif + +-#define PLATFORM_POSIX (PLATFORM_LINUX || PLATFORM_BSD || PLATFORM_MACOSX || PLATFORM_SOLARIS) ++#define PLATFORM_POSIX (PLATFORM_LINUX || PLATFORM_BSD || PLATFORM_MACOSX || PLATFORM_SOLARIS || PLATFORM_HAIKU) + + + /* Pull in platform-specific headers required by built-in functions */ +diff -urdN -E -b -w -B --strip-trailing-cr original/0ad-0.0.23-alpha/build/premake/premake5.lua 0ad-0.0.23-alpha/build/premake/premake5.lua +--- original/0ad-0.0.23-alpha/build/premake/premake5.lua 2018-04-22 18:14:45.011534336 +0000 ++++ 0ad-0.0.23-alpha/build/premake/premake5.lua 2019-06-07 19:00:27.612368384 +0000 +@@ -344,7 +344,7 @@ + defines { "INSTALLED_LIBDIR=" .. _OPTIONS["libdir"] } + end + +- if os.istarget("linux") or os.istarget("bsd") then ++ if os.istarget("linux") or os.istarget("bsd") or os.istarget("haiku") then + -- To use our local shared libraries, they need to be found in the + -- runtime dynamic linker path. Add their path to -rpath. + if _OPTIONS["libdir"] then +@@ -370,7 +370,7 @@ + -- add X11 includes paths after all the others so they don't conflict with + -- bundled libs + function project_add_x11_dirs() +- if not os.istarget("windows") and not os.istarget("macosx") then ++ if not os.istarget("windows") and not os.istarget("macosx") and not os.istarget("haiku") then + -- X11 includes may be installed in one of a gadzillion of five places + -- Famous last words: "You can't include too much! ;-)" + sysincludedirs { +@@ -835,6 +835,7 @@ + windows = { "lib/sysdep/os/win", "lib/sysdep/os/win/wposix", "lib/sysdep/os/win/whrt" }, + macosx = { "lib/sysdep/os/osx", "lib/sysdep/os/unix" }, + bsd = { "lib/sysdep/os/bsd", "lib/sysdep/os/unix", "lib/sysdep/os/unix/x" }, ++ haiku = { "lib/sysdep/os/haiku", "lib/sysdep/os/unix" } + } + for i,v in pairs(sysdep_dirs[os.target()]) do + table.insert(source_dirs, v); +@@ -1036,6 +1037,13 @@ + links { "ApplicationServices.framework", "Cocoa.framework", "CoreFoundation.framework" } + + end ++ ++ if os.istarget("haiku") then ++ links { "be" } ++ linkoptions { ++ "/boot/system/lib/libnetwork.so" ++ } ++ end + end + + +@@ -1420,6 +1428,13 @@ + + includedirs { source_root .. "pch/test/" } + end ++ ++ if os.istarget("haiku") then ++ links { "be" } ++ linkoptions { ++ "/boot/system/lib/libnetwork.so" ++ } ++ end + end + + -- must come first, so that VC sets it as the default project and therefore +diff -urdN -E -b -w -B --strip-trailing-cr original/0ad-0.0.23-alpha/build/workspaces/update-workspaces.sh 0ad-0.0.23-alpha/build/workspaces/update-workspaces.sh +--- original/0ad-0.0.23-alpha/build/workspaces/update-workspaces.sh 2017-10-30 13:52:05.021495808 +0000 ++++ 0ad-0.0.23-alpha/build/workspaces/update-workspaces.sh 2019-06-07 15:03:49.098566144 +0000 +@@ -1,9 +1,10 @@ + #!/bin/sh + +-if [ "$(id -u)" = "0" ]; then +- echo "Running as root will mess up file permissions. Aborting ..." 1>&2 +- exit 1 +-fi ++#if [ "$(id -u)" = "0" ]; then ++# echo "Running as root will mess up file permissions. Aborting ..." ++#1>&2 ++# exit 1 ++#fi + + die() + { +diff -urdN -E -b -w -B --strip-trailing-cr original/0ad-0.0.23-alpha/libraries/source/fcollada/include/FCDocument/FCDocument.h 0ad-0.0.23-alpha/libraries/source/fcollada/include/FCDocument/FCDocument.h +--- original/0ad-0.0.23-alpha/libraries/source/fcollada/include/FCDocument/FCDocument.h 2018-03-03 16:33:02.051118080 +0000 ++++ 0ad-0.0.23-alpha/libraries/source/fcollada/include/FCDocument/FCDocument.h 2019-06-07 17:02:13.541589504 +0000 +@@ -30,7 +30,7 @@ + #if defined(WIN32) + template class FCOLLADA_EXPORT FCDLibrary; /**< Trick Doxygen. */ + template class FCOLLADA_EXPORT FUUniqueStringMapT; /**< Trick Doxygen. */ +-#elif defined(LINUX) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) ++#elif defined(LINUX) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) || defined(__HAIKU__) + template class FCDLibrary; /**< Trick Doxygen. */ + template class FUUniqueStringMapT; /**< Trick Doxygen. */ + #endif // LINUX +diff -urdN -E -b -w -B --strip-trailing-cr original/0ad-0.0.23-alpha/libraries/source/fcollada/include/FUtils/Platforms.h 0ad-0.0.23-alpha/libraries/source/fcollada/include/FUtils/Platforms.h +--- original/0ad-0.0.23-alpha/libraries/source/fcollada/include/FUtils/Platforms.h 2018-03-03 16:33:02.041418752 +0000 ++++ 0ad-0.0.23-alpha/libraries/source/fcollada/include/FUtils/Platforms.h 2019-06-07 16:58:02.051904512 +0000 +@@ -74,7 +74,7 @@ + #include + #include + +-#elif defined(LINUX) || defined(__PPU__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) ++#elif defined(LINUX) || defined(__PPU__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) || defined(__HAIKU__) + #include + #include + #include +@@ -125,7 +125,7 @@ + #endif // PLATFORMS + + // Important functions that some OSes have missing! +-#if defined(__APPLE__) || defined(LINUX) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) ++#if defined(__APPLE__) || defined(LINUX) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) || defined(__HAIKU__) + inline char* strlower(char* str) { char* it = str; while (*it != 0) { *it = tolower(*it); ++it; } return str; } + inline wchar_t* wcslwr(wchar_t* str) { wchar_t* it = str; while (*it != 0) { *it = towlower(*it); ++it; } return str; } + inline int wcsicmp(const wchar_t* s1, const wchar_t* s2) { wchar_t c1 = *s1, c2 = *s2; while (c1 != 0 && c2 != 0) { if (c1 >= 'a' && c1 <= 'z') c1 -= 'a' + 'A'; if (c2 >= 'a' && c2 <= 'z') c2 -= 'a' + 'A'; if (c2 < c1) return -1; else if (c2 > c1) return 1; c1 = *(++s1); c2 = *(++s2); } return 0; } +diff -urdN -E -b -w -B --strip-trailing-cr original/0ad-0.0.23-alpha/libraries/source/fcollada/src/FCollada/FUtils/FUAssert.cpp 0ad-0.0.23-alpha/libraries/source/fcollada/src/FCollada/FUtils/FUAssert.cpp +--- original/0ad-0.0.23-alpha/libraries/source/fcollada/src/FCollada/FUtils/FUAssert.cpp 2017-07-10 21:53:47.007864320 +0000 ++++ 0ad-0.0.23-alpha/libraries/source/fcollada/src/FCollada/FUtils/FUAssert.cpp 2019-01-09 17:21:48.744751104 +0000 +@@ -12,8 +12,12 @@ + #include "FUAssert.h" + + #ifndef WIN32 ++ #ifdef __HAIKU__ ++ #include ++ #else + #include "sys/signal.h" // Used for throw(SIGTRAP) on UNIX-like systems + #endif ++#endif + + #ifdef __APPLE__ + #include +diff -urdN -E -b -w -B --strip-trailing-cr original/0ad-0.0.23-alpha/libraries/source/fcollada/src/FCollada/FUtils/FUPluginManager.cpp 0ad-0.0.23-alpha/libraries/source/fcollada/src/FCollada/FUtils/FUPluginManager.cpp +--- original/0ad-0.0.23-alpha/libraries/source/fcollada/src/FCollada/FUtils/FUPluginManager.cpp 2010-04-19 21:56:45.003932160 +0000 ++++ 0ad-0.0.23-alpha/libraries/source/fcollada/src/FCollada/FUtils/FUPluginManager.cpp 2019-01-09 17:27:47.778567680 +0000 +@@ -27,6 +27,9 @@ + #elif defined(__APPLE__) || defined(LINUX) + #include + #include ++#endif ++#if defined(__HAIKU__) ++ #include + #endif //WIN32 + + // +@@ -129,6 +132,9 @@ + } + + #elif defined(__APPLE__) || defined(LINUX) ++ #ifdef __HAIKU__ ++ struct stat s; ++ #endif + fm::string s_filter = TO_STRING(filter); + if (s_filter.length() > 0 && s_filter.front() == '*') s_filter.erase(0, 1); + if (s_filter.length() > 0 && s_filter.back() == '*') s_filter.pop_back(); +@@ -139,7 +145,12 @@ + dirent* directoryEntry; + while ((directoryEntry = readdir(directory)) != NULL) + { ++ #ifdef __HAIKU__ ++ stat(directoryEntry->d_name, &s); ++ if (S_ISDIR(s.st_mode)) continue; ++ #else + if (directoryEntry->d_type == DT_DIR) continue; // skip sub-folders. ++ #endif + if (strstr((const char*) directoryEntry->d_name, s_filter.c_str()) != NULL) + { + // We have a match. +--- original/0ad-0.0.23-alpha/libraries/source/fcollada/src/FCollada/FUtils/FUStringBuilder.h 2012-06-04 21:33:15.005505024 +0000 ++++ 0ad-0.0.23-alpha/libraries/source/fcollada/src/FCollada/FUtils/FUStringBuilder.h 2019-01-09 17:18:53.740032512 +0000 +@@ -135,7 +135,7 @@ + #else + inline void append(unsigned int i) { append((uint32) i); } /**< See above. */ + #endif +-#elif defined(__APPLE__) || defined(__OpenBSD__) ++#elif defined(__APPLE__) || defined(__OpenBSD__) || (defined(__HAIKU__) && defined(__i386__)) + inline void append(size_t i) { append((uint64)i); } + #endif // defined(WIN32) + + +diff -urdN -E -b -w -B --strip-trailing-cr original/0ad-0.0.23-alpha/libraries/source/nvtt/src/src/nvcore/Debug.cpp 0ad-0.0.23-alpha/libraries/source/nvtt/src/src/nvcore/Debug.cpp +--- original/0ad-0.0.23-alpha/libraries/source/nvtt/src/src/nvcore/Debug.cpp 2015-07-21 15:53:21.056623104 +0000 ++++ 0ad-0.0.23-alpha/libraries/source/nvtt/src/src/nvcore/Debug.cpp 2019-01-09 19:09:51.894435328 +0000 +@@ -221,6 +221,14 @@ + ucontext_t * ucp = (ucontext_t *)secret; + return (void *)ucp->sc_eip; + # endif ++# elif defined(__HAIKU__) ++# if NV_CPU_X86_64 ++ ucontext_t * ucp = (ucontext_t *)secret; ++ return (void *)ucp->uc_mcontext.rip; ++# elif NV_CPU_X86 ++ ucontext_t * ucp = (ucontext_t *)secret; ++ return (void* )ucp->uc_mcontext.eip; ++# endif + # else + # if NV_CPU_X86_64 + // #define REG_RIP REG_INDEX(rip) // seems to be 16 +diff -urdN -E -b -w -B --strip-trailing-cr original/0ad-0.0.23-alpha/libraries/source/nvtt/src/src/nvcore/nvcore.h 0ad-0.0.23-alpha/libraries/source/nvtt/src/src/nvcore/nvcore.h +--- original/0ad-0.0.23-alpha/libraries/source/nvtt/src/src/nvcore/nvcore.h 2015-07-21 15:53:21.057933824 +0000 ++++ 0ad-0.0.23-alpha/libraries/source/nvtt/src/src/nvcore/nvcore.h 2019-06-05 08:42:21.010485760 +0000 +@@ -58,6 +58,9 @@ + # define NV_OS_WIN32 1 + #elif defined POSH_OS_WIN64 + # define NV_OS_WIN64 1 ++#elif defined POSH_OS_HAIKU ++# define NV_OS_LINUX 1 ++# define NV_OS_UNIX 1 + #else + # error "Unsupported OS" + #endif +diff -urdN -E -b -w -B --strip-trailing-cr original/0ad-0.0.23-alpha/libraries/source/nvtt/src/src/nvcore/poshlib/posh.h 0ad-0.0.23-alpha/libraries/source/nvtt/src/src/nvcore/poshlib/posh.h +--- original/0ad-0.0.23-alpha/libraries/source/nvtt/src/src/nvcore/poshlib/posh.h 2015-07-21 15:53:21.057671680 +0000 ++++ 0ad-0.0.23-alpha/libraries/source/nvtt/src/src/nvcore/poshlib/posh.h 2019-01-09 19:11:56.499384320 +0000 +@@ -303,6 +303,11 @@ + # define POSH_OS_STRING "OpenBSD" + #endif + ++#if defined __HAIKU__ ++# define POSH_OS_HAIKU 1 ++# define POSH_OS_STRING "Haiku" ++#endif ++ + #if defined __CYGWIN32__ + # define POSH_OS_CYGWIN32 1 + # define POSH_OS_STRING "Cygwin" +diff -urdN -E -b -w -B --strip-trailing-cr original/0ad-0.0.23-alpha/libraries/source/nvtt/src/src/nvimage/ImageIO.cpp 0ad-0.0.23-alpha/libraries/source/nvtt/src/src/nvimage/ImageIO.cpp +--- original/0ad-0.0.23-alpha/libraries/source/nvtt/src/src/nvimage/ImageIO.cpp 2016-06-11 16:33:18.005767168 +0000 ++++ 0ad-0.0.23-alpha/libraries/source/nvtt/src/src/nvimage/ImageIO.cpp 2019-06-05 08:46:00.321126400 +0000 +@@ -28,7 +28,17 @@ + + #if defined(HAVE_TIFF) + # define _TIFF_DATA_TYPEDEFS_ ++#if defined(__HAIKU__) ++# define int32 int32_old ++# define uint32 uint32_old ++# define TRUE TRUE_OLD ++#endif + # include ++#if defined(__HAIKU__) ++# define int32_old int32 ++# define uint32_old uint32 ++# define TRUE_OLD TRUE ++#endif + #endif + + #if defined(HAVE_OPENEXR) +diff -urdN -E -b -w -B original/0ad-0.0.23-alpha/libraries/source/spidermonkey/build.sh 0ad-0.0.23-alpha/libraries/source/spidermonkey/build.sh +--- original/0ad-0.0.23-alpha/libraries/source/spidermonkey/build.sh 2016-10-04 15:01:34.062914560 +0000 ++++ 0ad-0.0.23-alpha/libraries/source/spidermonkey/build.sh 2019-06-09 07:59:56.329515008 +0000 +@@ -103,6 +103,54 @@ + perl -i.bak -pe 's/(SHARED_LIBRARY_NAME\s+=).*/$1 '\''mozjs38-ps-debug'\''/' moz.build + mkdir -p build-debug + cd build-debug ++ ++fixHaikuBuild() ++{ ++ baseDir=$(pwd) ++ ++ # HACK: HaikuPorter does not work with pip and virtual env at the moment. ++ mkdir -p _virtualenv ++ mkdir -p _virtualenv/non-packaged ++ mkdir -p _virtualenv/non-packaged/lib/ ++ mkdir -p _virtualenv/non-packaged/lib/python2.7/ ++ mkdir -p _virtualenv/non-packaged/lib/python2.7/site-packages/ ++ cd _virtualenv/non-packaged/lib/python2.7/site-packages/ ++ ++ echo testing/marionette/transport > marionette_transport.pth ++ echo testing/marionette/driver > marionette_driver.pth ++ echo testing/marionette/client > marionette.pth ++ echo python/blessings > blessings.pth ++ echo python/configobj > configobj.pth ++ echo python/jsmin > jsmin.pth ++ echo python/mach > mach.pth ++ echo python/mozbuild > mozbuild.pth ++ echo build/pymake > pymake.pth ++ #optional:setup.py:python/psutil:build_ext:--inplace ++ #optional:psutil.pth:python/psutil ++ echo python/which > which.pth ++ echo other-licenses/ply/ > ply.pth ++ echo python/mock-1.0.0 > mock.pth ++ echo build > mozilla.pth ++ echo config > mozilla.pth ++ echo xpcom/typelib/xpt/tools >> mozilla.pth ++ echo dom/bindings >> mozilla.pth ++ echo dom/bindings/parser >> mozilla.pth ++ echo layout/tools/reftest >> mozilla.pth ++ echo tools/docs > moztreedocs.pth ++ #copy:build/buildconfig.py ++ #packages.txt:testing/mozbase/packages.txt ++ #objdir:build ++ echo media/webrtc/trunk/tools/gyp/pylib > gyp.pth ++ echo python/pyasn1 > pyasn1.pth ++ echo python/bitstring > bitstring.pth ++ echo python/redo > redo.pth ++ echo python/requests > requests.pth ++ ++ cd $baseDir ++} ++ ++fixHaikuBuild ++ + CXXFLAGS="${CXXFLAGS} ${TLCXXFLAGS}" ../configure ${CONF_OPTS} --with-nspr-libs="$NSPR_LIBS" --with-nspr-cflags="$NSPR_INCLUDES" --enable-debug --disable-optimize --enable-js-diagnostics --enable-gczeal + ${MAKE} ${MAKE_OPTS} + cd .. +@@ -110,6 +158,9 @@ + perl -i.bak -pe 's/(SHARED_LIBRARY_NAME\s+=).*/$1 '\''mozjs38-ps-release'\''/' moz.build + mkdir -p build-release + cd build-release ++ ++fixHaikuBuild ++ + CXXFLAGS="${CXXFLAGS} ${TLCXXFLAGS}" ../configure ${CONF_OPTS} --with-nspr-libs="$NSPR_LIBS" --with-nspr-cflags="$NSPR_INCLUDES" --enable-optimize # --enable-gczeal --enable-debug-symbols + ${MAKE} ${MAKE_OPTS} + cd .. +diff -urdN -E -b -w -B --strip-trailing-cr original/0ad-0.0.23-alpha/libraries/source/spidermonkey/FixHaikuBuild.diff 0ad-0.0.23-alpha/libraries/source/spidermonkey/FixHaikuBuild.diff +--- original/0ad-0.0.23-alpha/libraries/source/spidermonkey/FixHaikuBuild.diff 1970-01-01 00:00:00.000000000 +0000 ++++ 0ad-0.0.23-alpha/libraries/source/spidermonkey/FixHaikuBuild.diff 2019-06-05 14:51:06.494665728 +0000 +@@ -0,0 +1,197 @@ ++diff -ur mozjs-38.0.0-old/js/src/asmjs/AsmJSSignalHandlers.cpp mozjs-38.0.0-new/js/src/asmjs/AsmJSSignalHandlers.cpp ++--- mozjs-38.0.0-old/js/src/asmjs/AsmJSSignalHandlers.cpp 2015-09-17 20:12:18.030670848 +0000 +++++ mozjs-38.0.0-new/js/src/asmjs/AsmJSSignalHandlers.cpp 2017-12-16 09:53:06.911736832 +0000 ++@@ -200,6 +200,28 @@ ++ #elif defined(XP_MACOSX) ++ # define EIP_sig(p) ((p)->uc_mcontext->__ss.__eip) ++ # define RIP_sig(p) ((p)->uc_mcontext->__ss.__rip) +++#elif defined(__HAIKU__) +++# define EIP_sig(p) ((p)->uc_mcontext.eip) +++# if defined(__x86_64__) +++# define RIP_sig(p) ((p)->uc_mcontext.rip) +++# define RAX_sig(p) ((p)->uc_mcontext.rax) +++# define RCX_sig(p) ((p)->uc_mcontext.rcx) +++# define RDX_sig(p) ((p)->uc_mcontext.rdx) +++# define RBX_sig(p) ((p)->uc_mcontext.rbx) +++# define RSP_sig(p) ((p)->uc_mcontext.rsp) +++# define RBP_sig(p) ((p)->uc_mcontext.rbp) +++# define RSI_sig(p) ((p)->uc_mcontext.rsi) +++# define RDI_sig(p) ((p)->uc_mcontext.rdi) +++# define R8_sig(p) ((p)->uc_mcontext.r8) +++# define R9_sig(p) ((p)->uc_mcontext.r9) +++# define R10_sig(p) ((p)->uc_mcontext.r10) +++# define R11_sig(p) ((p)->uc_mcontext.r11) +++# define R12_sig(p) ((p)->uc_mcontext.r12) +++# define R13_sig(p) ((p)->uc_mcontext.r13) +++# define R14_sig(p) ((p)->uc_mcontext.r14) +++# define R15_sig(p) ((p)->uc_mcontext.r15) +++# define XMM_sig(p,i) ((p)->uc_mcontext.fpu.xmm.xmm ## i) +++# endif ++ #else ++ # error "Don't know how to read/write to the thread state via the mcontext_t." ++ #endif ++diff -ur mozjs-38.0.0-old/js/src/configure mozjs-38.0.0-new/js/src/configure ++--- mozjs-38.0.0-old/js/src/configure 2017-12-16 10:03:35.259260416 +0000 +++++ mozjs-38.0.0-new/js/src/configure 2017-12-16 10:28:47.306446336 +0000 ++@@ -4408,7 +4408,12 @@ ++ esac ++ fi ++ +++#HACK: The python modules search path is not being correctly set. This is done manually here. +++echo import site > $MOZ_BUILD_ROOT/_virtualenv/lib/python2.7/site-packages/sitecustomize.py +++echo "site.addsitedir('$MOZ_BUILD_ROOT/_virtualenv/non-packaged/lib/python2.7/site-packages/')" >> $MOZ_BUILD_ROOT/_virtualenv/lib/python2.7/site-packages/sitecustomize.py ++ +++#HACK: The process.py script cannot detect the built-in variable so it should be redefined. +++export SHELL=/bin/bash ++ ++ echo $ac_n "checking Python environment is Mozilla virtualenv""... $ac_c" 1>&6 ++ echo "configure:4479: checking Python environment is Mozilla virtualenv" >&5 ++diff -ur mozjs-38.0.0-old/js/src/gc/Memory.cpp mozjs-38.0.0-new/js/src/gc/Memory.cpp ++--- mozjs-38.0.0-old/js/src/gc/Memory.cpp 2015-09-17 20:12:18.031719424 +0000 +++++ mozjs-38.0.0-new/js/src/gc/Memory.cpp 2017-12-16 09:53:06.915931136 +0000 ++@@ -22,7 +22,7 @@ ++ #include ++ #include ++ ++-#elif defined(XP_UNIX) +++#elif defined(XP_UNIX) || defined(__HAIKU__) ++ ++ #include ++ #include ++@@ -44,7 +44,7 @@ ++ // The OS allocation granularity may not match the page size. ++ static size_t allocGranularity = 0; ++ ++-#if defined(XP_UNIX) +++#if defined(XP_UNIX) || defined(__HAIKU__) ++ // The addresses handed out by mmap may grow up or down. ++ static mozilla::Atomic growthDirection(0); ++ #endif ++@@ -366,7 +366,7 @@ ++ // Not implemented. ++ } ++ ++-#elif defined(XP_UNIX) +++#elif defined(XP_UNIX) || defined(__HAIKU__) ++ ++ void ++ InitMemorySubsystem() ++@@ -604,7 +604,11 @@ ++ return false; ++ ++ MOZ_ASSERT(OffsetFromAligned(p, pageSize) == 0); +++#if defined(__HAIKU__) +++ int result = posix_madvise(p, size, POSIX_MADV_DONTNEED); +++#else ++ int result = madvise(p, size, MADV_DONTNEED); +++#endif ++ return result != -1; ++ } ++ ++@@ -625,7 +629,12 @@ ++ int err = getrusage(RUSAGE_SELF, &usage); ++ if (err) ++ return 0; +++#if defined(__HAIKU__) +++ //HACK: the ru_majfly variable does not exist in POSIX +++ return 0; +++#else ++ return usage.ru_majflt; +++#endif ++ } ++ ++ void* ++diff -ur mozjs-38.0.0-old/js/src/jsnativestack.cpp mozjs-38.0.0-new/js/src/jsnativestack.cpp ++--- mozjs-38.0.0-old/js/src/jsnativestack.cpp 2015-09-17 20:12:22.031195136 +0000 +++++ mozjs-38.0.0-new/js/src/jsnativestack.cpp 2017-12-16 09:53:06.916455424 +0000 ++@@ -9,9 +9,11 @@ ++ #ifdef XP_WIN ++ # include "jswin.h" ++ ++-#elif defined(XP_MACOSX) || defined(DARWIN) || defined(XP_UNIX) +++#elif defined(XP_MACOSX) || defined(DARWIN) || defined(XP_UNIX) || defined(__HAIKU__) ++ # include ++- +++# if defined(__HAIKU__) +++ #include +++# endif ++ # if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) ++ # include ++ # endif ++@@ -101,6 +103,9 @@ ++ # elif defined(PTHREAD_NP_H) || defined(_PTHREAD_NP_H_) || defined(NETBSD) ++ /* e.g. on FreeBSD 4.8 or newer, neundorf@kde.org */ ++ pthread_attr_get_np(thread, &sattr); +++# elif defined(__HAIKU__) +++ //HACK: Haiku does not implement pthread_getattr_np as it is not POSIX +++ //get_thread_info(thread, &sattr->id); ++ # else ++ /* ++ * FIXME: this function is non-portable; ++@@ -143,6 +148,8 @@ ++ // For non main-threads pthread allocates the stack itself so it tells ++ // the truth. ++ rc = pthread_attr_getstack(&sattr, &stackBase, &stackSize); +++# elif defined(__HAIKU__) +++ rc = 0; ++ # else ++ rc = pthread_attr_getstack(&sattr, &stackBase, &stackSize); ++ # endif ++diff -ur mozjs-38.0.0-old/js/src/shell/js.cpp mozjs-38.0.0-new/js/src/shell/js.cpp ++--- mozjs-38.0.0-old/js/src/shell/js.cpp 2015-09-17 20:12:22.004194304 +0000 +++++ mozjs-38.0.0-new/js/src/shell/js.cpp 2017-12-16 09:53:06.917766144 +0000 ++@@ -32,7 +32,7 @@ ++ #include ++ #include ++ #include ++-#ifdef XP_UNIX +++#if defined(XP_UNIX) || defined(__HAIKU__) ++ # include ++ # include ++ # include ++@@ -5892,7 +5892,7 @@ ++ if (!ptr) ++ return 0; ++ ++-#if defined(HAVE_MALLOC_USABLE_SIZE) +++#if defined(HAVE_MALLOC_USABLE_SIZE) && !defined(__HAIKU__) ++ return malloc_usable_size(ptr); ++ #elif defined(HAVE_MALLOC_SIZE) ++ return malloc_size(ptr); ++Only in mozjs-38.0.0-new/layout/tools/reftest/reftest: __init__.pyc ++diff -ur mozjs-38.0.0-old/mfbt/Poison.cpp mozjs-38.0.0-new/mfbt/Poison.cpp ++--- mozjs-38.0.0-old/mfbt/Poison.cpp 2015-09-17 20:12:16.000524288 +0000 +++++ mozjs-38.0.0-new/mfbt/Poison.cpp 2017-12-16 09:53:06.918552576 +0000 ++@@ -129,7 +129,11 @@ ++ static bool ++ ProbeRegion(uintptr_t aRegion, uintptr_t aSize) ++ { +++#ifdef __HAIKU__ +++ if (posix_madvise(reinterpret_cast(aRegion), aSize, POSIX_MADV_NORMAL)) { +++#else ++ if (madvise(reinterpret_cast(aRegion), aSize, MADV_NORMAL)) { +++#endif ++ return true; ++ } else { ++ return false; ++diff -ur mozjs-38.0.0-old/python/psutil/setup.py mozjs-38.0.0-new/python/psutil/setup.py ++--- mozjs-38.0.0-old/python/psutil/setup.py 2015-09-17 20:12:23.004456448 +0000 +++++ mozjs-38.0.0-new/python/psutil/setup.py 2017-12-16 09:53:06.919076864 +0000 ++@@ -125,6 +125,18 @@ ++ libraries=['kstat', 'nsl'],), ++ posix_extension, ++ ] +++# Haiku +++elif sys.platform.startswith("haiku"): +++ extensions = [] +++ """extensions = [Extension( +++ '_psutil_haiku', +++ sources=[ +++ #'psutil/_psutil_bsd.c', +++ 'psutil/_psutil_common.c', +++ #'psutil/arch/bsd/process_info.c' +++ ]), +++ posix_extension, +++ ]""" ++ else: ++ sys.exit('platform %s is not supported' % sys.platform) +diff -urdN -E -b -w -B --strip-trailing-cr original/0ad-0.0.23-alpha/libraries/source/spidermonkey/patch.sh 0ad-0.0.23-alpha/libraries/source/spidermonkey/patch.sh +--- original/0ad-0.0.23-alpha/libraries/source/spidermonkey/patch.sh 2017-09-13 00:10:27.062652416 +0000 ++++ 0ad-0.0.23-alpha/libraries/source/spidermonkey/patch.sh 2019-01-09 17:51:48.153092096 +0000 +@@ -53,3 +53,6 @@ + # Based on: https://svnweb.freebsd.org/ports/head/sysutils/py-psutil121/files/patch-_psutil_bsd.c?revision=436575&view=markup + # Related: https://bugzilla.mozilla.org/show_bug.cgi?id=1238983 + patch -p0 < ../FixpsutilFreeBSD.diff ++ ++# Fixes the build on Haiku by adding it as a recognised platform ++patch -p1 < ../FixHaikuBuild.diff +diff -urdN -E -b -w -B --strip-trailing-cr original/0ad-0.0.23-alpha/source/lib/allocators/page_aligned.cpp 0ad-0.0.23-alpha/source/lib/allocators/page_aligned.cpp +--- original/0ad-0.0.23-alpha/source/lib/allocators/page_aligned.cpp 2018-03-10 09:58:53.013107200 +0000 ++++ 0ad-0.0.23-alpha/source/lib/allocators/page_aligned.cpp 2019-06-04 15:27:05.314310656 +0000 +@@ -49,7 +49,11 @@ + Status mem_Reserve(size_t size, u8** pp) + { + errno = 0; ++#if !__HAIKU__ + void* ret = mmap(0, size, PROT_NONE, mmap_flags|MAP_NORESERVE, -1, 0); ++#else ++ void* ret = mmap(0, size, PROT_NONE, mmap_flags, -1, 0); ++#endif + *pp = (u8*)ret; + return StatusFromMap(ret); + } +@@ -76,7 +80,11 @@ + Status mem_Decommit(u8* p, size_t size) + { + errno = 0; ++#if !__HAIKU__ + void* ret = mmap(p, size, PROT_NONE, mmap_flags|MAP_NORESERVE|MAP_FIXED, -1, 0); ++#else ++ void* ret = mmap(p, size, PROT_NONE, mmap_flags|MAP_FIXED, -1, 0); ++#endif + return StatusFromMap(ret); + } + +diff -urdN -E -b -w -B --strip-trailing-cr original/0ad-0.0.23-alpha/source/lib/config2.h 0ad-0.0.23-alpha/source/lib/config2.h +--- original/0ad-0.0.23-alpha/source/lib/config2.h 2017-07-10 14:26:24.022282240 +0000 ++++ 0ad-0.0.23-alpha/source/lib/config2.h 2019-06-04 15:30:31.672923648 +0000 +@@ -60,7 +60,7 @@ + // work around a bug introduced in Linux 2.6.38 + // (http://www.wildfiregames.com/forum/index.php?showtopic=14561&view=findpost&p=217710) + // OpenBSD doesn't provide aio.h so we disable its use +-# if OS_LINUX || OS_OPENBSD ++# if OS_LINUX || OS_OPENBSD || __HAIKU__ + # define CONFIG2_FILE_ENABLE_AIO 0 + # else + # define CONFIG2_FILE_ENABLE_AIO 1 +diff -urdN -E -b -w -B --strip-trailing-cr original/0ad-0.0.23-alpha/source/lib/posix/posix_aio.h 0ad-0.0.23-alpha/source/lib/posix/posix_aio.h +--- original/0ad-0.0.23-alpha/source/lib/posix/posix_aio.h 2017-07-10 14:26:24.024117248 +0000 ++++ 0ad-0.0.23-alpha/source/lib/posix/posix_aio.h 2019-06-04 14:55:11.776208384 +0000 +@@ -30,7 +30,7 @@ + + #if OS_WIN + # include "lib/sysdep/os/win/wposix/waio.h" +-#elif OS_ANDROID || OS_OPENBSD ++#elif OS_ANDROID || OS_OPENBSD || __HAIKU__ + // Android doesn't provide aio.h. We don't actually use aio on Linuxes (see + // CONFIG2_FILE_ENABLE_AIO) but we use its symbols and structs, so define + // them here +diff -urdN -E -b -w -B --strip-trailing-cr original/0ad-0.0.23-alpha/source/lib/secure_crt.h 0ad-0.0.23-alpha/source/lib/secure_crt.h +--- original/0ad-0.0.23-alpha/source/lib/secure_crt.h 2017-07-10 14:26:24.047972352 +0000 ++++ 0ad-0.0.23-alpha/source/lib/secure_crt.h 2019-06-04 14:47:13.927727616 +0000 +@@ -47,13 +47,13 @@ + #if EMULATE_SECURE_CRT + + // (conflicts with glibc definitions) +-#if !OS_UNIX || OS_MACOSX || OS_OPENBSD ++#if !OS_UNIX || OS_MACOSX || OS_OPENBSD || __HAIKU__ + // return length [in characters] of a string, not including the trailing + // null character. to protect against access violations, only the + // first characters are examined; if the null character is + // not encountered by then, is returned. + // strnlen is available on OpenBSD +-#if !OS_OPENBSD ++#if !OS_OPENBSD && !__HAIKU__ + extern size_t strnlen(const char* str, size_t max_len); + #endif + extern size_t wcsnlen(const wchar_t* str, size_t max_len); +diff -urdN -E -b -w -B --strip-trailing-cr original/0ad-0.0.23-alpha/source/lib/sysdep/os/haiku/dir_watch.cpp 0ad-0.0.23-alpha/source/lib/sysdep/os/haiku/dir_watch.cpp +--- original/0ad-0.0.23-alpha/source/lib/sysdep/os/haiku/dir_watch.cpp 1970-01-01 00:00:00.000000000 +0000 ++++ 0ad-0.0.23-alpha/source/lib/sysdep/os/haiku/dir_watch.cpp 2019-06-05 11:00:18.633077760 +0000 +@@ -0,0 +1,36 @@ ++/* Copyright (C) 2012 Wildfire Games. ++ * ++ * Permission is hereby granted, free of charge, to any person obtaining ++ * a copy of this software and associated documentation files (the ++ * "Software"), to deal in the Software without restriction, including ++ * without limitation the rights to use, copy, modify, merge, publish, ++ * distribute, sublicense, and/or sell copies of the Software, and to ++ * permit persons to whom the Software is furnished to do so, subject to ++ * the following conditions: ++ * ++ * The above copyright notice and this permission notice shall be included ++ * in all copies or substantial portions of the Software. ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ++ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ++ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. ++ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY ++ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, ++ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE ++ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ++ */ ++ ++#include "precompiled.h" ++#include "lib/sysdep/dir_watch.h" ++ ++// stub implementations ++ ++Status dir_watch_Add(const OsPath& UNUSED(path), PDirWatch& UNUSED(dirWatch)) ++{ ++ return INFO::OK; ++} ++ ++Status dir_watch_Poll(DirWatchNotifications& UNUSED(notifications)) ++{ ++ return INFO::OK; ++} +diff -urdN -E -b -w -B --strip-trailing-cr original/0ad-0.0.23-alpha/source/lib/sysdep/os/haiku/haiku.cpp 0ad-0.0.23-alpha/source/lib/sysdep/os/haiku/haiku.cpp +--- original/0ad-0.0.23-alpha/source/lib/sysdep/os/haiku/haiku.cpp 1970-01-01 00:00:00.000000000 +0000 ++++ 0ad-0.0.23-alpha/source/lib/sysdep/os/haiku/haiku.cpp 2019-06-07 20:44:11.748683264 +0000 +@@ -0,0 +1,147 @@ ++/* Copyright (C) 2014 Wildfire Games. ++ * ++ * Permission is hereby granted, free of charge, to any person obtaining ++ * a copy of this software and associated documentation files (the ++ * "Software"), to deal in the Software without restriction, including ++ * without limitation the rights to use, copy, modify, merge, publish, ++ * distribute, sublicense, and/or sell copies of the Software, and to ++ * permit persons to whom the Software is furnished to do so, subject to ++ * the following conditions: ++ * ++ * The above copyright notice and this permission notice shall be included ++ * in all copies or substantial portions of the Software. ++ *cd ++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ++ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ++ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. ++ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY ++ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, ++ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE ++ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ++ */ ++ ++#include "precompiled.h" ++ ++#include "lib/sysdep/sysdep.h" ++#include "lib/sysdep/clipboard.h" ++#include "lib/sysdep/os/unix/unix_executable_pathname.h" ++#include "lib/sysdep/gfx.h" ++#include "lib/sysdep/cursor.h" ++ ++#include "ps/VideoMode.h" ++ ++#include "SDL.h" ++#include "SDL_syswm.h" ++ ++#include ++ ++#define debug_printf debug_printf_old ++#include ++#define debug_printf_old debug_printf ++ ++OsPath sys_ExecutablePathname() ++{ ++ return unix_ExecutablePathname(); ++} ++ ++wchar_t *sys_clipboard_get() ++{ ++ be_clipboard->Lock(); ++ BMessage* clipBoard = be_clipboard->Data(); ++ wchar_t* data = NULL; ++ if (clipBoard != NULL) ++ { ++ const char* clipData; ++ ssize_t length; ++ clipBoard->FindData("text/plain", B_MIME_TYPE, (const void**)&clipData, &length); ++ std::wstring dataString = wstring_from_utf8(clipData); ++ size_t dataStringSize = dataString.size() + 1; ++ data = new wchar_t[dataStringSize]; ++ memcpy(data, dataString.c_str(), dataStringSize * sizeof(wchar_t)); ++ } ++ be_clipboard->Unlock(); ++ ++ return data == NULL ? const_cast(L"") : data; ++} ++ ++Status sys_clipboard_free(wchar_t *clip_buf) ++{ ++ if (clip_buf != NULL) ++ { ++ delete clip_buf; ++ } ++ return INFO::OK; ++} ++ ++Status sys_clipboard_set(const wchar_t *str) ++{ ++ be_clipboard->Lock(); ++ BMessage* clipBoard = be_clipboard->Data(); ++ if (clipBoard != NULL) ++ { ++ be_clipboard->Clear(); ++ std::string dataString = utf8_from_wstring(str); ++ const char* data = dataString.c_str(); ++ clipBoard->AddData("text/plain", B_MIME_TYPE, (const void*)data, dataString.size()); ++ be_clipboard->Commit(); ++ } ++ be_clipboard->Unlock(); ++ return INFO::OK; ++} ++ ++Status sys_cursor_create() ++{ ++ return INFO::OK; ++} ++ ++Status sys_cursor_create_empty() ++{ ++ return INFO::OK; ++} ++ ++Status sys_cursor_set(sys_cursor cursor) ++{ ++ return INFO::OK; ++} ++ ++Status sys_cursor_free(sys_cursor cursor) ++{ ++ return INFO::OK; ++} ++ ++Status sys_cursor_reset() ++{ ++ return INFO::OK; ++} ++ ++namespace gfx ++{ ++ static bool get_wminfo(SDL_SysWMinfo& wminfo) ++ { ++ SDL_VERSION(&wminfo.version); ++ ++ const int ret = SDL_GetWindowWMInfo(g_VideoMode.GetWindow(), &wminfo); ++ ++ if(ret == 1) ++ return true; ++ ++ if(ret == -1) ++ { ++ debug_printf("SDL_GetWMInfo failed\n"); ++ return false; ++ } ++ if(ret == 0) ++ { ++ debug_printf("SDL_GetWMInfo is not implemented on this platform\n"); ++ return false; ++ } ++ ++ debug_printf("SDL_GetWMInfo returned an unknown value: %d\n", ret); ++ return false; ++ } ++ ++ Status GetVideoMode(int* xres, int* yres, int* bpp, int* freq) ++ { ++ return INFO::OK; ++ } ++} +diff -urdN -E -b -w -B --strip-trailing-cr original/0ad-0.0.23-alpha/source/lib/sysdep/os/haiku/hcpu.cpp 0ad-0.0.23-alpha/source/lib/sysdep/os/haiku/hcpu.cpp +--- original/0ad-0.0.23-alpha/source/lib/sysdep/os/haiku/hcpu.cpp 1970-01-01 00:00:00.000000000 +0000 ++++ 0ad-0.0.23-alpha/source/lib/sysdep/os/haiku/hcpu.cpp 2019-06-05 11:02:53.649854976 +0000 +@@ -0,0 +1,120 @@ ++/* Copyright (C) 2012 Wildfire Games. ++ * ++ * Permission is hereby granted, free of charge, to any person obtaining ++ * a copy of this software and associated documentation files (the ++ * "Software"), to deal in the Software without restriction, including ++ * without limitation the rights to use, copy, modify, merge, publish, ++ * distribute, sublicense, and/or sell copies of the Software, and to ++ * permit persons to whom the Software is furnished to do so, subject to ++ * the following conditions: ++ * ++ * The above copyright notice and this permission notice shall be included ++ * in all copies or substantial portions of the Software. ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ++ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ++ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. ++ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY ++ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, ++ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE ++ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ++ */ ++ ++#include "precompiled.h" ++ ++#include "lib/sysdep/os_cpu.h" ++#include "lib/alignment.h" ++#include "lib/bits.h" ++#include "lib/module_init.h" ++ ++#include "valgrind.h" ++#include ++#define debug_printf debug_printf_old ++#include ++#define debug_printf_old debug_printf ++ ++size_t os_cpu_NumProcessors() ++{ ++ static size_t numProcessors; ++ ++ if(numProcessors == 0) ++ { ++ // Valgrind reports the number of real CPUs, but only emulates a single CPU. ++ // That causes problems when we expect all those CPUs to be distinct, so ++ // just pretend there's only one CPU ++ if (RUNNING_ON_VALGRIND) ++ numProcessors = 1; ++ else ++ { ++ long res = sysconf(_SC_NPROCESSORS_CONF); ++ ENSURE(res != -1); ++ numProcessors = (size_t)res; ++ } ++ } ++ ++ return numProcessors; ++} ++ ++ ++uintptr_t os_cpu_ProcessorMask() ++{ ++ static uintptr_t processorMask; ++ ++ if(!processorMask) ++ processorMask = bit_mask(os_cpu_NumProcessors()); ++ ++ return processorMask; ++} ++ ++ ++size_t os_cpu_PageSize() ++{ ++ static size_t pageSize; ++ ++ if(!pageSize) ++ pageSize = (size_t)sysconf(_SC_PAGESIZE); ++ ++ return pageSize; ++} ++ ++ ++size_t os_cpu_LargePageSize() ++{ ++ // assume they're unsupported. ++ return 0; ++} ++ ++ ++size_t os_cpu_QueryMemorySize() ++{ ++ system_info info; ++ get_system_info(&info); ++ size_t memorySize = (size_t) (info.max_pages * (B_PAGE_SIZE / 1048576.0f) + 0.5f); ++ return memorySize; ++} ++ ++ ++size_t os_cpu_MemoryAvailable() ++{ ++ system_info info; ++ get_system_info(&info); ++ return (100 * info.used_pages / info.max_pages); ++} ++ ++uintptr_t os_cpu_SetThreadAffinityMask(uintptr_t UNUSED(processorMask)) ++{ ++ // not yet implemented ++ return os_cpu_ProcessorMask(); ++} ++ ++Status os_cpu_CallByEachCPU(OsCpuCallback cb, uintptr_t cbData) ++{ ++ for(size_t processor = 0; processor < os_cpu_NumProcessors(); processor++) ++ { ++ const uintptr_t processorMask = uintptr_t(1) << processor; ++ os_cpu_SetThreadAffinityMask(processorMask); ++ cb(processor, cbData); ++ } ++ ++ return INFO::OK; ++} +diff -urdN -E -b -w -B --strip-trailing-cr original/0ad-0.0.23-alpha/source/lib/sysdep/os/haiku/hdbg.cpp 0ad-0.0.23-alpha/source/lib/sysdep/os/haiku/hdbg.cpp +--- original/0ad-0.0.23-alpha/source/lib/sysdep/os/haiku/hdbg.cpp 1970-01-01 00:00:00.000000000 +0000 ++++ 0ad-0.0.23-alpha/source/lib/sysdep/os/haiku/hdbg.cpp 2019-06-05 10:59:07.954466304 +0000 +@@ -0,0 +1,46 @@ ++/* Copyright (C) 2012 Wildfire Games. ++ * ++ * Permission is hereby granted, free of charge, to any person obtaining ++ * a copy of this software and associated documentation files (the ++ * "Software"), to deal in the Software without restriction, including ++ * without limitation the rights to use, copy, modify, merge, publish, ++ * distribute, sublicense, and/or sell copies of the Software, and to ++ * permit persons to whom the Software is furnished to do so, subject to ++ * the following conditions: ++ * ++ * The above copyright notice and this permission notice shall be included ++ * in all copies or substantial portions of the Software. ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ++ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ++ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. ++ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY ++ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, ++ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE ++ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ++ */ ++ ++#include "precompiled.h" ++ ++#include "lib/sysdep/sysdep.h" ++#include "lib/debug.h" ++ ++void* debug_GetCaller(void* UNUSED(context), const wchar_t* UNUSED(lastFuncToSkip)) ++{ ++ return NULL; ++} ++ ++Status debug_DumpStack(wchar_t* buf, size_t max_chars, void* UNUSED(context), const wchar_t* UNUSED(lastFuncToSkip)) ++{ ++ return INFO::OK; ++} ++ ++Status debug_ResolveSymbol(void* ptr_of_interest, wchar_t* sym_name, wchar_t* file, int* line) ++{ ++ return INFO::OK; ++} ++ ++void debug_SetThreadName(char const* UNUSED(name)) ++{ ++ // Currently unimplemented ++} +diff -urdN -E -b -w -B --strip-trailing-cr original/0ad-0.0.23-alpha/source/lib/sysdep/os/unix/unix_executable_pathname.cpp 0ad-0.0.23-alpha/source/lib/sysdep/os/unix/unix_executable_pathname.cpp +--- original/0ad-0.0.23-alpha/source/lib/sysdep/os/unix/unix_executable_pathname.cpp 2017-07-10 14:26:24.037486592 +0000 ++++ 0ad-0.0.23-alpha/source/lib/sysdep/os/unix/unix_executable_pathname.cpp 2019-06-05 11:27:05.633077760 +0000 +@@ -35,7 +35,7 @@ + // Find the executable's filename + Dl_info dl_info; + memset(&dl_info, 0, sizeof(dl_info)); +- if (!T::dladdr((void *)sys_ExecutablePathname, &dl_info) || !dl_info.dli_fname) ++ if (!dladdr((void *)sys_ExecutablePathname, &dl_info) || !dl_info.dli_fname) + return OsPath(); + const char* path = dl_info.dli_fname; + +@@ -53,7 +53,7 @@ + if (strchr(path, '/')) + { + char cwd[PATH_MAX]; +- if (!T::getcwd(cwd, PATH_MAX)) ++ if (!getcwd(cwd, PATH_MAX)) + return OsPath(); + + char absolute[PATH_MAX]; +diff -urdN -E -b -w -B --strip-trailing-cr original/0ad-0.0.23-alpha/source/lib/sysdep/os/unix/uvm.cpp 0ad-0.0.23-alpha/source/lib/sysdep/os/unix/uvm.cpp +--- original/0ad-0.0.23-alpha/source/lib/sysdep/os/unix/uvm.cpp 2017-07-10 14:26:24.038273024 +0000 ++++ 0ad-0.0.23-alpha/source/lib/sysdep/os/unix/uvm.cpp 2019-06-04 16:26:42.716701696 +0000 +@@ -40,7 +40,11 @@ + void* ReserveAddressSpace(size_t size, size_t UNUSED(commitSize), PageType UNUSED(pageType), int UNUSED(prot)) + { + errno = 0; ++#if !defined(__HAIKU__) + void* p = mmap(0, size, PROT_NONE, mmap_flags|MAP_NORESERVE, -1, 0); ++#else ++ void* p = mmap(0, size, PROT_NONE, mmap_flags, -1, 0); ++#endif + if(p == MAP_FAILED) + return 0; + return p; +@@ -77,7 +81,11 @@ + bool Decommit(uintptr_t address, size_t size) + { + errno = 0; ++#if !defined(__HAIKU__) + if(mmap((void*)address, size, PROT_NONE, mmap_flags|MAP_NORESERVE|MAP_FIXED, -1, 0) == MAP_FAILED) ++#else ++ if(mmap((void*)address, size, PROT_NONE, mmap_flags|MAP_FIXED, -1, 0) == MAP_FAILED) ++#endif + return false; + return true; + } +diff -urdN -E -b -w -B --strip-trailing-cr original/0ad-0.0.23-alpha/source/lib/sysdep/os.h 0ad-0.0.23-alpha/source/lib/sysdep/os.h +--- original/0ad-0.0.23-alpha/source/lib/sysdep/os.h 2017-07-10 14:26:24.025952256 +0000 ++++ 0ad-0.0.23-alpha/source/lib/sysdep/os.h 2019-06-04 15:55:52.065273856 +0000 +@@ -103,7 +103,7 @@ + # define OS_AMIGA 0 + #endif + // Unix-based +-#if defined(unix) || defined(__unix) || defined(__unix__) || defined(_XOPEN_SOURCE) || defined(_POSIX_SOURCE) ++#if defined(unix) || defined(__unix) || defined(__unix__) || defined(_XOPEN_SOURCE) || defined(_POSIX_SOURCE) || defined(__HAIKU__) + # define OS_UNIX 1 + #else + # define OS_UNIX 0 +diff -urdN -E -b -w -B --strip-trailing-cr original/0ad-0.0.23-alpha/source/main.cpp 0ad-0.0.23-alpha/source/main.cpp +--- original/0ad-0.0.23-alpha/source/main.cpp 2018-05-08 10:03:46.009175040 +0000 ++++ 0ad-0.0.23-alpha/source/main.cpp 2019-06-05 12:26:15.713555968 +0000 +@@ -657,7 +657,8 @@ + + extern "C" int main(int argc, char* argv[]) + { +-#if OS_UNIX ++ // Haiku only has a root user. ++#if OS_UNIX && !defined(__HAIKU__) + // Don't allow people to run the game with root permissions, + // because bad things can happen, check before we do anything + if (geteuid() == 0) +diff -urdN -E -b -w -B --strip-trailing-cr original/0ad-0.0.23-alpha/source/ps/GameSetup/GameSetup.cpp 0ad-0.0.23-alpha/source/ps/GameSetup/GameSetup.cpp +--- original/0ad-0.0.23-alpha/source/ps/GameSetup/GameSetup.cpp 2018-05-08 09:45:54.051380224 +0000 ++++ 0ad-0.0.23-alpha/source/ps/GameSetup/GameSetup.cpp 2019-06-07 20:46:23.354156544 +0000 +@@ -87,7 +87,7 @@ + #include "tools/atlas/GameInterface/GameLoop.h" + #include "tools/atlas/GameInterface/View.h" + +-#if !(OS_WIN || OS_MACOSX || OS_ANDROID) // assume all other platforms use X11 for wxWidgets ++#if !(OS_WIN || OS_MACOSX || OS_ANDROID || __HAIKU__) // assume all other platforms use X11 for wxWidgets + #define MUST_INIT_X11 1 + #include + #else +@@ -787,7 +787,8 @@ + #if OS_UNIX + static void FixLocales() + { +-#if OS_MACOSX || OS_BSD ++#if OS_MACOSX || OS_BSD || defined(__HAIKU__) ++ // NOTE: The Haiku clipboard code relies on UTF-8 to convert strings. + // OS X requires a UTF-8 locale in LC_CTYPE so that *wprintf can handle + // wide characters. Peculiarly the string "UTF-8" seems to be acceptable + // despite not being a real locale, and it's conveniently language-agnostic, +diff -urdN -E -b -w -B original/0ad-0.0.23-alpha/source/ps/GameSetup/Paths.cpp 0ad-0.0.23-alpha/source/ps/GameSetup/Paths.cpp +--- original/0ad-0.0.23-alpha/source/ps/GameSetup/Paths.cpp 2016-11-23 13:02:58.051118080 +0000 ++++ 0ad-0.0.23-alpha/source/ps/GameSetup/Paths.cpp 2019-06-08 17:35:37.093585408 +0000 +@@ -141,12 +141,20 @@ + const OsPath xdgConfig = XDG_Path("XDG_CONFIG_HOME", home, home/".config/" ) / subdirectoryName; + const OsPath xdgCache = XDG_Path("XDG_CACHE_HOME", home, home/".cache/" ) / subdirectoryName; + ++#if !defined(__HAIKU__) + // We don't make the game vs. user data distinction on Unix + m_gameData = xdgData/""; + m_userData = m_gameData; + m_cache = xdgCache/""; + m_config = xdgConfig / "config"/""; + m_logs = xdgConfig / "logs"/""; ++#else ++ m_gameData = OsPath("/boot/system/settings/0ad/"); ++ m_userData = home / "config" / "settings" / "0ad" / ""; ++ m_cache = m_userData / "cache" / ""; ++ m_config = m_userData / "config"/""; ++ m_logs = m_userData / "logs" / ""; ++#endif + + #endif + } +diff -urdN -E -b -w -B --strip-trailing-cr original/0ad-0.0.23-alpha/source/third_party/tinygettext/src/iconv.cpp 0ad-0.0.23-alpha/source/third_party/tinygettext/src/iconv.cpp +--- original/0ad-0.0.23-alpha/source/third_party/tinygettext/src/iconv.cpp 2015-12-08 18:05:11.039845888 +0000 ++++ 0ad-0.0.23-alpha/source/third_party/tinygettext/src/iconv.cpp 2019-06-05 19:13:12.000000000 +0000 +@@ -117,7 +117,7 @@ + char* outbuf = &result[0]; + + // Try to convert the text. +- size_t ret = tinygettext_iconv(cd, &inbuf, &inbytesleft, &outbuf, &outbytesleft); ++ size_t ret = tinygettext_iconv(cd, const_cast(&inbuf), &inbytesleft, &outbuf, &outbytesleft); + if (ret == static_cast(-1)) + { + if (errno == EILSEQ || errno == EINVAL) diff --git a/games-strategy/0ad_data/0ad_data-0.0.23b~alpha.recipe b/games-strategy/0ad_data/0ad_data-0.0.23b~alpha.recipe new file mode 100644 index 000000000..df8299910 --- /dev/null +++ b/games-strategy/0ad_data/0ad_data-0.0.23b~alpha.recipe @@ -0,0 +1,29 @@ +SUMMARY="O A.D. - Game Data" +DESCRIPTION="Data for the game 0 A.D." +HOMEPAGE="https://play0ad.com/" +COPYRIGHT="Wildfire Games" +LICENSE="0ADLicense" +REVISION="1" +SOURCE_URI="https://releases.wildfiregames.com/0ad-${portVersion/\~/-}-unix-data.tar.xz" +CHECKSUM_SHA256="e11b4ade7ede954cbbdc1fe6e2e4b25ac6b8d5a644133b640ffc9b099338a713" +SOURCE_DIR="0ad-${portVersion/\~/-}" + +ARCHITECTURES="?any" + +DISABLE_SOURCE_PACKAGE="yes" + +PROVIDES=" + 0ad_data = $portVersion +" + +BUILD() +{ + true +} + +INSTALL() +{ + mkdir -p $dataDir + mkdir -p $dataDir/0ad + cp -R binaries/data/* $dataDir/0ad +} diff --git a/games-strategy/0ad_data/0ad_data-0.0.23~alpha.recipe b/games-strategy/0ad_data/0ad_data-0.0.23~alpha.recipe new file mode 100644 index 000000000..dd4d5972d --- /dev/null +++ b/games-strategy/0ad_data/0ad_data-0.0.23~alpha.recipe @@ -0,0 +1,29 @@ +SUMMARY="O A.D. - Game Data" +DESCRIPTION="Data for the game 0 A.D." +HOMEPAGE="https://play0ad.com/" +COPYRIGHT="Wildfire Games" +LICENSE="0ADLicense" +REVISION="1" +SOURCE_URI="https://releases.wildfiregames.com/0ad-${portVersion/\~/-}-unix-data.tar.xz" +CHECKSUM_SHA256="fdbf774637252dbedf339fbe29b77d7d585ab53a9a5ddede56dd7b8fda66d8ac" +SOURCE_DIR="0ad-${portVersion/\~/-}" + +ARCHITECTURES="?any" + +DISABLE_SOURCE_PACKAGE="yes" + +PROVIDES=" + 0ad_data = $portVersion +" + +BUILD() +{ + true +} + +INSTALL() +{ + mkdir -p $dataDir + mkdir -p $dataDir/0ad + cp -R binaries/data/* $dataDir/0ad +} diff --git a/games-strategy/0ad_data/licenses/0ADLicense b/games-strategy/0ad_data/licenses/0ADLicense new file mode 100644 index 000000000..22652ac14 --- /dev/null +++ b/games-strategy/0ad_data/licenses/0ADLicense @@ -0,0 +1,82 @@ + 0 A.D. Licensing Details +========================== + +0 A.D. is released as open source: you can freely use, copy, modify and +distribute the game's source code and data files, as long as you include +attribution to Wildfire Games and let anyone freely modify and distribute any +of your own modifications to the game's files. + +The distribution includes several different types of files, and a number of +third-party components. The details are described here, based on the directory +structure. For any file, see the longest path name below which is a prefix of +the file's path. + +Some files don't yet have licensing details specified - if you care about any +in particular, let us know and we can try to clarify it. + + /binaries/data + GPL version 2 (or later) - see license_gpl-2.0.txt + + /binaries/data/mods/art + /binaries/data/mods/audio + Creative Commons Attribution-Share Alike 3.0 - see + http://creativecommons.org/licenses/by-sa/3.0/ + and also see LICENSE.txt within those directories + + /binaries/system + Various (unspecified) + + /binaries/system/dbghelp.dll + Proprietary - see license_dbghelp.txt for restrictions you must agree to + before distributing this particular file + + /build + Various (unspecified) + + /build/premake/premake4 + /build/premake/premake5 + BSD + + /build/premake/*.lua + MIT - see license_mit.txt + + /docs + Various (unspecified) + + /libraries + Various - see LICENSE.txt within that directory + + /source + GPL version 2 (or later) - see license_gpl-2.0.txt + + /source/lib + MIT - see license_mit.txt + + /source/scriptinterface/third_party + MPL 2.0 + + /source/third_party/cppformat + BSD + + /source/third_party/encryption + GPL version 2 (or later) + ISC (pkcs5_pbkdf2.cpp) + MIT (pkcs5_pbkdf2.h) - see license_mit.txt + + /source/third-party/jsonspirit + MIT - see license_mit.txt + + /source/third_party/mikktspace + zlib + + /source/third_party/mongoose + MIT - see license_mit.txt + + /source/third_party/tinygettext + zlib + + /source/tools + Various - see LICENSE.txt within that directory + + /source/tools/atlas + GPL version 2 (or later) - see license_gpl-2.0.txt