public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: sys-process/btop/files/, sys-process/btop/
@ 2022-10-10 11:49 Sam James
  0 siblings, 0 replies; 4+ messages in thread
From: Sam James @ 2022-10-10 11:49 UTC (permalink / raw
  To: gentoo-commits

commit:     b07006fc3f1e69ec7f4605b6b2caffb985658431
Author:     Adrian Schollmeyer <nex+b-g-o <AT> nexadn <DOT> de>
AuthorDate: Mon Oct 10 10:59:09 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Oct 10 11:44:30 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b07006fc

sys-process/btop: Make build output verbose

The build system didn't support verbose output before (i.e. it didn't
show the exact commands used to build a unit). Upstream recently added
such a verbose mode, which is backported to the current versions in
::gentoo by this commit.

Closes: https://bugs.gentoo.org/876319
Signed-off-by: Adrian Schollmeyer <nex+b-g-o <AT> nexadn.de>
Closes: https://github.com/gentoo/gentoo/pull/27725
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-process/btop/btop-1.2.12.ebuild                |  6 ++-
 sys-process/btop/btop-1.2.9.ebuild                 |  6 ++-
 .../btop/files/876319-verbose-makefile.patch       | 54 ++++++++++++++++++++++
 3 files changed, 64 insertions(+), 2 deletions(-)

diff --git a/sys-process/btop/btop-1.2.12.ebuild b/sys-process/btop/btop-1.2.12.ebuild
index 6bf13cbd7d95..5dbb46974fd7 100644
--- a/sys-process/btop/btop-1.2.12.ebuild
+++ b/sys-process/btop/btop-1.2.12.ebuild
@@ -17,6 +17,10 @@ BDEPEND="
 	>=sys-devel/gcc-8
 "
 
