Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
zuckschwerdt authored Oct 16, 2024
2 parents f9c1b86 + 8fa97e2 commit 7600299
Show file tree
Hide file tree
Showing 292 changed files with 7,995 additions and 2,686 deletions.
77 changes: 39 additions & 38 deletions do_sysroot.sh → .ci/scripts/do_sysroot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@ sed="${sed:-sed}"
# from https://libusb.info/
if [ ! -e libusb/include/libusb-1.0/libusb.h ]
then
[ -e libusb-${libusb_ver}.7z ] || curl -L -O https://github.com/libusb/libusb/releases/download/v${libusb_ver}/libusb-${libusb_ver}.7z
mkdir -p libusb
7z x -olibusb -y libusb-${libusb_ver}.7z
[ -e libusb-${libusb_ver}.7z ] || curl -L -O https://github.com/libusb/libusb/releases/download/v${libusb_ver}/libusb-${libusb_ver}.7z
mkdir -p libusb
7z x -olibusb -y libusb-${libusb_ver}.7z
fi

source_dir=$(dirname $($realpath -s $0))
# remove this script name and two dir levels to get the source root
source_dir=$(dirname $(dirname $(dirname $($realpath -s $0))))
sysroot32=$(pwd)/sysroot32
sysroot64=$(pwd)/sysroot64
sysroot32static=$(pwd)/sysroot32static
Expand All @@ -45,64 +46,64 @@ cp libusb/MinGW64/dll/libusb-1.0.dll.a $sysroot64/usr/lib

if [ ! -d rtl-sdr-${rtlsdr_ver} ]
then
# or git clone https://github.com/osmocom/rtl-sdr.git
[ -e rtl-sdr-${rtlsdr_ver}.tar.gz ] || curl -L -o rtl-sdr-${rtlsdr_ver}.tar.gz https://github.com/osmocom/rtl-sdr/archive/${rtlsdr_ver}.tar.gz
tar xzf rtl-sdr-${rtlsdr_ver}.tar.gz
# or git clone https://github.com/osmocom/rtl-sdr.git
[ -e rtl-sdr-${rtlsdr_ver}.tar.gz ] || curl -L -o rtl-sdr-${rtlsdr_ver}.tar.gz https://github.com/osmocom/rtl-sdr/archive/${rtlsdr_ver}.tar.gz
tar xzf rtl-sdr-${rtlsdr_ver}.tar.gz
fi

cd rtl-sdr-${rtlsdr_ver}

if [ ! -e $sysroot32/usr/lib/librtlsdr.a ]
then
export CMAKE_SYSROOT=$sysroot32 ; echo $CMAKE_SYSROOT
mkdir build-tmp ; cd build-tmp ; cmake -DCMAKE_TOOLCHAIN_FILE=$source_dir/cmake/Toolchain-gcc-mingw-w64-i686.cmake .. && make && make install ; cd ..
rm -rf build-tmp
mv $sysroot32/usr/lib/librtlsdr_static.a $sysroot32/usr/lib/librtlsdr.a
export CMAKE_SYSROOT=$sysroot32 ; echo $CMAKE_SYSROOT
mkdir build-tmp ; cd build-tmp ; cmake -DCMAKE_TOOLCHAIN_FILE=$source_dir/cmake/Toolchain-gcc-mingw-w64-i686.cmake .. && make && make install ; cd ..
rm -rf build-tmp
mv $sysroot32/usr/lib/librtlsdr_static.a $sysroot32/usr/lib/librtlsdr.a
fi

if [ ! -e $sysroot32static/usr/lib/librtlsdr.a ]
then
export CMAKE_SYSROOT=$sysroot32static ; echo $CMAKE_SYSROOT
mkdir build-tmp ; cd build-tmp ; cmake -DCMAKE_TOOLCHAIN_FILE=$source_dir/cmake/Toolchain-gcc-mingw-w64-i686.cmake -DBUILD_SHARED_LIBS:BOOL=OFF .. && make && make install ; cd ..
rm -rf build-tmp
mv $sysroot32static/usr/lib/librtlsdr_static.a $sysroot32static/usr/lib/librtlsdr.a
rm $sysroot32static/usr/lib/librtlsdr.dll.a
rm $sysroot32static/usr/bin/librtlsdr.dll
export CMAKE_SYSROOT=$sysroot32static ; echo $CMAKE_SYSROOT
mkdir build-tmp ; cd build-tmp ; cmake -DCMAKE_TOOLCHAIN_FILE=$source_dir/cmake/Toolchain-gcc-mingw-w64-i686.cmake -DBUILD_SHARED_LIBS:BOOL=OFF .. && make && make install ; cd ..
rm -rf build-tmp
mv $sysroot32static/usr/lib/librtlsdr_static.a $sysroot32static/usr/lib/librtlsdr.a
rm $sysroot32static/usr/lib/librtlsdr.dll.a
rm $sysroot32static/usr/bin/librtlsdr.dll
fi

