Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions FINISHED
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ net/py-netifaces2 ready to import (lcheylus)
devel/gh-gr ready to import (lcheylus)
devel/tokei ready to import (lcheylus)
devel/scc ready to import (lcheylus)
games/idtech4a-engine ready for import, sent to ports@ (tx00100xt)
games/runelite sent to ports@ 2023-02-09 (limero)
games/serioussam ready for import, sent to ports@ (tx00100xt)
games/recoil-rts ready for import, sent to ports@ (thfr)
78 changes: 78 additions & 0 deletions games/idtech4a-engine/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
ONLY_FOR_ARCHS= amd64 i386

COMMENT= idTEch4a Engine provided Doom3/Quake4/Prey source port

N= idtech4a-engine
V= 1.1.0harmattan65
P= com.n0n3m4.diii4a

DIST_TUPLE = github glKarin ${P} v${V} .
PKGNAME = ${N}-${V}

CATEGORIES= games

MAINTAINER= Alexander Pavlov <[email protected]>


# GPL-3 - Main Code, OpenAL Code from dhewm3
# GPL-3 - Doom3/Quake4/Prey SDK for Android idTech4A++
# BSD - msinttypes, TinyEXR, OpenEXR, vorbis, ogg
# BSD-1 - Mesa
# BSD-2 - Base64, binpack2d, SSAO, SSGI
# CC0-1.0 - Replacement Textures
# MIT - ImGui, stb, curl
# RSA - MD4
# ZLIB - Minizip, CRC32i irrxml, mikktspace
# public-domain - MD5, stb
# GPL-2 - timidity
# LGPL-2 - timidity
# Artistic - timidity
# FTL BSD-style - freetype
# Apache-2.0 - soil
PERMIT_PACKAGE= Yes

WRKDIST= ${WRKDIR}/${P}-${V}/Q3E/src/main/jni/doom3/neo

# Extra: ogg.6 vorbis.9 vorbisfile.6 (dlopen)
WANTLIB += ${COMPILER_LIBCXX} SDL2 c m pthread vorbis
WANTLIB += ${COMPILER_LIBCXX} openal z curl ogg vorbisfile

MODULES = devel/cmake

# c++17
COMPILER = base-clang ports-gcc
CFLAGS += -I${X11BASE}/include
CXXFLAGS += -I${X11BASE}/include

CONFIGURE_ARGS += -DUSE_SYSTEM_ZLIB=ON -DOPENAL=TRUE
CONFIGURE_ARGS += -DCMAKE_BUILD_TYPE=Release -DSDL2=ON
CONFIGURE_ARGS += -DUSE_SYSTEM_CURL=ON -DNO_ALSA=ON


BUILD_DEPENDS = devel/ninja \
audio/libogg \
audio/libvorbis \
audio/openal \
net/curl \
devel/sdl2

LIB_DEPENDS = audio/openal \
audio/libogg \
audio/libvorbis \
net/curl \
devel/sdl2

NO_TEST = Yes

post-install:
${INSTALL_PROGRAM} ${WRKDIR}/build-${MACHINE_ARCH}/Doom3 \
${PREFIX}/bin/idtech4a-doom3
${INSTALL_PROGRAM} ${WRKDIR}/build-${MACHINE_ARCH}/Quake4 \
${PREFIX}/bin/idtech4a-quake4
${INSTALL_PROGRAM} ${WRKDIR}/build-${MACHINE_ARCH}/Prey \
${PREFIX}/bin/idtech4a-prey
${INSTALL_DATA_DIR} ${PREFIX}/share/doc/${N}
${INSTALL_DATA} ${WRKDIR}/${P}-${V}/README.md \
${PREFIX}/share/doc/${N}

.include <bsd.port.mk>
2 changes: 2 additions & 0 deletions games/idtech4a-engine/distinfo
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SHA256 (glKarin-com.n0n3m4.diii4a-v1.1.0harmattan65.tar.gz) = KNX8GRwAR6R0ioe25dETT6nF9Lx5rOpfan62+u/9LyQ=
SIZE (glKarin-com.n0n3m4.diii4a-v1.1.0harmattan65.tar.gz) = 388197988
56 changes: 56 additions & 0 deletions games/idtech4a-engine/patches/patch-CMakeLists_txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
Index: CMakeLists.txt
--- CMakeLists.txt.orig
+++ CMakeLists.txt
@@ -366,9 +366,12 @@ find_package(ZLIB REQUIRED)
include_directories(${ZLIB_INCLUDE_DIRS})
endif()

