commit: 644f1b4a501fc9d3c8767023e6a2bebcae0f145c Author: James Le Cuirot <chewi <AT> gentoo <DOT> org> AuthorDate: Fri Mar 4 22:49:27 2022 +0000 Commit: James Le Cuirot <chewi <AT> gentoo <DOT> org> CommitDate: Fri Mar 4 22:49:27 2022 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=644f1b4a
games-engines/odamex: Version bump to 10.0.0, unbundling patches Closes: https://bugs.gentoo.org/833588 Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org> games-engines/odamex/Manifest | 1 + .../odamex/files/odamex-10.0.0-unbundle-fltk.patch | 105 +++++++++++++++++++++ .../files/odamex-10.0.0-unbundle-jsoncpp.patch | 85 +++++++++++++++++ .../files/odamex-10.0.0-unbundle-miniupnpc.patch | 96 +++++++++++++++++++ games-engines/odamex/metadata.xml | 3 +- games-engines/odamex/odamex-10.0.0.ebuild | 90 ++++++++++++++++++ 6 files changed, 379 insertions(+), 1 deletion(-) diff --git a/games-engines/odamex/Manifest b/games-engines/odamex/Manifest index 41eaaf581314..b2e65dadb436 100644 --- a/games-engines/odamex/Manifest +++ b/games-engines/odamex/Manifest @@ -1 +1,2 @@ DIST odamex-0.9.5.tar.bz2 6659528 BLAKE2B 6f6052aff5a1e0c9a54c417113b67a91044d05ebf13d8ab5fb01132f9bb90b1c97392e881b8bff8baee4621c8e53abbb360fc8c7e6de8ff53d45ee55f73c48ec SHA512 70a0deb5e5b5902620f8fe692dc8507f9f19d7d6afabb4e2efbc25dc6879d469aa250dc55bb165db83a4288af9d5adda72ce3823a3db6dd9ccb83f5c684d3ac8 +DIST odamex-src-10.0.0.tar.xz 17680868 BLAKE2B 95df336ccc24c2658174bdd051cb9b98ca906d653d84a120330d8fe6f11ad91ba70ba7edfc960f8815d02795f7392761a0174171de30ea78b37389a61deacae7 SHA512 b825953a446a4eb46d2d004b20df876bceec823cb5f0bf661ecac03eff2f07c11fe47c6861f3c3ee417ce9ca869474ff422d78bba1b742485315ba5ba86bd702 diff --git a/games-engines/odamex/files/odamex-10.0.0-unbundle-fltk.patch b/games-engines/odamex/files/odamex-10.0.0-unbundle-fltk.patch new file mode 100644 index 000000000000..1c9a8753b44a --- /dev/null +++ b/games-engines/odamex/files/odamex-10.0.0-unbundle-fltk.patch @@ -0,0 +1,105 @@ +From 8a2b7c043fe86916d56044d7489f8dce6ed2d479 Mon Sep 17 00:00:00 2001 +From: James Le Cuirot <ch...@gentoo.org> +Date: Sun, 27 Feb 2022 14:01:33 +0000 +Subject: [PATCH 3/3] Allow building against the system FLTK library + +`USE_INTERNAL_FLTK` defaults to true and ignores `USE_INTERNAL_LIBS` +because users are unlikely to have it installed. + +Odamex makes of use screen scaling features in FLTK that have not yet +been released. This change therefore checks for the Fl::screen_scale +symbol and skips the associated code if it is absent. In practise, this +only affects the size of the dialog window on HiDPI screens. The game +window is unaffected. + +Tested against FLTK 1.3.5 on Gentoo Linux. + +(cherry picked from commit 656afab54e30598022f4dd2af298cf6a487a1fe1) +--- + CMakeLists.txt | 1 + + client/CMakeLists.txt | 23 ++++++++++++++++++++++- + client/gui/gui_boot.cpp | 2 ++ + libraries/CMakeLists.txt | 2 +- + 4 files changed, 26 insertions(+), 2 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 9353d0c6b..599b6e85b 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -42,6 +42,7 @@ option(USE_INTERNAL_DEUTEX "Use internal DeuTex" ${USE_INTERNAL_LIBS}) + cmake_dependent_option( USE_INTERNAL_ZLIB "Use internal zlib" ${USE_INTERNAL_LIBS} BUILD_CLIENT 0 ) + cmake_dependent_option( USE_INTERNAL_PNG "Use internal libpng" ${USE_INTERNAL_LIBS} BUILD_CLIENT 0 ) + cmake_dependent_option( USE_INTERNAL_CURL "Use internal libcurl" ${USE_INTERNAL_LIBS} BUILD_CLIENT 0 ) ++cmake_dependent_option( USE_INTERNAL_FLTK "Use internal FLTK" 1 BUILD_CLIENT 0 ) + cmake_dependent_option( USE_INTERNAL_JSONCPP "Use internal JsonCpp" 1 BUILD_SERVER 0 ) + cmake_dependent_option( USE_INTERNAL_WXWIDGETS "Use internal wxWidgets" ${USE_INTERNAL_LIBS} BUILD_LAUNCHER 0 ) + cmake_dependent_option( ENABLE_PORTMIDI "Enable portmidi support" 1 BUILD_CLIENT 0 ) +diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt +index bd071a7a5..ff1e72ba3 100644 +--- a/client/CMakeLists.txt ++++ b/client/CMakeLists.txt +@@ -206,7 +206,28 @@ if(TARGET SDL2::SDL2 OR TARGET SDL::SDL) + target_link_libraries(odamex ${PNG_LIBRARY} ${ZLIB_LIBRARY} CURL::libcurl) + if(NOT GCONSOLE) + target_include_directories(odamex PRIVATE gui) +- target_link_libraries(odamex fltk fltk_images) ++ ++ if(USE_INTERNAL_FLTK) ++ set(FLTK_LIBRARIES fltk fltk_images) ++ set(HAVE_FLTK_SCREEN_SCALE TRUE) ++ else() ++ set(FLTK_SKIP_OPENGL 1) ++ set(FLTK_SKIP_FORMS 1) ++ set(FLTK_SKIP_FLUID 1) ++ find_package(FLTK REQUIRED) ++ target_include_directories(odamex SYSTEM PRIVATE ${FLTK_INCLUDE_DIR}) ++ ++ include(CheckCXXSymbolExists) ++ set(CMAKE_REQUIRED_INCLUDES ${FLTK_INCLUDE_DIR}) ++ set(CMAKE_REQUIRED_LIBRARIES ${FLTK_LIBRARIES}) ++ check_cxx_symbol_exists(Fl::screen_scale "FL/Fl.H" HAVE_FLTK_SCREEN_SCALE) ++ endif() ++ ++ if(HAVE_FLTK_SCREEN_SCALE) ++ target_compile_definitions(odamex PRIVATE HAVE_FLTK_SCREEN_SCALE) ++ endif() ++ ++ target_link_libraries(odamex ${FLTK_LIBRARIES}) + endif() + + if(ENABLE_PORTMIDI) +diff --git a/client/gui/gui_boot.cpp b/client/gui/gui_boot.cpp +index f0a0035d1..834038209 100644 +--- a/client/gui/gui_boot.cpp ++++ b/client/gui/gui_boot.cpp +@@ -315,12 +315,14 @@ static BootWindow* MakeBootWindow() + */ + std::string GUI_BootWindow() + { ++#ifdef HAVE_FLTK_SCREEN_SCALE + // Scale according to 1600x900. + Fl::screen_scale(0, MAX(Fl::h() / 900.0f, 1.0f)); + + // This feature is too clever by half, and in my experience just + // deforms the window. + Fl::keyboard_screen_scaling(0); ++#endif + + BootWindow* win = MakeBootWindow(); + win->initWADDirs(); +diff --git a/libraries/CMakeLists.txt b/libraries/CMakeLists.txt +index 493d8f12b..a53441d13 100644 +--- a/libraries/CMakeLists.txt ++++ b/libraries/CMakeLists.txt +@@ -255,7 +255,7 @@ endif() + + ### FLTK (dep: libpng) ### + +-if(BUILD_CLIENT) ++if(BUILD_CLIENT AND USE_INTERNAL_FLTK) + message(STATUS "Compiling FLTK...") + + set(_FLTK_BUILDGEN_PARAMS +-- +2.34.1 + diff --git a/games-engines/odamex/files/odamex-10.0.0-unbundle-jsoncpp.patch b/games-engines/odamex/files/odamex-10.0.0-unbundle-jsoncpp.patch new file mode 100644 index 000000000000..9b0d3284dc48 --- /dev/null +++ b/games-engines/odamex/files/odamex-10.0.0-unbundle-jsoncpp.patch @@ -0,0 +1,85 @@ +From c8d1cd6465d8d64a23a111edb5fba67565660fe8 Mon Sep 17 00:00:00 2001 +From: James Le Cuirot <ch...@gentoo.org> +Date: Sun, 27 Feb 2022 22:51:18 +0000 +Subject: [PATCH 2/3] Allow building against the system JsonCpp library + +`USE_INTERNAL_JSONCPP` defaults to true and ignores `USE_INTERNAL_LIBS` +because users are unlikely to have it installed. + +More recent versions of JsonCpp require C++11, but Odamex targets C++98 +for compatibility with older platforms. The standard is therefore only +changed to C++11 when `USE_INTERNAL_JSONCPP` is false, and only for the +server where JsonCpp is used. Note that C++11 still works when building +against an older JsonCpp version. + +Tested against JsonCpp 1.9.5 on Gentoo Linux. + +Closes: https://github.com/odamex/odamex/issues/261 +(cherry picked from commit 5162c6297c7177af907e5e0502eac9d59ffcc22b) +--- + CMakeLists.txt | 1 + + libraries/CMakeLists.txt | 2 +- + server/CMakeLists.txt | 15 ++++++++++++++- + 3 files changed, 16 insertions(+), 2 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index c43c9f111..9353d0c6b 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -42,6 +42,7 @@ option(USE_INTERNAL_DEUTEX "Use internal DeuTex" ${USE_INTERNAL_LIBS}) + cmake_dependent_option( USE_INTERNAL_ZLIB "Use internal zlib" ${USE_INTERNAL_LIBS} BUILD_CLIENT 0 ) + cmake_dependent_option( USE_INTERNAL_PNG "Use internal libpng" ${USE_INTERNAL_LIBS} BUILD_CLIENT 0 ) + cmake_dependent_option( USE_INTERNAL_CURL "Use internal libcurl" ${USE_INTERNAL_LIBS} BUILD_CLIENT 0 ) ++cmake_dependent_option( USE_INTERNAL_JSONCPP "Use internal JsonCpp" 1 BUILD_SERVER 0 ) + cmake_dependent_option( USE_INTERNAL_WXWIDGETS "Use internal wxWidgets" ${USE_INTERNAL_LIBS} BUILD_LAUNCHER 0 ) + cmake_dependent_option( ENABLE_PORTMIDI "Enable portmidi support" 1 BUILD_CLIENT 0 ) + cmake_dependent_option( USE_MINIUPNP "Build with UPnP support" 1 BUILD_SERVER 0 ) +diff --git a/libraries/CMakeLists.txt b/libraries/CMakeLists.txt +index ae7db4c86..493d8f12b 100644 +--- a/libraries/CMakeLists.txt ++++ b/libraries/CMakeLists.txt +@@ -295,7 +295,7 @@ endif() + + ### JsonCpp ### + +-if(BUILD_SERVER) ++if(BUILD_SERVER AND USE_INTERNAL_JSONCPP) + message(STATUS "Compiling JsonCpp...") + + # Figure out the correct library path to attach to our imported target +diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt +index 32297080f..a9bf8c44d 100644 +--- a/server/CMakeLists.txt ++++ b/server/CMakeLists.txt +@@ -45,7 +45,12 @@ endif() + add_executable(odasrv + ${COMMON_SOURCES} ${SERVER_SOURCES} ${SERVER_WIN32_SOURCES}) + odamex_target_settings(odasrv) +-set_property(TARGET odasrv PROPERTY CXX_STANDARD 98) ++ ++if(USE_INTERNAL_JSONCPP) ++ set_property(TARGET odasrv PROPERTY CXX_STANDARD 98) ++else() ++ set_property(TARGET odasrv PROPERTY CXX_STANDARD 11) ++endif() + + target_include_directories(odasrv PRIVATE src) + if(WIN32) +@@ -53,6 +58,14 @@ if(WIN32) + endif() + target_link_libraries(odasrv ZLIB::ZLIB jsoncpp odamex-common odaproto) + ++if(USE_INTERNAL_JSONCPP) ++ target_link_libraries(odasrv jsoncpp) ++else() ++ find_package(PkgConfig REQUIRED) ++ pkg_check_modules(JSONCPP jsoncpp REQUIRED IMPORTED_TARGET) ++ target_link_libraries(odasrv PkgConfig::JSONCPP) ++endif() ++ + if(USE_MINIUPNP) + if(USE_INTERNAL_MINIUPNP) + target_link_libraries(odasrv upnpc-static) +-- +2.34.1 + diff --git a/games-engines/odamex/files/odamex-10.0.0-unbundle-miniupnpc.patch b/games-engines/odamex/files/odamex-10.0.0-unbundle-miniupnpc.patch new file mode 100644 index 000000000000..80b0806e0c11 --- /dev/null +++ b/games-engines/odamex/files/odamex-10.0.0-unbundle-miniupnpc.patch @@ -0,0 +1,96 @@ +From 4e9fec4ce56fda2568a3a656e1f7c59cdbc5fb21 Mon Sep 17 00:00:00 2001 +From: James Le Cuirot <ch...@gentoo.org> +Date: Sun, 20 Feb 2022 11:24:24 +0000 +Subject: [PATCH 1/3] Allow building against the system miniupnpc library + +`USE_INTERNAL_MINIUPNP` defaults to true and ignores `USE_INTERNAL_LIBS` because +users are unlikely to have it installed. + +Although miniupnpc uses pkg-config, it doesn't add any include paths to the +flags because it expects your include directives to include the miniupnpc +directory. We should therefore do the same with the internal build so that +either can be used. + +Bug: https://github.com/odamex/odamex/issues/261 +(cherry picked from commit 1832a4a1c06504de953cdec2413a47ee393101c7) +--- + CMakeLists.txt | 1 + + common/i_net.cpp | 7 +++---- + libraries/CMakeLists.txt | 4 ++-- + server/CMakeLists.txt | 8 +++++++- + 4 files changed, 13 insertions(+), 7 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index fd17dd36b..c43c9f111 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -45,6 +45,7 @@ cmake_dependent_option( USE_INTERNAL_CURL "Use internal libcurl" ${USE_INTERNAL_ + cmake_dependent_option( USE_INTERNAL_WXWIDGETS "Use internal wxWidgets" ${USE_INTERNAL_LIBS} BUILD_LAUNCHER 0 ) + cmake_dependent_option( ENABLE_PORTMIDI "Enable portmidi support" 1 BUILD_CLIENT 0 ) + cmake_dependent_option( USE_MINIUPNP "Build with UPnP support" 1 BUILD_SERVER 0 ) ++cmake_dependent_option( USE_INTERNAL_MINIUPNP "Use internal MiniUPnP" 1 USE_MINIUPNP 0 ) + + set(PROJECT_COPYRIGHT "2006-2022") + set(PROJECT_RC_VERSION "10,0,0,0") +diff --git a/common/i_net.cpp b/common/i_net.cpp +index 27b218d0d..dba512346 100644 +--- a/common/i_net.cpp ++++ b/common/i_net.cpp +@@ -93,10 +93,9 @@ typedef int SOCKET; + #include "minilzo.h" + + #ifdef ODA_HAVE_MINIUPNP +-#define MINIUPNP_STATICLIB +-#include "miniwget.h" +-#include "miniupnpc.h" +-#include "upnpcommands.h" ++#include "miniupnpc/miniwget.h" ++#include "miniupnpc/miniupnpc.h" ++#include "miniupnpc/upnpcommands.h" + #endif + + unsigned int inet_socket; +diff --git a/libraries/CMakeLists.txt b/libraries/CMakeLists.txt +index 1785ed0d8..ae7db4c86 100644 +--- a/libraries/CMakeLists.txt ++++ b/libraries/CMakeLists.txt +@@ -350,7 +350,7 @@ endif() + ### MiniUPnPc ### + if(BUILD_SERVER AND NOT USE_MINIUPNP) + message(STATUS "Skipping MiniUPnPc...") +-elseif(BUILD_SERVER AND USE_MINIUPNP) ++elseif(BUILD_SERVER AND USE_MINIUPNP AND USE_INTERNAL_MINIUPNP) + message(STATUS "Compiling MiniUPnPc...") + + # Figure out the correct library path to attach to our imported target +@@ -386,7 +386,7 @@ elseif(BUILD_SERVER AND USE_MINIUPNP) + # Synthesize an imported target that can be linked against. + add_library(upnpc-static STATIC IMPORTED GLOBAL) + set_target_properties(upnpc-static PROPERTIES +- INTERFACE_INCLUDE_DIRECTORIES "${MINIUPNPC_INCLUDE_DIR}" ++ INTERFACE_COMPILE_DEFINITIONS MINIUPNP_STATICLIB + IMPORTED_LOCATION ${MINIUPNPC_LIBRARY}) + if(WIN32) + set_target_properties(upnpc-static PROPERTIES INTERFACE_LINK_LIBRARIES "ws2_32;iphlpapi") +diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt +index c9fa17b64..32297080f 100644 +--- a/server/CMakeLists.txt ++++ b/server/CMakeLists.txt +@@ -54,7 +54,13 @@ endif() + target_link_libraries(odasrv ZLIB::ZLIB jsoncpp odamex-common odaproto) + + if(USE_MINIUPNP) +- target_link_libraries(odasrv upnpc-static) ++ if(USE_INTERNAL_MINIUPNP) ++ target_link_libraries(odasrv upnpc-static) ++ else() ++ find_package(PkgConfig REQUIRED) ++ pkg_check_modules(MINIUPNPC miniupnpc REQUIRED IMPORTED_TARGET) ++ target_link_libraries(odasrv PkgConfig::MINIUPNPC) ++ endif() + endif() + + if(WIN32) +-- +2.34.1 + diff --git a/games-engines/odamex/metadata.xml b/games-engines/odamex/metadata.xml index cb169a6f5bc5..1548d4273e2e 100644 --- a/games-engines/odamex/metadata.xml +++ b/games-engines/odamex/metadata.xml @@ -7,6 +7,7 @@ </maintainer> <use> <flag name="client">Build client target</flag> + <flag name="hidpi">Use bundled FLTK 1.4, which has better support for HiDPI screens</flag> <flag name="master">Build master server target (advertises odamex server list)</flag> <flag name="odalaunch">Build the wxWidgets based launcher</flag> <flag name="portmidi">Enable PortMidi support</flag> @@ -25,6 +26,6 @@ broader expanse of security features, personal configuration, gameplay options, and editing features. Odamex can run on a wide range of operating systems and hardware, so players should be able to play - on almost any platform. + on almost any platform. </longdescription> </pkgmetadata> diff --git a/games-engines/odamex/odamex-10.0.0.ebuild b/games-engines/odamex/odamex-10.0.0.ebuild new file mode 100644 index 000000000000..36c7c98744f3 --- /dev/null +++ b/games-engines/odamex/odamex-10.0.0.ebuild @@ -0,0 +1,90 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +WX_GTK_VER="3.0-gtk3" +inherit cmake desktop prefix wxwidgets xdg + +DESCRIPTION="Online multiplayer free software engine for DOOM" +HOMEPAGE="https://odamex.net/" +SRC_URI="https://github.com/${PN}/${PN}/releases/download/${PV}/${PN}-src-${PV}.tar.xz" + +LICENSE="GPL-2+ MIT" +SLOT="0" +KEYWORDS="~amd64 ~arm ~x86" +IUSE="+client hidpi master +odalaunch portmidi server upnp X" +REQUIRED_USE="|| ( client master server )" + +# protobuf is still bundled. Unfortunately an old version is required for C++98 +# compatibility. We could use C++11, but upstream is concerned about using a +# completely different protobuf version on a multiplayer-focused engine. + +RDEPEND=" + client? ( + media-libs/libpng:0= + media-libs/libsdl2[joystick,sound,video] + media-libs/sdl2-mixer + net-misc/curl + !hidpi? ( x11-libs/fltk:1 ) + portmidi? ( media-libs/portmidi ) + X? ( x11-libs/libX11 ) + ) + odalaunch? ( x11-libs/wxGTK:${WX_GTK_VER}[X] ) + server? ( + dev-libs/jsoncpp:= + upnp? ( net-libs/miniupnpc:= ) + )" +DEPEND="${RDEPEND}" +BDEPEND="games-util/deutex" + +S="${WORKDIR}/${PN}-src-${PV}" + +PATCHES=( + "${FILESDIR}"/${PN}-10.0.0-unbundle-miniupnpc.patch + "${FILESDIR}"/${PN}-10.0.0-unbundle-jsoncpp.patch + "${FILESDIR}"/${PN}-10.0.0-unbundle-fltk.patch + "${FILESDIR}"/${PN}-10.0.0-musl.patch +) + +src_prepare() { + rm -r libraries/libminiupnpc || die + hprefixify common/d_main.cpp + + use odalaunch && setup-wxwidgets + + cmake_src_prepare +} + +src_configure() { + local mycmakeargs=( + -DUSE_INTERNAL_FLTK=$(usex hidpi) + -DUSE_INTERNAL_JSONCPP=0 + -DUSE_INTERNAL_LIBS=0 + -DUSE_INTERNAL_MINIUPNP=0 + -DBUILD_CLIENT=$(usex client) + -DBUILD_LAUNCHER=$(usex odalaunch) + -DBUILD_MASTER=$(usex master) + -DBUILD_SERVER=$(usex server) + -DBUILD_OR_FAIL=1 + -DENABLE_PORTMIDI=$(usex portmidi) + -DUSE_MINIUPNP=$(usex upnp) + ) + use client && mycmakeargs+=(-DCMAKE_DISABLE_FIND_PACKAGE_X11=$(usex !X)) + + cmake_src_configure +} + +src_install() { + if use client ; then + newicon -s 128 "${S}/media/icon_${PN}_128.png" "${PN}.png" + make_desktop_entry "${PN}" "Odamex" + + if use odalaunch ; then + newicon -s 128 "${S}/media/icon_odalaunch_128.png" "odalaunch.png" + make_desktop_entry odalaunch "Odamex Launcher" odalaunch + fi + fi + + cmake_src_install +}