if [ ! -e $sysroot64/usr/lib/librtlsdr.a ]
then
export CMAKE_SYSROOT=$sysroot64 ; echo $CMAKE_SYSROOT
mkdir build-tmp ; cd build-tmp ; cmake -DCMAKE_TOOLCHAIN_FILE=$source_dir/cmake/Toolchain-gcc-mingw-w64-x86-64.cmake .. && make && make install ; cd ..
rm -rf build-tmp
mv $sysroot64/usr/lib/librtlsdr_static.a $sysroot64/usr/lib/librtlsdr.a
export CMAKE_SYSROOT=$sysroot64 ; echo $CMAKE_SYSROOT
mkdir build-tmp ; cd build-tmp ; cmake -DCMAKE_TOOLCHAIN_FILE=$source_dir/cmake/Toolchain-gcc-mingw-w64-x86-64.cmake .. && make && make install ; cd ..
rm -rf build-tmp
mv $sysroot64/usr/lib/librtlsdr_static.a $sysroot64/usr/lib/librtlsdr.a
fi

if [ ! -e $sysroot64static/usr/lib/librtlsdr.a ]
then
export CMAKE_SYSROOT=$sysroot64static ; echo $CMAKE_SYSROOT
mkdir build-tmp ; cd build-tmp ; cmake -DCMAKE_TOOLCHAIN_FILE=$source_dir/cmake/Toolchain-gcc-mingw-w64-x86-64.cmake -DBUILD_SHARED_LIBS:BOOL=OFF .. && make && make install ; cd ..
rm -rf build-tmp
mv $sysroot64static/usr/lib/librtlsdr_static.a $sysroot64static/usr/lib/librtlsdr.a
rm $sysroot64static/usr/lib/librtlsdr.dll.a
rm $sysroot64static/usr/bin/librtlsdr.dll
export CMAKE_SYSROOT=$sysroot64static ; echo $CMAKE_SYSROOT
mkdir build-tmp ; cd build-tmp ; cmake -DCMAKE_TOOLCHAIN_FILE=$source_dir/cmake/Toolchain-gcc-mingw-w64-x86-64.cmake -DBUILD_SHARED_LIBS:BOOL=OFF .. && make && make install ; cd ..
rm -rf build-tmp
mv $sysroot64static/usr/lib/librtlsdr_static.a $sysroot64static/usr/lib/librtlsdr.a
rm $sysroot64static/usr/lib/librtlsdr.dll.a
rm $sysroot64static/usr/bin/librtlsdr.dll
fi

cd ..

if [ ! -e $sysroot64/usr/bin/SoapySDR.dll -o ! -e $sysroot64/usr/lib/SoapySDR.lib ]
then
# from https://downloads.myriadrf.org/builds/PothosSDR/
[ -e PothosSDR-${pothos_ver}-x64.exe ] || curl -L -O https://downloads.myriadrf.org/builds/PothosSDR/PothosSDR-${pothos_ver}-x64.exe
mkdir -p pothos
7z x -opothos -y PothosSDR-${pothos_ver}-x64.exe
# workaround: 7-Zip 9.20 creates strange root directories
[ -e pothos/bin ] || mv pothos/*/* pothos/ || :
cp pothos/bin/SoapySDR.dll $sysroot64/usr/bin
cp -R pothos/include/SoapySDR $sysroot64/usr/include
cp pothos/lib/SoapySDR.lib $sysroot64/usr/lib
cp -R pothos/cmake $sysroot64/usr
$sed -i 's/.*INTERFACE_COMPILE_OPTIONS.*//g' $sysroot64/usr/cmake/SoapySDRExport.cmake
# from https://downloads.myriadrf.org/builds/PothosSDR/
[ -e PothosSDR-${pothos_ver}-x64.exe ] || curl -L -O https://downloads.myriadrf.org/builds/PothosSDR/PothosSDR-${pothos_ver}-x64.exe
mkdir -p pothos
7z x -opothos -y PothosSDR-${pothos_ver}-x64.exe
# workaround: 7-Zip 9.20 creates strange root directories
[ -e pothos/bin ] || mv pothos/*/* pothos/ || :
cp pothos/bin/SoapySDR.dll $sysroot64/usr/bin
cp -R pothos/include/SoapySDR $sysroot64/usr/include
cp pothos/lib/SoapySDR.lib $sysroot64/usr/lib
cp -R pothos/cmake $sysroot64/usr
$sed -i 's/.*INTERFACE_COMPILE_OPTIONS.*//g' $sysroot64/usr/cmake/SoapySDRExport.cmake
fi

# build rtl_433
Expand Down
24 changes: 24 additions & 0 deletions .ci/scripts/do_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash

