aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Schollmeyer <nex+b-g-o@nexadn.de>2023-02-17 18:01:01 +0100
committerAdrian Schollmeyer <nex+b-g-o@nexadn.de>2023-02-17 18:01:01 +0100
commit3b0efeeaeb01626ba215b0613ee05f733196860f (patch)
treefe516ddde890faa0068da4856796b72dbfdf55e6 /dev-cpp/dpp
parentdev-python/olm: fix deps (diff)
downloadguru-3b0efeeaeb01626ba215b0613ee05f733196860f.tar.gz
guru-3b0efeeaeb01626ba215b0613ee05f733196860f.tar.bz2
guru-3b0efeeaeb01626ba215b0613ee05f733196860f.zip
dev-cpp/dpp: backport upstream PR #596 build system rework
This rework finally gives back control over optimization flags and the like to CXXFLAGS/LDFLAGS instead of overwriting it in the ebuild. This might be relevant for systems where certain optimization flags are needed for performance reasons. Closes: https://bugs.gentoo.org/890014 Signed-off-by: Adrian Schollmeyer <nex+b-g-o@nexadn.de>
Diffstat (limited to 'dev-cpp/dpp')
-rw-r--r--dev-cpp/dpp/Manifest1
-rw-r--r--dev-cpp/dpp/dpp-10.0.21.ebuild3
-rw-r--r--dev-cpp/dpp/dpp-10.0.22.ebuild6
-rw-r--r--dev-cpp/dpp/files/dpp-rework-compiler-flag-setting-890014.patch147
4 files changed, 157 insertions, 0 deletions
diff --git a/dev-cpp/dpp/Manifest b/dev-cpp/dpp/Manifest
index e250f4a89..73ec513e5 100644
--- a/dev-cpp/dpp/Manifest
+++ b/dev-cpp/dpp/Manifest
@@ -1,3 +1,4 @@
DIST dpp-10.0.21-fix-install.patch 4090 BLAKE2B b4177190fb620952619ed5a0e4147a9adde4871f00643129b1f1140152718816cbcc1099c25e0b350c65ede56c2c5f373aeaf6345c382ba953c3ad32e9e3f2fd SHA512 8dd9a5f7db0097bc7de8e0a50253bc144786786331e3cfbfb00884925c41746e7a81bd2f87254d3bcc8d72bb820415bd92013cd0968950533bffa382bc53f279
DIST dpp-10.0.21.tar.gz 13706441 BLAKE2B e7e68d4d121d17ad840790f14375ddc4e3c95c56ced03a90667b8b838205f3e46162bc9d60ea33d50a619335c7395318a9dd47583eddca3e73481879fe35f393 SHA512 a335886cdde5772b5602426e68c50d91e921cd127bcb918066c450b39fc5b0cf87ae692096140e76176d87265bd0d9de1fbb9d808a1f217dc2c8ef27210ad57f
DIST dpp-10.0.22.tar.gz 13712205 BLAKE2B b935b763f87bfd1058e72f8d297fda136f532a03a5b9f3a6e3471f0ce64988c9615105fb1eb9b19192844cdaab9d332f355dfc22f8bcdbf977eec3eb5f0b8df3 SHA512 6c71673b47d559ef4f04b30cd72a3bd0a31b72ffe6d73dd17470a7e754eba75d21218ebd247702441db45549e5dcea9b200f3d435dd3a9af76fda90740ca4f1a
+DIST dpp-890014-rework-compiler-flags.patch 6670 BLAKE2B f23ad8f7347841aa924b82b706fbdc5ff5ceac9e90e6c01c28f13117619235a057648e30cdb92d5e3401c228c7497e8804e894d2dfd5d3591e2860746acfcaa2 SHA512 c5777efab36187b59ac8c0d5177752c4f605e584b0f3f2435bf210f792879df0461d64332725e4c47e19f026b3b11eeb2d243425bab9f888cf239dafbedc3890
diff --git a/dev-cpp/dpp/dpp-10.0.21.ebuild b/dev-cpp/dpp/dpp-10.0.21.ebuild
index f8bb48f57..20c778ac6 100644
--- a/dev-cpp/dpp/dpp-10.0.21.ebuild
+++ b/dev-cpp/dpp/dpp-10.0.21.ebuild
@@ -10,6 +10,7 @@ HOMEPAGE="https://dpp.dev/ https://github.com/brainboxdotcc/DPP"
SRC_URI="
https://github.com/brainboxdotcc/DPP/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz
https://patch-diff.githubusercontent.com/raw/brainboxdotcc/DPP/pull/591.patch -> ${P}-fix-install.patch
+ https://patch-diff.githubusercontent.com/raw/brainboxdotcc/DPP/pull/596.patch -> ${PN}-890014-rework-compiler-flags.patch
"
LICENSE="Apache-2.0"
@@ -33,6 +34,8 @@ DEPEND="${RDEPEND}"
PATCHES=(
# Backport of the installation fixes, remove after 10.0.21
"${DISTDIR}/${P}-fix-install.patch"
+ # Backport of the compiler flag setting fixes, remove after 10.0.22, https://bugs.gentoo.org/890014
+ "${DISTDIR}/${PN}-890014-rework-compiler-flags.patch"
)
S="${WORKDIR}/DPP-${PV}"
diff --git a/dev-cpp/dpp/dpp-10.0.22.ebuild b/dev-cpp/dpp/dpp-10.0.22.ebuild
index 6efc34565..bf42bca13 100644
--- a/dev-cpp/dpp/dpp-10.0.22.ebuild
+++ b/dev-cpp/dpp/dpp-10.0.22.ebuild
@@ -9,6 +9,7 @@ DESCRIPTION="Lightweight C++ Discord bot library"
HOMEPAGE="https://dpp.dev/ https://github.com/brainboxdotcc/DPP"
SRC_URI="
https://github.com/brainboxdotcc/DPP/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz
+ https://patch-diff.githubusercontent.com/raw/brainboxdotcc/DPP/pull/596.patch -> ${PN}-890014-rework-compiler-flags.patch
"
LICENSE="Apache-2.0"
@@ -33,6 +34,11 @@ S="${WORKDIR}/DPP-${PV}"
DOCS=( "README.md" "SECURITY.md" )
+PATCHES=(
+ # Backport of the compiler flag setting fixes, remove after 10.0.22, https://bugs.gentoo.org/890014
+ "${DISTDIR}/${PN}-890014-rework-compiler-flags.patch"
+)
+
src_configure() {
local mycmakeargs=(
-DBUILD_SHARED_LIBS=true
diff --git a/dev-cpp/dpp/files/dpp-rework-compiler-flag-setting-890014.patch b/dev-cpp/dpp/files/dpp-rework-compiler-flag-setting-890014.patch
new file mode 100644
index 000000000..5d41fa407
--- /dev/null
+++ b/dev-cpp/dpp/files/dpp-rework-compiler-flag-setting-890014.patch
@@ -0,0 +1,147 @@
+From 664b39498815689aae284f1d8541ed88a1101dd7 Mon Sep 17 00:00:00 2001
+From: NexAdn <nex@nexadn.de>
+Date: Sat, 7 Jan 2023 12:58:34 +0100
+Subject: [PATCH 1/4] build: Use CXX_FLAGS_{DEBUG,RELEASE} to get rid of
+ if-else blocks
+
+This commit uses the CMake variables CMAKE_CXX_FLAGS_DEBUG and
+CMAKE_CXX_FLAGS_RELEASE to handle setting varying compiler flags
+depending on the build target. This gets rid of a bunch of if-else
+blocks, allowing easier to read code.
+
+Furthermore, common flags are put in CMAKE_CXX_FLAGS only once to reduce
+code duplication.
+
+Issue: https://github.com/brainboxdotcc/DPP/issues/595
+---
+ library/CMakeLists.txt | 12 +++++-------
+ 1 file changed, 5 insertions(+), 7 deletions(-)
+
+diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt
+index 90cb6b6958..2dea07e7b7 100644
+--- a/library/CMakeLists.txt
++++ b/library/CMakeLists.txt
+@@ -170,14 +170,12 @@ if(MSVC)
+ endif()
+ string(REGEX REPLACE "/W[1|2|3|4]" "/W3" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
+ else()
+- if(CMAKE_BUILD_TYPE STREQUAL "Debug")
+- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -Wall -Wno-psabi -Wempty-body -Wignored-qualifiers -Wimplicit-fallthrough -Wmissing-field-initializers -Wsign-compare -Wtype-limits -Wuninitialized -Wshift-negative-value -pthread -g -Og -fPIC")
++ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -Wall -Wno-psabi -Wempty-body -Wignored-qualifiers -Wimplicit-fallthrough -Wmissing-field-initializers -Wsign-compare -Wtype-limits -Wuninitialized -Wshift-negative-value -pthread")
++ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g -Og -fPIC")
++ if (BUILD_O3)
++ set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -fPIC")
+ else()
+- if (BUILD_O3)
+- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -Wall -Wno-psabi -Wempty-body -Wignored-qualifiers -Wimplicit-fallthrough -Wmissing-field-initializers -Wsign-compare -Wtype-limits -Wuninitialized -Wshift-negative-value -pthread -O3 -fPIC")
+- else()
+- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -Wall -Wno-psabi -Wempty-body -Wignored-qualifiers -Wimplicit-fallthrough -Wmissing-field-initializers -Wsign-compare -Wtype-limits -Wuninitialized -Wshift-negative-value -pthread -Os -fPIC")
+- endif()
++ set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Os -fPIC")
+ endif()
+
+ if (NOT MINGW)
+
+From a48f9f6dfa7f9aa443d5bf52295a24decbaf1480 Mon Sep 17 00:00:00 2001
+From: NexAdn <nex@nexadn.de>
+Date: Sat, 7 Jan 2023 13:13:53 +0100
+Subject: [PATCH 2/4] build: Drop manually set -fPIC and -std=c++17 flags on
+ Linux
+
+-std=c++17 is automatically set on demand by target_compile_features.
+-fPIC is set by default for SHARED and MODULE targets and can be enabled
+by target properties for STATIC targets.
+
+Issue: https://github.com/brainboxdotcc/DPP/issues/595
+---
+ library/CMakeLists.txt | 9 +++++----
+ 1 file changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt
+index 2dea07e7b7..245380d2b9 100644
+--- a/library/CMakeLists.txt
++++ b/library/CMakeLists.txt
+@@ -170,12 +170,12 @@ if(MSVC)
+ endif()
+ string(REGEX REPLACE "/W[1|2|3|4]" "/W3" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
+ else()
+- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -Wall -Wno-psabi -Wempty-body -Wignored-qualifiers -Wimplicit-fallthrough -Wmissing-field-initializers -Wsign-compare -Wtype-limits -Wuninitialized -Wshift-negative-value -pthread")
+- set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g -Og -fPIC")
++ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-psabi -Wempty-body -Wignored-qualifiers -Wimplicit-fallthrough -Wmissing-field-initializers -Wsign-compare -Wtype-limits -Wuninitialized -Wshift-negative-value -pthread")
++ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g -Og")
+ if (BUILD_O3)
+- set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -fPIC")
++ set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3")
+ else()
+- set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Os -fPIC")
++ set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Os")
+ endif()
+
+ if (NOT MINGW)
+@@ -202,6 +202,7 @@ foreach (fullmodname ${subdirlist})
+ PROPERTIES
+ VERSION ${CMAKE_PROJECT_VERSION}
+ SOVERSION ${CMAKE_PROJECT_VERSION}
++ POSITION_INDEPENDENT_CODE true
+ )
+ target_include_directories(${modname} PUBLIC
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>
+
+From 5c03764df94b4a1f1c48581ab9e5a94941c2da29 Mon Sep 17 00:00:00 2001
+From: Adrian Schollmeyer <git@nexadn.de>
+Date: Mon, 9 Jan 2023 13:07:42 +0100
+Subject: [PATCH 3/4] build: Drop explicitly set -O and -g flags for Linux
+ where possible
+
+CMake provides various build types which already set the correct -O
+levels and -g depending on the user's choice. This commit gets rid of
+the previous explicit setting of these flags where possible.
+
+Issue: https://github.com/brainboxdotcc/DPP/issues/595
+---
+ library/CMakeLists.txt | 7 +------
+ 1 file changed, 1 insertion(+), 6 deletions(-)
+
+diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt
+index 245380d2b9..5531dbaddf 100644
+--- a/library/CMakeLists.txt
++++ b/library/CMakeLists.txt
+@@ -171,12 +171,7 @@ if(MSVC)
+ string(REGEX REPLACE "/W[1|2|3|4]" "/W3" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
+ else()
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-psabi -Wempty-body -Wignored-qualifiers -Wimplicit-fallthrough -Wmissing-field-initializers -Wsign-compare -Wtype-limits -Wuninitialized -Wshift-negative-value -pthread")
+- set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g -Og")
+- if (BUILD_O3)
+- set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3")
+- else()
+- set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Os")
+- endif()
++ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Og")
+
+ if (NOT MINGW)
+ add_link_options("-rdynamic")
+
+From 373d694517d0f773b8b248d306a7014d6c199862 Mon Sep 17 00:00:00 2001
+From: Adrian Schollmeyer <git@nexadn.de>
+Date: Mon, 9 Jan 2023 18:52:49 +0100
+Subject: [PATCH 4/4] build: Make C++17 a public compile feature
+
+C++17 is required when building against DPP. As such, it should be a
+PUBLIC compile feature.
+---
+ library/CMakeLists.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt
+index 5531dbaddf..f558ce0816 100644
+--- a/library/CMakeLists.txt
++++ b/library/CMakeLists.txt
+@@ -240,7 +240,7 @@ foreach (fullmodname ${subdirlist})
+ endif()
+ endforeach()
+
+-target_compile_features(dpp PRIVATE cxx_std_17)
++target_compile_features(dpp PUBLIC cxx_std_17)
+ target_compile_features(dpp PRIVATE cxx_constexpr)
+ target_compile_features(dpp PRIVATE cxx_auto_type)
+ target_compile_features(dpp PRIVATE cxx_defaulted_functions)