+find_package(OpenAL REQUIRED)
+include_directories(${OPENAL_INCLUDE_DIR})
+
# OpenAL using internal OpenAL-soft
#[[find_package(OpenAL REQUIRED)
-include_directories(${OPENAL_INCLUDE_DIR})]]
+#include_directories(${OPENAL_INCLUDE_DIR})]]


if(WIN32)
@@ -615,7 +618,9 @@ elseif(ANDROID)
set(sys_libs ${sys_libs} z)
endif()
else() #TODO linux
- set(sys_libs ${sys_libs} dl pthread)
+ set(sys_libs ${sys_libs} pthread) # TODO OpenBSD fix link
+ set(OPENAL_SOUND_LIBRARY "OpenAL::OpenAL")
+ set(sys_libs ${sys_libs} ${OPENAL_SOUND_LIBRARY})
if(USE_X11)
set(LINUX_SDL FALSE)
message(STATUS "use X11 + EGL")
@@ -1615,8 +1620,8 @@ else()
)
set(src_sys_base
${src_sys_base}
- sys/linux/sound.cpp
- sys/linux/sound_alsa.cpp
+ #sys/linux/sound.cpp
+ #sys/linux/sound_alsa.cpp
sys/linux/sdlmain.cpp
)
set(src_sys_core
@@ -1628,7 +1633,7 @@ else()
sys/linux/main.cpp
sys/linux/input.cpp
sys/linux/sound.cpp
- sys/linux/sound_alsa.cpp
+ ##sys/linux/sound_alsa.cpp
)
set(src_sys_core
sys/linux/gles2.cpp
@@ -1813,6 +1818,7 @@ if(CORE)
idlib
${sys_libs}
${local_libs}
+ ${OPENAL_LIBRARY}
)

