summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraristocratos <gnmjpl@gmail.com>2021-11-14 01:23:12 +0100
committeraristocratos <gnmjpl@gmail.com>2021-11-14 01:23:12 +0100
commit125e3c0cb2857882333a613881fa35ebd30db3e0 (patch)
treed39b14b4a5acccae198bfda8be4dacb9252cf663
parent0ed8ad76e84ea57180d39bb63f05b73a369e6c25 (diff)
v1.1.0 OSX Supportv1.1.0
-rw-r--r--CHANGELOG.md4
-rw-r--r--Makefile4
-rw-r--r--README.md121
-rw-r--r--src/btop.cpp18
4 files changed, 124 insertions, 23 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d134d7e..a2a77d3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+## v1.1.0
+
+* Added: Support for OSX, by @joske and @aristocratos
+
## v1.0.24
* Changed: Collection ordering
diff --git a/Makefile b/Makefile
index 42ff6c1..396b474 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
-#* Btop++ makefile v1.4
+#* Btop++ makefile v1.5
-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.4\033[0m
+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")
diff --git a/README.md b/README.md
index 2dd6f21..c668a00 100644
--- a/README.md
+++ b/README.md
@@ -5,6 +5,8 @@
</a>
![Linux](https://img.shields.io/badge/-Linux-grey?logo=linux)
+![OSX](https://img.shields.io/badge/-OSX-black?logo=apple)
+![FreeBSD](https://img.shields.io/badge/-FreeBSD-red?logo=freebsd)
![Usage](https://img.shields.io/badge/Usage-System%20resource%20monitor-yellow)
![c++20](https://img.shields.io/badge/cpp-c%2B%2B20-green)
![latest_release](https://img.shields.io/github/v/tag/aristocratos/btop?label=release)
@@ -12,14 +14,11 @@
[![Sponsor](https://img.shields.io/badge/-Sponsor-red?logo=github)](https://github.com/sponsors/aristocratos)
[![Coffee](https://img.shields.io/badge/-Buy%20me%20a%20Coffee-grey?logo=Ko-fi)](https://ko-fi.com/aristocratos)
[![btop](https://snapcraft.io/btop/badge.svg)](https://snapcraft.io/btop)
-[![Continuous Build](https://github.com/aristocratos/btop/actions/workflows/continuous-build.yml/badge.svg)](https://github.com/aristocratos/btop/actions)
+[![Continuous Build Linux](https://github.com/aristocratos/btop/actions/workflows/continuous-build-linux.yml/badge.svg)](https://github.com/aristocratos/btop/actions/workflows/continuous-build-linux.yml)
[![Continuous Build MacOS](https://github.com/aristocratos/btop/actions/workflows/continuous-build-macos.yml/badge.svg)](https://github.com/aristocratos/btop/actions/workflows/continuous-build-macos.yml)
-
## Index
-
-
* [News](#news)
* [Documents](#documents)
* [Description](#description)
@@ -29,9 +28,10 @@
* [Prerequisites](#prerequisites) (Read this if you are having issues!)
* [Screenshots](#screenshots)
* [Keybindings](#help-menu)
-* [Installation](#installation)
-* [Manual compilation](#compilation)
-* [Install the snap](#install-the-snap)
+* [Installation Linux/OSX](#installation-linux/osx)
+* [Compilation Linux](#compilation-osx)
+* [Compilation OSX](#compilation-osx)
+* [Installing the snap](#installing-the-snap)
* [Configurability](#configurability)
* [License](#license)
@@ -39,6 +39,16 @@
### Under development
+##### 13 November 2021
+
+Release v1.1.0 with OSX support. Binaries in [continuous-build-macos](https://github.com/aristocratos/btop/actions/workflows/continuous-build-macos.yml) are only x86 for now.
+Macos binaries + installer are included for both x86 and ARM64 (Apple Silicon) in the releases.
+
+Big thank you to [@joske](https://github.com/joske) who wrote the vast majority of the implementation!
+
+<details>
+<summary>More...</summary>
+
##### 30 October 2021
Work on the OSX and FreeBSD branches, both initiated and mostly worked on by [@joske](https://github.com/joske), will likely be completed in the coming weeks.
@@ -97,6 +107,8 @@ Windows support is not in the plans as of now, but if anyone else wants to take
This project is gonna take some time until it has complete feature parity with bpytop, since all system information gathering will have to be written from scratch without any external libraries.
And will need some help in the form of code contributions to get complete support for BSD and OSX.
+</details>
+
## Documents
**[CHANGELOG.md](CHANGELOG.md)**
@@ -203,11 +215,11 @@ Also needs a UTF8 locale and a font that covers:
![Screenshot 5](Img/help-menu.png)
-## Installation
+## Installation Linux/OSX
-**Binary release (statically compiled with musl, for kernel 2.6.39 and newer)**
+**Binaries for Linux are statically compiled with musl and works on kernel 2.6.39 and newer**
-1. **Download btop-(VERSION)-(PLATFORM)-(ARCH).tbz from [latest release](https://github.com/aristocratos/btop/releases/latest) and unpack to a new folder**
+1. **Download btop-(VERSION)-(ARCH)-(PLATFORM).tbz from [latest release](https://github.com/aristocratos/btop/releases/latest) and unpack to a new folder**
**Notice! Use x86_64 for 64-bit x86 systems, i486 and i686 are 32-bit!**
@@ -263,7 +275,7 @@ Also needs a UTF8 locale and a font that covers:
sudo zypper in btop
```
-## Compilation
+## Compilation Linux
Needs GCC 10 or higher, (GCC 11 or above strongly recommended for better CPU efficiency in the compiled binary).
@@ -355,7 +367,92 @@ Also needs a UTF8 locale and a font that covers:
make help
```
-## Install the snap
+## Compilation OSX
+
+ Needs GCC 10 or higher, (GCC 11 or above strongly recommended for better CPU efficiency in the compiled binary).
+
+ The makefile also needs GNU coreutils and `sed`.
+
+ Install and use Homebrew or MacPorts package managers for easy dependency installation
+
+1. **Install dependencies (example for Homebrew)**
+
+ ``` bash
+ brew install coreutils make gcc@11
+ ```
+
+2. **Clone repository**
+
+ ``` bash
+ git clone https://github.com/aristocratos/btop.git
+ cd btop
+ ```
+
+3. **Compile**
+
+ Append `QUIET=true` for less verbose output.
+
+ Append `STRIP=true` to force stripping of debug symbols (adds `-s` linker flag).
+
+ Append `ARCH=<architecture>` 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)
* **Install the snap**
diff --git a/src/btop.cpp b/src/btop.cpp
index 5d782f6..88c3403 100644
--- a/src/btop.cpp
+++ b/src/btop.cpp
@@ -53,7 +53,7 @@ namespace Global {
{"#801414", "██████╔╝ ██║ ╚██████╔╝██║ ╚═╝ ╚═╝"},
{"#000000", "╚═════╝ ╚═╝ ╚═════╝ ╚═╝"},
};
- const string Version = "1.0.24";
+ const string Version = "1.1.0";
int coreCount;
string overlay;
@@ -179,7 +179,7 @@ void term_resize(bool force) {
if (Input::poll()) {
auto key = Input::get();
if (key == "q")
- exit(0);
+ clean_quit(0);
else if (is_in(key, "1", "2", "3", "4")) {
Config::current_preset = -1;
Config::toggle_box(all_boxes.at(std::stoi(key) - 1));
@@ -584,7 +584,7 @@ namespace Runner {
pthread_cancel(Runner::runner_id);
if (pthread_create(&Runner::runner_id, NULL, &Runner::_runner, NULL) != 0) {
Global::exit_error_msg = "Failed to re-create _runner thread!";
- exit(1);
+ clean_quit(1);
}
}
if (stopping or Global::resized) return;
@@ -623,7 +623,7 @@ namespace Runner {
if (ret != EBUSY and not Global::quitting) {
if (active) active = false;
Global::exit_error_msg = "Runner thread died unexpectedly!";
- exit(1);
+ clean_quit(1);
}
else if (ret == EBUSY) {
atomic_wait_for(active, true, 5000);
@@ -634,7 +634,7 @@ namespace Runner {
}
else {
Global::exit_error_msg = "No response from Runner thread, quitting!";
- exit(1);
+ clean_quit(1);
}
}
thread_trigger();
@@ -829,7 +829,7 @@ int main(int argc, char **argv) {
Runner::thread_sem_init();
if (pthread_create(&Runner::runner_id, NULL, &Runner::_runner, NULL) != 0) {
Global::exit_error_msg = "Failed to create _runner thread!";
- exit(1);
+ clean_quit(1);
}
else {
Global::_runner_started = true;
@@ -866,8 +866,8 @@ int main(int argc, char **argv) {
try {
while (not true not_eq not false) {
//? Check for exceptions in secondary thread and exit with fail signal if true
- if (Global::thread_exception) exit(1);
- else if (Global::should_quit) exit(0);
+ if (Global::thread_exception) clean_quit(1);
+ else if (Global::should_quit) clean_quit(0);
else if (Global::should_sleep) { Global::should_sleep = false; _sleep(); }
//? Make sure terminal size hasn't changed (in case of SIGWINCH not working properly)
@@ -923,7 +923,7 @@ int main(int argc, char **argv) {
}
catch (const std::exception& e) {
Global::exit_error_msg = "Exception in main loop -> " + (string)e.what();
- exit(1);
+ clean_quit(1);
}
}