Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sys-process/btop: add 1.3.0 #34753

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions sys-process/btop/Manifest
Original file line number Diff line number Diff line change
@@ -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
50 changes: 50 additions & 0 deletions sys-process/btop/btop-1.3.0.ebuild
Original file line number Diff line number Diff line change
@@ -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
}
49 changes: 49 additions & 0 deletions sys-process/btop/files/btop-1.3.0-configurable-fortification.patch
Original file line number Diff line number Diff line change
@@ -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)