From 9f8fd17d55d0fe0cbca82eda3464338508b6bf25 Mon Sep 17 00:00:00 2001 From: James Le Cuirot Date: Tue, 19 Mar 2024 23:03:42 +0000 Subject: games-engines/odamex: Fix launcher path issue, fix LTO, fix wxGTK crash We've already seen that odalaunch crashes with wxGTK 3.2 so keep it at 3.0. I have looked into this, and it relates to the server list sorting, but I cannot figure it out. Closes: https://bugs.gentoo.org/858722 Signed-off-by: James Le Cuirot --- games-engines/odamex/files/odamex-lto.patch | 41 ++++++++++ .../odamex/files/odamex-odalaunch-prefix.patch | 64 +++++++++++++++ games-engines/odamex/odamex-10.4.0-r1.ebuild | 92 --------------------- games-engines/odamex/odamex-10.4.0-r2.ebuild | 94 ++++++++++++++++++++++ 4 files changed, 199 insertions(+), 92 deletions(-) create mode 100644 games-engines/odamex/files/odamex-lto.patch create mode 100644 games-engines/odamex/files/odamex-odalaunch-prefix.patch delete mode 100644 games-engines/odamex/odamex-10.4.0-r1.ebuild create mode 100644 games-engines/odamex/odamex-10.4.0-r2.ebuild (limited to 'games-engines') diff --git a/games-engines/odamex/files/odamex-lto.patch b/games-engines/odamex/files/odamex-lto.patch new file mode 100644 index 000000000000..20d9d88c002b --- /dev/null +++ b/games-engines/odamex/files/odamex-lto.patch @@ -0,0 +1,41 @@ +https://github.com/odamex/odamex/pull/942 + +diff --git a/client/src/cl_parse.cpp b/client/src/cl_parse.cpp +index cdadbbdf2..e15c45edc 100644 +--- a/client/src/cl_parse.cpp ++++ b/client/src/cl_parse.cpp +@@ -2354,7 +2354,7 @@ static void CL_SectorProperties(const odaproto::svc::SectorProperties* msg) + break; + } + case SPC_Gravity: +- *(int*)§or->gravity = msg->sector().gravity(); ++ *§or->gravity = msg->sector().gravity(); + break; + case SPC_Panning: + sector->ceiling_xoffs = msg->sector().ceiling_offs().x(); +diff --git a/common/p_spec.cpp b/common/p_spec.cpp +index df1a42a6a..d0a5af419 100644 +--- a/common/p_spec.cpp ++++ b/common/p_spec.cpp +@@ -465,7 +465,7 @@ void DPusher::Serialize (FArchive &arc) + else + { + arc >> m_Type; +- arc.ReadObject((DObject*&)m_Source, DPusher::StaticType()); ++ arc.ReadObject((DObject*&)*m_Source, DPusher::StaticType()); + arc >> m_Xmag >> m_Ymag >> m_Magnitude >> m_Radius >> m_X >> m_Y >> m_Affectee; + } + } +diff --git a/odalpapi/net_io.cpp b/odalpapi/net_io.cpp +index d6dd666fe..16f136374 100644 +--- a/odalpapi/net_io.cpp ++++ b/odalpapi/net_io.cpp +@@ -194,7 +194,7 @@ void BufferedSocket::SetRemoteAddress(const string& Address, const uint16_t& Por + + m_RemoteAddress.sin_family = PF_INET; + m_RemoteAddress.sin_port = htons(Port); +- m_RemoteAddress.sin_addr.s_addr = *((unsigned long*)&(((sockaddr_in*)result->ai_addr)->sin_addr)); ++ m_RemoteAddress.sin_addr = ((sockaddr_in*)result->ai_addr)->sin_addr; + memset(m_RemoteAddress.sin_zero, '\0', sizeof m_RemoteAddress.sin_zero); + + freeaddrinfo(result); diff --git a/games-engines/odamex/files/odamex-odalaunch-prefix.patch b/games-engines/odamex/files/odamex-odalaunch-prefix.patch new file mode 100644 index 000000000000..cf293e60f9e1 --- /dev/null +++ b/games-engines/odamex/files/odamex-odalaunch-prefix.patch @@ -0,0 +1,64 @@ +From 04e38b9fcb8a71a7b0b1b5bc1c1f229f2ff7a0a8 Mon Sep 17 00:00:00 2001 +From: James Le Cuirot +Date: Mon, 18 Mar 2024 22:54:16 +0000 +Subject: [PATCH] Always define INSTALL_PREFIX to fix paths for odalaunch + +Without INSTALL_PREFIX, it was falling back to the current directory and +failing to launch the game. +--- + CMakeLists.txt | 5 +++++ + client/CMakeLists.txt | 5 ----- + server/CMakeLists.txt | 5 ----- + 3 files changed, 5 insertions(+), 10 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 147060cb1..97c447424 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -26,6 +26,11 @@ include(GNUInstallDirs OPTIONAL) + add_definitions(-DINSTALL_BINDIR="${CMAKE_INSTALL_BINDIR}") + add_definitions(-DINSTALL_DATADIR="${CMAKE_INSTALL_DATADIR}") + ++# Set up FHS installation path ++if(NOT APPLE AND NOT WIN32) ++ add_definitions(-DINSTALL_PREFIX="${CMAKE_INSTALL_PREFIX}") ++endif() ++ + if(WIN32) + set(USE_INTERNAL_LIBS 1) + else() +diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt +index 56caf04f8..0559564c7 100644 +--- a/client/CMakeLists.txt ++++ b/client/CMakeLists.txt +@@ -128,11 +128,6 @@ if(APPLE) + ${AUDIOUNIT_LIBRARY}) + endif() + +-# Set up FHS installation path +-if(NOT APPLE AND NOT WIN32) +- add_definitions(-DINSTALL_PREFIX="${CMAKE_INSTALL_PREFIX}") +-endif() +- + # Client target + if(TARGET SDL2::SDL2 OR TARGET SDL::SDL) + +diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt +index e5b54d8de..9afc6c2c6 100644 +--- a/server/CMakeLists.txt ++++ b/server/CMakeLists.txt +@@ -37,11 +37,6 @@ if(WIN32 AND NOT MSVC) + add_definitions(-DWINVER=0x0500) + endif() + +-# Set up FHS installation path +-if(NOT APPLE AND NOT WIN32) +- add_definitions(-DINSTALL_PREFIX="${CMAKE_INSTALL_PREFIX}") +-endif() +- + add_executable(odasrv + ${COMMON_SOURCES} ${SERVER_SOURCES} ${SERVER_WIN32_SOURCES}) + odamex_target_settings(odasrv) +-- +2.43.2 + diff --git a/games-engines/odamex/odamex-10.4.0-r1.ebuild b/games-engines/odamex/odamex-10.4.0-r1.ebuild deleted file mode 100644 index db3f6bd5532a..000000000000 --- a/games-engines/odamex/odamex-10.4.0-r1.ebuild +++ /dev/null @@ -1,92 +0,0 @@ -# Copyright 1999-2023 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=8 - -WX_GTK_VER="3.2-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.gz" - -LICENSE="GPL-2+ MIT" -SLOT="0" -KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~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.3.0-unbundle-fltk.patch - "${FILESDIR}"/${PN}-10.4.0-backport-pr928.patch -) - -src_prepare() { - rm -r libraries/miniupnp || 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 - for size in 96 128 256 512; do - newicon -s ${size} "${S}/media/icon_${PN}_${size}.png" "${PN}.png" - done - make_desktop_entry "${PN}" "Odamex" - - if use odalaunch ; then - for size in 96 128 256 512; do - newicon -s ${size} "${S}/media/icon_odalaunch_${size}.png" "odalaunch.png" - done - make_desktop_entry odalaunch "Odamex Launcher" odalaunch - fi - fi - - cmake_src_install -} diff --git a/games-engines/odamex/odamex-10.4.0-r2.ebuild b/games-engines/odamex/odamex-10.4.0-r2.ebuild new file mode 100644 index 000000000000..97ddf96efce4 --- /dev/null +++ b/games-engines/odamex/odamex-10.4.0-r2.ebuild @@ -0,0 +1,94 @@ +# Copyright 1999-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +WX_GTK_VER="3.0-gtk3" # odalaunch crashes with 3.2. Check it before updating! +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.gz" + +LICENSE="GPL-2+ MIT" +SLOT="0" +KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~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.3.0-unbundle-fltk.patch + "${FILESDIR}"/${PN}-10.4.0-backport-pr928.patch + "${FILESDIR}"/${PN}-odalaunch-prefix.patch + "${FILESDIR}"/${PN}-lto.patch +) + +src_prepare() { + rm -r libraries/miniupnp || 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 + for size in 96 128 256 512; do + newicon -s ${size} "${S}/media/icon_${PN}_${size}.png" "${PN}.png" + done + make_desktop_entry "${PN}" "Odamex" + + if use odalaunch ; then + for size in 96 128 256 512; do + newicon -s ${size} "${S}/media/icon_odalaunch_${size}.png" "odalaunch.png" + done + make_desktop_entry odalaunch "Odamex Launcher" odalaunch + fi + fi + + cmake_src_install +} -- cgit v1.2.3-65-gdbad