On Sat, 27 Aug 2022, Paco Esteban wrote: > Hi ports@, > > This is an update of games/fheroes2 to its latest version 0.9.18 > It builds and runs fine for me on amd64, not sure I did the right thing > with the right thing with the lang Makefile. They seem to have changed > things a bit in this area. > > Maintainer on cc. > > Comments ? Ok to commit ?
ping ? diff here again for convenience diff /usr/ports commit - d831ba6400d1500e8b55926b20ca44816aa1d8c7 path + /usr/ports blob - c45a60fc907c523c9fe249b68025fd7205d12b6c file + games/fheroes2/Makefile --- games/fheroes2/Makefile +++ games/fheroes2/Makefile @@ -2,11 +2,10 @@ COMMENT = engine recreation for Heroes of Might and Ma GH_ACCOUNT = ihhub GH_PROJECT = fheroes2 -GH_TAGNAME = 0.9.14 +GH_TAGNAME = 0.9.18 CATEGORIES = games HOMEPAGE = https://ihhub.github.io/fheroes2/ MAINTAINER = Thomas Frohwein <t...@openbsd.org> -REVISION = 0 # GPLv2.0+, LGPLv2.1+ (src/thirdparty/libsmacker) PERMIT_PACKAGE = Yes @@ -30,7 +29,6 @@ do-gen: do-install: ${INSTALL_DATA_DIR} ${PREFIX}/share/fheroes2/files/data - ${INSTALL_DATA} ${WRKSRC}/fheroes2.key ${PREFIX}/share/fheroes2/ ${INSTALL_DATA} ${WRKSRC}/files/data/resurrection.h2d \ ${PREFIX}/share/fheroes2/files/data/ ${INSTALL_DATA_DIR} ${PREFIX}/share/fheroes2/files/lang blob - fe69e1e68011d777d3004c15ca45a0fb6b4e89ea file + games/fheroes2/distinfo --- games/fheroes2/distinfo +++ games/fheroes2/distinfo @@ -1,2 +1,2 @@ -SHA256 (fheroes2-0.9.14.tar.gz) = VTL6hEO42PVPz8VmKPECBHCtIV4SKF14yEUOSeqZRL4= -SIZE (fheroes2-0.9.14.tar.gz) = 3628240 +SHA256 (fheroes2-0.9.18.tar.gz) = vNmvznuGljD5fP23E2aPD33M9p/Gsx2xynSsL2NSSo0= +SIZE (fheroes2-0.9.18.tar.gz) = 5117381 blob - 765221e1f24c22c250ab4e4e79020970626a7d68 file + /dev/null --- games/fheroes2/patches/patch-files_lang_Makefile +++ /dev/null @@ -1,60 +0,0 @@ -used UTF-8 so that sed doesn't fail because of different string lengths -add in missing instructions for languages (hu, lt, nl, sv, pt, tr) - -Index: files/lang/Makefile ---- files/lang/Makefile.orig -+++ files/lang/Makefile -@@ -31,14 +31,14 @@ merge: - # Spanish: drop accents transliterated with `"` (which breaks translation file format) - # and transliterate the rest using the es_ES.UTF-8 locale - es.mo: es.po -- sed -e 'y/äëïöőüűÄËÏŐÖÜŰ/aeioouuAEIOOUU/' $< > $<.tmp -+ LANG=es_ES.UTF-8 LC_CTYPE=es_ES.UTF-8 sed -e 'y/äëïöőüűÄËÏŐÖÜŰ/aeioouuAEIOOUU/' $< > $<.tmp - LANG=es_ES.UTF-8 LC_ALL=es_ES.UTF-8 LC_CTYPE=es_ES.UTF-8 iconv -f utf-8 -t ascii//TRANSLIT $<.tmp > $<.2.tmp - msgfmt $<.2.tmp -o $@ - - # In French, accented characters are mapped to unused ASCII characters - # Non-mapped characters are replaced by their non-accented equivalents - fr.mo: fr.po -- sed -e 'y/àâçéèêîïôùûüÉÊÀ/@*^~`|><#&$$uEEA/' $< > $<.tmp -+ LANG=fr_FR.UTF-8 LC_CTYPE=fr_FR.UTF-8 sed -e 'y/àâçéèêîïôùûüÉÊÀ/@*^~`|><#&$$uEEA/' $< > $<.tmp - sed -i~ -e 's/œ/oe/g' $<.tmp - msgfmt $<.tmp -o $@ - -@@ -78,6 +78,36 @@ nb.mo: nb.po - it.mo: it.po - iconv -f utf-8 -t CP1252 $< > $<.tmp - LANG=it.CP1252 LC_ALL=it.CP1252 LC_CTYPE=it.CP1252 sed -e 's/UTF-8/CP1252/' $<.tmp > $<.2.tmp -+ msgfmt $<.2.tmp -o $@ -+ -+hu.mo: hu.po -+ LANG=hu_HU.UTF-8 LC_ALL=hu_HU.UTF-8 LC_CTYPE=hu_HU.UTF-8 sed -e 'y/äëïöőüűÄËÏŐÖÜŰ/aeioouuAEIOOUU/' $< > $<.tmp -+ iconv -f utf-8 -t ascii//TRANSLIT $<.tmp > $<.2.tmp -+ msgfmt $<.2.tmp -o $@ -+ -+lt.mo: lt.po -+ LANG=lt_LT.UTF-8 LC_ALL=lt_LT.UTF-8 LC_CTYPE=lt_LT.UTF-8 sed -e 'y/äëïöőüűÄËÏŐÖÜŰ/aeioouuAEIOOUU/' $< > $<.tmp -+ iconv -f utf-8 -t ascii//TRANSLIT $<.tmp > $<.2.tmp -+ msgfmt $<.2.tmp -o $@ -+ -+nl.mo: nl.po -+ LANG=nl_NL.UTF-8 LC_ALL=nl_NL.UTF-8 LC_CTYPE=nl_NL.UTF-8 sed -e 'y/äëïöőüűÄËÏŐÖÜŰ/aeioouuAEIOOUU/' $< > $<.tmp -+ iconv -f utf-8 -t ascii//TRANSLIT $<.tmp > $<.2.tmp -+ msgfmt $<.2.tmp -o $@ -+ -+sv.mo: sv.po -+ LANG=sv_SV.UTF-8 LC_ALL=sv_SV.UTF-8 LC_CTYPE=sv_SV.UTF-8 sed -e 'y/äëïöőüűÄËÏŐÖÜŰ/aeioouuAEIOOUU/' $< > $<.tmp -+ iconv -f utf-8 -t ascii//TRANSLIT $<.tmp > $<.2.tmp -+ msgfmt $<.2.tmp -o $@ -+ -+pt.mo: pt.po -+ LANG=pt_PT.UTF-8 LC_ALL=pt_PT.UTF-8 LC_CTYPE=pt_PT.UTF-8 sed -e 'y/äëïöőüűÄËÏŐÖÜŰ/aeioouuAEIOOUU/' $< > $<.tmp -+ iconv -f utf-8 -t ascii//TRANSLIT $<.tmp > $<.2.tmp -+ msgfmt $<.2.tmp -o $@ -+ -+tr.mo: tr.po -+ LANG=tr_TR.UTF-8 LC_ALL=tr_TR.UTF-8 LC_CTYPE=tr_TR.UTF-8 sed -e 'y/äëïöőüűÄËÏŐÖÜŰ/aeioouuAEIOOUU/' $< > $<.tmp -+ iconv -f utf-8 -t ascii//TRANSLIT $<.tmp > $<.2.tmp - msgfmt $<.2.tmp -o $@ - - # All other languages: drop accents transliterated with `"` (which breaks translation file format) blob - 89a33ef3e05b9aff8fdff3db84fe94b3d6dc5bd5 file + /dev/null --- games/fheroes2/patches/patch-src_fheroes2_agg_agg_cpp +++ /dev/null @@ -1,163 +0,0 @@ -Fix failing music file search -GH PR 5278 - -Index: src/fheroes2/agg/agg.cpp ---- src/fheroes2/agg/agg.cpp.orig -+++ src/fheroes2/agg/agg.cpp -@@ -22,6 +22,7 @@ - ***************************************************************************/ - - #include <algorithm> -+#include <array> - #include <cassert> - #include <condition_variable> - #include <map> -@@ -33,21 +34,31 @@ - #include "agg_file.h" - #include "audio.h" - #include "dir.h" --#include "embedded_image.h" - #include "game.h" - #include "localevent.h" - #include "logging.h" - #include "m82.h" - #include "mus.h" --#include "screen.h" - #include "settings.h" - #include "system.h" - #include "tools.h" - #include "xmi.h" --#include "zzlib.h" - - namespace - { -+ struct MusicFileType -+ { -+ explicit MusicFileType( const MUS::EXTERNAL_MUSIC_TYPE type_ ) -+ : type( type_ ) -+ { -+ // Do nothing. -+ } -+ -+ MUS::EXTERNAL_MUSIC_TYPE type = MUS::EXTERNAL_MUSIC_TYPE::WIN_VERSION; -+ -+ std::array<std::string, 3> extension{ ".ogg", ".mp3", ".flac" }; -+ }; -+ - const std::string externalMusicDirectory( "music" ); - - std::vector<std::string> getMusicDirectories() -@@ -63,46 +74,58 @@ namespace - return directories; - } - -- std::string getExternalMusicFile( const int musicTrackId, const MUS::EXTERNAL_MUSIC_TYPE musicType, const std::vector<std::string> & directories ) -+ bool findMusicFile( const std::vector<std::string> & directories, const std::string & fileName, std::string & fullPath ) - { -+ for ( const std::string & dir : directories ) { -+ ListFiles musicFilePaths; -+ musicFilePaths.ReadDir( dir, fileName, false ); -+ if ( musicFilePaths.empty() ) { -+ continue; -+ } -+ -+ std::string correctFilePath = System::ConcatePath( dir, fileName ); -+ correctFilePath = StringLower( correctFilePath ); -+ -+ for ( const std::string & path : musicFilePaths ) { -+ const std::string temp = StringLower( path ); -+ if ( temp == correctFilePath ) { -+ fullPath = path; -+ return true; -+ } -+ } -+ } -+ -+ return false; -+ } -+ -+ std::string getExternalMusicFile( const int musicTrackId, const std::vector<std::string> & directories, MusicFileType & musicType ) -+ { - if ( directories.empty() ) { - // Nothing to search. - return {}; - } - -- // Instead of relying some generic functions we want to have maximum performance as I/O operations are the slowest. -- std::vector<std::string> possibleFilenames; -- possibleFilenames.reserve( directories.size() ); -+ std::string fullPath; - -- for ( const std::string & dir : directories ) { -- possibleFilenames.emplace_back( System::ConcatePath( dir, MUS::getFileName( musicTrackId, musicType, ".flac" ) ) ); -+ std::string fileName = MUS::getFileName( musicTrackId, musicType.type, musicType.extension[0].c_str() ); -+ if ( findMusicFile( directories, fileName, fullPath ) ) { -+ return fullPath; - } - -- // Search for FLAC files as they have the best audio quality. -- for ( const std::string & filename : possibleFilenames ) { -- if ( System::IsFile( filename ) ) { -- return filename; -- } -+ fheroes2::replaceStringEnding( fileName, musicType.extension[0].c_str(), musicType.extension[1].c_str() ); -+ if ( findMusicFile( directories, fileName, fullPath ) ) { -+ // Swap extensions to improve cache hit. -+ std::swap( musicType.extension[0], musicType.extension[1] ); -+ return fullPath; - } - -- // None of FLAC files found. Try OGG files. -- for ( std::string & filename : possibleFilenames ) { -- fheroes2::replaceStringEnding( filename, ".flac", ".ogg" ); -- -- if ( System::IsFile( filename ) ) { -- return filename; -- } -+ fheroes2::replaceStringEnding( fileName, musicType.extension[1].c_str(), musicType.extension[2].c_str() ); -+ if ( findMusicFile( directories, fileName, fullPath ) ) { -+ // Swap extensions to improve cache hit. -+ std::swap( musicType.extension[0], musicType.extension[2] ); -+ return fullPath; - } - -- // No luck with even OGG. Try with MP3. -- for ( std::string & filename : possibleFilenames ) { -- fheroes2::replaceStringEnding( filename, ".ogg", ".mp3" ); -- -- if ( System::IsFile( filename ) ) { -- return filename; -- } -- } -- - // Looks like music file does not exist. - return {}; - } -@@ -582,13 +605,21 @@ void AGG::PlayMusicInternally( const int mus, const Mu - if ( musicType == MUSIC_EXTERNAL ) { - const std::vector<std::string> & musicDirectories = getMusicDirectories(); - -- std::string filename = getExternalMusicFile( mus, MUS::EXTERNAL_MUSIC_TYPE::DOS_VERSION, musicDirectories ); -- if ( filename.empty() ) { -- filename = getExternalMusicFile( mus, MUS::EXTERNAL_MUSIC_TYPE::WIN_VERSION, musicDirectories ); -- } -+ // To avoid extra I/O calls to data storage it might be useful to remember the last successful type of music and try to search for it next time. -+ static std::array<MusicFileType, 3> musicFileTypes{ MusicFileType( MUS::EXTERNAL_MUSIC_TYPE::DOS_VERSION ), -+ MusicFileType( MUS::EXTERNAL_MUSIC_TYPE::WIN_VERSION ), MusicFileType( MUS::EXTERNAL_MUSIC_TYPE::MAPPED ) }; - -- if ( filename.empty() ) { -- filename = getExternalMusicFile( mus, MUS::EXTERNAL_MUSIC_TYPE::MAPPED, musicDirectories ); -+ std::string filename; -+ -+ for ( size_t i = 0; i < musicFileTypes.size(); ++i ) { -+ filename = getExternalMusicFile( mus, musicDirectories, musicFileTypes[i] ); -+ if ( !filename.empty() ) { -+ if ( i > 0 ) { -+ // Swap music types to improve cache hit. -+ std::swap( musicFileTypes[0], musicFileTypes[i] ); -+ } -+ break; -+ } - } - - if ( filename.empty() ) { blob - 0eb2863ea6dab8e28c9dd4044243011e5ddd434b file + games/fheroes2/pkg/PLIST --- games/fheroes2/pkg/PLIST +++ games/fheroes2/pkg/PLIST @@ -2,22 +2,20 @@ share/doc/pkg-readmes/${PKGSTEM} share/fheroes2/ share/fheroes2/download_demo_version.sh -share/fheroes2/fheroes2.key share/fheroes2/files/ share/fheroes2/files/data/ share/fheroes2/files/data/resurrection.h2d share/fheroes2/files/lang/ +share/fheroes2/files/lang/be.mo +share/fheroes2/files/lang/bg.mo share/fheroes2/files/lang/cs.mo share/fheroes2/files/lang/de.mo share/fheroes2/files/lang/es.mo -share/fheroes2/files/lang/fr.mo -share/fheroes2/files/lang/hu.mo share/fheroes2/files/lang/it.mo -share/fheroes2/files/lang/lt.mo share/fheroes2/files/lang/nb.mo -share/fheroes2/files/lang/nl.mo share/fheroes2/files/lang/pl.mo share/fheroes2/files/lang/pt.mo +share/fheroes2/files/lang/ro.mo share/fheroes2/files/lang/ru.mo share/fheroes2/files/lang/sv.mo -share/fheroes2/files/lang/tr.mo +share/fheroes2/files/lang/uk.mo blob - 12be8e617e7e7df6b358c680b5230c7099169f55 file + games/fheroes2/pkg/README --- games/fheroes2/pkg/README +++ games/fheroes2/pkg/README @@ -16,10 +16,8 @@ environment variable FHEROES2_DATA: $ env FHEROES2_DATA=/path/to/game fheroes2 -Key bindings can be adjusted in the file fheroes2.key. Copy it first to -~/.fheroes2/ to work with it: +Key bindings can be adjusted in the file ~/.fheroes2/fheroes2.key. +It's automatically created on first run. -$ cp ${PREFIX}/share/fheroes2/fheroes2.key ~/.fheroes2/ - The port includes a script to download the freeware demo data at ${PREFIX}/share/fheroes2/download_demo_version.sh. -- Paco Esteban. 0x5818130B8A6DBC03