commit:     b7af427658d58502ae043866a3ab4d716c15f0e8
Author:     Takuya Wakazono <pastalian46 <AT> gmail <DOT> com>
AuthorDate: Sat Nov  9 06:14:48 2024 +0000
Commit:     Viorel Munteanu <ceamac <AT> gentoo <DOT> org>
CommitDate: Sat Nov  9 08:24:47 2024 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=b7af4276

games-engines/fs2_open: fix ODR violations and DEPEND

Closes: https://bugs.gentoo.org/859982
Closes: https://bugs.gentoo.org/917418
Closes: https://bugs.gentoo.org/935326
Signed-off-by: Takuya Wakazono <pastalian46 <AT> gmail.com>

 .../fs2_open/files/fs2_open-24.0.2-fix-odr.patch   | 173 +++++++++++++++++++++
 .../files/fs2_open-24.0.2-respect-flags.patch      |  83 ++++++++++
 ...pen-24.0.2.ebuild => fs2_open-24.0.2-r1.ebuild} |  20 ++-
 3 files changed, 269 insertions(+), 7 deletions(-)

diff --git a/games-engines/fs2_open/files/fs2_open-24.0.2-fix-odr.patch 
b/games-engines/fs2_open/files/fs2_open-24.0.2-fix-odr.patch
new file mode 100644
index 000000000..4a992da28
--- /dev/null
+++ b/games-engines/fs2_open/files/fs2_open-24.0.2-fix-odr.patch
@@ -0,0 +1,173 @@
+Fix ODR violations for `barracks_buttons` and `Section`.
+https://bugs.gentoo.org/859982
+https://github.com/scp-fs2open/fs2open.github.com/pull/6417
+--- a/code/menuui/playermenu.cpp
++++ b/code/menuui/playermenu.cpp
+@@ -79,45 +79,45 @@ const char 
*Player_select_background_mask_bitmap[GR_NUM_RESOLUTIONS] = {
+ #define PLAYER_SELECT_MAIN_HALL_OVERLAY               NOX("MainHall1")        
                // main hall help overlay
+ 
+ // convenient struct for handling all button controls
+-struct barracks_buttons {
++struct barracks_buttons_alt {
+       const char *filename;
+       int x, y, xt, yt;
+       int hotspot;
+       UI_BUTTON button;  // because we have a class inside this struct, we 
need the constructor below..
+ 
+-      barracks_buttons(const char *name, int x1, int y1, int xt1, int yt1, 
int h) : filename(name), x(x1), y(y1), xt(xt1), yt(yt1), hotspot(h) {}
++      barracks_buttons_alt(const char *name, int x1, int y1, int xt1, int 
yt1, int h) : filename(name), x(x1), y(y1), xt(xt1), yt(yt1), hotspot(h) {}
+ };
+ 
+-static barracks_buttons 
Player_select_buttons[GR_NUM_RESOLUTIONS][NUM_PLAYER_SELECT_BUTTONS] = {
++static barracks_buttons_alt 
Player_select_buttons[GR_NUM_RESOLUTIONS][NUM_PLAYER_SELECT_BUTTONS] = {
+       { // GR_640
+               // create, clone and delete (respectively)
+-              barracks_buttons("CPB_00",              114,    205,    117,    
240,    0),
+-              barracks_buttons("CPB_01",              172,    205,    175,    
240,    1),
+-              barracks_buttons("CPB_02",              226,    205,    229,    
240,    2),
++              barracks_buttons_alt("CPB_00",          114,    205,    117,    
240,    0),
++              barracks_buttons_alt("CPB_01",          172,    205,    175,    
240,    1),
++              barracks_buttons_alt("CPB_02",          226,    205,    229,    
240,    2),
+ 
+               // scroll up, scroll down, and accept (respectively)
+-              barracks_buttons("CPB_03",              429,    213,     -1,    
 -1,    3),
+-              barracks_buttons("CPB_04",              456,    213,     -1,    
 -1,    4),
+-              barracks_buttons("CPB_05",              481,    207,    484,    
246,    5),
++              barracks_buttons_alt("CPB_03",          429,    213,     -1,    
 -1,    3),
++              barracks_buttons_alt("CPB_04",          456,    213,     -1,    
 -1,    4),
++              barracks_buttons_alt("CPB_05",          481,    207,    484,    
246,    5),
+               
+               // single player select and multiplayer select, respectively
+-              barracks_buttons("CPB_06",              428,     82,    430,    
108,    6),
+-              barracks_buttons("CPB_07",              477,     82,    481,    
108,    7)
++              barracks_buttons_alt("CPB_06",          428,     82,    430,    
108,    6),
++              barracks_buttons_alt("CPB_07",          477,     82,    481,    
108,    7)
+       }, 
+       { // GR_1024
+               // create, clone and delete (respectively)
+-              barracks_buttons("2_CPB_00",    182,    328,    199,    384,    
0),
+-              barracks_buttons("2_CPB_01",    275,    328,    292,    384,    
1),
+-              barracks_buttons("2_CPB_02",    361,    328,    379,    384,    
2),
++              barracks_buttons_alt("2_CPB_00",        182,    328,    199,    
384,    0),
++              barracks_buttons_alt("2_CPB_01",        275,    328,    292,    
384,    1),
++              barracks_buttons_alt("2_CPB_02",        361,    328,    379,    
384,    2),
+ 
+               // scroll up, scroll down, and accept (respectively)
+-              barracks_buttons("2_CPB_03",    686,    341,     -1,     -1,    
3),
+-              barracks_buttons("2_CPB_04",    729,    341,     -1,     -1,    
4),
+-              barracks_buttons("2_CPB_05",    770,    332,    787,    394,    
5),
++              barracks_buttons_alt("2_CPB_03",        686,    341,     -1,    
 -1,    3),
++              barracks_buttons_alt("2_CPB_04",        729,    341,     -1,    
 -1,    4),
++              barracks_buttons_alt("2_CPB_05",        770,    332,    787,    
394,    5),
+               
+               // single player select and multiplayer select, respectively
+-              barracks_buttons("2_CPB_06",    685,    132,    700,    173,    
6),
+-              barracks_buttons("2_CPB_07",    764,    132,    782,    173,    
7)
++              barracks_buttons_alt("2_CPB_06",        685,    132,    700,    
173,    6),
++              barracks_buttons_alt("2_CPB_07",        764,    132,    782,    
173,    7)
+       }
+ };
+ 
+@@ -294,7 +294,7 @@ void player_select_set_controls(int gray)
+ void player_select_init()
+ {
+       int i;
+-      barracks_buttons *b;
++      barracks_buttons_alt *b;
+       UI_WINDOW *w;
+ 
+       // start a looping ambient sound
+--- a/code/osapi/osregistry.cpp
++++ b/code/osapi/osregistry.cpp
+@@ -475,17 +475,17 @@ typedef struct KeyValue
+       struct KeyValue *next;
+ } KeyValue;
+ 
+-typedef struct Section
++typedef struct IniSection
+ {
+       char *name;
+ 
+       struct KeyValue *pairs;
+-      struct Section *next;
+-} Section;
++      struct IniSection *next;
++} IniSection;
+ 
+ typedef struct Profile
+ {
+-      struct Section *sections;
++      struct IniSection *sections;
+ } Profile;
+ 
+ // For string config functions
+@@ -602,8 +602,8 @@ static Profile *profile_read(const char *file)
+       Profile *profile = (Profile *)vm_malloc(sizeof(Profile));
+       profile->sections = NULL;
+ 
+-      Section **sp_ptr = &(profile->sections);
+-      Section *sp = NULL;
++      IniSection **sp_ptr = &(profile->sections);
++      IniSection *sp = NULL;
+ 
+       KeyValue **kvp_ptr = NULL;
+ 
+@@ -620,7 +620,7 @@ static Profile *profile_read(const char *file)
+                               *pend = 0;
+ 
+                               if (*ptr) {
+-                                      sp = (Section 
*)vm_malloc(sizeof(Section));
++                                      sp = (IniSection 
*)vm_malloc(sizeof(IniSection));
+                                       sp->next = NULL;
+ 
+                                       sp->name = vm_strdup(ptr);
+@@ -675,9 +675,9 @@ static void profile_free(Profile *profile)
+       if (profile == NULL)
+               return;
+ 
+-      Section *sp = profile->sections;
++      IniSection *sp = profile->sections;
+       while (sp != NULL) {
+-              Section *st = sp;
++              IniSection *st = sp;
+               KeyValue *kvp = sp->pairs;
+ 
+               while (kvp != NULL) {
+@@ -709,8 +709,8 @@ static Profile *profile_update(Profile *profile, const 
char *section, const char
+ 
+       KeyValue *kvp;
+ 
+-      Section **sp_ptr = &(profile->sections);
+-      Section *sp = profile->sections;
++      IniSection **sp_ptr = &(profile->sections);
++      IniSection *sp = profile->sections;
+ 
+       while (sp != NULL) {
+               if (strcmp(section, sp->name) == 0) {
+@@ -758,7 +758,7 @@ static Profile *profile_update(Profile *profile, const 
char *section, const char
+       }
+ 
+       /* section not found */
+-      sp = (Section *)vm_malloc(sizeof(Section));
++      sp = (IniSection *)vm_malloc(sizeof(IniSection));
+       sp->next = NULL;
+       sp->name = vm_strdup(section);
+ 
+@@ -779,7 +779,7 @@ static char *profile_get_value(Profile *profile, const 
char *section, const char
+       if (profile == NULL)
+               return NULL;
+ 
+-      Section *sp = profile->sections;
++      IniSection *sp = profile->sections;
+ 
+       while (sp != NULL) {
+               if (stricmp(section, sp->name) == 0) {
+@@ -814,7 +814,7 @@ static void profile_save(Profile *profile, const char 
*file)
+       if (fp == NULL)
+               return;
+ 
+-      Section *sp = profile->sections;
++      IniSection *sp = profile->sections;
+ 
+       while (sp != NULL) {
+               sprintf(tmp, NOX("[%s]\n"), sp->name);

diff --git a/games-engines/fs2_open/files/fs2_open-24.0.2-respect-flags.patch 
b/games-engines/fs2_open/files/fs2_open-24.0.2-respect-flags.patch
new file mode 100644
index 000000000..d27003fac
--- /dev/null
+++ b/games-engines/fs2_open/files/fs2_open-24.0.2-respect-flags.patch
@@ -0,0 +1,83 @@
+https://bugs.gentoo.org/917418
+--- a/cmake/toolchain-clang.cmake
++++ b/cmake/toolchain-clang.cmake
+@@ -87,27 +87,12 @@ endif()
+ string(REGEX MATCH "-O[a-zA-Z|0-9]+" CXX_OPT_FLAG ${CXX_BASE_FLAGS})
+ string(REGEX MATCH "-O[a-zA-Z|0-9]+" C_OPT_FLAG ${C_BASE_FLAGS})
+ 
+-# If no user-set opt flag, set -O2 and -Og
+-if ("${CXX_OPT_FLAG}" STREQUAL "")
+-      set(CXX_OPT_FLAG_RELEASE "-O2")
+-      set(CXX_OPT_FLAG_DEBUG "-Og")
+-else()
+-      set(CXX_OPT_FLAG_RELEASE "${CXX_OPT_FLAG}")
+-      set(CXX_OPT_FLAG_DEBUG "${CXX_OPT_FLAG}")
+-endif()
+-if ("${C_OPT_FLAG}" STREQUAL "")
+-      set(C_OPT_FLAG_RELEASE "-O2")
+-      set(C_OPT_FLAG_DEBUG "-Og")
+-else()
+-      set(C_OPT_FLAG_RELEASE "${C_OPT_FLAG}")
+-      set(C_OPT_FLAG_DEBUG "${C_OPT_FLAG}")
+-endif()
+ 
+ set(CXX_FLAGS_RELEASE "${CXX_OPT_FLAG_RELEASE} -Wno-unused-variable 
-Wno-unused-parameter")
+ set(C_FLAGS_RELEASE "${C_OPT_FLAG_RELEASE} -Wno-unused-variable 
-Wno-unused-parameter")
+ 
+-set(CXX_FLAGS_DEBUG "${CXX_OPT_FLAG_DEBUG} -g -Wshadow")
+-set(C_FLAGS_DEBUG "${C_OPT_FLAG_DEBUG} -g -Wshadow")
++set(CXX_FLAGS_DEBUG "${CXX_OPT_FLAG_DEBUG} -Wshadow")
++set(C_FLAGS_DEBUG "${C_OPT_FLAG_DEBUG} -Wshadow")
+ 
+ # Always use the base flags and add our compiler flags at the back
+ set(CMAKE_CXX_FLAGS "${CXX_BASE_FLAGS} ${COMPILER_FLAGS}")
+@@ -134,7 +119,7 @@ if (SANITIZE_FLAGS)
+ endif()
+ 
+ set(CMAKE_EXE_LINKER_FLAGS_RELEASE "")
+-set(CMAKE_EXE_LINKER_FLAGS_DEBUG "-g -rdynamic")
++set(CMAKE_EXE_LINKER_FLAGS_DEBUG "")
+ 
+ if (FSO_FATAL_WARNINGS)
+       # Make warnings fatal if the right variable is set
+--- a/cmake/toolchain-gcc.cmake
++++ b/cmake/toolchain-gcc.cmake
+@@ -117,27 +117,12 @@ endif()
+ string(REGEX MATCH "-O[a-zA-Z|0-9]+" CXX_OPT_FLAG ${CXX_BASE_FLAGS})
+ string(REGEX MATCH "-O[a-zA-Z|0-9]+" C_OPT_FLAG ${C_BASE_FLAGS})
+ 
+-# If no user-set opt flag, set -O2 and -Og
+-if ("${CXX_OPT_FLAG}" STREQUAL "")
+-      set(CXX_OPT_FLAG_RELEASE "-O2")
+-      set(CXX_OPT_FLAG_DEBUG "-Og")
+-else()
+-      set(CXX_OPT_FLAG_RELEASE "${CXX_OPT_FLAG}")
+-      set(CXX_OPT_FLAG_DEBUG "${CXX_OPT_FLAG}")
+-endif()
+-if ("${C_OPT_FLAG}" STREQUAL "")
+-      set(C_OPT_FLAG_RELEASE "-O2")
+-      set(C_OPT_FLAG_DEBUG "-Og")
+-else()
+-      set(C_OPT_FLAG_RELEASE "${C_OPT_FLAG}")
+-      set(C_OPT_FLAG_DEBUG "${C_OPT_FLAG}")
+-endif()
+ 
+ set(CXX_FLAGS_RELEASE "${CXX_OPT_FLAG_RELEASE} -Wno-unused-variable 
-Wno-unused-but-set-variable -Wno-array-bounds -Wno-empty-body -Wno-clobbered 
-Wno-unused-parameter")
+ set(C_FLAGS_RELEASE "${C_OPT_FLAG_RELEASE} -Wno-unused-variable 
-Wno-unused-but-set-variable -Wno-array-bounds -Wno-empty-body -Wno-clobbered 
-Wno-unused-parameter")
+ 
+-set(CXX_FLAGS_DEBUG "${CXX_OPT_FLAG_DEBUG} -g -Wshadow")
+-set(C_FLAGS_DEBUG "${C_OPT_FLAG_DEBUG} -g -Wshadow")
++set(CXX_FLAGS_DEBUG "${CXX_OPT_FLAG_DEBUG} -Wshadow")
++set(C_FLAGS_DEBUG "${C_OPT_FLAG_DEBUG} -Wshadow")
+ 
+ # Always use the base flags and add our compiler flags at the back
+ set(CMAKE_CXX_FLAGS "${CXX_BASE_FLAGS} ${COMPILER_FLAGS}")
+@@ -161,7 +146,7 @@ if (SANITIZE_FLAGS)
+ endif()
+ 
+ set(CMAKE_EXE_LINKER_FLAGS_RELEASE "")
+-set(CMAKE_EXE_LINKER_FLAGS_DEBUG "-g")
++set(CMAKE_EXE_LINKER_FLAGS_DEBUG "")
+ 
+ if (GCC_GENERATE_GDB_INDEX)
+       # For pure debug binaries, generate a gdb index for better debugging

diff --git a/games-engines/fs2_open/fs2_open-24.0.2.ebuild 
b/games-engines/fs2_open/fs2_open-24.0.2-r1.ebuild
similarity index 89%
rename from games-engines/fs2_open/fs2_open-24.0.2.ebuild
rename to games-engines/fs2_open/fs2_open-24.0.2-r1.ebuild
index 41ceb753c..db40c7ea8 100644
--- a/games-engines/fs2_open/fs2_open-24.0.2.ebuild
+++ b/games-engines/fs2_open/fs2_open-24.0.2-r1.ebuild
@@ -30,27 +30,33 @@ KEYWORDS="~amd64"
 IUSE="clang debug discord"
 
 DEPEND="
-       app-arch/lz4
+       app-arch/lz4:=
        <dev-lang/lua-5.1.6:5.1
-       dev-libs/jansson
+       dev-libs/jansson:=
        media-libs/freetype:2
        media-libs/glu
-       media-libs/libjpeg-turbo
-       media-libs/libpng
-       media-libs/libsdl2
+       media-libs/libjpeg-turbo:=
+       media-libs/libpng:=
+       media-libs/libsdl2[X]
        media-libs/libtheora
        media-libs/libvorbis
        media-libs/mesa
        media-libs/openal
-       media-video/ffmpeg
+       media-video/ffmpeg:=
+       x11-libs/libX11
 "
+RDEPEND="${DEPEND}"
 BDEPEND="
-       clang? ( sys-devel/clang:= )
+       clang? ( sys-devel/clang )
 "
 PATCHES=(
        "${FILESDIR}/${P}-deps-fix.patch"
        "${FILESDIR}/${P}-dont-build-lz4.patch"
        "${FILESDIR}/${P}-make-arch-independent.patch"
+       # bug 859982
+       "${FILESDIR}/${P}-fix-odr.patch"
+       # bug 917418
+       "${FILESDIR}/${P}-respect-flags.patch"
 )
 
 CMAKE_BUILD_TYPE=Release

Reply via email to