Index: games/Makefile =================================================================== --- games/Makefile +++ games/Makefile @@ -673,6 +673,7 @@ SUBDIR += openarena-oax SUBDIR += openarena-server SUBDIR += openastromenace + SUBDIR += openbor SUBDIR += openbubbles SUBDIR += opencity SUBDIR += openclonk Index: games/openbor/Makefile =================================================================== --- /dev/null +++ games/openbor/Makefile @@ -0,0 +1,97 @@ +# $FreeBSD$ + +PORTNAME= openbor +PORTVERSION= 3.0.r4125 +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 + +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 + +DESKTOP_ENTRIES="OpenBOR" \ + "" \ + "${PORTNAME}" \ + "${PORTNAME}" \ + "Game;ArcadeGame;" \ + "" + +.include + +.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/-fno-ident//' \ + -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 + +.include Index: games/openbor/distinfo =================================================================== --- /dev/null +++ games/openbor/distinfo @@ -0,0 +1,2 @@ +SHA256 (openbor-3.0.r4125.tar.xz) = 0c561156ac2839505fb4aaf1d2e5dfefc31221f615c7249fea385a0e1181b416 +SIZE (openbor-3.0.r4125.tar.xz) = 3432380 Index: games/openbor/files/patch-sdl__sdlport.c =================================================================== --- /dev/null +++ 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 ++#include ++#include ++#include ++ + #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); Index: games/openbor/files/patch-source__ramlib__ram.c =================================================================== --- /dev/null +++ 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 + #include + #include ++#elif defined(__DragonFly__) || defined(__FreeBSD__) || \ ++ defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) ++#include ++#include ++#include ++# if defined(__DragonFly__) ++#include // struct kinfo_proc ++#include // struct vmstats ++# elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) ++#include // struct kinfo_proc ++# elif defined(__NetBSD__) ++#include // struct uvmexp_sysctl ++# elif defined(__OpenBSD__) ++#include // struct uvmexp ++# endif + #elif LINUX + #include + #include +@@ -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"); Index: games/openbor/pkg-descr =================================================================== --- /dev/null +++ games/openbor/pkg-descr @@ -0,0 +1,17 @@ +OpenBOR is a continuation of the Beats Of Rage 2D game engine, which +was originally created by Senile Team. + +History +---------------------- +In 2004, Senile Team released Beats of Rage, a free beat-'em-up for +DOS inspired by SEGA's Streets of Rage series and using sprites from +SNK Playmore's King of Fighters series. The game spread only by word +of mouth, but it nonetheless amassed popularity very quickly. Senile +Team soon released an edit pack allowing anyone interested to create a +mod for the BOR engine. + +In 2005, Kirby2000 asked Senile Team to open the source code to BOR. +They agreed, and OpenBOR was born. Development on the engine was +continued by the community, and still is to this day. + +WWW: http://www.chronocrash.com/