commit:     c329e94b0515e8fc29b7234fe74bd6506fdf0383
Author:     Adrian Schollmeyer <nex+b-g-o <AT> nexadn <DOT> de>
AuthorDate: Wed Jan 10 09:02:00 2024 +0000
Commit:     Yixun Lan <dlan <AT> gentoo <DOT> org>
CommitDate: Fri Jan 12 00:11:56 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c329e94b

sys-process/btop: add 1.3.0

Closes: https://bugs.gentoo.org/919934
Closes: https://bugs.gentoo.org/898148
Closes: https://github.com/gentoo/gentoo/pull/34753
Signed-off-by: Adrian Schollmeyer <nex+b-g-o <AT> nexadn.de>
Signed-off-by: Yixun Lan <dlan <AT> gentoo.org>

 sys-process/btop/Manifest                          |  1 +
 sys-process/btop/btop-1.3.0.ebuild                 | 50 ++++++++++++++++++++++
 .../btop-1.3.0-configurable-fortification.patch    | 49 +++++++++++++++++++++
 3 files changed, 100 insertions(+)

diff --git a/sys-process/btop/Manifest b/sys-process/btop/Manifest
index e6b2ccbdcbb4..9549f453803d 100644
--- a/sys-process/btop/Manifest
+++ b/sys-process/btop/Manifest
@@ -1 +1,2 @@
 DIST btop-1.2.13.tar.gz 982660 BLAKE2B 
053c1ef87203b894c2cbe6007c3b5962dca232733d28f97d82a2f70e771d4cc92fe4c49d3582c80cb79974d65329d3e95e758b9e8a7fa51a2ff0cdbf6cbd9a75
 SHA512 
324e572d43e57e5e65e646aa743f7730e6d535fdc52e848aeb55d60c8d73945850c5b89fe0b541e98495ddf2bae71427a6ec8fe8a495b41cef885c535d01019b
+DIST btop-1.3.0.tar.gz 1142088 BLAKE2B 
9f29828e646a8a4de2cacb8d5eb2885afbb5cf7764c9e4344f0da79b44c7481ca2591524789d753bc227f5a28c18717eda3aa3d1bb9f307f37e2732e9bbbde55
 SHA512 
0c20e3e1648dcf7d416e8f0072d40ed4b3e558eeb749150e4881d260cd675932c9b25315578e378f880172fe6470a8afc2687e011b491a79bd3e29618448f397

diff --git a/sys-process/btop/btop-1.3.0.ebuild 
b/sys-process/btop/btop-1.3.0.ebuild
new file mode 100644
index 000000000000..753495ab9c7f
--- /dev/null
+++ b/sys-process/btop/btop-1.3.0.ebuild
@@ -0,0 +1,50 @@
+# Copyright 2021-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit toolchain-funcs optfeature xdg cmake
+
+DESCRIPTION="A monitor of resources"
+HOMEPAGE="https://github.com/aristocratos/btop";
+SRC_URI="
+       https://github.com/aristocratos/btop/archive/refs/tags/v${PV}.tar.gz -> 
${P}.tar.gz
+"
+
+LICENSE="Apache-2.0"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~arm64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~x86"
+
+PATCHES=(
+       # Backport of upstream PR 648. Remove after 1.3.0
+       "${FILESDIR}/${P}-configurable-fortification.patch"
+)
+
+pkg_setup() {
+       if [[ "${MERGE_TYPE}" != "binary" ]]; then
+               if tc-is-clang ; then
+                       if [[ "$(clang-major-version)" -lt 16 ]]; then
+                               die "sys-process/btop requires 
>=sys-devel/clang-16.0.0 to build."
+                       fi
+               elif ! tc-is-gcc ; then
+                       die "$(tc-getCXX) is not a supported compiler. Please 
use sys-devel/gcc or >=sys-devel/clang-16.0.0 instead."
+               fi
+       fi
+}
+
+src_configure() {
+       local mycmakeargs=(
+               -DBTOP_GPU=true
+               -DBTOP_RSMI_STATIC=false
+               # Fortification can be set in CXXFLAGS instead
+               -DBTOP_FORTIFY=false
+       )
+       cmake_src_configure
+}
+
+pkg_postinst() {
+       xdg_pkg_postinst
+
+       optfeature "GPU monitoring support (Radeon GPUs)" dev-util/rocm-smi
+       optfeature "GPU monitoring support (NVIDIA GPUs)" 
x11-drivers/nvidia-drivers
+}

