Skip to content

Commit

Permalink
games/gemrb: fix crash and improve port
Browse files Browse the repository at this point in the history
- use GCC (gemrb/gemrb#1786)
- add optional OpenGL and SDL2_mixer support
- add disabled pixelscaling to screensize option
- change GemRB.cfg into a proper conffile
  (remove from pkg-plist and annotate GemRB.cfg.sample with @sample)
- fix and modernize pkg-message
- use distfiles form GitHub instead of SourceForge
- make PNG, OGG, TTF and OpenAL support optional
- make optional demo assets also optional in the port
- use compiler:c++11-lang
- remove gnome and localbase uses
- remove DOC_DIR and MAN_DIR from CMAKE_ARGS
- set CMake options explicitly
- use CMake options helpers for boolean options
- organize options into AUDIO, RESOURCE and VIDEO groups

git rm games/gemrb/files/patch-gemrb_plugins_TTFImporter_CMakeLists.txt
git add games/gemrb/files/extra-patch-gemrb_plugins_TTFImporter_CMakeLists.txt
  • Loading branch information
bsdcode authored and pkubaj committed Feb 20, 2024
1 parent 42060ba commit cfbb908
Show file tree
Hide file tree
Showing 5 changed files with 100 additions and 39 deletions.
91 changes: 70 additions & 21 deletions games/gemrb/Makefile
@@ -1,8 +1,8 @@
PORTNAME= gemrb
PORTVERSION= 0.9.2
CATEGORIES= games emulators
MASTER_SITES= SF/${PORTNAME}/Releases/${PORTVERSION}
DISTNAME= ${PORTNAME}-${PORTVERSION}-sources
PORTNAME= gemrb
DISTVERSIONPREFIX= v
DISTVERSION= 0.9.2
PORTREVISION= 1
CATEGORIES= games emulators

MAINTAINER= pkubaj@FreeBSD.org
COMMENT= GemRB (Game engine made with preRendered Background)
Expand All @@ -11,27 +11,76 @@ WWW= https://www.gemrb.org/
LICENSE= GPLv2+
LICENSE_FILE= ${WRKSRC}/COPYING

LIB_DEPENDS= libpng.so:graphics/png \
libvorbis.so:audio/libvorbis \
libfreetype.so:print/freetype2

USES= cmake compiler:c11 gnome iconv localbase openal:al,alut \
python sdl shebangfix
USES= cmake compiler:c++11-lang iconv python sdl shebangfix
SHEBANG_FILES= admin/extend2da.py
USE_SDL= sdl2
USE_GCC= yes # https://github.com/gemrb/gemrb/issues/1786
USE_GITHUB= yes
USE_LDCONFIG= yes
USE_SDL= sdl2

CMAKE_ARGS= -DCMAKE_BUILD_TYPE=Release \
-DHAVE_LDEXPF=1 \
-DLAYOUT=fhs \
-DPYTHON_VERSION=Auto \
-DSANITIZE=None \
-DSDL_BACKEND=SDL2
CMAKE_OFF= DISABLE_WERROR \
INSOURCEBUILD \
STATIC_LINK \
USE_LIBVLC \
USE_SDL_CONTROLLER_API

SUB_FILES= pkg-message

OPTIONS_DEFINE= DOCS
OPTIONS_DEFAULT= DEMO FREETYPE OPENAL OPENGL PNG SDLMIXER VORBIS

OPTIONS_GROUP= AUDIO RESOURCE VIDEO
OPTIONS_GROUP_AUDIO= OPENAL SDLMIXER
OPTIONS_GROUP_RESOURCE= DEMO FREETYPE PNG VORBIS
OPTIONS_GROUP_VIDEO= OPENGL RESIND

OPTIONS_SUB= yes

OPTIONS_DEFINE= DOCS
OPTIONS_SUB= yes
DEMO_DESC= Optional demo assets
DEMO_GH_ACCOUNT= gemrb:demo
DEMO_GH_PROJECT= gemrb-assets:demo
DEMO_GH_TAGNAME= 5b5dcde:demo

CMAKE_ARGS= -DDOC_DIR="${DOCSDIR}" \
-DMAN_DIR="${PREFIX}/share/man/man6/" \
-DSDL_BACKEND=SDL2 \
-DUSE_OPENAL=ON \
-DUSE_LIBVLC=OFF \
-DHAVE_LDEXPF=1
FREETYPE_LIB_DEPENDS= libfreetype.so:print/freetype2
FREETYPE_EXTRA_PATCHES= ${PATCHDIR}/extra-patch-gemrb_plugins_TTFImporter_CMakeLists.txt
FREETYPE_CMAKE_BOOL= USE_FREETYPE

OPENAL_USES= openal:al,alut
OPENAL_CMAKE_BOOL= USE_OPENAL

OPENGL_USES= gl
OPENGL_USE= gl=egl
OPENGL_CMAKE_ON= -DOPENGL_BACKEND=OpenGL
OPENGL_CMAKE_OFF= -DOPENGL_BACKEND=None

PNG_LIB_DEPENDS= libpng.so:graphics/png
PNG_CMAKE_BOOL= USE_PNG

RESIND_DESC= Scale to screensize with pixelscaling
RESIND_CMAKE_BOOL= SDL_RESOLUTION_INDEPENDANCE

SDLMIXER_DESC= Audio support via SDL_mixer
SDLMIXER_USE= sdl=mixer2
SDLMIXER_CMAKE_BOOL= USE_SDLMIXER

VORBIS_LIB_DEPENDS= libvorbis.so:audio/libvorbis
VORBIS_CMAKE_BOOL= USE_VORBIS

PLIST_SUB= PORTVERSION=${PORTVERSION}
WRKSRC= ${WRKDIR}/${PORTNAME}-${PORTVERSION}

post-extract-DEMO-on:
${MKDIR} ${WRKSRC}/demo/music/mx0100
${INSTALL_DATA} ${WRKSRC_demo}/demo/audio/whispers-seamless.ogg ${WRKSRC}/demo/music/mx0100/mx0100a.ogg
${MKDIR} ${WRKSRC}/demo/music/theme
${INSTALL_DATA} ${WRKSRC_demo}/demo/audio/themea.ogg ${WRKSRC}/demo/music/theme

post-install:
${RM} ${STAGEDIR}${ETCDIR}/GemRB.cfg

.include <bsd.port.mk>
8 changes: 5 additions & 3 deletions games/gemrb/distinfo
@@ -1,3 +1,5 @@
TIMESTAMP = 1705483350
SHA256 (gemrb-0.9.2-sources.tar.gz) = 5206d7e3fee45d21030caac92bc799b12ec011f90e59d7408c4b0eb4a8330d40
SIZE (gemrb-0.9.2-sources.tar.gz) = 16123769
TIMESTAMP = 1708291230
SHA256 (gemrb-gemrb-v0.9.2_GH0.tar.gz) = ea614c067483606dab680ab18cd50527f56803bd46e0888e3c786eec05d3bb7d
SIZE (gemrb-gemrb-v0.9.2_GH0.tar.gz) = 14327547
SHA256 (gemrb-gemrb-assets-5b5dcde_GH0.tar.gz) = 3e180e3ae063651bfabaab5795a946183212fd451986e3f4cac9203278283d23
SIZE (gemrb-gemrb-assets-5b5dcde_GH0.tar.gz) = 11161448
24 changes: 17 additions & 7 deletions games/gemrb/files/pkg-message.in
@@ -1,14 +1,24 @@
[
{ type: install
message: <<EOM
To use GemRB, you must copy the Chitin.key from your respective Infinity Engine
game CD to the GemRB directory. If you do not copy this file, GemRB will not
work. Additionally, %%ETCDIR%%/GemRB.cfg needs to be edited to point to the
Infinity Engine game installation directory. Games can be installed with
emulators/wine-devel, archivers/unshield, or the custom GemRB game installer:
http://git.njw.name/cgit/cgit.cgi/gemrb-gameinstallers/
You will need one of the original Infinity Engine games or the free Baldur's Gate II
demo. GemRB does not support the Enhanced Edition versions of the games. GemRB comes
with its own short demo.

Please see http://www.gemrb.org/ for additional help and instructions.
GemRB needs access to game files. You have several options to provide the files:
- copy from a Windows system
- install with emulators/wine
- extract with archivers/unshield and archivers/cabextract
(https://github.com/gemrb/gemrb/wiki/Unshield:-alternative-game-install-method)
- use the custom GemRB games installers
(http://git.njw.name/cgit/cgit.cgi/gemrb-gameinstallers)

Additionally, %%ETCDIR%%/GemRB.cfg needs to be edited to point to the Infinity
Engine game installation directory, i.e. the directory where you provide the game
files from above. If it doesn't point to a valid game directory then GemRB will
start its demo instead.

Please see https://www.gemrb.org for additional help and instructions.
EOM
}
]
16 changes: 8 additions & 8 deletions games/gemrb/pkg-plist
@@ -1,8 +1,7 @@
bin/extend2da.py
bin/gemrb
%%ETCDIR%%/GemRB.cfg
%%ETCDIR%%/GemRB.cfg.noinstall.sample
%%ETCDIR%%/GemRB.cfg.sample
@sample %%ETCDIR%%/GemRB.cfg.sample
lib/gemrb/libgemrb_core.so
lib/gemrb/libgemrb_core.so.%%PORTVERSION%%
lib/gemrb/plugins/2DAImporter.so
Expand Down Expand Up @@ -31,20 +30,21 @@ lib/gemrb/plugins/MUSImporter.so
lib/gemrb/plugins/MVEPlayer.so
lib/gemrb/plugins/NullSound.so
lib/gemrb/plugins/NullSource.so
lib/gemrb/plugins/OGGReader.so
lib/gemrb/plugins/OpenALAudio.so
%%VORBIS%%lib/gemrb/plugins/OGGReader.so
%%OPENAL%%lib/gemrb/plugins/OpenALAudio.so
lib/gemrb/plugins/PLTImporter.so
lib/gemrb/plugins/PNGImporter.so
%%PNG%%lib/gemrb/plugins/PNGImporter.so
lib/gemrb/plugins/PROImporter.so
lib/gemrb/plugins/PSTOpcodes.so
lib/gemrb/plugins/PVRZImporter.so
lib/gemrb/plugins/SAVImporter.so
%%SDLMIXER%%lib/gemrb/plugins/SDLAudio.so
lib/gemrb/plugins/SDLVideo.so
lib/gemrb/plugins/SPLImporter.so
lib/gemrb/plugins/STOImporter.so
lib/gemrb/plugins/TISImporter.so
lib/gemrb/plugins/TLKImporter.so
lib/gemrb/plugins/TTFImporter.so
%%FREETYPE%%lib/gemrb/plugins/TTFImporter.so
lib/gemrb/plugins/WAVReader.so
lib/gemrb/plugins/WEDImporter.so
lib/gemrb/plugins/WMPImporter.so
Expand Down Expand Up @@ -336,9 +336,9 @@ share/applications/gemrb.desktop
%%DATADIR%%/demo/gem-demo.ini
%%DATADIR%%/demo/keymap.ini
%%DATADIR%%/demo/music/mx0100.mus
%%DATADIR%%/demo/music/mx0100/mx0100a.ogg
%%DEMO%%%%DATADIR%%/demo/music/mx0100/mx0100a.ogg
%%DATADIR%%/demo/music/theme.mus
%%DATADIR%%/demo/music/theme/themea.ogg
%%DEMO%%%%DATADIR%%/demo/music/theme/themea.ogg
%%DATADIR%%/demo/override/AMB_D18.ogg
%%DATADIR%%/demo/override/AR0100.WED
%%DATADIR%%/demo/override/AR0100HT.BMP
Expand Down

0 comments on commit cfbb908

Please sign in to comment.