kopia lustrzana https://github.com/weetmuts/wmbusmeters
Add support for FreeBSD.
rodzic
db4fe082e8
commit
6f323b30e6
13
Makefile
13
Makefile
|
@ -21,12 +21,12 @@
|
|||
# make DEBUG=true HOST=arm
|
||||
|
||||
ifeq "$(HOST)" "arm"
|
||||
CXX=arm-linux-gnueabihf-g++
|
||||
CXX?=arm-linux-gnueabihf-g++
|
||||
STRIP=arm-linux-gnueabihf-strip
|
||||
BUILD=build_arm
|
||||
DEBARCH=armhf
|
||||
else
|
||||
CXX=g++
|
||||
CXX?=g++
|
||||
STRIP=strip
|
||||
#--strip-unneeded --remove-section=.comment --remove-section=.note
|
||||
BUILD=build
|
||||
|
@ -37,8 +37,13 @@ ifeq "$(DEBUG)" "true"
|
|||
DEBUG_FLAGS=-O0 -ggdb -fsanitize=address -fno-omit-frame-pointer -fprofile-arcs -ftest-coverage
|
||||
STRIP_BINARY=
|
||||
BUILD:=$(BUILD)_debug
|
||||
DEBUG_LDFLAGS=-lasan -lgcov --coverage
|
||||
GCOV=gcov
|
||||
ifeq '' '$(findstring clang++,$(CXX))'
|
||||
DEBUG_LDFLAGS=-fsanitize=address --coverage
|
||||
GCOV?=llvm-cov gcov
|
||||
else
|
||||
DEBUG_LDFLAGS=-lasan -lgcov --coverage
|
||||
GCOV?=gcov
|
||||
endif
|
||||
else
|
||||
DEBUG_FLAGS=-Os
|
||||
STRIP_BINARY=$(STRIP) $(BUILD)/wmbusmeters
|
||||
|
|
|
@ -7,7 +7,7 @@ MQTT, curled to a REST api, inserted into a database or stored in a log file.
|
|||
|
||||
[FAQ/WIKI/MANUAL pages](https://weetmuts.github.io/wmbusmeterswiki/)
|
||||
|
||||
The program runs on GNU/Linux, MacOSX and Raspberry Pi.
|
||||
The program runs on GNU/Linux, MacOSX, FreeBSD, and Raspberry Pi.
|
||||
|
||||
| OS | Status |
|
||||
| ------------ |:-------------:|
|
||||
|
@ -321,7 +321,7 @@ With an rtlwmbus or amb8465 dongle: `wmbusmeters --listento=c1,t1 auto`
|
|||
|
||||
With an imst871a dongle: `wmbusmeters --listento=c1 auto`
|
||||
|
||||
# Builds and runs on GNU/Linux and MacOSX (with recent XCode)
|
||||
# Builds and runs on GNU/Linux MacOSX (with recent XCode), and FreeBSD
|
||||
|
||||
`make && make test`
|
||||
|
||||
|
@ -335,6 +335,8 @@ Binary generated: `./build_arm/wmbusmeters`
|
|||
|
||||
Binary generated: `./build_debug/wmbusmeters`
|
||||
|
||||
Debug builds only work on FreeBSD if the compiler is LLVM. If your system default compiler is gcc, set `CXX=clang++` to the build environment to force LLVM to be used.
|
||||
|
||||
`make DEBUG=true HOST=arm`
|
||||
|
||||
Binary generated: `./build_arm_debug/wmbusmeters`
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
#include<algorithm>
|
||||
#include<memory.h>
|
||||
#include<time.h>
|
||||
|
||||
MeterCommonImplementation::MeterCommonImplementation(WMBus *bus, MeterInfo &mi,
|
||||
MeterType type, int manufacturer) :
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include <memory.h>
|
||||
#include <pthread.h>
|
||||
#include <sys/types.h>
|
||||
#if defined(__APPLE__) && defined(__MACH__)
|
||||
#if defined(__APPLE__) && defined(__MACH__) or defined(__FreeBSD__)
|
||||
#include <sys/wait.h>
|
||||
#else
|
||||
#include <wait.h>
|
||||
|
@ -61,7 +61,7 @@ void invokeShell(string program, vector<string> args, vector<string> envs)
|
|||
if (pid == 0) {
|
||||
// I am the child!
|
||||
close(0); // Close stdin
|
||||
#if defined(__APPLE__) && defined(__MACH__)
|
||||
#if (defined(__APPLE__) && defined(__MACH__)) || defined(__FreeBSD__)
|
||||
execve(program.c_str(), (char*const*)&argv[0], (char*const*)&env[0]);
|
||||
#else
|
||||
execvpe(program.c_str(), (char*const*)&argv[0], (char*const*)&env[0]);
|
||||
|
@ -130,7 +130,7 @@ bool invokeBackgroundShell(string program, vector<string> args, vector<string> e
|
|||
close(link[1]);
|
||||
close(0); // Close stdin
|
||||
|
||||
#if defined(__APPLE__) && defined(__MACH__)
|
||||
#if (defined(__APPLE__) && defined(__MACH__)) || defined(__FreeBSD__)
|
||||
execve(program.c_str(), (char*const*)&argv[0], (char*const*)&env[0]);
|
||||
#else
|
||||
execvpe(program.c_str(), (char*const*)&argv[0], (char*const*)&env[0]);
|
||||
|
|
Ładowanie…
Reference in New Issue