Skip to content

Commit

Permalink
v1.2.0 FreeBSD Support
Browse files Browse the repository at this point in the history
  • Loading branch information
aristocratos committed Jan 16, 2022
1 parent 1816f9d commit 22061fa
Show file tree
Hide file tree
Showing 4 changed files with 110 additions and 7 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
92 changes: 91 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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=<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)
Expand Down
9 changes: 4 additions & 5 deletions src/btop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ tab-size = 4
#include <clocale>
#include <pthread.h>
#ifdef __FreeBSD__
#include <pthread_np.h>
#include <pthread_np.h>
#endif
#include <thread>
#include <numeric>
Expand Down Expand Up @@ -60,7 +60,7 @@ namespace Global {
{"#801414", "██████╔╝ ██║ ╚██████╔╝██║ ╚═╝ ╚═╝"},
{"#000000", "╚═════╝ ╚═╝ ╚═════╝ ╚═╝"},
};
const string Version = "1.1.4";
const string Version = "1.2.0";

int coreCount;
string overlay;
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 22061fa

Please sign in to comment.