aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Frei <freijon@pm.me>2023-11-13 06:33:31 +0100
committerJonas Frei <freijon@pm.me>2023-11-13 06:35:14 +0100
commit7d9a1b2df949a03883e81d47bda176054480b14a (patch)
tree0e102a1e34a59142405387cd48bc66fde501ac18 /games-engines
parentgui-apps/xremap: new package, add 0.8.11 (diff)
downloadguru-7d9a1b2df949a03883e81d47bda176054480b14a.tar.gz
guru-7d9a1b2df949a03883e81d47bda176054480b14a.tar.bz2
guru-7d9a1b2df949a03883e81d47bda176054480b14a.zip
games-engines/fs2_open: Added patch to respect -O flags, fixes 887671
This new patch is to be removed on the next release, it was implemented upstream. Closes: https://bugs.gentoo.org/887671 Signed-off-by: Jonas Frei <freijon@pm.me>
Diffstat (limited to 'games-engines')
-rw-r--r--games-engines/fs2_open/files/fs2_open-23.2.1-dont-ignore-user-cflags.patch117
-rw-r--r--games-engines/fs2_open/fs2_open-23.2.1-r1.ebuild (renamed from games-engines/fs2_open/fs2_open-23.2.1.ebuild)1
2 files changed, 118 insertions, 0 deletions
diff --git a/games-engines/fs2_open/files/fs2_open-23.2.1-dont-ignore-user-cflags.patch b/games-engines/fs2_open/files/fs2_open-23.2.1-dont-ignore-user-cflags.patch
new file mode 100644
index 000000000..c0f29d05f
--- /dev/null
+++ b/games-engines/fs2_open/files/fs2_open-23.2.1-dont-ignore-user-cflags.patch
@@ -0,0 +1,117 @@
+From 3ebdc51c4814648c2171440484c2d429899d3ab4 Mon Sep 17 00:00:00 2001
+From: Jonas Frei <freijon@pm.me>
+Date: Tue, 7 Nov 2023 21:21:28 +0100
+Subject: [PATCH] Don't ignore user-set -O* flags
+
+---
+ cmake/toolchain-clang.cmake | 37 +++++++++++++++++++++++++++++--------
+ cmake/toolchain-gcc.cmake | 34 ++++++++++++++++++++++++++++------
+ 2 files changed, 57 insertions(+), 14 deletions(-)
+
+--- a/cmake/toolchain-clang.cmake
++++ b/cmake/toolchain-clang.cmake
+@@ -83,20 +83,41 @@ if(SUPPORTS_SHIFT_NEGATIVE_VALUE)
+ set(COMPILER_FLAGS "${COMPILER_FLAGS} -Wno-shift-negative-value")
+ endif()
+
+-set(COMPILER_FLAGS_RELEASE "-O2 -Wno-unused-variable -Wno-unused-parameter")
++# Check if there is a user-set optimisation flag
++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(COMPILER_FLAGS_DEBUG "-Og -g -Wshadow")
++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")
+
+-# Always use the base flags and add our compiler flags at the bacl
++set(CXX_FLAGS_DEBUG "${CXX_OPT_FLAG_DEBUG} -g -Wshadow")
++set(C_FLAGS_DEBUG "${C_OPT_FLAG_DEBUG} -g -Wshadow")
++
++# Always use the base flags and add our compiler flags at the back
+ set(CMAKE_CXX_FLAGS "${CXX_BASE_FLAGS} ${COMPILER_FLAGS}")
+ set(CMAKE_C_FLAGS "${C_BASE_FLAGS} ${COMPILER_FLAGS}")
+
+-set(CMAKE_CXX_FLAGS_RELEASE ${COMPILER_FLAGS_RELEASE})
+-set(CMAKE_C_FLAGS_RELEASE ${COMPILER_FLAGS_RELEASE})
+-
+-set(CMAKE_CXX_FLAGS_DEBUG ${COMPILER_FLAGS_DEBUG})
+-set(CMAKE_C_FLAGS_DEBUG ${COMPILER_FLAGS_DEBUG})
++set(CMAKE_CXX_FLAGS_RELEASE ${CXX_FLAGS_RELEASE})
++set(CMAKE_C_FLAGS_RELEASE ${C_FLAGS_RELEASE})
+
++set(CMAKE_CXX_FLAGS_DEBUG ${CXX_FLAGS_DEBUG})
++set(CMAKE_C_FLAGS_DEBUG ${C_FLAGS_DEBUG})
+
+ set(CMAKE_EXE_LINKER_FLAGS "")
+
+diff --git a/cmake/toolchain-gcc.cmake b/cmake/toolchain-gcc.cmake
+index ca740832e..78577038c 100644
+--- a/cmake/toolchain-gcc.cmake
++++ b/cmake/toolchain-gcc.cmake
+@@ -113,19 +113,41 @@ if(SUPPORTS_STRINGOP_TRUNCATION)
+ set(COMPILER_FLAGS "${COMPILER_FLAGS} -Wno-stringop-overflow")
+ endif()
+
+-set(COMPILER_FLAGS_RELEASE "-O2 -Wno-unused-variable -Wno-unused-but-set-variable -Wno-array-bounds -Wno-empty-body -Wno-clobbered -Wno-unused-parameter")
++# Check if there is a user-set optimisation flag
++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})
+
+-set(COMPILER_FLAGS_DEBUG "-Og -g -Wshadow")
++# 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")
+
+ # Always use the base flags and add our compiler flags at the back
+ set(CMAKE_CXX_FLAGS "${CXX_BASE_FLAGS} ${COMPILER_FLAGS}")
+ set(CMAKE_C_FLAGS "${C_BASE_FLAGS} ${COMPILER_FLAGS}")
+
+-set(CMAKE_CXX_FLAGS_RELEASE ${COMPILER_FLAGS_RELEASE})
+-set(CMAKE_C_FLAGS_RELEASE ${COMPILER_FLAGS_RELEASE})
++set(CMAKE_CXX_FLAGS_RELEASE ${CXX_FLAGS_RELEASE})
++set(CMAKE_C_FLAGS_RELEASE ${C_FLAGS_RELEASE})
+
+-set(CMAKE_CXX_FLAGS_DEBUG ${COMPILER_FLAGS_DEBUG})
+-set(CMAKE_C_FLAGS_DEBUG ${COMPILER_FLAGS_DEBUG})
++set(CMAKE_CXX_FLAGS_DEBUG ${CXX_FLAGS_DEBUG})
++set(CMAKE_C_FLAGS_DEBUG ${C_FLAGS_DEBUG})
+
+ set(CMAKE_EXE_LINKER_FLAGS "${LINKER_FLAGS}")
+
+--
+2.41.0
+
diff --git a/games-engines/fs2_open/fs2_open-23.2.1.ebuild b/games-engines/fs2_open/fs2_open-23.2.1-r1.ebuild
index 8c63d4680..aa639f958 100644
--- a/games-engines/fs2_open/fs2_open-23.2.1.ebuild
+++ b/games-engines/fs2_open/fs2_open-23.2.1-r1.ebuild
@@ -48,6 +48,7 @@ BDEPEND="
"
PATCHES=(
"${FILESDIR}/${P}-dont-build-lz4.patch"
+ "${FILESDIR}/${P}-dont-ignore-user-cflags.patch"
"${FILESDIR}/${P}-make-arch-independent.patch"
)