diff options
author | jbeich <jbeich@FreeBSD.org> | 2015-04-13 21:43:47 +0800 |
---|---|---|
committer | jbeich <jbeich@FreeBSD.org> | 2015-04-13 21:43:47 +0800 |
commit | 71a925ba2bacb19351c0fa74a4f436e281c4081f (patch) | |
tree | e618d942153e403d1fe48f044e4092407288371c | |
parent | b9f786eb28734b248dab4da7bdf5938edc0237ef (diff) | |
download | freebsd-ports-gnome-71a925ba2bacb19351c0fa74a4f436e281c4081f.tar.gz freebsd-ports-gnome-71a925ba2bacb19351c0fa74a4f436e281c4081f.tar.zst freebsd-ports-gnome-71a925ba2bacb19351c0fa74a4f436e281c4081f.zip |
Add new port games/openbor
PR: 196657
Reviewed by: games (danfe, partial of earlier version)
Approved by: bapt (mentor, earlier version)
OpenBOR is a continuation of the Beats Of Rage 2D game engine, which
was originally created by Senile Team.
WWW: http://www.chronocrash.com
-rw-r--r-- | games/Makefile | 1 | ||||
-rw-r--r-- | games/openbor/Makefile | 100 | ||||
-rw-r--r-- | games/openbor/distinfo | 2 | ||||
-rw-r--r-- | games/openbor/files/patch-sdl__sdlport.c | 30 | ||||
-rw-r--r-- | games/openbor/files/patch-source__ramlib__ram.c | 200 | ||||
-rw-r--r-- | games/openbor/pkg-descr | 4 |
6 files changed, 337 insertions, 0 deletions
diff --git a/games/Makefile b/games/Makefile index 21d10e910ee2..67ffb9dc9bd4 100644 --- a/games/Makefile +++ b/games/Makefile @@ -672,6 +672,7 @@ SUBDIR += openarena-oax SUBDIR += openarena-server SUBDIR += openastromenace + SUBDIR += openbor SUBDIR += openbubbles SUBDIR += opencity SUBDIR += openclonk diff --git a/games/openbor/Makefile b/games/openbor/Makefile new file mode 100644 index 000000000000..88624ee06456 --- /dev/null +++ b/games/openbor/Makefile @@ -0,0 +1,100 @@ +# $FreeBSD$ + +PORTNAME= openbor +PORTVERSION= 3.0.r4138 +CATEGORIES= games +MASTER_SITES= LOCAL/jbeich \ + https://svn.code.sf.net/p/${PORTNAME}/engine/engine/:svn + +MAINTAINER= jbeich@FreeBSD.org +COMMENT= Moddable fighting game engine (aka Beats of Rage) + +LICENSE= BSD3CLAUSE + +LIB_DEPENDS= libvorbisfile.so:${PORTSDIR}/audio/libvorbis \ + libpng.so:${PORTSDIR}/graphics/png \ + libvpx.so:${PORTSDIR}/multimedia/libvpx + +USES= dos2unix gmake pkgconfig tar:xz +USE_SDL= gfx2 +DOS2UNIX_FILES= Makefile +MAKE_ENV= BUILD_LINUX=1 SDKPATH="${LOCALBASE}" \ + GCC_TARGET="${CONFIGURE_TARGET:S/amd64/x86_64/}" +MAKE_ARGS= CC="${CC}" LIBRARIES="${LOCALBASE}/lib" \ + TARGET_ARCH=${ARCH:S/i386/x86/} ARCHFLAGS="" \ + TARGET_FINAL='$(TARGET)' +LDFLAGS+= -Wl,--as-needed +PLIST_FILES= bin/${PORTNAME} \ + share/pixmaps/${PORTNAME}.png +PORTDOCS= README + +DESKTOP_ENTRIES="OpenBOR" \ + "" \ + "${PORTNAME}" \ + "${PORTNAME}" \ + "Game;ArcadeGame;" \ + "" + +.include <bsd.port.options.mk> + +.if ${ARCH} == i386 +BUILD_DEPENDS+= yasm:${PORTSDIR}/devel/yasm +.endif + +# +# To update snapshot: make makesum BOOTSTRAP= +# Specific snapshot: make makesum SVN_FETCH= PORTVERSION=1.0.r1234 +# +.if defined(BOOTSTRAP) +# XXX _MASTER_SITES_svn isn't defined yet +SVN_REV!= ${SETENV} LC_ALL=C svn info \ + ${MASTER_SITES:M*\:svn:S/:svn//} | \ + ${SED} -n 's/^Last Changed Rev: //p' +PORTVERSION:= ${PORTVERSION:R}.r${SVN_REV} +.else +SVN_REV?= ${PORTVERSION:E:S/r//} +.endif + +.if defined(BOOTSTRAP) || defined(SVN_FETCH) +FETCH_DEPENDS+= svn:${PORTSDIR}/devel/subversion + +do-fetch: + ${MKDIR} ${WRKDIR} + svn export -r${SVN_REV} ${_MASTER_SITES_svn} ${WRKSRC} + (cd ${WRKDIR} && ${TAR} cJvf \ + ${_DISTDIR}/${DISTNAME}${EXTRACT_SUFX} ${DISTNAME}) + ${REINPLACE_CMD} -i '' '/^PORTVERSION=/s/r.*/r${SVN_REV}/' \ + ${MASTERDIR}/Makefile +. if ${USER} == ${MAINTAINER:C/@.*//} + -scp ${_DISTDIR}/${DISTNAME}${EXTRACT_SUFX} \ + freefall.freebsd.org:public_distfiles/ +. endif +.endif + +post-patch: + @${REINPLACE_CMD} -e 's/ -O[0-9]//; s/ -g//; s/ -Werror//' \ + -e 's/ -fomit-frame-pointer//' \ + -e 's/ -freorder-blocks//' \ + -e 's/ -Wno-unused-result//' \ + -e 's/ -Wl,-rpath,$$(LIBRARIES)//' \ + -e '/echo/!s/ @/ /' \ + -e 's/$$(LIBS)/$$(LDFLAGS) &/' \ + ${WRKSRC}/Makefile + @${GREP} -Flr 'malloc.h' ${WRKSRC} | ${XARGS} ${REINPLACE_CMD} \ + 's,malloc\.h,stdlib.h,' + @${REINPLACE_CMD} -e 's/^function \(.*\) {/\1() {/' \ + -e 's/^get_revnum/VERSION_BUILD=${SVN_REV}/' \ + ${WRKSRC}/version.sh + +do-configure: + (cd ${WRKSRC} && ${SH} ./version.sh) + +do-install: + ${INSTALL_PROGRAM} ${WRKSRC}/OpenBOR.elf \ + ${STAGEDIR}${PREFIX}/bin/${PORTNAME} + ${INSTALL_DATA} ${WRKSRC}/resources/OpenBOR_Icon_128x128.png \ + ${STAGEDIR}${PREFIX}/share/pixmaps/${PORTNAME}.png + (cd ${WRKSRC} && ${COPYTREE_SHARE} \ + "${PORTDOCS}" ${STAGEDIR}${DOCSDIR}) + +.include <bsd.port.mk> diff --git a/games/openbor/distinfo b/games/openbor/distinfo new file mode 100644 index 000000000000..5a8f4d442990 --- /dev/null +++ b/games/openbor/distinfo @@ -0,0 +1,2 @@ +SHA256 (openbor-3.0.r4138.tar.xz) = e99b4c0b6f1bd3eee8332f1a078ebb1d05b08ac5e9b504cde24ef532bb1307a3 +SIZE (openbor-3.0.r4138.tar.xz) = 3451504 diff --git a/games/openbor/files/patch-sdl__sdlport.c b/games/openbor/files/patch-sdl__sdlport.c new file mode 100644 index 000000000000..b092c843e344 --- /dev/null +++ b/games/openbor/files/patch-sdl__sdlport.c @@ -0,0 +1,30 @@ +--- sdl/sdlport.c.orig 2013-12-29 14:05:10 UTC ++++ sdl/sdlport.c +@@ -6,6 +6,11 @@ + * Copyright (c) 2004 - 2014 OpenBOR Team + */ + ++#include <errno.h> ++#include <unistd.h> ++#include <err.h> ++#include <sys/stat.h> ++ + #include "sdlport.h" + #include "packfile.h" + #include "ram.h" +@@ -92,6 +97,15 @@ int main(int argc, char *argv[]) + #ifdef ANDROID + dirExists(rootDir, 1); + chdir(rootDir); ++#else ++ { ++ if (chdir(getenv("HOME")) != 0) ++ err(1, "cannot cd to $HOME"); ++ if (mkdir(".openbor", 0755) != 0 && errno != EEXIST) ++ err(1, "cannot mkdir $HOME/.openbor"); ++ if (chdir(".openbor") != 0) ++ err(1, "cannot cd to $HOME/.openbor"); ++ } + #endif + dirExists(paksDir, 1); + dirExists(savesDir, 1); diff --git a/games/openbor/files/patch-source__ramlib__ram.c b/games/openbor/files/patch-source__ramlib__ram.c new file mode 100644 index 000000000000..9774e734dcbc --- /dev/null +++ b/games/openbor/files/patch-source__ramlib__ram.c @@ -0,0 +1,200 @@ +--- source/ramlib/ram.c.orig 2013-12-29 14:05:10 UTC ++++ source/ramlib/ram.c +@@ -27,6 +27,21 @@ + #include <mach/task.h> + #include <mach/mach.h> + #include <mach/mach_init.h> ++#elif defined(__DragonFly__) || defined(__FreeBSD__) || \ ++ defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) ++#include <sys/types.h> ++#include <sys/sysctl.h> ++#include <unistd.h> ++# if defined(__DragonFly__) ++#include <sys/kinfo.h> // struct kinfo_proc ++#include <sys/vmmeter.h> // struct vmstats ++# elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) ++#include <sys/user.h> // struct kinfo_proc ++# elif defined(__NetBSD__) ++#include <uvm/uvm_extern.h> // struct uvmexp_sysctl ++# elif defined(__OpenBSD__) ++#include <uvm/uvmexp.h> // struct uvmexp ++# endif + #elif LINUX + #include <sys/sysinfo.h> + #include <unistd.h> +@@ -50,6 +65,8 @@ + + static u64 systemRam = 0x00000000; + ++#if !defined(__DragonFly__) && !defined(__FreeBSD__) && \ ++ !defined(__FreeBSD_kernel__) && !defined(__NetBSD__) && !defined(__OpenBSD__) + #ifndef DARWIN + #ifndef WIN + #ifndef XBOX +@@ -60,10 +77,13 @@ static unsigned long stackSize = 0x00000 + #endif + #endif + #endif ++#endif + + ///////////////////////////////////////////////////////////////////////////// + // Symbols + ++#if !defined(__DragonFly__) && !defined(__FreeBSD__) && \ ++ !defined(__FreeBSD_kernel__) && !defined(__NetBSD__) && !defined(__OpenBSD__) + #ifndef DARWIN + #ifndef WIN + #ifndef XBOX +@@ -81,6 +101,7 @@ extern unsigned long start; + #endif + #endif + #endif ++#endif + + ///////////////////////////////////////////////////////////////////////////// + // Functions +@@ -107,6 +128,49 @@ u64 getFreeRam(int byte_size) + return 0; + } + return (u64)(((vms.inactive_count + vms.free_count) * size) / byte_size); ++#elif defined(__DragonFly__) ++ struct vmstats vms; ++ size_t sz = sizeof(vms); ++ if (sysctlbyname("vm.vmstats", &vms, &sz, NULL, 0)) ++ { ++ return 0; ++ } ++ return (u64)((vms.v_free_count + vms.v_inactive_count ++ + vms.v_cache_count) * getpagesize()) / byte_size; ++#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) ++ u_int v_free_count, v_inactive_count, v_cache_count; ++ size_t sz = sizeof(u_int); ++ v_free_count = v_inactive_count = v_cache_count = 0; ++ sysctlbyname("vm.stats.vm.v_free_count", ++ &v_free_count, &sz, NULL, 0); ++ sysctlbyname("vm.stats.vm.v_inactive_count", ++ &v_inactive_count, &sz, NULL, 0); ++ sysctlbyname("vm.stats.vm.v_cache_count", ++ &v_cache_count, &sz, NULL, 0); ++ return (u64)((v_free_count + v_inactive_count + v_cache_count) ++ * getpagesize()) / byte_size; ++#elif defined(__NetBSD__) || defined(__OpenBSD__) ++# if defined(__NetBSD__) ++#undef VM_UVMEXP ++#define VM_UVMEXP VM_UVMEXP2 ++#define uvmexp uvmexp_sysctl ++# else ++#define filepages vnodepages ++#define execpages vtextpages ++# endif ++ int mib[] = { ++ CTL_VM, ++ VM_UVMEXP, ++ }; ++ u_int miblen = sizeof(mib) / sizeof(mib[0]); ++ struct uvmexp uvmexp; ++ size_t sz = sizeof(uvmexp); ++ if (sysctl(mib, miblen, &uvmexp, &sz, NULL, 0)) ++ { ++ return 0; ++ } ++ return (u64)((uvmexp.free + uvmexp.inactive + uvmexp.filepages ++ + uvmexp.execpages) * uvmexp.pagesize) / byte_size; + #elif LINUX + struct sysinfo info; + sysinfo(&info); +@@ -147,11 +211,29 @@ void setSystemRam() + stat.dwLength = sizeof(MEMORYSTATUS); + GlobalMemoryStatus(&stat); + systemRam = stat.dwTotalPhys; +-#elif DARWIN +- u64 mem; +- size_t len = sizeof(mem); +- sysctlbyname("hw.memsize", &mem, &len, NULL, 0); +- systemRam = mem; ++#elif defined(DARWIN) || defined(__DragonFly__) || defined(__FreeBSD__) || \ ++ defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) ++# if defined(HW_MEMSIZE) || defined(HW_PHYSMEM64) ++ uint64_t physmem; ++# else ++ u_long physmem; ++# endif ++ int mib[] = { ++ CTL_HW, ++# if defined(HW_MEMSIZE) ++ HW_MEMSIZE, ++# elif defined(HW_PHYSMEM64) ++ HW_PHYSMEM64, ++# else ++ HW_PHYSMEM, ++# endif ++ }; ++ size_t sz = sizeof(physmem); ++ if (sysctl(mib, 2, &physmem, &sz, NULL, 0)) ++ { ++ physmem = 0; ++ } ++ systemRam = physmem; + #elif LINUX + struct sysinfo info; + sysinfo(&info); +@@ -194,6 +276,8 @@ void setSystemRam() + stackSize = 0x00000000; + systemRam = getFreeRam(BYTES); + #endif ++#if !defined(__DragonFly__) && !defined(__FreeBSD__) && \ ++ !defined(__FreeBSD_kernel__) && !defined(__NetBSD__) && !defined(__OpenBSD__) + #ifndef DARWIN + #ifndef WIN + #ifndef XBOX +@@ -205,6 +289,7 @@ void setSystemRam() + #endif + #endif + #endif ++#endif + getRamStatus(BYTES); + } + +@@ -234,6 +319,42 @@ u64 getUsedRam(int byte_size) + return 0; + } + return info.resident_size / byte_size; ++#elif defined(__DragonFly__) || defined(__FreeBSD__) || \ ++ defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) ++# if defined(__NetBSD__) ++#undef KERN_PROC ++#define KERN_PROC KERN_PROC2 ++#define KINFO_PROC struct kinfo_proc2 ++# else ++#define KINFO_PROC struct kinfo_proc ++# endif ++# if defined(__DragonFly__) ++#define KP_RSS(kp) (kp.kp_vm_rssize * getpagesize()) ++# elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) ++#define KP_RSS(kp) (kp.ki_rssize * getpagesize()) ++# elif defined(__NetBSD__) ++#define KP_RSS(kp) (kp.p_vm_rssize * getpagesize()) ++# elif defined(__OpenBSD__) ++#define KP_RSS(kp) (kp.p_vm_rssize * getpagesize()) ++# endif ++ int mib[] = { ++ CTL_KERN, ++ KERN_PROC, ++ KERN_PROC_PID, ++ getpid(), ++# if defined(__NetBSD__) || defined(__OpenBSD__) ++ sizeof(KINFO_PROC), ++ 1, ++# endif ++ }; ++ u_int miblen = sizeof(mib) / sizeof(mib[0]); ++ KINFO_PROC kp; ++ size_t sz = sizeof(KINFO_PROC); ++ if (sysctl(mib, miblen, &kp, &sz, NULL, 0)) ++ { ++ return 0; ++ } ++ return (u64)KP_RSS(kp) / byte_size; + #elif LINUX + unsigned long vm = 0; + FILE *file = fopen("/proc/self/statm", "r"); diff --git a/games/openbor/pkg-descr b/games/openbor/pkg-descr new file mode 100644 index 000000000000..89a4fc698168 --- /dev/null +++ b/games/openbor/pkg-descr @@ -0,0 +1,4 @@ +OpenBOR is a continuation of the Beats Of Rage 2D game engine, which +was originally created by Senile Team. + +WWW: http://www.chronocrash.com/ |