diff --git a/sys-process/btop/files/btop-1.3.0-configurable-fortification.patch 
b/sys-process/btop/files/btop-1.3.0-configurable-fortification.patch
new file mode 100644
index 000000000000..f6fd873edb13
--- /dev/null
+++ b/sys-process/btop/files/btop-1.3.0-configurable-fortification.patch
@@ -0,0 +1,49 @@
+Patch from https://github.com/aristocratos/btop/pull/648/files.
+Allows to disable setting -D_FORTIFY_SOURCE in the build system,
+so the fortification level can be configured freely in make.conf.
+
+Bug: https://bugs.gentoo.org/898148
+
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -41,6 +41,7 @@ option(BTOP_LTO "Enable LTO" ON)
+ option(BTOP_USE_MOLD "Use mold to link btop" OFF)
+ option(BTOP_PEDANTIC "Enable a bunch of additional warnings" OFF)
+ option(BTOP_WERROR "Compile with warnings as errors" OFF)
++option(BTOP_FORTIFY "Detect buffer overflows with _FORTIFY_SOURCE=3" ON)
+ option(BTOP_GPU "Enable GPU support" ON)
+ cmake_dependent_option(BTOP_RSMI_STATIC "Link statically to ROCm SMI" OFF 
"BTOP_GPU" OFF)
+ 
+@@ -112,7 +113,7 @@ target_compile_definitions(btop PRIVATE
+   _FILE_OFFSET_BITS=64
+   $<$<CONFIG:Debug>:_GLIBCXX_ASSERTIONS _LIBCPP_ENABLE_ASSERTIONS=1>
+   # Only has an effect with optimizations enabled
+-  $<$<NOT:$<CONFIG:Debug>>:_FORTIFY_SOURCE=2>
++  $<$<AND:$<NOT:$<CONFIG:Debug>>,$<BOOL:${BTOP_FORTIFY}>>:_FORTIFY_SOURCE=3>
+ )
+ 
+ target_include_directories(btop SYSTEM PRIVATE include)
+--- a/Makefile
++++ b/Makefile
+@@ -50,6 +50,11 @@ ifeq ($(GPU_SUPPORT),true)
+       override ADDFLAGS += -DGPU_SUPPORT
+ endif
+ 
++FORTIFY_SOURCE ?= true
++ifeq ($(FORTIFY_SOURCE),true)
++      override ADDFLAGS += -D_FORTIFY_SOURCE=3
++endif
++
+ #? Compiler and Linker
+ ifeq ($(shell $(CXX) --version | grep clang >/dev/null 2>&1; echo $$?),0)
+       override CXX_IS_CLANG := true
+@@ -174,7 +179,7 @@ override GOODFLAGS := $(foreach flag,$(TESTFLAGS),$(strip 
$(shell echo "int main
+ override REQFLAGS   := -std=c++20
+ WARNFLAGS                     := -Wall -Wextra -pedantic
+ OPTFLAGS                      := -O2 -ftree-vectorize -flto=$(LTO)
+-LDCXXFLAGS                    := -pthread -D_FORTIFY_SOURCE=2 
-D_GLIBCXX_ASSERTIONS -D_FILE_OFFSET_BITS=64 $(GOODFLAGS) $(ADDFLAGS)
++LDCXXFLAGS                    := -pthread -D_GLIBCXX_ASSERTIONS 
-D_FILE_OFFSET_BITS=64 $(GOODFLAGS) $(ADDFLAGS)
+ override CXXFLAGS     += $(REQFLAGS) $(LDCXXFLAGS) $(OPTFLAGS) $(WARNFLAGS)
+ override LDFLAGS      += $(LDCXXFLAGS) $(OPTFLAGS) $(WARNFLAGS)
+ INC                                   := $(foreach incdir,$(INCDIRS),-isystem 
$(incdir)) -I$(SRCDIR)
+ 

Reply via email to