diff --git a/CMakeLists.txt b/CMakeLists.txt index 21676ebbe..1311009d7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -81,11 +81,14 @@ find_package(CppUnit) # find_package(Gnuradio) #endif(CMAKE_SYSTEM_NAME STREQUAL "Darwin") -set(GR_REQUIRED_COMPONENTS ANALOG DIGITAL RUNTIME BLOCKS FILTER PMT) -find_package(Gnuradio) +set(GR_REQUIRED_COMPONENTS ANALOG DIGITAL RUNTIME BLOCKS FILTER PMT FFT) +find_package(Gnuradio REQUIRED COMPONENTS analog blocks digital filter fft) find_package(GnuradioRuntime) find_package(CppUnit) +math(EXPR GNURADIO_VERSION "(${Gnuradio_VERSION_MAJOR} / 10) << 20 | (${Gnuradio_VERSION_MAJOR} % 10) << 16 | (${Gnuradio_VERSION_MINOR} / 10) << 12 | (${Gnuradio_VERSION_MINOR} % 10) << 8 | (${Gnuradio_VERSION_PATCH} / 10) << 4 | (${Gnuradio_VERSION_PATCH} % 10) << 0 ") +message(STATUS "GnuRadio Version: " ${GNURADIO_VERSION}) + if(NOT GNURADIO_RUNTIME_FOUND) message(FATAL_ERROR "GnuRadio Runtime required to compile Trunk Recorder") endif() @@ -105,9 +108,7 @@ find_package(UHD) find_package(OpenSSL REQUIRED) find_package(CURL REQUIRED) -if(NOT GNURADIO_RUNTIME_FOUND) - message(FATAL_ERROR "GnuRadio Runtime required to build " ${CMAKE_PROJECT_NAME}) -endif() + ######################################################################## # Setup boost @@ -141,14 +142,14 @@ set(Boost_ADDITIONAL_VERSIONS "1.70.0" "1.70" "1.71.0" "1.71" "1.72.0" "1.72" "1.73.0" "1.73" "1.74.0" "1.74" ) -find_package(Boost COMPONENTS ${BOOST_REQUIRED_COMPONENTS}) +find_package(Boost COMPONENTS ${BOOST_REQUIRED_COMPONENTS} REQUIRED) if(NOT Boost_FOUND) message(FATAL_ERROR "Boost required to build " ${CMAKE_PROJECT_NAME}) endif() ADD_DEFINITIONS(-DBOOST_ALL_DYN_LINK) - +add_definitions(-DGNURADIO_VERSION=${GNURADIO_VERSION}) ######################################################################## # Setup the include and linker paths @@ -175,17 +176,14 @@ link_directories( ${OPENSSL_ROOT_DIR}/lib ) - set(CMAKE_CXX_FLAGS_DEBUG "-Wall -Wno-unused-local-typedef -Wno-deprecated-declarations -Wno-error=deprecated-declarations -g") SET(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -Wno-narrowing") - add_subdirectory(lib/op25_repeater) - list(APPEND trunk_recorder_sources trunk-recorder/main.cc trunk-recorder/formatter.cc @@ -240,4 +238,13 @@ target_compile_options( add_executable(recorder ${trunk_recorder_sources}) -target_link_libraries(recorder ssl crypto ${CURL_LIBRARIES} ${GNURADIO_PMT_LIBRARIES} ${GNURADIO_RUNTIME_LIBRARIES} ${GNURADIO_FILTER_LIBRARIES} ${GNURADIO_DIGITAL_LIBRARIES} ${GNURADIO_ANALOG_LIBRARIES} ${GNURADIO_AUDIO_LIBRARIES} ${GNURADIO_UHD_LIBRARIES} ${UHD_LIBRARIES} ${GNURADIO_BLOCKS_LIBRARIES} ${GROSMOSDR_LIBRARIES} ${Boost_LIBRARIES} ${LIBOP25_REPEATER_LIBRARIES} gnuradio-op25_repeater imbe_vocoder) +target_link_libraries(recorder ssl crypto ${CURL_LIBRARIES} ${Boost_LIBRARIES} ${GNURADIO_PMT_LIBRARIES} ${GNURADIO_RUNTIME_LIBRARIES} ${GNURADIO_FILTER_LIBRARIES} ${GNURADIO_DIGITAL_LIBRARIES} ${GNURADIO_ANALOG_LIBRARIES} ${GNURADIO_AUDIO_LIBRARIES} ${GNURADIO_UHD_LIBRARIES} ${UHD_LIBRARIES} ${GNURADIO_BLOCKS_LIBRARIES} ${GROSMOSDR_LIBRARIES} ${LIBOP25_REPEATER_LIBRARIES} gnuradio-op25_repeater imbe_vocoder) +message(STATUS "All libraries:" ${GNURADIO_ALL_LIBRARIES}) +if(NOT Gnuradio_VERSION VERSION_LESS "3.8") + target_link_libraries(recorder + gnuradio::gnuradio-analog + gnuradio::gnuradio-blocks + gnuradio::gnuradio-digital + gnuradio::gnuradio-filter + ) +endif() diff --git a/blacklist-rtl.conf b/blacklist-rtl.conf new file mode 100644 index 000000000..f723da335 --- /dev/null +++ b/blacklist-rtl.conf @@ -0,0 +1,4 @@ +blacklist dvb_usb_rtl28xxu +blacklist rtl2832 +blacklist rtl2830 +blacklist rtl2838 diff --git a/install.sh b/install.sh new file mode 100755 index 000000000..b99371c73 --- /dev/null +++ b/install.sh @@ -0,0 +1,31 @@ +#! /bin/sh + +set -e + +# trunk-recorder install script for debian based systems +# including ubuntu 18.04/20.04 and raspbian + +if [ ! -d trunk-recorder/recorders ]; then + echo ====== ERROR: trunk-recorder top level directories not found. + echo ====== You must change to the trunk-recorder top level directory + echo ====== before running this script. + exit +fi + +sudo apt-get update +sudo apt-get install gnuradio gnuradio-dev gr-osmosdr libhackrf-dev libuhd-dev libgmp-dev +sudo apt-get install git cmake build-essential libboost-all-dev libusb-1.0-0.dev libssl-dev libcurl4-openssl-dev liborc-0.4-dev + +mkdir build +cd build +cmake ../ +make +sudo cp -i recorder /usr/local/bin/trunk-recorder + +cd .. + +if [ ! -f /etc/modprobe.d/blacklist-rtl.conf ]; then + echo ====== Installing blacklist-rtl.conf for selecting the correct RTL-SDR drivers + echo ====== Please reboot before running trunk-recorder. + sudo install -m 0644 ./blacklist-rtl.conf /etc/modprobe.d/ +fi diff --git a/rebuild.sh b/rebuild.sh new file mode 100755 index 000000000..3b5cd0cde --- /dev/null +++ b/rebuild.sh @@ -0,0 +1,9 @@ +#!/bin/sh +set -e +git pull +mkdir -p build +cd build +rm -rf * +cmake ../ +make +sudo cp -i recorder /usr/local/bin/trunk-recorder diff --git a/trunk-recorder/recorders/analog_recorder.h b/trunk-recorder/recorders/analog_recorder.h index e5471aecc..290ef2c8a 100644 --- a/trunk-recorder/recorders/analog_recorder.h +++ b/trunk-recorder/recorders/analog_recorder.h @@ -20,11 +20,16 @@ #include #include -#include +#if GNURADIO_VERSION < 0x030800 +#include +#include +#else +#include +#include +#endif #include #include -#include #include #include diff --git a/trunk-recorder/recorders/debug_recorder.h b/trunk-recorder/recorders/debug_recorder.h index bc2b66848..a718f883a 100644 --- a/trunk-recorder/recorders/debug_recorder.h +++ b/trunk-recorder/recorders/debug_recorder.h @@ -20,24 +20,29 @@ #include #include -#include -#include -#include #include -#include - -#include #include #include #include #include +#if GNURADIO_VERSION < 0x030800 +#include +#include +#include +#include +#include +#include +#else +#include +#include +#include +#include +#endif + #include #include #include -#include -#include -#include #include #include diff --git a/trunk-recorder/recorders/p25_recorder.h b/trunk-recorder/recorders/p25_recorder.h index 2321df1e0..b307403e0 100644 --- a/trunk-recorder/recorders/p25_recorder.h +++ b/trunk-recorder/recorders/p25_recorder.h @@ -17,15 +17,11 @@ #include #include - #include -#include -#include -#include + #include #include -#include #include #include #include @@ -34,9 +30,22 @@ #include #include #include -#include + +#if GNURADIO_VERSION < 0x030800 +#include #include +#include #include +#include +#include +#include +#else +#include +#include +#include +#include +#endif + #include #include diff --git a/trunk-recorder/recorders/recorder.h b/trunk-recorder/recorders/recorder.h index f1f5fdc30..4a0ccffea 100644 --- a/trunk-recorder/recorders/recorder.h +++ b/trunk-recorder/recorders/recorder.h @@ -17,21 +17,32 @@ #include #include -#include #include + +#if GNURADIO_VERSION < 0x030800 +#include +#include #include #include +#include +#include #include -#include #include -#include -#include -#include -#include -#include -#include #include #include +#else +#include +#include +#include +#include +#include +#include +#endif + +#include + +#include + #include #include #include diff --git a/trunk-recorder/recorders/sigmf_recorder.h b/trunk-recorder/recorders/sigmf_recorder.h index 280057477..db820ee6f 100644 --- a/trunk-recorder/recorders/sigmf_recorder.h +++ b/trunk-recorder/recorders/sigmf_recorder.h @@ -17,17 +17,13 @@ #include #include -#include #include -#include -#include -#include #include -#include + #include -#include + #include #include #include @@ -36,14 +32,30 @@ #include +#if GNURADIO_VERSION < 0x030800 +#include #include #include #include +#include +#include +#include +#include +#include +#include +#else +#include +#include +#include +#include +#include +#include +#endif + #include #include -#include -#include + #include #include diff --git a/trunk-recorder/systems/p25_trunking.h b/trunk-recorder/systems/p25_trunking.h index 3c14aa8c1..e753878ab 100644 --- a/trunk-recorder/systems/p25_trunking.h +++ b/trunk-recorder/systems/p25_trunking.h @@ -20,19 +20,28 @@ #include #include + +#if GNURADIO_VERSION < 0x030800 #include #include +#include +#include +#include +#else +#include +#include +#include +#include +#endif + #include #include #include -#include #include -#include #include #include -#include #include #include #include diff --git a/trunk-recorder/systems/smartnet_trunking.h b/trunk-recorder/systems/smartnet_trunking.h index 13380d62c..fa636319f 100644 --- a/trunk-recorder/systems/smartnet_trunking.h +++ b/trunk-recorder/systems/smartnet_trunking.h @@ -11,19 +11,26 @@ #include +#if GNURADIO_VERSION < 0x030800 +#include +#include +#include +#else +#include +#include +#include +#endif + #include #include -#include #include #include #include #include #include -#include -#include -#include +#include #include "smartnet_decode.h"