if(NOT APPLE AND NOT WIN32 AND NOT ANDROID)
228 changes: 228 additions & 0 deletions games/idtech4a-engine/patches/patch-SConstruct
Original file line number Diff line number Diff line change
@@ -0,0 +1,228 @@
Index: SConstruct
--- SConstruct.orig
+++ SConstruct
@@ -12,8 +12,8 @@ import scons_utils
conf_filename='site.conf'
# choose configuration variables which should be saved between runs
# ( we handle all those as strings )
-serialized=['CC', 'CXX', 'JOBS', 'BUILD', 'IDNET_HOST', 'DEDICATED',
- 'DEBUG_MEMORY', 'LIBC_MALLOC', 'ID_NOLANADDRESS', 'ID_MCHECK', 'ALSA',
+serialized=['CC', 'CXX', 'X86', 'JOBS', 'BUILD', 'IDNET_HOST', 'DEDICATED',
+ 'DEBUG_MEMORY', 'LIBC_MALLOC', 'ID_NOLANADDRESS', 'ID_MCHECK',
'TARGET_CORE', 'TARGET_GAME', 'TARGET_D3XP', 'TARGET_MONO', 'TARGET_DEMO', 'NOCURL',
'TARGET_CDOOM',
'TARGET_D3LE',
@@ -29,6 +29,13 @@ serialized=['CC', 'CXX', 'JOBS', 'BUILD', 'IDNET_HOST'
'MULTITHREAD', 'OPENSLES'
]

+
+# global build mode ------------------------------
+
+g_sdk = not os.path.exists( 'sys/scons/SConscript.core' )
+
+# ------------------------------------------------
+
# help -------------------------------------------

help_string = """
@@ -102,12 +109,18 @@ BUILD_GAMEPAK (default 0)
BASEFLAGS (default '')
Add compile flags

-NOCONF (default 0, not saved)
- ignore site configuration and use defaults + command line only
+X86 (default 0)
+ cross compile for x86 (only applicable on x86_64)

SILENT ( default 0, saved )
hide the compiler output, unless error

+NOCONF (default 0, not saved)
+ ignore site configuration and use defaults + command line only
+"""
+
+if ( not g_sdk ):
+ help_string += """
DEDICATED (default 0)
Control regular / dedicated type of build:
0 - client
@@ -155,9 +168,12 @@ ID_MCHECK (default 2)
note that Doom has it's own block allocator/checking
this should not be considered a replacement, but an additional tool

-ALSA (default 1)
- enable ALSA sound backend support
-
+SETUP (default 0, not saved)
+ build a setup. implies release build
+
+SDK (default 0, not saved)
+ build an SDK release
+
NOCURL (default 0)
set to 1 to disable usage of libcurl and http/ftp downloads feature
"""
@@ -175,18 +191,27 @@ EnsureSConsVersion( 0, 96 )
# system detection -------------------------------

# CPU type
-cpu = commands.getoutput('uname -m')
-exp = re.compile('i?86')
-if exp.match(cpu):
- cpu = 'x86'
-else:
- if (commands.getoutput('uname -p') == 'powerpc'):
- cpu = 'ppc'
-g_os = 'Linux'
+g_cpu = ''

-if ARGUMENTS.has_key( 'ARCH' ):
- cpu = ARGUMENTS['ARCH']
+uname = commands.getoutput('uname -m')
+if uname == 'x86_64':
+ g_cpu = 'x86_64'

+if len(g_cpu) < 1:
+ exp = re.compile('.*i?86.*')
+ if exp.match(uname):
+ g_cpu = 'x86'
+
+if len(g_cpu) < 1:
+ uname = commands.getoutput('uname -p')
+ if (uname == 'powerpc'):
+ g_cpu = 'ppc'
+
+if len(g_cpu) < 1:
+ g_cpu = 'cpu'
+
+g_os = commands.getoutput('uname -s')
+
# end system detection ---------------------------

# default settings -------------------------------
@@ -195,6 +220,7 @@ CC = 'gcc'
CXX = 'g++'
JOBS = '16'
BUILD = 'debug'
+X86 = '0'
DEDICATED = '0'
TARGET_CORE = '1'
TARGET_GAME = '1'
@@ -218,7 +244,8 @@ LIBC_MALLOC = '1'
ID_NOLANADDRESS = '0'
ID_MCHECK = '2'
BUILD_ROOT = 'build'
-ALSA = '1'
+SETUP = '0'
+SDK = '0'
NOCONF = '0'
NOCURL = '0'
BUILD_GAMEPAK = '0'
@@ -271,6 +298,21 @@ if ( not ARGUMENTS.has_key( 'NOCONF' ) or ARGUMENTS['N

# end save site configuration ------------------

+# configuration rules --------------------------
+
+if ( SETUP != '0' ):
+ DEDICATED = '2'
+ BUILD = 'release'
+
+if ( g_sdk or SDK != '0' ):
+ TARGET_CORE = '0'
+ TARGET_GAME = '1'
+ TARGET_D3XP = '1'
+ TARGET_MONO = '0'
+ TARGET_DEMO = '0'
+
+# end configuration rules ----------------------
+
# general configuration, target selection --------

g_build = BUILD_ROOT + '/' + BUILD
@@ -297,15 +339,31 @@ CORECPPPATH = [ ]
CORELIBPATH = [ ]
CORECPPFLAGS = [ ]
GAMECPPFLAGS = [ ]
-BASELINKFLAGS = [ '-Wl,--no-undefined' ]
-CORELINKFLAGS = [ '-Wl,--no-undefined' ]
-#//k BASELINKFLAGS = [ '-Wl,--no-undefined', '-static-libstdc++' ]
-#//k CORELINKFLAGS = [ '-Wl,--no-undefined', '-static-libstdc++' ]
+BASELINKFLAGS = [ ]
+CORELINKFLAGS = [ ]

# for release build, further optimisations that may not work on all files
OPTCPPFLAGS = [ ]

-BASECPPFLAGS.append( BASEFLAGS.split() )
+if (g_cpu == 'x86_64' and X86 == '1'):
+ print('cross compiling for x86')
+ g_cpu = 'x86'
+ BASECPPFLAGS.append('-m32')
+ BASELINKFLAGS.append('-m32')
+
+g_build = '%s/%s-%s' % (BUILD_ROOT, g_cpu, BUILD)
+
+SConsignFile( g_build + '/scons.signatures' )
+
+if ( DEBUG_MEMORY != '0' ):
+ g_build += '-debugmem'
+
+if ( LIBC_MALLOC != '1' ):
+ g_build += '-nolibcmalloc'
+
+LINK = CXX
+
+BASECPPFLAGS.extend( BASEFLAGS.split(' ') )
BASECPPFLAGS.append( '-pipe' )
# warn all
BASECPPFLAGS.append( '-Wall' ) # -w
@@ -328,6 +386,13 @@ if ( g_os == 'Linux' ):
#BASECPPFLAGS.append('-D__arm__')
# //k

+if ( "BSD" in g_os ):
+ BASECPPFLAGS.append( '-I/usr/local/include' )
+ BASELINKFLAGS.append('-L/usr/local/lib')
+
+if ( g_sdk or SDK != '0' ):
+ BASECPPFLAGS.append( '-D_D3SDK' )
+
if ( TARGET_ANDROID == '1' ):
BASECPPFLAGS.append( '-D__ANDROID__')
g_os = 'Android'
@@ -353,6 +418,10 @@ elif ( BUILD == 'release' ):
OPTCPPFLAGS = [ '-O3', '-Wl,--no-undefined', '-ffast-math', '-fno-unsafe-math-optimizations', '-fomit-frame-pointer' ]
else:
OPTCPPFLAGS = [ '-O3', '-march=native', '-ffast-math', '-fno-unsafe-math-optimizations', '-fomit-frame-pointer' ]
+
+ if (g_cpu == 'x86'):
+ OPTCPPFLAGS.append('-march=pentium3')
+
if ( ID_MCHECK == '0' ):
ID_MCHECK = '2'
else:
@@ -373,7 +442,12 @@ if ( ID_NOLANADDRESS != '0' ):

if ( ID_MCHECK == '1' ):
BASECPPFLAGS.append( '-DID_MCHECK' )
-
+
+# TODO fix these warnings
+BASECPPFLAGS.append('-Wno-sign-compare')
+BASECPPFLAGS.append('-Wno-switch')
+BASECPPFLAGS.append('-Wno-format-security')
+
# create the build environements
g_base_env = Environment( ENV = os.environ, CC = CC, CXX = CXX, LINK = LINK, CPPFLAGS = BASECPPFLAGS, LINKFLAGS = BASELINKFLAGS, CPPPATH = CORECPPPATH, LIBPATH = CORELIBPATH, NDK = NDK, MULTITHREAD = MULTITHREAD, OPENSLES = OPENSLES )
scons_utils.SetupUtils( g_base_env )
@@ -430,7 +504,7 @@ local_humanhead = 0
# OpenGL
local_opengl = 0

-GLOBALS = 'g_env g_env_noopt g_game_env g_os ID_MCHECK ALSA idlib_objects game_objects local_dedicated local_gamedll local_demo local_idlibpic local_curl local_d3xp local_cdoom local_d3le local_rivensin local_hardcorps local_quake4 local_raven local_prey local_humanhead local_opengl OPTCPPFLAGS NDK MULTITHREAD OPENSLES'
+GLOBALS = 'g_env g_env_noopt g_game_env g_os g_cpu g_build ID_MCHECK idlib_objects game_objects local_dedicated local_gamedll local_demo local_idlibpic local_curl local_d3xp local_cdoom local_d3le local_rivensin local_hardcorps local_quake4 local_raven local_prey local_humanhead local_opengl OPTCPPFLAGS NDK MULTITHREAD OPENSLES'

# end general configuration ----------------------

12 changes: 12 additions & 0 deletions games/idtech4a-engine/patches/patch-externlibs_miniz_miniz_c
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Index: externlibs/miniz/miniz.c
--- externlibs/miniz/miniz.c.orig
+++ externlibs/miniz/miniz.c
@@ -3171,7 +3171,7 @@ static int mz_stat64(const char *path, struct __stat64
#define MZ_FREOPEN(p, m, s) freopen64(p, m, s)
#define MZ_DELETE_FILE remove

-#elif defined(__APPLE__) || defined(__FreeBSD__)
+#elif defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__)
#ifndef MINIZ_NO_TIME
#include <utime.h>
#endif
Loading