summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2023-04-29 07:56:25 +0100
committerSam James <sam@gentoo.org>2023-04-29 08:08:34 +0100
commite956e4b31cb514f0ec71c993b5e84eba75a92ec0 (patch)
tree9f33231f20c6d036bdaa68fd5d68b2f6e61e6d69 /games-action
parentapp-portage/gemato: Bump to 20.2 (diff)
downloadgentoo-e956e4b31cb514f0ec71c993b5e84eba75a92ec0.tar.gz
gentoo-e956e4b31cb514f0ec71c993b5e84eba75a92ec0.tar.bz2
gentoo-e956e4b31cb514f0ec71c993b5e84eba75a92ec0.zip
games-action/astromenace: backport ODR fix
Closes: https://bugs.gentoo.org/858515 Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'games-action')
-rw-r--r--games-action/astromenace/astromenace-1.4.2-r1.ebuild61
-rw-r--r--games-action/astromenace/files/astromenace-1.4.2-odr.patch203
2 files changed, 264 insertions, 0 deletions
diff --git a/games-action/astromenace/astromenace-1.4.2-r1.ebuild b/games-action/astromenace/astromenace-1.4.2-r1.ebuild
new file mode 100644
index 000000000000..0a7245e6d20e
--- /dev/null
+++ b/games-action/astromenace/astromenace-1.4.2-r1.ebuild
@@ -0,0 +1,61 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit cmake desktop xdg
+
+DESCRIPTION="Hardcore 3D space scroll-shooter with spaceship upgrade possibilities"
+HOMEPAGE="https://viewizard.com"
+SRC_URI="https://github.com/viewizard/astromenace/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="GPL-3 GPL-3+ CC-BY-SA-4.0 OFL-1.1"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+
+DEPEND="
+ media-libs/freealut
+ media-libs/freetype:2
+ media-libs/libogg
+ media-libs/libsdl2[joystick,video]
+ media-libs/libvorbis
+ media-libs/openal
+ virtual/glu
+ virtual/opengl
+ x11-libs/libXinerama
+"
+RDEPEND="${DEPEND}"
+
+PATCHES=(
+ "${FILESDIR}"/${P}-gcc13.patch
+ "${FILESDIR}"/${P}-odr.patch
+)
+
+src_prepare() {
+ cmake_src_prepare
+
+ # no messing with CXXFLAGS please.
+ sed -i -e '/-Os/d' CMakeLists.txt || die
+}
+
+src_configure() {
+ local mycmakeargs=( -DDATADIR="${EPREFIX}/usr/share/${PN}" )
+
+ cmake_src_configure
+}
+
+src_install() {
+ # As of 1.4.2, the CMake install target is better, but still needs porting
+ # to GNUInstallDirs.
+ dobin "${BUILD_DIR}"/astromenace
+
+ insinto /usr/share/${PN}
+ doins "${BUILD_DIR}"/gamedata.vfs
+
+ newicon -s 128 share/astromenace_128.png ${PN}.png
+ newicon -s 64 share/astromenace_64.png ${PN}.png
+
+ einstalldocs
+
+ make_desktop_entry "${PN}" AstroMenace
+}
diff --git a/games-action/astromenace/files/astromenace-1.4.2-odr.patch b/games-action/astromenace/files/astromenace-1.4.2-odr.patch
new file mode 100644
index 000000000000..974edab4c0d3
--- /dev/null
+++ b/games-action/astromenace/files/astromenace-1.4.2-odr.patch
@@ -0,0 +1,203 @@
+From 710b35e786e5fe940a00b59c17eb638ec05a7a97 Mon Sep 17 00:00:00 2001
+From: Mikhail Kurinnoi <viewizard@viewizard.com>
+Date: Fri, 28 Apr 2023 20:31:57 +0300
+Subject: [PATCH] Fix "violates the C++ One Definition Rule errors" during
+ build. Related to https://bugs.gentoo.org/858515
+
+---
+ CMakeLists.txt | 1 +
+ src/menu/dialog.cpp | 10 +++---
+ src/menu/menu_information.cpp | 8 ++---
+ src/menu/menu_workshop_weaponry.cpp | 53 ++++++++++++++++-------------
+ 4 files changed, 40 insertions(+), 32 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 80210a66..7902931b 100755
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -190,6 +190,7 @@ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra")
+ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
+ SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Weffc++")
+ #SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wconversion")
++#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -flto -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing")
+
+ # AppleClang 8.1.0.8020042 don't support this flag
+ IF(NOT (MACOS AND ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")))
+diff --git a/src/menu/dialog.cpp b/src/menu/dialog.cpp
+index a2e0469f..68da945c 100644
+--- a/src/menu/dialog.cpp
++++ b/src/menu/dialog.cpp
+@@ -71,16 +71,16 @@ float StartHideTransp = 1.0f;
+ // what should draw in dialogue 6,7,8
+ std::weak_ptr<cSpaceShip> DialogSpaceShip{};
+ extern std::weak_ptr<cSpaceShip> WorkshopFighterGame; // player's ship "holder" in shipyard menu
+-char *GetShipGroupTitle(int Num);
+-char *GetWorkshopShipName(int Num);
++const char *GetShipGroupTitle(int Num);
++const char *GetWorkshopShipName(int Num);
+
+ cWeapon *DialogWeapon = nullptr;
+-char *GetWeaponName(int Num);
+-char *GetWeaponGroupTitle(int Num);
++const char *GetWeaponName(int Num);
++const char *GetWeaponGroupTitle(int Num);
+
+ // internal system number... 1-20
+ int DialogSystem = 0;
+-char *GetSystemName(int Num);
++const char *GetSystemName(int Num);
+ float GetShipEngineSystemEnergyUse(int Num);
+ float GetShipProtectionSystemEnergyUse(int Num);
+ float GetShipRechargeEnergy(int Num);
+diff --git a/src/menu/menu_information.cpp b/src/menu/menu_information.cpp
+index ee41014e..8579a49b 100644
+--- a/src/menu/menu_information.cpp
++++ b/src/menu/menu_information.cpp
+@@ -53,10 +53,10 @@ std::weak_ptr<cProjectile> InfoMine{};
+ std::weak_ptr<cGroundObject> InfoGroundObject{};
+
+
+-char *GetWeaponGroupTitle(int Num);
+-char *GetWeaponName(int Num);
+-char *GetShipGroupTitle(int Num);
+-char *GetWorkshopShipName(int Num);
++const char *GetWeaponGroupTitle(int Num);
++const char *GetWeaponName(int Num);
++const char *GetShipGroupTitle(int Num);
++const char *GetWorkshopShipName(int Num);
+
+
+
+diff --git a/src/menu/menu_workshop_weaponry.cpp b/src/menu/menu_workshop_weaponry.cpp
+index ff90eb4a..0a0a74f3 100644
+--- a/src/menu/menu_workshop_weaponry.cpp
++++ b/src/menu/menu_workshop_weaponry.cpp
+@@ -48,7 +48,7 @@ namespace viewizard {
+ namespace astromenace {
+
+ extern std::weak_ptr<cSpaceShip> WorkshopFighterGame;
+-extern cWeapon *WorkshopNewWeapon;
++extern std::weak_ptr<cWeapon> WorkshopNewWeapon;
+ extern int CurrentWorkshopNewWeapon;
+ extern float CurrentDeviationSum;
+ extern sVECTOR3D WorkShopPointCamera;
+@@ -545,8 +545,12 @@ void ShipSlotWeapon(int SlotNum, int X, int Y)
+ if (DragWeapon && sharedWorkshopFighterGame->WeaponSlots[SlotNum].Type >= DragWeaponLevel) {
+ CanOn = true;
+ }
+- if (!DragWeapon && sharedWorkshopFighterGame->WeaponSlots[SlotNum].Type >= WorkshopNewWeapon->WeaponLevel) {
+- CanOn = true;
++
++ if (auto sharedWorkshopNewWeapon = WorkshopNewWeapon.lock())
++ {
++ if (!DragWeapon && sharedWorkshopFighterGame->WeaponSlots[SlotNum].Type >= sharedWorkshopNewWeapon->WeaponLevel) {
++ CanOn = true;
++ }
+ }
+
+
+@@ -561,8 +565,8 @@ void ShipSlotWeapon(int SlotNum, int X, int Y)
+ if (sharedWorkshopFighterGame->WeaponSlots[i].Type < DragWeaponLevel) {
+ NeedAlert = true;
+ }
+- } else {
+- if (sharedWorkshopFighterGame->WeaponSlots[i].Type < WorkshopNewWeapon->WeaponLevel) {
++ } else if (auto sharedWorkshopNewWeapon = WorkshopNewWeapon.lock()) {
++ if (sharedWorkshopFighterGame->WeaponSlots[i].Type < sharedWorkshopNewWeapon->WeaponLevel) {
+ NeedAlert = true;
+ }
+ }
+@@ -1045,7 +1049,10 @@ void Workshop_Weaponry()
+ {
+ sRECT SrcRect, DstRect;
+
+-
++ auto sharedWorkshopNewWeapon = WorkshopNewWeapon.lock();
++ if (!sharedWorkshopNewWeapon) {
++ return;
++ }
+
+ // start weapon dragging from shopfront
+ DstRect(GameConfig().InternalWidth/2-416, 100+32, GameConfig().InternalWidth/2-96, 450-32);
+@@ -1058,9 +1065,9 @@ void Workshop_Weaponry()
+ // setup drag-and-drop variables for new weapon
+ DragWeapon = true;
+ DragWeaponNum = CurrentWorkshopNewWeapon;
+- DragWeaponLevel = WorkshopNewWeapon->WeaponLevel;
+- DragWeaponAmmo = WorkshopNewWeapon->Ammo;
+- DragWeaponAmmoStart = WorkshopNewWeapon->AmmoStart;
++ DragWeaponLevel = sharedWorkshopNewWeapon->WeaponLevel;
++ DragWeaponAmmo = sharedWorkshopNewWeapon->Ammo;
++ DragWeaponAmmoStart = sharedWorkshopNewWeapon->AmmoStart;
+ // by default, second for launchers only
+ if (CurrentWorkshopNewWeapon <= 15) {
+ DragWeaponControl = 1;
+@@ -1082,7 +1089,7 @@ void Workshop_Weaponry()
+
+ vw_End2DMode();
+ WorkshopDrawShip(WorkshopFighterGame, 4);
+- WorkshopDrawWeapon(WorkshopNewWeapon);
++ WorkshopDrawWeapon(sharedWorkshopNewWeapon.get());
+ vw_Start2DMode(-1,1);
+
+
+@@ -1090,7 +1097,7 @@ void Workshop_Weaponry()
+ vw_DrawTextUTF32(GameConfig().InternalWidth/2-438, 50+6, 0, 0, 1.0f, sRGBCOLOR{eRGBCOLOR::yellow}, MenuContentTransp, vw_GetTextUTF32(GetWeaponName(CurrentWorkshopNewWeapon)));
+ if (DrawButton128_2(GameConfig().InternalWidth/2-197, 50, vw_GetTextUTF32("Info"), MenuContentTransp, false)) {
+ SetCurrentDialogBox(eDialogBox::ShowWeaponsInfo);
+- DialogWeapon = WorkshopNewWeapon;
++ DialogWeapon = sharedWorkshopNewWeapon.get();
+ }
+
+ std::ostringstream tmpStream;
+@@ -1101,14 +1108,14 @@ void Workshop_Weaponry()
+
+
+ int k2 = 0;
+- if (GetProjectileDamageKinetic(WorkshopNewWeapon->InternalType) > 0.0f) {
++ if (GetProjectileDamageKinetic(sharedWorkshopNewWeapon->InternalType) > 0.0f) {
+ vw_DrawTextUTF32(GameConfig().InternalWidth/2-438, 130, -170, 0, 1.0f, sRGBCOLOR{eRGBCOLOR::white}, MenuContentTransp, vw_GetTextUTF32("Damage, Kinetic:"));
+ tmpStream.clear();
+ tmpStream.str(std::string{});
+- tmpStream << GetProjectileDamageKinetic(WorkshopNewWeapon->InternalType) << " ";
+- if (WorkshopNewWeapon->InternalType == 11
+- || WorkshopNewWeapon->InternalType == 12
+- || WorkshopNewWeapon->InternalType == 14) {
++ tmpStream << GetProjectileDamageKinetic(sharedWorkshopNewWeapon->InternalType) << " ";
++ if (sharedWorkshopNewWeapon->InternalType == 11
++ || sharedWorkshopNewWeapon->InternalType == 12
++ || sharedWorkshopNewWeapon->InternalType == 14) {
+ tmpStream << vw_GetText("units/sec");
+ } else {
+ tmpStream << vw_GetText("units/shot");
+@@ -1117,14 +1124,14 @@ void Workshop_Weaponry()
+
+ k2=20;
+ }
+- if (GetProjectileDamageEM(WorkshopNewWeapon->InternalType) > 0.0f) {
++ if (GetProjectileDamageEM(sharedWorkshopNewWeapon->InternalType) > 0.0f) {
+ vw_DrawTextUTF32(GameConfig().InternalWidth/2-438, 130+k2, -170, 0, 1.0f, sRGBCOLOR{eRGBCOLOR::white}, MenuContentTransp, vw_GetTextUTF32("Damage, EM:"));
+ tmpStream.clear();
+ tmpStream.str(std::string{});
+- tmpStream << GetProjectileDamageEM(WorkshopNewWeapon->InternalType) << " ";
+- if (WorkshopNewWeapon->InternalType == 11
+- || WorkshopNewWeapon->InternalType == 12
+- || WorkshopNewWeapon->InternalType == 14) {
++ tmpStream << GetProjectileDamageEM(sharedWorkshopNewWeapon->InternalType) << " ";
++ if (sharedWorkshopNewWeapon->InternalType == 11
++ || sharedWorkshopNewWeapon->InternalType == 12
++ || sharedWorkshopNewWeapon->InternalType == 14) {
+ tmpStream << vw_GetText("units/sec");
+ } else {
+ tmpStream << vw_GetText("units/shot");
+@@ -1140,8 +1147,8 @@ void Workshop_Weaponry()
+ sRGBCOLOR tmpColor{eRGBCOLOR::green};
+ tmpStream.clear();
+ tmpStream.str(std::string{});
+- tmpStream << vw_GetText("Weapon Level") << ": " << WorkshopNewWeapon->WeaponLevel;
+- if (WorkshopNewWeapon->WeaponLevel > GetShipWeaponsMaxSlotLevel()) {
++ tmpStream << vw_GetText("Weapon Level") << ": " << sharedWorkshopNewWeapon->WeaponLevel;
++ if (sharedWorkshopNewWeapon->WeaponLevel > GetShipWeaponsMaxSlotLevel()) {
+ tmpTransp = MenuContentTransp * CurrentAlert3;
+ tmpColor = sRGBCOLOR{eRGBCOLOR::orange};
+ }