Re: git: cfbb908ce243 - main - games/gemrb: fix crash and improve port

From: Daniel Engberg <daniel.engberg.lists_at_pyret.net>
Date: Tue, 20 Feb 2024 21:14:49 UTC
On 2024-02-20T21:56:31.000+01:00, Piotr Kubaj <pkubaj@FreeBSD.org>
wrote:

> The branch main has been updated by pkubaj:
> 
> URL: https://cgit.FreeBSD.org/ports/commit/?id=cfbb908ce243d1bd9e2aedea968e330a214b1d21
> 
> commit cfbb908ce243d1bd9e2aedea968e330a214b1d21
> 
> Author:     bsdcode <bsdcode@disroot.org>
> 
> AuthorDate: 2024-02-20 11:54:28 +0000
> 
> Commit:     Piotr Kubaj <pkubaj@FreeBSD.org>
> 
> CommitDate: 2024-02-20 20:56:07 +0000
> 
>     games/gemrb: fix crash and improve port
> 
>     
> 
>     - use GCC (https://github.com/gemrb/gemrb/issues/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
> 
> ---
> 
>  games/gemrb/Makefile                               | 91 +++++++++++++++++-----
> 
>  games/gemrb/distinfo                               |  8 +-
> 
>  ...patch-gemrb_plugins_TTFImporter_CMakeLists.txt} |  0
> 
>  games/gemrb/files/pkg-message.in [http://pkg-message.in]                   | 24 ++++--
> 
>  games/gemrb/pkg-plist                              | 16 ++--
> 
>  5 files changed, 100 insertions(+), 39 deletions(-)
> 
> diff --git a/games/gemrb/Makefile b/games/gemrb/Makefile
> 
> index 14d06b5e9359..e78c7b2ec233 100644
> 
> --- a/games/gemrb/Makefile
> 
> +++ b/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)
> 
> @@ -11,27 +11,76 @@ WWW=        https://www.gemrb.org/
> 
>  LICENSE=    GPLv2+
> 
>  LICENSE_FILE=    ${WRKSRC}/COPYING
> 
>  
> 
> -LIB_DEPENDS=    libpng.so:graphics/png [http://libpng.so:graphics/png] \
> 
> -        libvorbis.so:audio/libvorbis [http://libvorbis.so:audio/libvorbis] \
> 
> -        libfreetype.so:print/freetype2 [http://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 [http://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 [http://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 [http://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 [http://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> [http://bsd.port.mk>];
> 
> diff --git a/games/gemrb/distinfo b/games/gemrb/distinfo
> 
> index 0ae3e5741971..a80d2e1ab4dc 100644
> 
> --- a/games/gemrb/distinfo
> 
> +++ b/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
> 
> diff --git a/games/gemrb/files/patch-gemrb_plugins_TTFImporter_CMakeLists.txt b/games/gemrb/files/extra-patch-gemrb_plugins_TTFImporter_CMakeLists.txt
> 
> similarity index 100%
> 
> rename from games/gemrb/files/patch-gemrb_plugins_TTFImporter_CMakeLists.txt
> 
> rename to games/gemrb/files/extra-patch-gemrb_plugins_TTFImporter_CMakeLists.txt
> 
> diff --git a/games/gemrb/files/pkg-message.in [http://pkg-message.in] b/games/gemrb/files/pkg-message.in [http://pkg-message.in]
> 
> index c58d42d857b1..26668d0faccb 100644
> 
> --- a/games/gemrb/files/pkg-message.in [http://pkg-message.in]
> 
> +++ b/games/gemrb/files/pkg-message.in [http://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
> 
>  }
> 
>  ]
> 
> diff --git a/games/gemrb/pkg-plist b/games/gemrb/pkg-plist
> 
> index 7d6817e6b2b8..11d19f0345db 100644
> 
> --- a/games/gemrb/pkg-plist
> 
> +++ b/games/gemrb/pkg-plist
> 
> @@ -1,8 +1,7 @@
> 
>  bin/extend2da.py [http://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 [http://core.so]
> 
>  lib/gemrb/libgemrb_core.so [http://core.so].%%PORTVERSION%%
> 
>  lib/gemrb/plugins/2DAImporter.so [http://2DAImporter.so]
> 
> @@ -31,20 +30,21 @@ lib/gemrb/plugins/MUSImporter.so [http://MUSImporter.so]
> 
>  lib/gemrb/plugins/MVEPlayer.so [http://MVEPlayer.so]
> 
>  lib/gemrb/plugins/NullSound.so [http://NullSound.so]
> 
>  lib/gemrb/plugins/NullSource.so [http://NullSource.so]
> 
> -lib/gemrb/plugins/OGGReader.so [http://OGGReader.so]
> 
> -lib/gemrb/plugins/OpenALAudio.so [http://OpenALAudio.so]
> 
> +%%VORBIS%%lib/gemrb/plugins/OGGReader.so [http://OGGReader.so]
> 
> +%%OPENAL%%lib/gemrb/plugins/OpenALAudio.so [http://OpenALAudio.so]
> 
>  lib/gemrb/plugins/PLTImporter.so [http://PLTImporter.so]
> 
> -lib/gemrb/plugins/PNGImporter.so [http://PNGImporter.so]
> 
> +%%PNG%%lib/gemrb/plugins/PNGImporter.so [http://PNGImporter.so]
> 
>  lib/gemrb/plugins/PROImporter.so [http://PROImporter.so]
> 
>  lib/gemrb/plugins/PSTOpcodes.so [http://PSTOpcodes.so]
> 
>  lib/gemrb/plugins/PVRZImporter.so [http://PVRZImporter.so]
> 
>  lib/gemrb/plugins/SAVImporter.so [http://SAVImporter.so]
> 
> +%%SDLMIXER%%lib/gemrb/plugins/SDLAudio.so [http://SDLAudio.so]
> 
>  lib/gemrb/plugins/SDLVideo.so [http://SDLVideo.so]
> 
>  lib/gemrb/plugins/SPLImporter.so [http://SPLImporter.so]
> 
>  lib/gemrb/plugins/STOImporter.so [http://STOImporter.so]
> 
>  lib/gemrb/plugins/TISImporter.so [http://TISImporter.so]
> 
>  lib/gemrb/plugins/TLKImporter.so [http://TLKImporter.so]
> 
> -lib/gemrb/plugins/TTFImporter.so [http://TTFImporter.so]
> 
> +%%FREETYPE%%lib/gemrb/plugins/TTFImporter.so [http://TTFImporter.so]
> 
>  lib/gemrb/plugins/WAVReader.so [http://WAVReader.so]
> 
>  lib/gemrb/plugins/WEDImporter.so [http://WEDImporter.so]
> 
>  lib/gemrb/plugins/WMPImporter.so [http://WMPImporter.so]
> 
> @@ -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 [http://AR0100.WED]
> 
>  %%DATADIR%%/demo/override/AR0100HT.BMP

Hi,

What's the reasoning behind moving away from a static release archive?
This is opposite of how we want to fetch sources. See also the warning
section in Porters Handbook:

https://docs.freebsd.org/en/books/porters-handbook/book/#makefile-master_sites-github

Why is CMAKE_BUILD_TYPE defined?
https://cgit.freebsd.org/ports/tree/Mk/Uses/cmake.mk#n97

Best regards,

Daniel