diff --git a/games/pokerth/Makefile b/games/pokerth/Makefile index e43bd1e3362c..52afc46405ac 100644 --- a/games/pokerth/Makefile +++ b/games/pokerth/Makefile @@ -1,68 +1,72 @@ PORTNAME= pokerth PORTVERSION= 1.1.2 PORTREVISION= 17 CATEGORIES= games MASTER_SITES= SF PATCH_SITES= https://gitweb.gentoo.org/repo/gentoo.git/plain/games-board/pokerth/files/ \ https://raw.githubusercontent.com/gentoo/gentoo/master/games-board/pokerth/files/ PATCHFILES= pokerth-1.1.2-boost-1.73.patch:-p1 MAINTAINER= ports@FreeBSD.org COMMENT= Poker game written in C++/Qt WWW= https://www.pokerth.net/ LICENSE= AGPLv3+ LICENSE_FILE= ${WRKSRC}/COPYING LIB_DEPENDS= libboost_thread.so:devel/boost-libs \ libmikmod.so:audio/libmikmod \ libgnutls.so:security/gnutls \ libcurl.so:ftp/curl \ libgsasl.so:security/libgsasl \ libtinyxml.so:textproc/tinyxml \ libprotobuf.so:devel/protobuf \ libircclient.so:irc/libircclient BUILD_DEPENDS= ${LOCALBASE}/include/websocketpp/client.hpp:devel/websocketpp \ protoc:devel/protobuf -USES= compiler:c++11-lang gl gmake iconv qmake qt:5 sdl sqlite ssl +USES= compiler:c++17-lang gl gmake iconv localbase:ldflags qmake qt:5 sdl sqlite ssl USE_GL= gl -USE_CXXSTD= c++11 +USE_CXXSTD= c++17 USE_QT= buildtools:build core gui network sql sql-sqlite3 widgets USE_SDL= mixer +CXXFLAGS+= -D_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION +LDFLAGS+= -labsl_log_internal_check_op \ + -labsl_log_internal_message \ + -lprotobuf QMAKE_SOURCE_PATH= pokerth.pro QMAKE_ARGS+= CONFIG+="client" WRKSRC= ${WRKDIR}/${DISTNAME}-rc PORTDOCS= server_setup_howto.txt OPTIONS_DEFINE= DOCS .include post-patch: @${REINPLACE_CMD} -E \ -e 's|/usr([a-z|/]*)|${LOCALBASE}/\1|g' \ -e 's|(-lcurl)|\1 ${ICONV_LIB}|g' \ -e 's|(-lcrypto) -liconv|\1 ${ICONV_LIB}|' \ -e 's:boost_([a-z]+)-[-|a-z|0-9|_]*:boost_\1:g' \ -e 's|LIB_DIRS =.*|LIB_DIRS = ${LOCALBASE}/lib|g' \ -e '/.*QMAKE_CXXFLAGS.*/d' \ ${WRKSRC}/*.pro pre-build: (cd ${WRKSRC} && \ protoc --cpp_out=src/third_party/protobuf chatcleaner.proto && \ protoc --cpp_out=src/third_party/protobuf pokerth.proto \ ) post-install: @${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/pokerth ${INSTALL_PROGRAM} ${WRKSRC}/bin/pokerth_server ${STAGEDIR}${PREFIX}/bin ${INSTALL_MAN} ${WRKSRC}/docs/pokerth.1 ${STAGEDIR}${MAN1PREFIX}/man/man1 @${MKDIR} ${STAGEDIR}${DOCSDIR} ${INSTALL_DATA} ${WRKSRC}/docs/server_setup_howto.txt ${STAGEDIR}${DOCSDIR} .include diff --git a/games/pokerth/files/patch-protobuf b/games/pokerth/files/patch-protobuf new file mode 100644 index 000000000000..2269493ebf7d --- /dev/null +++ b/games/pokerth/files/patch-protobuf @@ -0,0 +1,85 @@ +--- pokerth_common.pro.orig 2017-08-16 12:24:03 UTC ++++ pokerth_common.pro +@@ -1,14 +1,14 @@ + # QMake pro-file for PokerTH + +-!c++11 { ++!c++17 { + system( $$QMAKE_CXX -dumpversion | grep -e "^6.[0-9]" > /dev/null ) { + greaterThan(QT_MAJOR_VERSION, 5) | equals(QT_MAJOR_VERSION, 5) { +- CONFIG += c++11 ++ CONFIG += c++17 + } + else { + equals(QT_MAJOR_VERSION, 4) : greaterThan(QT_MINOR_VERSION, 7) { +- CONFIG += "c++11" +- QMAKE_CXXFLAGS += "-std=gnu++11" ++ CONFIG += "c++17" ++ QMAKE_CXXFLAGS += "-std=gnu++17" + } + else { + error (QT must be greater and 4.8+) +@@ -17,10 +17,10 @@ + } + } + +-c++11 { ++c++17 { + !system( $$QMAKE_CXX -dumpversion | grep -e "^6.[0-9]" > /dev/null ) { + equals(QT_MAJOR_VERSION, 4) : greaterThan(QT_MINOR_VERSION, 7) { +- QMAKE_CXXFLAGS += "-std=gnu++11" ++ QMAKE_CXXFLAGS += "-std=gnu++17" + } + } + } +--- src/engine/local_engine/tools.cpp.orig 2017-08-16 12:24:03 UTC ++++ src/engine/local_engine/tools.cpp +@@ -43,6 +43,7 @@ + #include + #include + #include ++#include + + + using namespace std; +@@ -68,9 +69,10 @@ static inline void InitRandState() + + void Tools::ShuffleArrayNonDeterministic(int *inout, unsigned count) + { ++ std::random_device rd; ++ std::mt19937 g(rd()); + InitRandState(); +- nondet_rng rand(*g_rand_state); +- random_shuffle(&inout[0], &inout[count], rand); ++ std::shuffle(&inout[0], &inout[count], g); + } + + void Tools::GetRand(int minValue, int maxValue, unsigned count, int *out) +--- src/net/common/servergame.cpp.orig 2017-08-16 12:24:03 UTC ++++ src/net/common/servergame.cpp +@@ -32,6 +32,7 @@ + #include + #include + #include ++#include + + #include + #include +@@ -295,6 +296,8 @@ ServerGame::InternalStartGame() + { + // Initialize the game. + PlayerDataList playerData(GetFullPlayerDataList()); ++ std::random_device rd; ++ std::mt19937 g(rd()); + + if (playerData.size() >= 2) { + // Set DB Backend. +@@ -307,7 +310,7 @@ ServerGame::InternalStartGame() + // Note: This does not use a cryptographically strong + // random number generator. + vector > tmpData(playerData.begin(), playerData.end()); +- random_shuffle(tmpData.begin(), tmpData.end()); ++ std::shuffle(tmpData.begin(), tmpData.end(), g); + copy(tmpData.begin(), tmpData.end(), playerData.begin()); + + // Set order of players.