aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToni Uhlig <matzeton@googlemail.com>2022-09-07 11:31:32 +0200
committerToni Uhlig <matzeton@googlemail.com>2022-09-11 12:23:12 +0200
commitf72eba39cbe47af9919797326eaf28dc06daa5c8 (patch)
treea88eb107062e06b522499c498d273ea7962353e7
btop: add package
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
-rw-r--r--admin/btop/Makefile46
-rw-r--r--admin/btop/patches/0001-fix-broken-makefile.patch269
-rw-r--r--admin/btop/patches/0002-disable-unicode-check.patch16
3 files changed, 331 insertions, 0 deletions
diff --git a/admin/btop/Makefile b/admin/btop/Makefile
new file mode 100644
index 0000000..a8df7ea
--- /dev/null
+++ b/admin/btop/Makefile
@@ -0,0 +1,46 @@
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=btop
+PKG_RELEASE:=1
+PKG_VERSION:=1.2.8
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=https://codeload.github.com/aristocratos/btop/tar.gz/v$(PKG_VERSION)?
+PKG_HASH:=7944b06e3181cc1080064adf1e9eb4f466af0b84a127df6697430736756a89ac
+
+PKG_MAINTAINER:=Toni Uhlig <matzeton@googlemail.com>
+PKG_LICENSE:=Apache-2.0
+PKG_LICENSE_FILES:=LICENSE
+
+PKG_BUILD_PARALLEL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/btop
+ SECTION:=admin
+ CATEGORY:=Administration
+ TITLE:=A monitor of resources
+ DEPENDS:=+libstdcpp
+ URL:=https://github.com/aristocratos/btop
+endef
+
+define Package/btop/description
+ Resource monitor that shows usage and stats for
+ processor, memory, disks, network and processes.
+ C++ version and continuation of bashtop and bpytop.
+endef
+
+MAKE_FLAGS += \
+ QUIET=true BANNER='' LDCXXFLAGS=''
+
+define Package/btop/install
+ $(INSTALL_DIR) $(1)/usr/bin
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/btop $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,btop))
diff --git a/admin/btop/patches/0001-fix-broken-makefile.patch b/admin/btop/patches/0001-fix-broken-makefile.patch
new file mode 100644
index 0000000..dce75a0
--- /dev/null
+++ b/admin/btop/patches/0001-fix-broken-makefile.patch
@@ -0,0 +1,269 @@
+--- a/Makefile
++++ b/Makefile
+@@ -2,14 +2,14 @@
+
+ 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[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╔═╝╚═\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
+
+-override BTOP_VERSION := $(shell head -n100 src/btop.cpp 2>/dev/null | grep "Version =" | cut -f2 -d"\"" || echo " unknown")
+-override TIMESTAMP := $(shell date +%s 2>/dev/null || echo "0")
+-override DATESTAMP := $(shell date '+%Y-%m-%d %H:%M:%S' || echo "5 minutes ago")
+-ifeq ($(shell command -v gdate >/dev/null; echo $$?),0)
+- DATE_CMD := gdate
+-else
+- DATE_CMD := date
+-endif
++#override BTOP_VERSION := $(shell head -n100 src/btop.cpp 2>/dev/null | grep "Version =" | cut -f2 -d"\"" || echo " unknown")
++#override TIMESTAMP := $(shell date +%s 2>/dev/null || echo "0")
++#override DATESTAMP := $(shell date '+%Y-%m-%d %H:%M:%S' || echo "5 minutes ago")
++#ifeq ($(shell command -v gdate >/dev/null; echo $$?),0)
++# DATE_CMD := gdate
++#else
++# DATE_CMD := date
++#endif
+
+ ifneq ($(QUIET),true)
+ override PRE := info info-quiet
+@@ -21,26 +21,26 @@ endif
+ PREFIX ?= /usr/local
+
+ #? Detect PLATFORM and ARCH from uname/gcc if not set
+-PLATFORM ?= $(shell uname -s || echo unknown)
+-ifneq ($(filter unknown Darwin, $(PLATFORM)),)
+- override PLATFORM := $(shell $(CXX) -dumpmachine | awk -F"-" '{ print (NF==4) ? $$3 : $$2 }')
+- ifeq ($(PLATFORM),apple)
+- override PLATFORM := macos
+- endif
+-endif
+-ifeq ($(shell uname -v | grep ARM64 >/dev/null 2>&1; echo $$?),0)
+- ARCH ?= arm64
+-else
+- ARCH ?= $(shell $(CXX) -dumpmachine | cut -d "-" -f 1)
+-endif
+-
+-override PLATFORM_LC := $(shell echo $(PLATFORM) | tr '[:upper:]' '[:lower:]')
++#PLATFORM ?= $(shell uname -s || echo unknown)
++#ifneq ($(filter unknown Darwin, $(PLATFORM)),)
++# override PLATFORM := $(shell $(CXX) -dumpmachine | awk -F"-" '{ print (NF==4) ? $$3 : $$2 }')
++# ifeq ($(PLATFORM),apple)
++# override PLATFORM := macos
++# endif
++#endif
++#ifeq ($(shell uname -v | grep ARM64 >/dev/null 2>&1; echo $$?),0)
++# ARCH ?= arm64
++#else
++# ARCH ?= $(shell $(CXX) -dumpmachine | cut -d "-" -f 1)
++#endif
++
++#override PLATFORM_LC := $(shell echo $(PLATFORM) | tr '[:upper:]' '[:lower:]')
+
+ #? 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)
+- override TESTFLAGS += -fstack-protector
+-endif
++#override TESTFLAGS := -fexceptions -fstack-clash-protection -fcf-protection
++#ifneq ($(PLATFORM) $(ARCH),macos arm64)
++# override TESTFLAGS += -fstack-protector
++#endif
+
+ ifeq ($(STATIC),true)
+ override ADDFLAGS += -static-libgcc -static-libstdc++
+@@ -54,55 +54,55 @@ ifeq ($(STRIP),true)
+ endif
+
+ #? Compiler and Linker
+-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)
++#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
++#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
+- THREADS := $(shell getconf _NPROCESSORS_ONLN 2>/dev/null || echo 1)
+- SU_GROUP := root
+-else ifeq ($(PLATFORM_LC),freebsd)
+- PLATFORM_DIR := freebsd
+- THREADS := $(shell getconf NPROCESSORS_ONLN 2>/dev/null || echo 1)
+- SU_GROUP := wheel
+- override ADDFLAGS += -lstdc++ -lm -lkvm -ldevstat -Wl,-rpath=/usr/local/lib/gcc11
+- export MAKE = gmake
+-else ifeq ($(PLATFORM_LC),macos)
+- PLATFORM_DIR := osx
+- THREADS := $(shell sysctl -n hw.ncpu || echo 1)
+- override ADDFLAGS += -framework IOKit -framework CoreFoundation -Wno-format-truncation
+- SU_GROUP := wheel
+-else
+-$(error $(shell printf "\033[1;91mERROR: \033[97mUnsupported platform ($(PLATFORM))\033[0m"))
+-endif
++#ifeq ($(PLATFORM_LC),linux)
++PLATFORM_DIR := linux
++# THREADS := $(shell getconf _NPROCESSORS_ONLN 2>/dev/null || echo 1)
++# SU_GROUP := root
++#else ifeq ($(PLATFORM_LC),freebsd)
++# PLATFORM_DIR := freebsd
++# THREADS := $(shell getconf NPROCESSORS_ONLN 2>/dev/null || echo 1)
++# SU_GROUP := wheel
++# override ADDFLAGS += -lstdc++ -lm -lkvm -ldevstat -Wl,-rpath=/usr/local/lib/gcc11
++# export MAKE = gmake
++#else ifeq ($(PLATFORM_LC),macos)
++# PLATFORM_DIR := osx
++# THREADS := $(shell sysctl -n hw.ncpu || echo 1)
++# override ADDFLAGS += -framework IOKit -framework CoreFoundation -Wno-format-truncation
++# SU_GROUP := wheel
++#else
++#$(error $(shell printf "\033[1;91mERROR: \033[97mUnsupported platform ($(PLATFORM))\033[0m"))
++#endif
+
+ #? Use all CPU cores (will only be set if using Make 4.3+)
+-MAKEFLAGS := --jobs=$(THREADS)
+-ifeq ($(THREADS),1)
+- override THREADS := auto
+-endif
++#MAKEFLAGS := --jobs=$(THREADS)
++#ifeq ($(THREADS),1)
++# override THREADS := auto
++#endif
+
+ #? The Directories, Source, Includes, Objects and Binary
+ SRCDIR := src
+@@ -114,18 +114,21 @@ DEPEXT := d
+ OBJEXT := o
+
+ #? Filter out unsupported compiler flags
+-override GOODFLAGS := $(foreach flag,$(TESTFLAGS),$(strip $(shell echo "int main() {}" | $(CXX) -o /dev/null $(flag) -x c++ - >/dev/null 2>&1 && echo $(flag) || true)))
++#override GOODFLAGS := $(foreach flag,$(TESTFLAGS),$(strip $(shell echo "int main() {}" | $(CXX) -o /dev/null $(flag) -x c++ - >/dev/null 2>&1 && echo $(flag) || true)))
+
+ #? 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)
+-override CXXFLAGS += $(REQFLAGS) $(LDCXXFLAGS) $(OPTFLAGS) $(WARNFLAGS)
+-override LDFLAGS += $(LDCXXFLAGS) $(OPTFLAGS) $(WARNFLAGS)
++#override CXXFLAGS += $(REQFLAGS) $(LDCXXFLAGS) $(OPTFLAGS) $(WARNFLAGS)
++#override LDFLAGS += $(LDCXXFLAGS) $(OPTFLAGS) $(WARNFLAGS)
+ INC := -I$(INCDIR) -I$(SRCDIR)
+ SU_USER := root
+
++CXXFLAGS += -std=c++20 -pthread
++LDFLAGS += -pthread
++
+ ifdef DEBUG
+ override OPTFLAGS := -O0 -g
+ endif
+@@ -139,18 +142,18 @@ SOURCE_COUNT := $(words $(SOURCES))
+
+ OBJECTS := $(patsubst $(SRCDIR)/%,$(BUILDDIR)/%,$(SOURCES:.$(SRCEXT)=.$(OBJEXT)))
+
+-ifeq ($(shell find $(BUILDDIR) -type f -newermt "$(DATESTAMP)" -name *.o >/dev/null 2>&1; echo $$?),0)
+- ifneq ($(wildcard $(BUILDDIR)/.*),)
+- SKIPPED_SOURCES := $(foreach fname,$(SOURCES),$(shell find $(BUILDDIR) -type f -newer $(fname) -name *.o | grep "$(basename $(notdir $(fname))).o" 2>/dev/null))
+- override SOURCE_COUNT := $(shell expr $(SOURCE_COUNT) - $(words $(SKIPPED_SOURCES)))
+- ifeq ($(SOURCE_COUNT),0)
+- override SOURCE_COUNT = $(words $(SOURCES))
+- endif
+- endif
+- PROGRESS = expr $$(find $(BUILDDIR) -type f -newermt "$(DATESTAMP)" -name *.o | wc -l || echo 1) '*' 90 / $(SOURCE_COUNT) | cut -c1-2
+-else
+- PROGRESS = expr $$(find $(BUILDDIR) -type f -name *.o | wc -l || echo 1) '*' 90 / $(SOURCE_COUNT) | cut -c1-2
+-endif
++#ifeq ($(shell find $(BUILDDIR) -type f -newermt "$(DATESTAMP)" -name *.o >/dev/null 2>&1; echo $$?),0)
++# ifneq ($(wildcard $(BUILDDIR)/.*),)
++# SKIPPED_SOURCES := $(foreach fname,$(SOURCES),$(shell find $(BUILDDIR) -type f -newer $(fname) -name *.o | grep "$(basename $(notdir $(fname))).o" 2>/dev/null))
++# override SOURCE_COUNT := $(shell expr $(SOURCE_COUNT) - $(words $(SKIPPED_SOURCES)))
++# ifeq ($(SOURCE_COUNT),0)
++# override SOURCE_COUNT = $(words $(SOURCES))
++# endif
++# endif
++# PROGRESS = expr $$(find $(BUILDDIR) -type f -newermt "$(DATESTAMP)" -name *.o | wc -l || echo 1) '*' 90 / $(SOURCE_COUNT) | cut -c1-2
++#else
++# PROGRESS = expr $$(find $(BUILDDIR) -type f -name *.o | wc -l || echo 1) '*' 90 / $(SOURCE_COUNT) | cut -c1-2
++#endif
+
+ P := %%
+
+@@ -171,8 +174,7 @@ info:
+ @printf "\033[1;95mLDFLAGS \033[1;92m+| \033[0;37m\$$(\033[93mLDCXXFLAGS\033[37m) \$$(\033[94mOPTFLAGS\033[37m) \$$(\033[91mWARNFLAGS\033[37m)\n"
+
+ info-quiet:
+- @sleep 0.1 2>/dev/null || true
+- @printf "\n\033[1;92mBuilding btop++ \033[91m(\033[97mv$(BTOP_VERSION)\033[91m) \033[93m$(PLATFORM) \033[96m$(ARCH)\033[0m\n"
++ @printf "Building btop++\n"
+
+ help:
+ @printf " $(BANNER)\n"
+@@ -194,8 +196,7 @@ directories:
+
+ #? Clean only Objects
+ clean:
+- @printf "\033[1;91mRemoving: \033[1;97mbuilt objects...\033[0m\n"
+- @rm -rf $(BUILDDIR)
++ rm -rf $(BUILDDIR)
+
+ #? Clean Objects and Binaries
+ distclean: clean
+@@ -249,21 +250,12 @@ uninstall:
+ #? Link
+ .ONESHELL:
+ 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"
+- @$(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"
++ $(CXX) -o $(TARGETDIR)/btop $^ $(LDFLAGS)
+
+ #? Compile
+ .ONESHELL:
+ $(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"
+- @$(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"
++ $(CXX) $(CXXFLAGS) $(INC) -MMD -c -o $@ $<
+
+ #? Non-File Targets
+ .PHONY: all msg help pre
diff --git a/admin/btop/patches/0002-disable-unicode-check.patch b/admin/btop/patches/0002-disable-unicode-check.patch
new file mode 100644
index 0000000..c9710f4
--- /dev/null
+++ b/admin/btop/patches/0002-disable-unicode-check.patch
@@ -0,0 +1,16 @@
+--- a/src/btop.cpp
++++ b/src/btop.cpp
+@@ -800,13 +800,6 @@ int main(int argc, char **argv) {
+ Logger::warning("Failed to set macos locale, continuing anyway.");
+ }
+ }
+- #else
+- if (found.empty() and Global::utf_force)
+- Logger::warning("No UTF-8 locale detected! Forcing start with --utf-force argument.");
+- else if (found.empty()) {
+- Global::exit_error_msg = "No UTF-8 locale detected!\nUse --utf-force argument to force start if you're sure your terminal can handle it.";
+- clean_quit(1);
+- }
+ #endif
+ else if (not set_failure)
+ Logger::debug("Setting LC_ALL=" + found);