Merge branch 'ZeWaren-add-freebsd-support'

pull/106/head
Fredrik Öhrström 2020-04-22 08:06:15 +02:00
commit feaba72ee6
27 zmienionych plików z 43 dodań i 34 usunięć

Wyświetl plik

@ -23,24 +23,29 @@
DESTDIR?=/
ifeq "$(HOST)" "arm"
CXX=arm-linux-gnueabihf-g++
CXX?=arm-linux-gnueabihf-g++
STRIP?=arm-linux-gnueabihf-strip
BUILD=build_arm
DEBARCH=armhf
DEBARCH=armhf
else
CXX=g++
CXX?=g++
STRIP?=strip
#--strip-unneeded --remove-section=.comment --remove-section=.note
BUILD=build
DEBARCH=amd64
DEBARCH=amd64
endif
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
ifneq '' '$(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
@ -284,3 +289,4 @@ run_fuzz_telegrams:
# Include dependency information generated by gcc in a previous compile.
include $(wildcard $(patsubst %.o,%.d,$(METER_OBJS)))

Wyświetl plik

@ -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 |
| ------------ |:-------------:|
@ -329,7 +329,7 @@ With an rtlwmbus or amb8465 dongle: `wmbusmeters --listento=c1,t1 /dev/ttyUSB0:a
With an imst871a dongle: `wmbusmeters --listento=c1 /dev/ttyUSB0:im871a`
# 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`
@ -343,6 +343,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`

1
src/meters.cc 100644 → 100755
Wyświetl plik

@ -23,6 +23,7 @@
#include<algorithm>
#include<memory.h>
#include<time.h>
MeterCommonImplementation::MeterCommonImplementation(WMBus *bus, MeterInfo &mi,
MeterType type, int manufacturer) :

Wyświetl plik

@ -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]);

Wyświetl plik

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
PROG="$1"
TESTINTERNAL=$(dirname $PROG)/testinternals

Wyświetl plik

@ -1,3 +1,3 @@
#!/bin/bash
#!/bin/sh
echo "T1;1;1;2019-04-03 19:00:42.000;97;148;88888888;0x6e4401068888888805077a85006085bc2630713819512eb4cd87fba554fb43f67cf9654a68ee8e194088160df752e716238292e8af1ac20986202ee561d743602466915e42f1105d9c6782a54504e4f099e65a7656b930c73a30775122d2fdf074b5035cfaa7e0050bf32faae03a77"
#{"media":"water","meter":"apator162","name":"ApWater","id":"88888888","total_m3":4.848,"timestamp":"1111-11-11T11:11:11Z"}

Wyświetl plik

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
PROG="$1"
TEST=testoutput

Wyświetl plik

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
PROG="$1"

Wyświetl plik

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
PROG="$1"

Wyświetl plik

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
PROG="$1"

Wyświetl plik

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
PROG="$1"
TEST=testoutput

Wyświetl plik

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
PROG="$1"
TEST=testoutput

Wyświetl plik

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
PROG="$1"

Wyświetl plik

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
PROG="$1"
TEST=testoutput

Wyświetl plik

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
PROG="$1"

Wyświetl plik

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
PROG="$1"

Wyświetl plik

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
PROG="$1"
TEST=testoutput

Wyświetl plik

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
PROG="$1"

Wyświetl plik

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
PROG="$1"

Wyświetl plik

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
PROG="$1"

Wyświetl plik

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
PROG="$1"

Wyświetl plik

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
PROG="$1"

Wyświetl plik

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
PROG="$1"

Wyświetl plik

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
PROG="$1"
TEST=testoutput

Wyświetl plik

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
PROG="$1"

Wyświetl plik

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
PROG="$1"

Wyświetl plik

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
PROG="$1"