# This script is for internal CI use only

set -e
set -x

# prefer GNU commands
realpath=$(command -v grealpath || :)
realpath="${realpath:-realpath}"

# remove this script name and two dir levels to get the source root
source_dir=$(dirname $(dirname $(dirname $($realpath -s $0))))

cd "${source_dir}/.."
[ -e rtl_433_tests ] || git clone --depth 1 https://github.com/merbanan/rtl_433_tests.git
cd rtl_433_tests
export PATH="${source_dir}/build/src:$PATH"
test -f "${source_dir}/build/src/rtl_433"

# python3 -m venv .venv
# source .venv/bin/activate
# pip install deepdiff
make test
4 changes: 3 additions & 1 deletion .deploy/WINDOWS-MINGWW64.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ For the SoapySDR builds you need PothosSDR installed https://downloads.myriadrf.
Any recent version should work, currently built with 2021.07.25-vc16:
https://downloads.myriadrf.org/builds/PothosSDR/PothosSDR-2021.07.25-vc16-x64.exe
When installing choose "Add PothosSDR to the system PATH for the current user"

Remove the SoapySDR.dll in this directory, it's for testing only and won't load any driver modules.
To run with SoapySDR you need to copy `rtl_433.exe` to `PothosSDR\bin` (usually `C:\Program Files\PothosSDR`).
Otherwise SoapySDR driver modules won't be found.

An alternative to installing SoapySDR from PothosSDR is to extract the installer
and copy the builds (.exe) from this release to the `bin` directory in PothosSDR.
Expand All @@ -26,4 +29,3 @@ Running the "-F http" option would look like this:
(directory)> rtl_433 -F http
Press enter and rtl_433 should successfully launch.
When it does, go to http://127.0.0.1:8433/

5 changes: 4 additions & 1 deletion .deploy/WINDOWS-MSVC.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ Any recent version should work, currently built with 2021.07.25-vc16:
https://downloads.myriadrf.org/builds/PothosSDR/PothosSDR-2021.07.25-vc16-x64.exe
When installing choose "Add PothosSDR to the system PATH for the current user"

Remove the SoapySDR.dll in this directory, it's for testing only and won't load any driver modules.
To run with SoapySDR you need to copy `rtl_433-rtlsdr-soapysdr.exe` to `PothosSDR\bin` (usually `C:\Program Files\PothosSDR`).
Otherwise SoapySDR driver modules won't be found.

For the TLS builds (mqtts and influxs) you need OpenSSL installed.
E.g. install Chocolatey https://chocolatey.org/install
then run `choco install openssl.light`
Expand All @@ -27,4 +31,3 @@ Running the "-F http" option would look like this:
(directory)> rtl_433 -F http
Press enter and rtl_433 should successfully launch.
When it does, go to http://127.0.0.1:8433/

2 changes: 1 addition & 1 deletion .github/actions/style-check/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'Style Check'
description: 'Check for common code style warnings'
runs:
using: 'node16'
using: 'node20'
main: 'index.js'
2 changes: 1 addition & 1 deletion .github/actions/style-check/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ process.exitCode = [
'tests/CMakeLists.txt',
])
.filter(discard_vendor)
.reduce((e, f) => e + style_check(f), 0) > 0
.reduce((e, f) => e + style_check(f), 0) > 0 ? 1 : 0