+PATCHES=(
+	"${FILESDIR}/876319-verbose-makefile.patch"
+)
+
 pkg_setup() {
 	if [[ "${MERGE_TYPE}" != "binary" ]]; then
 		if ! tc-is-gcc ; then
@@ -34,7 +38,7 @@ src_prepare() {
 
 src_compile() {
 	# Disable btop optimization flags, since we have our flags in CXXFLAGS
-	emake OPTFLAGS="" CXX="$(tc-getCXX)"
+	emake VERBOSE=true OPTFLAGS="" CXX="$(tc-getCXX)"
 }
 
 src_install() {

diff --git a/sys-process/btop/btop-1.2.9.ebuild b/sys-process/btop/btop-1.2.9.ebuild
index ee0bbdefbd6d..39aa6592146f 100644
--- a/sys-process/btop/btop-1.2.9.ebuild
+++ b/sys-process/btop/btop-1.2.9.ebuild
@@ -17,6 +17,10 @@ BDEPEND="
 	>=sys-devel/gcc-8
 "
 
+PATCHES=(
+	"${FILESDIR}/876319-verbose-makefile.patch"
+)
+
 pkg_setup() {
 	if [[ "${MERGE_TYPE}" != "binary" ]]; then
 		if ! tc-is-gcc ; then
@@ -34,7 +38,7 @@ src_prepare() {
 
 src_compile() {
 	# Disable btop optimization flags, since we have our flags in CXXFLAGS
-	emake OPTFLAGS="" CXX="$(tc-getCXX)"
+	emake VERBOSE=true OPTFLAGS="" CXX="$(tc-getCXX)"
 }
 
 src_install() {

diff --git a/sys-process/btop/files/876319-verbose-makefile.patch b/sys-process/btop/files/876319-verbose-makefile.patch
new file mode 100644
index 000000000000..ef2199d728d1
--- /dev/null
+++ b/sys-process/btop/files/876319-verbose-makefile.patch
@@ -0,0 +1,54 @@
+# Backport of upstream commit 080a47e6496f12f616b811e0d2f8f36c62d397e2
+# See https://bugs.gentoo.org/876319
+diff --git a/Makefile b/Makefile
+index d1bc95d..6a36c76 100644
+--- a/Makefile
++++ b/Makefile
+@@ -18,6 +18,9 @@ else
+ 	override PRE := info-quiet
+ endif
+ 
++OLDCXX := $(CXXFLAGS)
++OLDLD := $(LDFLAGS)
++
+ PREFIX ?= /usr/local
+ 
+ #? Detect PLATFORM and ARCH from uname/gcc if not set
+@@ -53,6 +56,10 @@ ifeq ($(STRIP),true)
+ 	override ADDFLAGS += -s
+ endif
+ 
++ifneq ($(VERBOSE),true)
++	override VERBOSE := false
++endif
++
+ #? Compiler and Linker
+ ifeq ($(shell command -v g++-11 >/dev/null; echo $$?),0)
+ 	CXX := g++-11
+@@ -167,8 +174,8 @@ info:
+ 	@printf "\033[1;91mWARNFLAGS  \033[1;94m:| \033[0m$(WARNFLAGS)\n"
+ 	@printf "\033[1;94mOPTFLAGS   \033[1;94m:| \033[0m$(OPTFLAGS)\n"
+ 	@printf "\033[1;93mLDCXXFLAGS \033[1;94m:| \033[0m$(LDCXXFLAGS)\n"
+-	@printf "\033[1;95mCXXFLAGS   \033[1;92m+| \033[0;37m\$$(\033[92mREQFLAGS\033[37m) \$$(\033[93mLDCXXFLAGS\033[37m) \$$(\033[94mOPTFLAGS\033[37m) \$$(\033[91mWARNFLAGS\033[37m)\n"
+-	@printf "\033[1;95mLDFLAGS    \033[1;92m+| \033[0;37m\$$(\033[93mLDCXXFLAGS\033[37m) \$$(\033[94mOPTFLAGS\033[37m) \$$(\033[91mWARNFLAGS\033[37m)\n"
++	@printf "\033[1;95mCXXFLAGS   \033[1;92m+| \033[0;37m\$$(\033[92mREQFLAGS\033[37m) \$$(\033[93mLDCXXFLAGS\033[37m) \$$(\033[94mOPTFLAGS\033[37m) \$$(\033[91mWARNFLAGS\033[37m) $(OLDCXX)\n"
++	@printf "\033[1;95mLDFLAGS    \033[1;92m+| \033[0;37m\$$(\033[93mLDCXXFLAGS\033[37m) \$$(\033[94mOPTFLAGS\033[37m) \$$(\033[91mWARNFLAGS\033[37m) $(OLDLD)\n"
+ 
+ info-quiet:
+ 	@sleep 0.1 2>/dev/null || true
+@@ -252,6 +259,7 @@ btop: $(OBJECTS)
+ 	@sleep 0.2 2>/dev/null || true
+ 	@TSTAMP=$$(date +%s 2>/dev/null || echo "0")
+ 	@$(QUIET) || printf "\n\033[1;92mLinking and optimizing binary\033[37m...\033[0m\n"
++	@$(VERBOSE) && printf "$(CXX) -o $(TARGETDIR)/btop $^ $(LDFLAGS)\n"
+ 	@$(CXX) -o $(TARGETDIR)/btop $^ $(LDFLAGS) || exit 1
+ 	@printf "\033[1;92m100$(P) -> \033[1;37m$(TARGETDIR)/btop \033[100D\033[38C\033[1;93m(\033[1;97m$$(du -ah $(TARGETDIR)/btop | cut -f1)iB\033[1;93m) \033[92m(\033[97m$$($(DATE_CMD) -d @$$(expr $$(date +%s 2>/dev/null || echo "0") - $${TSTAMP} 2>/dev/null) -u +%Mm:%Ss 2>/dev/null | sed 's/^00m://' || echo '')\033[92m)\033[0m\n"
+ 	@printf "\n\033[1;92mBuild complete in \033[92m(\033[97m$$($(DATE_CMD) -d @$$(expr $$(date +%s 2>/dev/null || echo "0") - $(TIMESTAMP) 2>/dev/null) -u +%Mm:%Ss 2>/dev/null | sed 's/^00m://' || echo "unknown")\033[92m)\033[0m\n"
+@@ -262,6 +270,7 @@ $(BUILDDIR)/%.$(OBJEXT): $(SRCDIR)/%.$(SRCEXT)
+ 	@sleep 0.3 2>/dev/null || true
+ 	@TSTAMP=$$(date +%s 2>/dev/null || echo "0")
+ 	@$(QUIET) || printf "\033[1;97mCompiling $<\033[0m\n"
++	@$(VERBOSE) && printf "$(CXX) $(CXXFLAGS) $(INC) -MMD -c -o $@ $<\n"
+ 	@$(CXX) $(CXXFLAGS) $(INC) -MMD -c -o $@ $< || exit 1
+ 	@printf "\033[1;92m$$($(PROGRESS))$(P)\033[10D\033[5C-> \033[1;37m$@ \033[100D\033[38C\033[1;93m(\033[1;97m$$(du -ah $@ | cut -f1)iB\033[1;93m) \033[92m(\033[97m$$($(DATE_CMD) -d @$$(expr $$($(DATE_CMD) +%s 2>/dev/null || echo "0") - $${TSTAMP} 2>/dev/null) -u +%Mm:%Ss 2>/dev/null | sed 's/^00m://' || echo '')\033[92m)\033[0m\n"
+ 


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-process/btop/files/, sys-process/btop/
@ 2023-06-25  7:22 Sam James
  0 siblings, 0 replies; 4+ messages in thread
From: Sam James @ 2023-06-25  7:22 UTC (permalink / raw
  To: gentoo-commits

commit:     47740cd72e28a74bd91c71302e7993b5fa224439
Author:     Violet Purcell <vimproved <AT> inventati <DOT> org>
AuthorDate: Tue Jun 20 00:49:37 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Jun 25 07:22:08 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=47740cd7

sys-process/btop: Backport patch to allow compilation with clang >=16

Bug: https://bugs.gentoo.org/839318
Signed-off-by: Violet Purcell <vimproved <AT> inventati.org>
Closes: https://github.com/gentoo/gentoo/pull/31534
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-process/btop/btop-1.2.13-r2.ebuild             |   4 +
 .../btop/files/btop-1.2.13-allow-clang.patch       | 191 +++++++++++++++++++++
 2 files changed, 195 insertions(+)

diff --git a/sys-process/btop/btop-1.2.13-r2.ebuild b/sys-process/btop/btop-1.2.13-r2.ebuild
index 22dd41185a5b..a061530402ae 100644
--- a/sys-process/btop/btop-1.2.13-r2.ebuild
+++ b/sys-process/btop/btop-1.2.13-r2.ebuild
@@ -22,6 +22,10 @@ PATCHES=(
 	# Backported fix for https://bugs.gentoo.org/908670
 	# can be removed in 1.2.14 or later
 	"${FILESDIR}/${P}-musl-1.2.4-lfs64.patch"
+
+	# Backported patch to allow compilation with clang 16 or above
+	# can be removed in 1.2.14 or later
+	"${FILESDIR}/${P}-allow-clang.patch"
 )
 
 pkg_setup() {

diff --git a/sys-process/btop/files/btop-1.2.13-allow-clang.patch b/sys-process/btop/files/btop-1.2.13-allow-clang.patch
new file mode 100644
index 000000000000..68f2434dc7e8
--- /dev/null
+++ b/sys-process/btop/files/btop-1.2.13-allow-clang.patch
@@ -0,0 +1,191 @@
+Support compiling with clang 16 or above.
+
+Bug: https://bugs.gentoo.org/839318
+Upstream Commit: https://github.com/aristocratos/btop/commit/7e50b03e391a346b2b6ce92be332c58d91f75a000w
+
+With hunks from:
+From af7d5086fce8d995f3f8b10677d107a1124a12bf Mon Sep 17 00:00:00 2001
+From: "Jakob P. Liljenberg" <admin@qvantnet.com>
+Date: Thu, 15 Jun 2023 17:45:05 +0200
+Subject: [PATCH] Merge pull request #510 from nobounce/LLVM
+--- a/Makefile
++++ b/Makefile
+@@ -1,4 +1,4 @@
+-#* Btop++ makefile v1.5
++#* Btop++ makefile v1.6
+ 
+ BANNER  = \n \033[38;5;196m██████\033[38;5;240m╗ \033[38;5;196m████████\033[38;5;240m╗ \033[38;5;196m██████\033[38;5;240m╗ \033[38;5;196m██████\033[38;5;240m╗\n \033[38;5;160m██\033[38;5;239m╔══\033[38;5;160m██\033[38;5;239m╗╚══\033[38;5;160m██\033[38;5;239m╔══╝\033[38;5;160m██\033[38;5;239m╔═══\033[38;5;160m██\033[38;5;239m╗\033[38;5;160m██\033[38;5;239m╔══\033[38;5;160m██\033[38;5;239m╗   \033[38;5;160m██\033[38;5;239m╗    \033[38;5;160m██\033[38;5;239m╗\n \033[38;5;124m██████\033[38;5;238m╔╝   \033[38;5;124m██\033[38;5;238m║   \033[38;5;124m██\033[38;5;238m║   \033[38;5;124m██\033[38;5;238m║\033[38;5;124m██████\033[38;5;238m╔╝ \033[38;5;124m██████\033[38;5;238m╗\033[38;5;124m██████\033[38;5;238m╗\n \033[38;5;88m██\033[38;5;237m╔══\033[38;5;88m██\033[3
 8;5;237m╗   \033[38;5;88m██\033[38;5;237m║   \033[38;5;88m██\033[38;5;237m║   \033[38;5;88m██\033[38;5;237m║\033[38;5;88m██\033[38;5;237m╔═══╝  ╚═\033[38;5;88m██\033[38;5;237m╔═╝╚═\033[38;5;88m██\033[38;5;237m╔═╝\n \033[38;5;52m██████\033[38;5;236m╔╝   \033[38;5;52m██\033[38;5;236m║   ╚\033[38;5;52m██████\033[38;5;236m╔╝\033[38;5;52m██\033[38;5;236m║        ╚═╝    ╚═╝\n \033[38;5;235m╚═════╝    ╚═╝    ╚═════╝ ╚═╝      \033[1;3;38;5;240mMakefile v1.5\033[0m
+ 
+@@ -39,6 +39,46 @@ endif
+ 
+ override PLATFORM_LC := $(shell echo $(PLATFORM) | tr '[:upper:]' '[:lower:]')
+ 
++#? Compiler and Linker
++ifeq ($(shell $(CXX) --version | grep clang >/dev/null 2>&1; echo $$?),0)
++	override CXX_IS_CLANG := true
++endif
++override CXX_VERSION := $(shell $(CXX) -dumpfullversion -dumpversion || echo 0)
++override CXX_VERSION_MAJOR := $(shell echo $(CXX_VERSION) | cut -d '.' -f 1)
++
++CLANG_WORKS = false
++GCC_WORKS = false
++
++#? Supported is Clang 16.0.0 and later
++ifeq ($(CXX_IS_CLANG),true)
++	ifneq ($(shell test $(CXX_VERSION_MAJOR) -lt 16; echo $$?),0)
++		CLANG_WORKS := true
++	endif
++endif
++ifeq ($(CLANG_WORKS),false)
++	#? Try to find a newer GCC version
++	ifeq ($(shell command -v g++-12 >/dev/null; echo $$?),0)
++		CXX := g++-12
++	else ifeq ($(shell command -v g++-11 >/dev/null; echo $$?),0)
++		CXX := g++-11
++	else ifeq ($(shell command -v g++11 >/dev/null; echo $$?),0)
++		CXX := g++11
++	else ifeq ($(shell command -v g++ >/dev/null; echo $$?),0)
++		CXX := g++
++	endif
++	override CXX_VERSION := $(shell $(CXX) -dumpfullversion -dumpversion || echo 0)
++	override CXX_VERSION_MAJOR := $(shell echo $(CXX_VERSION) | cut -d '.' -f 1)
++	ifneq ($(shell test $(CXX_VERSION_MAJOR) -lt 10; echo $$?),0)
++		GCC_WORKS := true
++	endif
++endif
++
++ifeq ($(CLANG_WORKS),false)
++	ifeq ($(GCC_WORKS),false)
++$(error $(shell printf "\033[1;91mERROR: \033[97mCompiler too old. (Requires Clang 16.0.0, GCC 10.1.0)\033[0m"))
++	endif
++endif
++
+ #? Any flags added to TESTFLAGS must not contain whitespace for the testing to work
+ override TESTFLAGS := -fexceptions -fstack-clash-protection -fcf-protection
+ ifneq ($(PLATFORM) $(ARCH),macos arm64)
+@@ -46,7 +86,13 @@ ifneq ($(PLATFORM) $(ARCH),macos arm64)
+ endif
+ 
+ ifeq ($(STATIC),true)
+-	override ADDFLAGS += -static-libgcc -static-libstdc++
++	ifeq ($(CXX_IS_CLANG),true)
++		ifeq ($(shell $(CXX) -print-target-triple | grep gnu >/dev/null; echo $$?),0)
++$(error $(shell printf "\033[1;91mERROR: \033[97m$(CXX) can't statically link glibc\033[0m"))
++		endif
++	else
++		override ADDFLAGS += -static-libgcc -static-libstdc++
++	endif
+ 	ifneq ($(PLATFORM),macos)
+ 		override ADDFLAGS += -DSTATIC_BUILD -static -Wl,--fatal-warnings
+ 	endif
+@@ -62,33 +108,6 @@ else
+ 	override VERBOSE := true
+ endif
+ 
+-#? Compiler and Linker
+-ifeq ($(shell command -v g++-12 >/dev/null; echo $$?),0)
+-	CXX := g++-12
+-else ifeq ($(shell command -v g++-11 >/dev/null; echo $$?),0)
+-	CXX := g++-11
+-else ifeq ($(shell command -v g++11 >/dev/null; echo $$?),0)
+-	CXX := g++11
+-else ifeq ($(shell command -v g++ >/dev/null; echo $$?),0)
+-	CXX := g++
+-endif
+-override CXX_VERSION := $(shell $(CXX) -dumpfullversion -dumpversion || echo 0)
+-
+-#? Try to make sure we are using GCC/G++ version 11 or later if not instructed to use g++-10
+-ifeq ($(CXX),g++)
+-	ifeq ($(shell g++ --version | grep clang >/dev/null 2>&1; echo $$?),0)
+-		V_MAJOR := 0
+-	else
+-		V_MAJOR := $(shell echo $(CXX_VERSION) | cut -f1 -d".")
+-	endif
+-	ifneq ($(shell test $(V_MAJOR) -ge 11; echo $$?),0)
+-		ifeq ($(shell command -v g++-11 >/dev/null; echo $$?),0)
+-			override CXX := g++-11
+-			override CXX_VERSION := $(shell $(CXX) -dumpfullversion -dumpversion || echo 0)
+-		endif
+-	endif
+-endif
+-
+ #? Pull in platform specific source files and get thread count
+ ifeq ($(PLATFORM_LC),linux)
+ 	PLATFORM_DIR := linux
+@@ -115,6 +134,13 @@ ifeq ($(THREADS),1)
+ 	override THREADS := auto
+ endif
+ 
++#? LTO command line
++ifeq ($(CLANG_WORKS),true)
++	LTO := thin
++else
++	LTO := $(THREADS)
++endif
++
+ #? The Directories, Source, Includes, Objects and Binary
+ SRCDIR		:= src
+ INCDIR		:= include
+@@ -130,8 +156,8 @@ override GOODFLAGS := $(foreach flag,$(TESTFLAGS),$(strip $(shell echo "int main
+ #? Flags, Libraries and Includes
+ override REQFLAGS   := -std=c++20
+ WARNFLAGS			:= -Wall -Wextra -pedantic
+-OPTFLAGS			:= -O2 -ftree-loop-vectorize -flto=$(THREADS)
++OPTFLAGS			:= -O2 -ftree-vectorize -flto=$(LTO)
+ LDCXXFLAGS			:= -pthread -D_FORTIFY_SOURCE=2 -D_GLIBCXX_ASSERTIONS -D_FILE_OFFSET_BITS=64 $(GOODFLAGS) $(ADDFLAGS)
+ override CXXFLAGS	+= $(REQFLAGS) $(LDCXXFLAGS) $(OPTFLAGS) $(WARNFLAGS)
+ override LDFLAGS	+= $(LDCXXFLAGS) $(OPTFLAGS) $(WARNFLAGS)
+ INC					:= -I$(INCDIR) -I$(SRCDIR)
+--- a/src/btop.cpp
++++ b/src/btop.cpp
+@@ -37,6 +37,11 @@ tab-size = 4
+ 	#include <mach-o/dyld.h>
+ 	#include <limits.h>
+ #endif
++#if !defined(__clang__) && __GNUC__ < 11
++	#include <semaphore.h>
++#else
++	#include <semaphore>
++#endif
+ 
+ #include <btop_shared.hpp>
+ #include <btop_tools.hpp>
+@@ -321,14 +326,12 @@ namespace Runner {
+ 	atomic<bool> coreNum_reset (false);
+ 
+ 	//* Setup semaphore for triggering thread to do work
+-#if __GNUC__ < 11
+-	#include <semaphore.h>
++#if !defined(__clang__) && __GNUC__ < 11
+ 	sem_t do_work;
+ 	inline void thread_sem_init() { sem_init(&do_work, 0, 0); }
+ 	inline void thread_wait() { sem_wait(&do_work); }
+ 	inline void thread_trigger() { sem_post(&do_work); }
+ #else
+-	#include <semaphore>
+ 	std::binary_semaphore do_work(0);
+ 	inline void thread_sem_init() { ; }
+ 	inline void thread_wait() { do_work.acquire(); }
+--- a/src/btop_tools.cpp
++++ b/src/btop_tools.cpp
+@@ -17,6 +17,7 @@ tab-size = 4
+ */
+ 
+ #include <cmath>
++#include <codecvt>
+ #include <iostream>
+ #include <fstream>
+ #include <ctime>
+--- a/src/btop.cpp
++++ b/src/btop.cpp
+@@ -657,7 +657,7 @@ namespace Runner {
+ 				<< Term::sync_end << flush;
+ 		}
+ 		//* ----------------------------------------------- THREAD LOOP -----------------------------------------------
+-		pthread_exit(NULL);
++		return {};
+ 	}
+ 	//? ------------------------------------------ Secondary thread end -----------------------------------------------
+
+-- 
+2.41.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-process/btop/files/, sys-process/btop/
@ 2023-06-25  7:22 Sam James
  0 siblings, 0 replies; 4+ messages in thread
From: Sam James @ 2023-06-25  7:22 UTC (permalink / raw
  To: gentoo-commits

commit:     c8f21b68cbb2af2738dbc972166f6b4bfa4e4494
Author:     Violet Purcell <vimproved <AT> inventati <DOT> org>
AuthorDate: Mon Jun 19 21:56:50 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Jun 25 07:22:07 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c8f21b68

sys-process/btop: Backport musl 1.2.4 fix

Closes: https://bugs.gentoo.org/908670
Signed-off-by: Violet Purcell <vimproved <AT> inventati.org>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-process/btop/btop-1.2.13-r2.ebuild             | 67 ++++++++++++++++++++++
 .../btop/files/btop-1.2.13-musl-1.2.4-lfs64.patch  | 39 +++++++++++++
 2 files changed, 106 insertions(+)

diff --git a/sys-process/btop/btop-1.2.13-r2.ebuild b/sys-process/btop/btop-1.2.13-r2.ebuild
new file mode 100644
index 000000000000..22dd41185a5b
--- /dev/null
+++ b/sys-process/btop/btop-1.2.13-r2.ebuild
@@ -0,0 +1,67 @@
+# Copyright 2021-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit toolchain-funcs xdg-utils
+
+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 ~mips ~ppc ~ppc64 ~riscv ~x86"
+
+PATCHES=(
+	# Backported fixes for https://bugs.gentoo.org/884005,
+	# can be removed in 1.2.14 or later
+	"${FILESDIR}/${P}-fix-makefile-deps.patch"
+	"${FILESDIR}/${P}-verbose-mkdir.patch"
+
+	# Backported fix for https://bugs.gentoo.org/908670
+	# can be removed in 1.2.14 or later
+	"${FILESDIR}/${P}-musl-1.2.4-lfs64.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_prepare() {
+	default
+	# btop installs README.md to /usr/share/btop by default
+	sed -i '/^.*cp -p README.md.*$/d' Makefile || die
+}
+
+src_compile() {
+	# Disable btop optimization flags, since we have our flags in CXXFLAGS
+	emake VERBOSE=true OPTFLAGS="" CXX="$(tc-getCXX)"
+}
+
+src_install() {
+	emake \
+		PREFIX="${EPREFIX}/usr" \
+		DESTDIR="${D}" \
+		install
+
+	dodoc README.md CHANGELOG.md
+}
+
+pkg_postinst() {
+	xdg_desktop_database_update
+	xdg_icon_cache_update
+}
+
+pkg_postrm() {
+	xdg_desktop_database_update
+	xdg_icon_cache_update
+}

diff --git a/sys-process/btop/files/btop-1.2.13-musl-1.2.4-lfs64.patch b/sys-process/btop/files/btop-1.2.13-musl-1.2.4-lfs64.patch
new file mode 100644
index 000000000000..e91fa7d7de9c
--- /dev/null
+++ b/sys-process/btop/files/btop-1.2.13-musl-1.2.4-lfs64.patch
@@ -0,0 +1,39 @@
+Fix for building on musl 1.2.4 and above due to deprecation of LFS64 interfaces.
+
+Bug: https://bugs.gentoo.org/908670
+Upstream Commit: https://github.com/aristocratos/btop/commit/7e50b03e391a346b2b6ce92be332c58d91f75a000w
+
+With hunks from:
+From af7d5086fce8d995f3f8b10677d107a1124a12bf Mon Sep 17 00:00:00 2001
+From: "Jakob P. Liljenberg" <admin@qvantnet.com>
+Date: Thu, 15 Jun 2023 17:45:05 +0200
+Subject: [PATCH] Merge pull request #510 from nobounce/LLVM
+--- a/src/linux/btop_collect.cpp
++++ b/src/linux/btop_collect.cpp
+@@ -1079,9 +1079,9 @@ namespace Mem {
+ 				bool new_ignored = false;
+ 				for (auto& [mountpoint, disk] : disks) {
+ 					if (std::error_code ec; not fs::exists(mountpoint, ec) or v_contains(ignore_list, mountpoint)) continue;
+-					struct statvfs64 vfs;
+-					if (statvfs64(mountpoint.c_str(), &vfs) < 0) {
+-						Logger::warning("Failed to get disk/partition stats for mount \""+ mountpoint + "\" with statvfs64 error code: " + to_string(errno) + ". Ignoring...");
++					struct statvfs vfs;
++					if (statvfs(mountpoint.c_str(), &vfs) < 0) {
++						Logger::warning("Failed to get disk/partition stats for mount \""+ mountpoint + "\" with statvfs error code: " + to_string(errno) + ". Ignoring...");
+ 						ignore_list.push_back(mountpoint);
+ 						new_ignored = true;
+ 						continue;
+--- a/Makefile
++++ b/Makefile
+@@ -130,8 +156,8 @@ override GOODFLAGS := $(foreach flag,$(TESTFLAGS),$(strip $(shell echo "int main
+ #? Flags, Libraries and Includes
+ override REQFLAGS   := -std=c++20
+ WARNFLAGS			:= -Wall -Wextra -pedantic
+ OPTFLAGS			:= -O2 -ftree-loop-vectorize -flto=$(THREADS)
+-LDCXXFLAGS			:= -pthread -D_FORTIFY_SOURCE=2 -D_GLIBCXX_ASSERTIONS $(GOODFLAGS) $(ADDFLAGS)
++LDCXXFLAGS			:= -pthread -D_FORTIFY_SOURCE=2 -D_GLIBCXX_ASSERTIONS -D_FILE_OFFSET_BITS=64 $(GOODFLAGS) $(ADDFLAGS)
+ override CXXFLAGS	+= $(REQFLAGS) $(LDCXXFLAGS) $(OPTFLAGS) $(WARNFLAGS)
+ override LDFLAGS	+= $(LDCXXFLAGS) $(OPTFLAGS) $(WARNFLAGS)
+ INC					:= -I$(INCDIR) -I$(SRCDIR)
+-- 
+2.41.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: sys-process/btop/files/, sys-process/btop/
@ 2024-01-12  0:21 Yixun Lan
  0 siblings, 0 replies; 4+ messages in thread
From: Yixun Lan @ 2024-01-12  0:21 UTC (permalink / raw
  To: gentoo-commits

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)
+ 


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-01-12  0:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-25  7:22 [gentoo-commits] repo/gentoo:master commit in: sys-process/btop/files/, sys-process/btop/ Sam James
  -- strict thread matches above, loose matches on Subject: below --
2024-01-12  0:21 Yixun Lan
2023-06-25  7:22 Sam James
2022-10-10 11:49 Sam James

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox