From 22061fa627e3bab2f0f59cdcc3fbe498baa51c1e Mon Sep 17 00:00:00 2001 From: aristocratos Date: Sun, 16 Jan 2022 14:19:31 +0100 Subject: v1.2.0 FreeBSD Support --- CHANGELOG.md | 14 +++++++++ Makefile | 2 +- README.md | 92 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- src/btop.cpp | 9 +++--- 4 files changed, 110 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c5b6797..004c8c1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,17 @@ +## v1.2.0 + +* Added: Support for FreeBSD, by @joske and @aristocratos + +* Fixed (again): Account for system rolling over net speeds in Net::collect() + +* Added: Theme gruvbox_material_dark, by @marcoradocchia + +* Added: Option for base 10 bytes/bits + +## v1.1.5 + +* Fixed: Account for system rolling over net speeds in Net::collect() + ## v1.1.4 * Fixed: Create dependency files in build directory when compiling, by @stwnt diff --git a/Makefile b/Makefile index f844c21..a3e743f 100644 --- a/Makefile +++ b/Makefile @@ -85,7 +85,7 @@ ifeq ($(PLATFORM_LC),linux) else ifeq ($(PLATFORM_LC),freebsd) PLATFORM_DIR := freebsd THREADS := $(shell getconf NPROCESSORS_ONLN 2>/dev/null || echo 1) - SU_GROUP := root + SU_GROUP := wheel override ADDFLAGS += -lstdc++ -lm -lkvm -ldevstat -Wl,-rpath=/usr/local/lib/gcc11 export MAKE = gmake else ifeq ($(PLATFORM_LC),macos) diff --git a/README.md b/README.md index 7450962..483adaa 100644 --- a/README.md +++ b/README.md @@ -31,13 +31,20 @@ * [Installation Linux/OSX](#installation) * [Compilation Linux](#compilation-linux) * [Compilation OSX](#compilation-osx) +* [Compilation FreeBSD](#compilation-freebsd) * [Installing the snap](#installing-the-snap) * [Configurability](#configurability) * [License](#license) ## News -### Under development +##### 16 January 2022 + +Release v1.2.0 with FreeBSD support. No release binaries for FreeBSD provided as of yet. + +Again a big thanks to [@joske](https://github.com/joske) for his porting efforts! + +Since compatibility with Linux, MacOS and FreeBSD are done, the focus going forward will be on new features like GPU monitoring. ##### 13 November 2021 @@ -460,6 +467,89 @@ Also needs a UTF8 locale and a font that covers: gmake help ``` +## Compilation FreeBSD + + Needs GCC 10 or higher, (GCC 11 or above strongly recommended for better CPU efficiency in the compiled binary). + + Note that GNU make (`gmake`) is required to compile on FreeBSD. + +1. **Install dependencies** + + ``` bash + sudo pkg install gmake gcc11 coreutils git + ``` + +2. **Clone repository** + + ``` bash + git clone https://github.com/aristocratos/btop.git + cd btop + ``` + +3. **Compile** + + Append `STATIC=true` to `make` command for static compilation. + + Append `QUIET=true` for less verbose output. + + Append `STRIP=true` to force stripping of debug symbols (adds `-s` linker flag). + + Append `ARCH=` to manually set the target architecture. + If omitted the makefile uses the machine triple (output of `-dumpmachine` compiler parameter) to detect the target system. + + Use `ADDFLAGS` variable for appending flags to both compiler and linker. + + For example: `ADDFLAGS=-march=native` might give a performance boost if compiling only for your own system. + + ``` bash + gmake + ``` + +4. **Install** + + Append `PREFIX=/target/dir` to set target, default: `/usr/local` + + Notice! Only use "sudo" when installing to a NON user owned directory. + + ``` bash + sudo gmake install + ``` + +5. **(Recommended) Set suid bit to make btop always run as root (or other user)** + + No need for `sudo` to see information for non user owned processes and to enable signal sending to any process. + + Run after make install and use same PREFIX if any was used at install. + + Set `SU_USER` and `SU_GROUP` to select user and group, default is `root` and `wheel` + + ``` bash + sudo gmake setuid + ``` + +* **Uninstall** + + ``` bash + sudo gmake uninstall + ``` + +* **Remove any object files from source dir** + + ```bash + gmake clean + ``` + +* **Remove all object files, binaries and created directories in source dir** + + ```bash + gmake distclean + ``` + +* **Show help** + + ```bash + gmake help + ``` ## Installing the snap [![btop](https://snapcraft.io/btop/badge.svg)](https://snapcraft.io/btop) diff --git a/src/btop.cpp b/src/btop.cpp index 6bf3ff4..02367d2 100644 --- a/src/btop.cpp +++ b/src/btop.cpp @@ -20,7 +20,7 @@ tab-size = 4 #include #include #ifdef __FreeBSD__ -#include + #include #endif #include #include @@ -60,7 +60,7 @@ namespace Global { {"#801414", "██████╔╝ ██║ ╚██████╔╝██║ ╚═╝ ╚═╝"}, {"#000000", "╚═════╝ ╚═╝ ╚═════╝ ╚═╝"}, }; - const string Version = "1.1.4"; + const string Version = "1.2.0"; int coreCount; string overlay; @@ -209,14 +209,14 @@ void clean_quit(int sig) { if (Global::_runner_started) { #ifdef __APPLE__ if (pthread_join(Runner::runner_id, NULL) != 0) { - Logger::error("Failed to join _runner thread!"); + Logger::warning("Failed to join _runner thread on exit!"); pthread_cancel(Runner::runner_id); } #else struct timespec ts; ts.tv_sec = 5; if (pthread_timedjoin_np(Runner::runner_id, NULL, &ts) != 0) { - Logger::error("Failed to join _runner thread!"); + Logger::warning("Failed to join _runner thread on exit!"); pthread_cancel(Runner::runner_id); } #endif @@ -243,7 +243,6 @@ void clean_quit(int sig) { const auto excode = (sig != -1 ? sig : 0); - //? Assume error if still not cleaned up and call quick_exit to avoid a segfault from Tools::atomic_lock destructor #ifdef __APPLE__ _Exit(excode); #else -- cgit v1.2.3