Index: games/Makefile =================================================================== --- games/Makefile +++ games/Makefile @@ -670,6 +670,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,104 @@ +# $FreeBSD$ + +PORTNAME= openbor +PORTVERSION= 3.0.r${SVN_REV} +CATEGORIES= games +MASTER_SITES= LOCAL/jbeich + +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 tar:xz +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/icons/hicolor/128x128/apps/${PORTNAME}.png + +DESKTOP_ENTRIES="OpenBOR" \ + "" \ + "${PORTNAME}" \ + "${PORTNAME}" \ + "Game;ArcadeGame;" \ + "" + +OPTIONS_DEFINE= SDL2 +OPTIONS_DEFAULT=SDL2 + +SDL2_DESC= ${SDL_DESC} version 2 +SDL2_CFLAGS= -DSDL2=1 +SDL2_USE= SDL=gfx2 +SDL2_USE_OFF= SDL=gfx + +.include + +.if ${ARCH} == i386 +BUILD_DEPENDS+= yasm:${PORTSDIR}/devel/yasm +.endif + +# Modified from devel/llvm-devel +.if !defined(SVN_REV) +.if defined(BOOTSTRAP) +LANG= "C" +SVN_URL= https://svn.code.sf.net/p/openbor/engine/engine/ +SVN_REV!= svn info ${SVN_URL} | ${SED} -n 's/^Last Changed Rev: //p' +.else +.include "Makefile.svn_rev" +.endif +.endif + +.if defined(BOOTSTRAP) || defined(SVN_FETCH) +FETCH_DEPENDS+= svn:${PORTSDIR}/devel/subversion + +do-fetch: + ${MKDIR} ${WRKDIR} + svn export -r${SVN_REV} ${SVN_URL} ${WRKSRC} + (cd ${WRKDIR} && ${TAR} cJvf ${DISTDIR}/${DISTNAME}.tar.xz ${DISTNAME}) + ${ECHO_CMD} "SVN_REV= ${SVN_REV}" >${MASTERDIR}/Makefile.svn_rev +.if ${USER} == jbeich || ${USER} == holo + scp ${DISTDIR}/${DISTNAME}.tar.xz \ + jbeich@freefall.freebsd.org:public_distfiles/ +.endif +.endif + +post-patch: +.if ${PORT_OPTIONS:MSDL2} + @${REINPLACE_CMD} -i.sdl2 -e 's,include/SDL,&2,' \ + -e 's,-lSDL,&2,g' \ + ${WRKSRC}/Makefile +.endif + @${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} + ${MKDIR} ${STAGEDIR}${PREFIX}/share/icons/hicolor/128x128/apps + ${INSTALL_DATA} ${WRKSRC}/resources/OpenBOR_Icon_128x128.png \ + ${STAGEDIR}${PREFIX}/share/icons/hicolor/128x128/apps/${PORTNAME}.png + +.include Index: games/openbor/Makefile.svn_rev =================================================================== --- /dev/null +++ games/openbor/Makefile.svn_rev @@ -0,0 +1 @@ +SVN_REV= 4107 Index: games/openbor/distinfo =================================================================== --- /dev/null +++ games/openbor/distinfo @@ -0,0 +1,2 @@ +SHA256 (openbor-3.0.r4107.tar.xz) = 00500c7d42f4fe6a53b265d3b83b3353f4d6fc52d731bd6160f9731fe3763b21 +SIZE (openbor-3.0.r4107.tar.xz) = 3431756 Index: games/openbor/files/patch-sdl__sdlport.c =================================================================== --- /dev/null +++ games/openbor/files/patch-sdl__sdlport.c @@ -0,0 +1,30 @@ +--- sdl/sdlport.c~ ++++ 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~ ++++ 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); + #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