function discard_vendor(filename) {
return filename.indexOf('/jsmn.') < 0 && filename.indexOf('/mongoose.') < 0
Expand Down
117 changes: 74 additions & 43 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -1,52 +1,83 @@
name: Build Analyze Check
on: [push, pull_request]
jobs:
macos_check_job:
strategy:
fail-fast: false
matrix:
os: [macos-12, macos-14]
runs-on: ${{ matrix.os }}
name: Build on ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Setup
run: brew install soapysdr librtlsdr
- name: Configure
run: cmake -B build
- name: Build
run: cmake --build build

build_check_job:
runs-on: ubuntu-latest
name: Build with CMake
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get latest CMake and Ninja
uses: lukka/get-cmake@latest
- name: Run CMake+Ninja
uses: lukka/run-cmake@v10
with:
configurePreset: dummy
configurePresetCmdString: "[`-B`, `${{ runner.workspace }}/b/ninja`, `-GNinja`, `-DENABLE_RTLSDR=OFF`, `-DENABLE_SOAPYSDR=OFF`]"
buildPreset: dummy
buildPresetCmdString: "[`--build`, `${{ runner.workspace }}/b/ninja`]"
- name: Run CMake+UnixMakefiles
uses: lukka/run-cmake@v10
with:
configurePreset: dummy
configurePresetCmdString: "[`-B`, `${{ runner.workspace }}/b/unixmakefiles`, `-G`, `Unix Makefiles`, `-DENABLE_RTLSDR=OFF`, `-DENABLE_SOAPYSDR=OFF`]"
buildPreset: dummy
buildPresetCmdString: "[`--build`, `${{ runner.workspace }}/b/unixmakefiles`]"
- uses: actions/checkout@v4
- name: Setup
run: |
sudo apt-get update -q -y
sudo apt-get install -q -y --no-install-recommends cmake ninja-build
sudo apt-get install -q -y libsoapysdr-dev librtlsdr-dev
- name: Configure CMake+Ninja
run: cmake -GNinja -B ${{ runner.workspace }}/b/ninja -DENABLE_RTLSDR=OFF -DENABLE_SOAPYSDR=OFF
- name: Build CMake+Ninja
run: cmake --build ${{ runner.workspace }}/b/ninja
- name: Configure CMake+UnixMakefiles
run: cmake -G"Unix Makefiles" -B ${{ runner.workspace }}/b/unixmakefiles -DENABLE_RTLSDR=OFF -DENABLE_SOAPYSDR=OFF
- name: Build CMake+UnixMakefiles
run: cmake --build ${{ runner.workspace }}/b/unixmakefiles

doc_check_job:
runs-on: ubuntu-latest
name: Build documentation
steps:
- uses: actions/checkout@v4
- name: Install Doxygen
run: |
sudo apt-get update -q -y
sudo apt-get install -q -y --no-install-recommends cmake ninja-build
sudo apt-get install -q -y doxygen
- name: Configure CMake+Ninja
run: cmake -GNinja -B ${{ runner.workspace }}/b/ninja -DBUILD_DOCUMENTATION=ON -DENABLE_RTLSDR=OFF -DENABLE_SOAPYSDR=OFF
- name: Build CMake+Ninja
run: cmake --build ${{ runner.workspace }}/b/ninja -- doc_doxygen

style_check_job:
runs-on: ubuntu-latest
name: Check code style
steps:
- uses: actions/checkout@v3
- name: Style Check
uses: ./.github/actions/style-check
- uses: actions/checkout@v4
- name: Style Check
uses: ./.github/actions/style-check

maintainer_update_check_job:
runs-on: ubuntu-latest
name: Needs maintainer_update
steps:
- uses: actions/checkout@v3
- name: Working directory clean excluding untracked files
run: |
./maintainer_update.py
[ -z "$(git status --untracked-files=no --porcelain)" ]
- uses: actions/checkout@v4
- name: Working directory clean excluding untracked files
run: |
./maintainer_update.py
[ -z "$(git status --untracked-files=no --porcelain)" ]
symbolizer_check_job:
runs-on: ubuntu-latest
name: Check symbol errors
steps:
- uses: actions/checkout@v3
- name: Symbolizer report
run: |
./tests/symbolizer.py check
- uses: actions/checkout@v4
- name: Symbolizer report
run: |
./tests/symbolizer.py check
analyzer_check_job:
# https://github.com/actions/virtual-environments
# - Ubuntu 22.04 ubuntu-22.04
Expand All @@ -58,16 +89,16 @@ jobs:
runs-on: ubuntu-22.04
name: Analyze with Clang
steps:
- uses: actions/checkout@v3
- name: Install Clang
run: |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key 2>/dev/null | sudo apt-key add -
sudo add-apt-repository 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-14 main' -y
sudo apt-get update -q
sudo apt-get install -y clang-14 lld-14 libc++-14-dev libc++abi-14-dev clang-tools-14
- name: Clang Analyzer
# excludes include/mongoose.h src/mongoose.c include/jsmn.h src/jsmn.c
# exit code 1 if there is output
run: |
clang -Iinclude -DTHREADS --analyze -Xanalyzer -analyzer-output=text -Xanalyzer -analyzer-disable-checker=deadcode.DeadStores include/[a-ikln-z]*.h src/[a-ikln-z]*.c src/devices/*.c 2>&1 | tee analyzer.out
[ ! -s analyzer.out ]
- uses: actions/checkout@v4
- name: Install Clang
run: |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key 2>/dev/null | sudo apt-key add -
sudo add-apt-repository 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-18 main' -y
sudo apt-get update -q
sudo apt-get install -q -y clang-18 lld-18 libc++-18-dev libc++abi-18-dev clang-tools-18
- name: Clang Analyzer
# excludes include/mongoose.h src/mongoose.c include/jsmn.h src/jsmn.c
# exit code 1 if there is output
run: |
clang -Iinclude -DTHREADS --analyze -Xanalyzer -analyzer-output=text -Xanalyzer -analyzer-disable-checker=deadcode.DeadStores include/[a-ikln-z]*.h src/[a-ikln-z]*.c src/devices/*.c 2>&1 | tee analyzer.out
[ ! -s analyzer.out ]
Loading

0 comments on commit 7600299

Please sign in to comment.