mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-11-21 10:37:22 -08:00
sys-process/btop: Backport musl 1.2.4 fix
Closes: https://bugs.gentoo.org/908670 Signed-off-by: Violet Purcell <vimproved@inventati.org> Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
@@ -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
|
||||
}
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user