aboutsummaryrefslogtreecommitdiff
path: root/games/0ad
diff options
context:
space:
mode:
authorAntoine Brodin <antoine@FreeBSD.org>2021-01-01 10:11:34 +0000
committerAntoine Brodin <antoine@FreeBSD.org>2021-01-01 10:11:34 +0000
commit26b4c8f71f91d22e081b27814782686edde0c90a (patch)
tree1c321c39372c25d8634e75b5c8e08edc676b296d /games/0ad
parent548f16bd1a2915f08878b716eed92ff3267e6de2 (diff)
downloadports-26b4c8f71f91d22e081b27814782686edde0c90a.tar.gz
ports-26b4c8f71f91d22e081b27814782686edde0c90a.zip
Notes
Diffstat (limited to 'games/0ad')
-rw-r--r--games/0ad/Makefile92
-rw-r--r--games/0ad/distinfo5
-rw-r--r--games/0ad/files/patch-build_premake_extern__libs5.lua21
-rw-r--r--games/0ad/files/patch-build_premake_premake5.lua17
-rw-r--r--games/0ad/files/patch-build_workspaces_update-workspaces.sh13
-rw-r--r--games/0ad/files/patch-icu6817
-rw-r--r--games/0ad/files/patch-libraries_source_fcollada_src_FCollada_FUtils_FUStringBuilder.hpp157
-rw-r--r--games/0ad/files/patch-libraries_source_fcollada_src_Makefile11
-rw-r--r--games/0ad/files/patch-libraries_source_spidermonkey_FixpsutilFreeBSD.diff168
-rw-r--r--games/0ad/files/patch-libraries_source_spidermonkey_build.sh17
-rw-r--r--games/0ad/files/patch-source_lib_allocators_page__aligned.cpp20
-rw-r--r--games/0ad/files/patch-source_lib_sysdep_os_unix_uvm.cpp20
-rw-r--r--games/0ad/files/patch-source_tools_atlas_AtlasObject_AtlasObjectImpl.cpp30
-rw-r--r--games/0ad/files/patch-source_tools_atlas_AtlasUI_CustomControls_MapDialog_MapDialog.cpp34
-rw-r--r--games/0ad/files/patch-source_tools_atlas_AtlasUI_ScenarioEditor_ScenarioEditor.cpp56
-rw-r--r--games/0ad/pkg-descr16
-rw-r--r--games/0ad/pkg-plist12
17 files changed, 706 insertions, 0 deletions
diff --git a/games/0ad/Makefile b/games/0ad/Makefile
new file mode 100644
index 000000000000..fd1ae3e6da87
--- /dev/null
+++ b/games/0ad/Makefile
@@ -0,0 +1,92 @@
+# $FreeBSD$
+
+PORTNAME= 0ad
+PORTVERSION= 0.0.23b
+PORTREVISION= 12
+CATEGORIES= games
+MASTER_SITES= http://releases.wildfiregames.com/ \
+ SF/zero-ad/releases
+DISTFILES= ${PORTNAME}-${PORTVERSION}-alpha-unix-build.tar.xz \
+ ${PORTNAME}-${PORTVERSION}-alpha-unix-data.tar.xz
+
+MAINTAINER= madpilot@FreeBSD.org
+COMMENT= Real-time strategy (RTS) game of ancient warfare
+
+DEPRECATED= Uses deprecated version of python
+EXPIRATION_DATE= 2020-12-31
+
+BUILD_DEPENDS= zip:archivers/zip \
+ cmake:devel/cmake
+LIB_DEPENDS= libboost_thread.so:devel/boost-libs \
+ libicui18n.so:devel/icu \
+ libpng.so:graphics/png \
+ libogg.so:audio/libogg \
+ libvorbis.so:audio/libvorbis \
+ libcurl.so:ftp/curl \
+ libgloox.so:net-im/gloox \
+ libminiupnpc.so:net/miniupnpc \
+ libnspr4.so:devel/nspr \
+ libenet.so:net/enet \
+ libtiff.so:graphics/tiff \
+ libsodium.so:security/libsodium
+
+USES= compiler:c++11-lib desktop-file-utils dos2unix gl gmake gnome \
+ iconv jpeg openal:al pkgconfig python:2.7,build sdl tar:xz xorg
+USE_GNOME= libxml2
+USE_GL= gl
+USE_SDL= sdl2
+USE_XORG= x11 xcursor
+
+WRKSRC= ${WRKDIR}/${PORTNAME}-${PORTVERSION}-alpha
+BUILD_WRKSRC= ${WRKSRC}/build/workspaces/gcc
+MAKE_ARGS= config=release verbose=1
+CPPFLAGS+= -DU_USING_ICU_NAMESPACE=1
+BUNDLE_LIBS= yes
+DOS2UNIX_REGEX= .*\.([ch]p{0,2}|make)
+BINARY_ALIAS= python=${PYTHON_CMD}
+
+USE_WX= 3.0+
+WX_COMPS= wx:lib
+MAKE_ENV+= JOBS=${_MAKE_JOBS}
+
+BROKEN_aarch64= fails to compile: no member named verifyHeapAccessDisassembly
+BROKEN_armv6= fails to link: fatal error: conftest: Unknown error: -1
+BROKEN_armv7= fails to link: fatal error: conftest: Unknown error: -1
+BROKEN_powerpc64= fails to compile: _psutil_bsd.c: error: 'struct xtcpcb' has no member named 'xt_tp'
+
+PORTDATA= *
+
+.include <bsd.port.pre.mk>
+
+post-patch:
+ @${REINPLACE_CMD} -e 's|%%LOCALBASE%%|${LOCALBASE}|' \
+ -e 's|%%CC%%|${CC}|' \
+ ${WRKSRC}/build/premake/premake5.lua ${WRKSRC}/build/premake/extern_libs5.lua
+.if ${ARCH} == i386 && ${CHOSEN_COMPILER_TYPE} == gcc
+ @${REINPLACE_CMD} -e '1055,1251s/-rdynamic/-lssp_nonshared &/' \
+ -e '1441s/"execinfo",/& "ssp_nonshared",/' \
+ ${WRKSRC}/build/premake/premake5.lua
+.endif
+ @${REINPLACE_CMD} 's,^\(Exec=\)/usr/local,\1${PREFIX},' \
+ ${WRKSRC}/build/resources/0ad.desktop
+ @${REINPLACE_CMD} 's|%%PREFIX%%|${PREFIX}|' \
+ ${WRKSRC}/build/resources/0ad.sh
+
+pre-build:
+ (cd ${WRKSRC}/build/workspaces && ${SETENV} ${MAKE_ENV} ./update-workspaces.sh --bindir=${PREFIX}/bin --datadir=${DATADIR} --libdir=${PREFIX}/lib/${PORTNAME})
+
+do-install:
+ ${INSTALL_PROGRAM} ${WRKSRC}/binaries/system/pyrogenesis ${STAGEDIR}${PREFIX}/bin
+ ${INSTALL_SCRIPT} ${WRKSRC}/build/resources/0ad.sh ${STAGEDIR}${PREFIX}/bin/0ad
+ ${INSTALL_PROGRAM} ${WRKSRC}/binaries/system/ActorEditor ${STAGEDIR}${PREFIX}/bin
+ ${MKDIR} ${STAGEDIR}${PREFIX}/lib/${PORTNAME}
+ (cd ${WRKSRC}/binaries/system && ${INSTALL_LIB} libAtlasUI.so libCollada.so libmozjs38-ps-release.so libnvcore.so libnvimage.so libnvmath.so libnvtt.so ${STAGEDIR}${PREFIX}/lib/${PORTNAME})
+ ${INSTALL_DATA} ${WRKSRC}/build/resources/0ad.desktop ${STAGEDIR}${PREFIX}/share/applications
+ ${INSTALL_DATA} ${WRKSRC}/build/resources/0ad.png ${STAGEDIR}${PREFIX}/share/pixmaps
+ ${MKDIR} ${STAGEDIR}${DATADIR}
+ (cd ${WRKSRC}/binaries/data && ${COPYTREE_SHARE} "config l10n tests tools" ${STAGEDIR}${DATADIR})
+ ${MKDIR} ${STAGEDIR}${DATADIR}/mods/public ${STAGEDIR}${DATADIR}/mods/mod
+ ${TAR} xf ${WRKSRC}/binaries/data/mods/public/public.zip -C ${STAGEDIR}${DATADIR}/mods/public --no-same-permissions
+ ${TAR} xf ${WRKSRC}/binaries/data/mods/mod/mod.zip -C ${STAGEDIR}${DATADIR}/mods/mod --no-same-permissions
+
+.include <bsd.port.post.mk>
diff --git a/games/0ad/distinfo b/games/0ad/distinfo
new file mode 100644
index 000000000000..7aa206213e7b
--- /dev/null
+++ b/games/0ad/distinfo
@@ -0,0 +1,5 @@
+TIMESTAMP = 1545588170
+SHA256 (0ad-0.0.23b-alpha-unix-build.tar.xz) = 01bff7641ee08cac896c54d518d7e4b01752513105558f212e3199d747512a37
+SIZE (0ad-0.0.23b-alpha-unix-build.tar.xz) = 31922812
+SHA256 (0ad-0.0.23b-alpha-unix-data.tar.xz) = e11b4ade7ede954cbbdc1fe6e2e4b25ac6b8d5a644133b640ffc9b099338a713
+SIZE (0ad-0.0.23b-alpha-unix-data.tar.xz) = 691280800
diff --git a/games/0ad/files/patch-build_premake_extern__libs5.lua b/games/0ad/files/patch-build_premake_extern__libs5.lua
new file mode 100644
index 000000000000..946c30375b72
--- /dev/null
+++ b/games/0ad/files/patch-build_premake_extern__libs5.lua
@@ -0,0 +1,21 @@
+--- build/premake/extern_libs5.lua.orig 2018-04-29 15:44:48 UTC
++++ build/premake/extern_libs5.lua
+@@ -191,7 +191,7 @@ extern_lib_defs = {
+ end
+ -- TODO: This actually applies to most libraries we use on BSDs, make this a global setting.
+ if os.istarget("bsd") then
+- sysincludedirs { "/usr/local/include" }
++ sysincludedirs { "%%LOCALBASE%%/include" }
+ end
+ end,
+ link_settings = function()
+@@ -301,9 +301,6 @@ extern_lib_defs = {
+ elseif os.istarget("macosx") then
+ add_default_include_paths("iconv")
+ defines { "LIBICONV_STATIC" }
+- elseif os.getversion().description == "FreeBSD" then
+- defines { "HAVE_ICONV_CONST" }
+- defines { "ICONV_CONST=const" }
+ end
+ end,
+ link_settings = function()
diff --git a/games/0ad/files/patch-build_premake_premake5.lua b/games/0ad/files/patch-build_premake_premake5.lua
new file mode 100644
index 000000000000..edd965ab45dd
--- /dev/null
+++ b/games/0ad/files/patch-build_premake_premake5.lua
@@ -0,0 +1,17 @@
+--- build/premake/premake5.lua.orig 2018-04-22 18:14:45 UTC
++++ build/premake/premake5.lua
+@@ -376,11 +376,11 @@ function project_add_x11_dirs()
+ sysincludedirs {
+ "/usr/X11R6/include/X11",
+ "/usr/X11R6/include",
+- "/usr/local/include/X11",
+- "/usr/local/include",
++ "%%LOCALBASE%%/include/X11",
++ "%%LOCALBASE%%/include",
+ "/usr/include/X11"
+ }
+- libdirs { "/usr/X11R6/lib" }
++ libdirs { "%%LOCALBASE%%/lib" }
+ end
+ end
+
diff --git a/games/0ad/files/patch-build_workspaces_update-workspaces.sh b/games/0ad/files/patch-build_workspaces_update-workspaces.sh
new file mode 100644
index 000000000000..311f65a0c84f
--- /dev/null
+++ b/games/0ad/files/patch-build_workspaces_update-workspaces.sh
@@ -0,0 +1,13 @@
+--- build/workspaces/update-workspaces.sh.orig 2014-09-20 19:02:24 UTC
++++ build/workspaces/update-workspaces.sh
+@@ -1,10 +1,5 @@
+ #!/bin/sh
+
+-if [ "$(id -u)" = "0" ]; then
+- echo "Running as root will mess up file permissions. Aborting ..." 1>&2
+- exit 1
+-fi
+-
+ die()
+ {
+ echo ERROR: $*
diff --git a/games/0ad/files/patch-icu68 b/games/0ad/files/patch-icu68
new file mode 100644
index 000000000000..5e9199d89535
--- /dev/null
+++ b/games/0ad/files/patch-icu68
@@ -0,0 +1,17 @@
+Regressed by https://github.com/unicode-org/icu/commit/c3fe7e09d844
+
+../../../source/i18n/L10n.cpp:208:82: error: use of undeclared identifier 'TRUE'
+ currentLocaleIsOriginalGameLocale = (currentLocale == icu::Locale::getUS()) == TRUE;
+ ^
+
+--- source/i18n/L10n.cpp.orig 2018-04-10 18:13:32 UTC
++++ source/i18n/L10n.cpp
+@@ -205,7 +205,7 @@ void L10n::ReevaluateCurrentLocaleAndReload()
+ else
+ {
+ GetDictionaryLocale(locale, currentLocale);
+- currentLocaleIsOriginalGameLocale = (currentLocale == icu::Locale::getUS()) == TRUE;
++ currentLocaleIsOriginalGameLocale = (currentLocale == icu::Locale::getUS()) == true;
+ useLongStrings = false;
+ }
+ LoadDictionaryForCurrentLocale();
diff --git a/games/0ad/files/patch-libraries_source_fcollada_src_FCollada_FUtils_FUStringBuilder.hpp b/games/0ad/files/patch-libraries_source_fcollada_src_FCollada_FUtils_FUStringBuilder.hpp
new file mode 100644
index 000000000000..1e7b881a41fb
--- /dev/null
+++ b/games/0ad/files/patch-libraries_source_fcollada_src_FCollada_FUtils_FUStringBuilder.hpp
@@ -0,0 +1,157 @@
+--- libraries/source/fcollada/src/FCollada/FUtils/FUStringBuilder.hpp.orig 2017-07-28 19:57:27 UTC
++++ libraries/source/fcollada/src/FCollada/FUtils/FUStringBuilder.hpp
+@@ -26,63 +26,6 @@
+ #define SAFE_DELETE_ARRAY(ptr) if (ptr != NULL) { delete [] ptr; ptr = NULL; }
+ #endif
+
+-template <class Char, class FloatType>
+-void FloatToString(FloatType f, Char* sz)
+-{
+- Char* buffer = sz + 1;
+- static const int digitCount = 6;
+- int decimal, sign;
+-
+- // ecvt rounds the string for us: http://www.datafocus.com/docs/man3/ecvt.3.asp
+- char* end = ecvt(f, digitCount, &decimal, &sign);
+-
+- if (sign != 0) (*buffer++) = '-';
+- int count = digitCount;
+- if (decimal > digitCount)
+- {
+- // We use the scientific notation: P.MeX
+- (*buffer++) = (*end++); // P is one character.
+- (*buffer++) = '.';
+-
+- // Mantissa (cleaned for zeroes)
+- for (--count; count > 0; --count) if (end[count - 1] != '0') break;
+- for (int i = 0; i < count; ++i) (*buffer++) = (*end++);
+- if (buffer[-1] == '.') --buffer;
+-
+- // Exponent
+- (*buffer++) = 'e';
+- uint32 exponent = decimal - 1; // X
+- if (exponent >= 10) (*buffer++) = (Char) ('0' + (exponent / 10));
+- (*buffer++) = (Char) ('0' + (exponent % 10));
+- (*buffer) = 0;
+- return;
+- }
+- else if (decimal > 0)
+- {
+- // Simple number: A.B
+- for (int i = 0; i < decimal; ++i) (*buffer++) = (*end++);
+- if (decimal < digitCount) (*buffer++) = '.';
+- count = digitCount - decimal;
+- }
+- else if (decimal < -digitCount)
+- {
+- // What case is this?
+- decimal = count = 0;
+- }
+- else if (decimal < 0 || (decimal == 0 && *end != '0'))
+- {
+- // Tiny number: 0.Me-X
+- (*buffer++) = '0'; (*buffer++) = '.';
+- for (int i = 0; i < -decimal; ++i) (*buffer++) = '0';
+- count = digitCount + decimal;
+- }
+- for (; count > 0; --count) if (end[count - 1] != '0') break;
+- for (int i = 0; i < count; ++i) (*buffer++) = (*end++);
+- if (decimal == 0 && count == 0) (*buffer++) = '0';
+- if (buffer[-1] == '.') --buffer;
+- (*buffer) = 0;
+-}
+-
+ template <class Char>
+ FUStringBuilderT<Char>::FUStringBuilderT(const String& sz)
+ {
+@@ -234,53 +177,50 @@ void FUStringBuilderT<Char>::append(const FUStringBuil
+ template <class Char>
+ void FUStringBuilderT<Char>::append(float f)
+ {
+-#ifdef WIN32
+- // use <float.h> _isnan method to detect the 1.#IND00 NaN.
+- if (f != std::numeric_limits<float>::infinity() && f != -std::numeric_limits<float>::infinity() && f != std::numeric_limits<float>::quiet_NaN() && f != std::numeric_limits<float>::signaling_NaN() && !_isnan((double)f))
+-#else
+- if (f != std::numeric_limits<float>::infinity() && f != -std::numeric_limits<float>::infinity() && f != std::numeric_limits<float>::quiet_NaN() && f != std::numeric_limits<float>::signaling_NaN())
+-#endif
+- {
+- if (IsEquivalent(f, 0.0f, std::numeric_limits<float>::epsilon())) append((Char)'0');
+- else
+- {
+- Char sz[128];
+- FloatToString(f, sz);
+- append(sz + 1);
+- }
+- }
+- else if (f == std::numeric_limits<float>::infinity())
+- { append((Char)'I'); append((Char)'N'); append((Char)'F'); }
+- else if (f == -std::numeric_limits<float>::infinity())
+- { append((Char)'-'); append((Char)'I'); append((Char)'N'); append((Char)'F'); }
+- else
+- { append((Char)'N'); append((Char)'a'); append((Char)'N'); }
++ append((double)f);
+ }
+
+ template <class Char>
+ void FUStringBuilderT<Char>::append(double f)
+ {
+-#ifdef WIN32
+- // use <float.h> _isnan method to detect the .#IND00 NaN.
+- if (f != std::numeric_limits<float>::infinity() && f != -std::numeric_limits<float>::infinity() && f != std::numeric_limits<float>::quiet_NaN() && f != std::numeric_limits<float>::signaling_NaN() && !_isnan(f))
+-#else
+- if (f != std::numeric_limits<float>::infinity() && f != -std::numeric_limits<float>::infinity() && f != std::numeric_limits<float>::quiet_NaN() && f != std::numeric_limits<float>::signaling_NaN())
+-#endif
+- {
+- if (IsEquivalent(f, 0.0, std::numeric_limits<double>::epsilon())) append((Char)'0');
+- else
+- {
+- Char sz[128];
+- FloatToString(f, sz);
+- append(sz + 1);
+- }
++ if (f == -std::numeric_limits<double>::infinity()) {
++ append("-INF");
++ return;
++ } else if (f == std::numeric_limits<double>::infinity()) {
++ append("INF");
++ return;
++ } else if (f != f) {
++ append("NaN");
++ return;
++ } else if (-std::numeric_limits<double>::epsilon() < f && f < std::numeric_limits<double>::epsilon()) {
++ append("0.0E0");
++ return;
+ }
+- else if (f == std::numeric_limits<double>::infinity())
+- { append((Char)'I'); append((Char)'N'); append((Char)'F'); }
+- else if (f == -std::numeric_limits<double>::infinity())
+- { append((Char)'-'); append((Char)'I'); append((Char)'N'); append((Char)'F'); }
++
++ if (f < 0.0) {
++ f = -f;
++ append('-');
++ }
++
++ int e = 0;
++// e = floor(log10(f));
++// f = f / pow(10.0, e);
++
++ if (f < 1.0)
++ for (; f < 1.0; f *= 10.0)
++ e--;
+ else
+- { append((Char)'N'); append((Char)'a'); append((Char)'N'); }
++ for (; f >= 10.0; f /= 10.0)
++ e++;
++
++ char tmp[10];
++ sprintf(tmp, "%.6g", f);
++ append(tmp);
++ if (tmp[1] == 0) // only one digit, add missing part according canonical representation
++ append(".0");
++
++ sprintf(tmp, "E%d", e);
++ append(tmp);
+ }
+
+ template <class Char>
diff --git a/games/0ad/files/patch-libraries_source_fcollada_src_Makefile b/games/0ad/files/patch-libraries_source_fcollada_src_Makefile
new file mode 100644
index 000000000000..5221789a8bcb
--- /dev/null
+++ b/games/0ad/files/patch-libraries_source_fcollada_src_Makefile
@@ -0,0 +1,11 @@
+--- libraries/source/fcollada/src/Makefile.orig 2019-04-26 13:27:39 UTC
++++ libraries/source/fcollada/src/Makefile
+@@ -227,7 +227,7 @@ OBJECTS_ALL = $(OBJECTS_DEBUG) $(OBJECTS_RELEASE) $(OB
+ all: output/libFColladaSD.a output/libFColladaSR.a install
+
+ output_dirs:
+- bash -c 'mkdir -p output/{debug,release,test}/{FCollada/{FCDocument,FMath,FUtils,FColladaTest/{FCTestAssetManagement,FCTestExportImport,FCTestXRef}},FColladaPlugins/FArchiveXML}'
++ for x in debug release test; do for y in FCDocument FMath FUtils FColladaTest; do for z in FCTestAssetManagement FCTestExportImport FCTestXRef; do mkdir -p output/$$x/FCollada/$$y/$$z; done; done; mkdir -p output/$$x/FColladaPlugins/FArchiveXML; done
+
+ test: FCollada/FColladaTest/ output/FColladaTest
+ ( cd FCollada/FColladaTest/ ; ../../output/FColladaTest )
diff --git a/games/0ad/files/patch-libraries_source_spidermonkey_FixpsutilFreeBSD.diff b/games/0ad/files/patch-libraries_source_spidermonkey_FixpsutilFreeBSD.diff
new file mode 100644
index 000000000000..78701a995867
--- /dev/null
+++ b/games/0ad/files/patch-libraries_source_spidermonkey_FixpsutilFreeBSD.diff
@@ -0,0 +1,168 @@
+--- libraries/source/spidermonkey/FixpsutilFreeBSD.diff.orig 2017-09-13 00:10:27 UTC
++++ libraries/source/spidermonkey/FixpsutilFreeBSD.diff
+@@ -1,6 +1,6 @@
+---- python/psutil/psutil/_psutil_bsd.c
+-+++ python/psutil/psutil/_psutil_bsd.c
+-@@ -957,11 +957,19 @@ psutil_sockaddr_matches(int family, int port, void *pc
++--- ./python/psutil/psutil/_psutil_bsd.c.orig 2015-09-17 22:12:23.000000000 +0200
+++++ ./python/psutil/psutil/_psutil_bsd.c
++@@ -957,11 +957,19 @@
+ psutil_sockaddr_addrlen(family)) == 0);
+ }
+
+@@ -20,7 +20,7 @@
+ struct xinpgen *xig, *oxig;
+ struct xsocket *so;
+
+-@@ -969,9 +977,15 @@ psutil_search_tcplist(char *buf, struct kinfo_file *ki
++@@ -969,9 +977,15 @@
+ for (xig = (struct xinpgen *)((char *)xig + xig->xig_len);
+ xig->xig_len > sizeof(struct xinpgen);
+ xig = (struct xinpgen *)((char *)xig + xig->xig_len)) {
+@@ -36,7 +36,44 @@
+
+ if (so->so_type != kif->kf_sock_type ||
+ so->xso_family != kif->kf_sock_domain ||
+-@@ -1019,7 +1033,11 @@ psutil_proc_connections(PyObject *self, PyObject *args
++@@ -981,20 +995,36 @@
++ if (kif->kf_sock_domain == AF_INET) {
++ if (!psutil_sockaddr_matches(
++ AF_INET, inp->inp_lport, &inp->inp_laddr,
+++#if __FreeBSD_version < 1200031
++ &kif->kf_sa_local))
+++#else
+++ &kif->kf_un.kf_sock.kf_sa_local))
+++#endif
++ continue;
++ if (!psutil_sockaddr_matches(
++ AF_INET, inp->inp_fport, &inp->inp_faddr,
+++#if __FreeBSD_version < 1200031
++ &kif->kf_sa_peer))
+++#else
+++ &kif->kf_un.kf_sock.kf_sa_peer))
+++#endif
++ continue;
++ } else {
++ if (!psutil_sockaddr_matches(
++ AF_INET6, inp->inp_lport, &inp->in6p_laddr,
+++#if __FreeBSD_version < 1200031
++ &kif->kf_sa_local))
+++#else
+++ &kif->kf_un.kf_sock.kf_sa_peer))
+++#endif
++ continue;
++ if (!psutil_sockaddr_matches(
++ AF_INET6, inp->inp_fport, &inp->in6p_faddr,
+++#if __FreeBSD_version < 1200031
++ &kif->kf_sa_peer))
+++#else
+++ &kif->kf_un.kf_sock.kf_sa_peer))
+++#endif
++ continue;
++ }
++
++@@ -1019,7 +1049,11 @@
+ struct kinfo_file *freep = NULL;
+ struct kinfo_file *kif;
+ char *tcplist = NULL;
+@@ -48,3 +85,100 @@
+
+ PyObject *retList = PyList_New(0);
+ PyObject *tuple = NULL;
++@@ -1094,19 +1128,35 @@
++ inet_ntop(
++ kif->kf_sock_domain,
++ psutil_sockaddr_addr(kif->kf_sock_domain,
+++#if __FreeBSD_version < 1200031
++ &kif->kf_sa_local),
+++#else
+++ &kif->kf_un.kf_sock.kf_sa_local),
+++#endif
++ lip,
++ sizeof(lip));
++ inet_ntop(
++ kif->kf_sock_domain,
++ psutil_sockaddr_addr(kif->kf_sock_domain,
+++#if __FreeBSD_version < 1200031
++ &kif->kf_sa_peer),
+++#else
+++ &kif->kf_un.kf_sock.kf_sa_peer),
+++#endif
++ rip,
++ sizeof(rip));
++ lport = htons(psutil_sockaddr_port(kif->kf_sock_domain,
+++#if __FreeBSD_version < 1200031
++ &kif->kf_sa_local));
+++#else
+++ &kif->kf_un.kf_sock.kf_sa_local));
+++#endif
++ rport = htons(psutil_sockaddr_port(kif->kf_sock_domain,
+++#if __FreeBSD_version < 1200031
++ &kif->kf_sa_peer));
+++#else
+++ &kif->kf_un.kf_sock.kf_sa_peer));
+++#endif
++
++ // construct python tuple/list
++ laddr = Py_BuildValue("(si)", lip, lport);
++@@ -1137,7 +1187,11 @@
++ else if (kif->kf_sock_domain == AF_UNIX) {
++ struct sockaddr_un *sun;
++
+++#if __FreeBSD_version < 1200031
++ sun = (struct sockaddr_un *)&kif->kf_sa_local;
+++#else
+++ sun = (struct sockaddr_un *)&kif->kf_un.kf_sock.kf_sa_local;
+++#endif
++ snprintf(
++ path, sizeof(path), "%.*s",
++ (sun->sun_len - (sizeof(*sun) - sizeof(sun->sun_path))),
++@@ -1779,7 +1833,11 @@
++ struct xinpgen *xig, *exig;
++ struct xinpcb *xip;
++ struct xtcpcb *xtp;
+++#if __FreeBSD_version >= 1200026
+++ struct xinpcb *inp;
+++#else
++ struct inpcb *inp;
+++#endif
++ struct xsocket *so;
++ struct sock *sock;
++ const char *varname;
++@@ -1849,13 +1907,21 @@
++ PyErr_Format(PyExc_RuntimeError, "struct xinpcb size mismatch");
++ goto error;
++ }
+++#if __FreeBSD_version >= 1200026
+++ inp = xip;
+++#else
++ inp = &xip->xi_inp;
+++#endif
++ so = &xip->xi_socket;
++ break;
++ }
++
++ inp = &xtp->xt_inp;
+++#if __FreeBSD_version >= 1200026
+++ so = &xtp->xt_inp.xi_socket;
+++#else
++ so = &xtp->xt_socket;
+++#endif
++ char lip[200], rip[200];
++ int family, lport, rport, pid, status;
++
++@@ -1863,9 +1929,14 @@
++ pid = psutil_get_pid_from_sock(hash);
++ if (pid < 0)
++ continue;
+++
++ lport = ntohs(inp->inp_lport);
++ rport = ntohs(inp->inp_fport);
+++#if __FreeBSD_version >= 1200026
+++ status = xtp->t_state;
+++#else
++ status = xtp->xt_tp.t_state;
+++#endif
++
++ if (inp->inp_vflag & INP_IPV4) {
++ family = AF_INET;
diff --git a/games/0ad/files/patch-libraries_source_spidermonkey_build.sh b/games/0ad/files/patch-libraries_source_spidermonkey_build.sh
new file mode 100644
index 000000000000..661627fc0407
--- /dev/null
+++ b/games/0ad/files/patch-libraries_source_spidermonkey_build.sh
@@ -0,0 +1,17 @@
+--- libraries/source/spidermonkey/build.sh.orig 2016-10-04 15:01:34 UTC
++++ libraries/source/spidermonkey/build.sh
+@@ -96,6 +96,14 @@ cd js/src
+ rm -rf build-debug
+ rm -rf build-release
+
++cp jsnativestack.cpp jsnativestack.cpp.orig
++sed 's/# include <pthread_np.h>/#pragma GCC visibility push(default)\
++#include <pthread_np.h>\
++#pragma GCC visibility pop/' jsnativestack.cpp.orig >jsnativestack.cpp
++
++cp configure configure.orig
++sed -e 's/"$ac_cv_have_visibility_class_bug" = "no"; then/"$ac_cv_have_visibility_class_bug" = "no" -a "$OS_ARCH" != "FreeBSD" ; then/' -e 's/-Werror=conversion-null//' configure.orig >configure
++
+ # We want separate debug/release versions of the library, so we have to change
+ # the LIBRARY_NAME for each build.
+ # (We use perl instead of sed so that it works with MozillaBuild on Windows,
diff --git a/games/0ad/files/patch-source_lib_allocators_page__aligned.cpp b/games/0ad/files/patch-source_lib_allocators_page__aligned.cpp
new file mode 100644
index 000000000000..87d3081a43e7
--- /dev/null
+++ b/games/0ad/files/patch-source_lib_allocators_page__aligned.cpp
@@ -0,0 +1,20 @@
+--- source/lib/allocators/page_aligned.cpp.orig 2017-07-28 19:57:26 UTC
++++ source/lib/allocators/page_aligned.cpp
+@@ -49,7 +49,7 @@ static const int mmap_flags = MAP_PRIVATE|MAP_ANONYMOU
+ Status mem_Reserve(size_t size, u8** pp)
+ {
+ errno = 0;
+- void* ret = mmap(0, size, PROT_NONE, mmap_flags|MAP_NORESERVE, -1, 0);
++ void* ret = mmap(0, size, PROT_NONE, mmap_flags, -1, 0);
+ *pp = (u8*)ret;
+ return StatusFromMap(ret);
+ }
+@@ -76,7 +76,7 @@ Status mem_Commit(u8* p, size_t size, int prot)
+ Status mem_Decommit(u8* p, size_t size)
+ {
+ errno = 0;
+- void* ret = mmap(p, size, PROT_NONE, mmap_flags|MAP_NORESERVE|MAP_FIXED, -1, 0);
++ void* ret = mmap(p, size, PROT_NONE, mmap_flags|MAP_FIXED, -1, 0);
+ return StatusFromMap(ret);
+ }
+
diff --git a/games/0ad/files/patch-source_lib_sysdep_os_unix_uvm.cpp b/games/0ad/files/patch-source_lib_sysdep_os_unix_uvm.cpp
new file mode 100644
index 000000000000..09152b8501de
--- /dev/null
+++ b/games/0ad/files/patch-source_lib_sysdep_os_unix_uvm.cpp
@@ -0,0 +1,20 @@
+--- source/lib/sysdep/os/unix/uvm.cpp.orig 2017-07-28 19:57:26 UTC
++++ source/lib/sysdep/os/unix/uvm.cpp
+@@ -40,7 +40,7 @@ namespace vm {
+ void* ReserveAddressSpace(size_t size, size_t UNUSED(commitSize), PageType UNUSED(pageType), int UNUSED(prot))
+ {
+ errno = 0;
+- void* p = mmap(0, size, PROT_NONE, mmap_flags|MAP_NORESERVE, -1, 0);
++ void* p = mmap(0, size, PROT_NONE, mmap_flags, -1, 0);
+ if(p == MAP_FAILED)
+ return 0;
+ return p;
+@@ -77,7 +77,7 @@ bool Commit(uintptr_t address, size_t size, PageType U
+ bool Decommit(uintptr_t address, size_t size)
+ {
+ errno = 0;
+- if(mmap((void*)address, size, PROT_NONE, mmap_flags|MAP_NORESERVE|MAP_FIXED, -1, 0) == MAP_FAILED)
++ if(mmap((void*)address, size, PROT_NONE, mmap_flags|MAP_FIXED, -1, 0) == MAP_FAILED)
+ return false;
+ return true;
+ }
diff --git a/games/0ad/files/patch-source_tools_atlas_AtlasObject_AtlasObjectImpl.cpp b/games/0ad/files/patch-source_tools_atlas_AtlasObject_AtlasObjectImpl.cpp
new file mode 100644
index 000000000000..b67f4c71c6e6
--- /dev/null
+++ b/games/0ad/files/patch-source_tools_atlas_AtlasObject_AtlasObjectImpl.cpp
@@ -0,0 +1,30 @@
+--- source/tools/atlas/AtlasObject/AtlasObjectImpl.cpp.orig 2016-11-23 14:09:58 UTC
++++ source/tools/atlas/AtlasObject/AtlasObjectImpl.cpp
+@@ -164,7 +164,12 @@ void AtObj::add(const char* key, AtObj& data)
+
+ void AtObj::add(const char* key, const wxString& value)
+ {
+- add(key, value.wc_str());
++ const AtNode* o = new AtNode(value.wc_str());
++
++ if (!p)
++ p = new AtNode();
++
++ p = p->addChild(key, AtNode::Ptr(o));
+ }
+
+ void AtObj::add(const char* key, const wchar_t* value)
+@@ -187,7 +192,12 @@ void AtObj::set(const char* key, AtObj& data)
+
+ void AtObj::set(const char* key, const wxString& value)
+ {
+- set(key, value.wc_str());
++ const AtNode* o = new AtNode(value.wc_str());
++
++ if (!p)
++ p = new AtNode();
++
++ p = p->setChild(key, AtNode::Ptr(o));
+ }
+
+ void AtObj::set(const char* key, const wchar_t* value)
diff --git a/games/0ad/files/patch-source_tools_atlas_AtlasUI_CustomControls_MapDialog_MapDialog.cpp b/games/0ad/files/patch-source_tools_atlas_AtlasUI_CustomControls_MapDialog_MapDialog.cpp
new file mode 100644
index 000000000000..d9653b27468f
--- /dev/null
+++ b/games/0ad/files/patch-source_tools_atlas_AtlasUI_CustomControls_MapDialog_MapDialog.cpp
@@ -0,0 +1,34 @@
+--- source/tools/atlas/AtlasUI/CustomControls/MapDialog/MapDialog.cpp.orig 2018-03-13 20:26:30 UTC
++++ source/tools/atlas/AtlasUI/CustomControls/MapDialog/MapDialog.cpp
+@@ -166,11 +166,11 @@ void MapDialog::OnListBox(wxCommandEvent& evt)
+ else
+ {
+ wxString filePath = GetSelectedFilePath();
+- AtlasMessage::qVFSFileExists qry(filePath.wc_str());
++ AtlasMessage::qVFSFileExists qry(filePath.ToStdWstring());
+ qry.Post();
+ if (!filePath.IsEmpty() && qry.exists)
+ {
+- AtlasMessage::qVFSFileRealPath qry(filePath.wc_str());
++ AtlasMessage::qVFSFileRealPath qry(filePath.ToStdWstring());
+ qry.Post();
+ wxDynamicCast(FindWindow(ID_MapDialogFilename), wxTextCtrl)->ChangeValue(*qry.realPath);
+ }
+@@ -221,7 +221,7 @@ void MapDialog::OpenFile()
+ if (filePath.empty())
+ return;
+
+- AtlasMessage::qVFSFileExists qry(filePath.wc_str());
++ AtlasMessage::qVFSFileExists qry(filePath.ToStdWstring());
+ qry.Post();
+ if (!qry.exists)
+ return;
+@@ -236,7 +236,7 @@ void MapDialog::SaveFile()
+ return;
+
+ // TODO: this test would work better outside the VFS
+- AtlasMessage::qVFSFileExists qry(filePath.wc_str());
++ AtlasMessage::qVFSFileExists qry(filePath.ToStdWstring());
+ qry.Post();
+ if (qry.exists)
+ {
diff --git a/games/0ad/files/patch-source_tools_atlas_AtlasUI_ScenarioEditor_ScenarioEditor.cpp b/games/0ad/files/patch-source_tools_atlas_AtlasUI_ScenarioEditor_ScenarioEditor.cpp
new file mode 100644
index 000000000000..4b1b88917a8c
--- /dev/null
+++ b/games/0ad/files/patch-source_tools_atlas_AtlasUI_ScenarioEditor_ScenarioEditor.cpp
@@ -0,0 +1,56 @@
+--- source/tools/atlas/AtlasUI/ScenarioEditor/ScenarioEditor.cpp.orig 2018-03-13 20:20:45 UTC
++++ source/tools/atlas/AtlasUI/ScenarioEditor/ScenarioEditor.cpp
+@@ -723,7 +723,7 @@ bool ScenarioEditor::OpenFile(const wxString& name, co
+ wxBusyInfo busy(_("Loading ") + name);
+ wxBusyCursor busyc;
+
+- AtlasMessage::qVFSFileExists qry(filename.wc_str());
++ AtlasMessage::qVFSFileExists qry(filename.ToStdWstring());
+ qry.Post();
+ if (!qry.exists)
+ return false;
+@@ -733,7 +733,7 @@ bool ScenarioEditor::OpenFile(const wxString& name, co
+ m_ToolManager.SetCurrentTool(_T(""));
+ // TODO: clear the undo buffer, etc
+
+- std::wstring map(filename.wc_str());
++ std::wstring map(filename.ToStdWstring());
+ POST_MESSAGE(LoadMap, (map));
+
+ SetOpenFilename(name);
+@@ -786,7 +786,7 @@ void ScenarioEditor::OnImportHeightmap(wxCommandEvent&
+
+ OpenFile(_T(""), _T("maps/scenarios/_default.xml"));
+
+- std::wstring image(dlg.GetPath().wc_str());
++ std::wstring image(dlg.GetPath().ToStdWstring());
+ POST_MESSAGE(ImportHeightmap, (image));
+
+ // TODO: Make this a non-undoable command
+@@ -830,7 +830,7 @@ void ScenarioEditor::OnSave(wxCommandEvent& event)
+ // the preview units.)
+ m_ToolManager.SetCurrentTool(_T(""));
+
+- std::wstring map(m_OpenFilename.wc_str());
++ std::wstring map(m_OpenFilename.ToStdWstring());
+ POST_MESSAGE(SaveMap, (map));
+
+ // Wait for it to finish saving
+@@ -852,7 +852,7 @@ void ScenarioEditor::OnSaveAs(wxCommandEvent& WXUNUSED
+
+ m_ToolManager.SetCurrentTool(_T(""));
+
+- std::wstring map(filePath.wc_str());
++ std::wstring map(filePath.ToStdWstring());
+ POST_MESSAGE(SaveMap, (map));
+
+ SetOpenFilename(filePath);
+@@ -920,7 +920,7 @@ void ScenarioEditor::OnJavaScript(wxCommandEvent& WXUN
+ wxString cmd = ::wxGetTextFromUser(_T(""), _("JS command"), _T(""), this);
+ if (cmd.IsEmpty())
+ return;
+- POST_MESSAGE(JavaScript, ((std::wstring)cmd.wc_str()));
++ POST_MESSAGE(JavaScript, ((std::wstring)cmd.ToStdWstring()));
+ }
+
+ void ScenarioEditor::OnCameraReset(wxCommandEvent& WXUNUSED(event))
diff --git a/games/0ad/pkg-descr b/games/0ad/pkg-descr
new file mode 100644
index 000000000000..948039bd24f9
--- /dev/null
+++ b/games/0ad/pkg-descr
@@ -0,0 +1,16 @@
+0 A.D. (pronounced "zero ey-dee") is a free, open-source, cross-platform
+real-time strategy (RTS) game of ancient warfare. In short, it is
+a historically-based war/economy game that allows players to relive
+or rewrite the history of Western civilizations, focusing on the
+years between 500 B.C. and 500 A.D. The project is highly ambitious,
+involving state-of-the-art 3D graphics, detailed artwork, sound,
+and a flexible and powerful custom-built game engine.
+
+The game has been in development by Wildfire Games (WFG), a group
+of volunteer, hobbyist game developers, since 2001. The code and
+data are available under the GPL license, and the art, sound and
+documentation are available under CC-BY-SA. In short, we consider
+0 A.D. an educational celebration of game development and ancient
+history.
+
+WWW: https://play0ad.com/
diff --git a/games/0ad/pkg-plist b/games/0ad/pkg-plist
new file mode 100644
index 000000000000..75d3e4e5b2c5
--- /dev/null
+++ b/games/0ad/pkg-plist
@@ -0,0 +1,12 @@
+bin/pyrogenesis
+bin/0ad
+bin/ActorEditor
+lib/0ad/libAtlasUI.so
+lib/0ad/libCollada.so
+lib/0ad/libmozjs38-ps-release.so
+lib/0ad/libnvcore.so
+lib/0ad/libnvimage.so
+lib/0ad/libnvmath.so
+lib/0ad/libnvtt.so
+share/applications/0ad.desktop
+share/pixmaps/0ad.png