Skip to content

Commit

Permalink
Migrate from autotools to meson
Browse files Browse the repository at this point in the history
For long-term maintainability and security.

Removing non-liquid and non-TMC build options (not tested or
maintained).
  • Loading branch information
windytan committed May 21, 2024
1 parent fcc6e1d commit 279748c
Show file tree
Hide file tree
Showing 23 changed files with 93 additions and 205 deletions.
20 changes: 9 additions & 11 deletions .github/workflows/ccpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: build

on:
push:
branches: [ master ]
branches: [ master, meson ]
pull_request:
branches: [ master ]

Expand All @@ -13,13 +13,11 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Install libraries
run: sudo apt-get install libsndfile1-dev libliquid-dev
- name: autoreconf
run: ./autogen.sh
- name: configure
run: ./configure
- name: make
run: make
- name: make check
run: make check
- name: Install dependencies
run: sudo apt install python3-pip ninja-build libsndfile1-dev libliquid-dev
- name: Install meson
run: pip3 install --user meson
- name: meson setup
run: meson setup build
- name: compile
run: cd build && meson compile
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## HEAD

* Migrate build system from autotools to meson (#90)
* Remove unmaintained build options for non-liquid, non-TMC builds
* Add support for enhanced RadioText (eRT)
* Add support for Long PS in Group 15A
* Fix detection of invalid date/time (timestamps >2000 years ago)
Expand Down
2 changes: 0 additions & 2 deletions Makefile.am

This file was deleted.

28 changes: 9 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ supports a large [subset of RDS features][Wiki: Features].
[![release](https://img.shields.io/github/release/windytan/redsea.svg)](https://github.com/windytan/redsea/releases/latest)
![build](https://github.com/windytan/redsea/workflows/build/badge.svg)

Decoded RDS groups are printed to the terminal as [line-delimited JSON][https://jsonlines.org/] objects
Decoded RDS groups are printed to the terminal as [line-delimited JSON](https://jsonlines.org/) objects
or, optionally, undecoded hex blocks (`-x`). Please refer to the wiki for
[input data formats][Wiki: Input].

Expand Down Expand Up @@ -50,11 +50,12 @@ beginning.

1. Install the prerequisites. On Ubuntu:

$ sudo apt install git build-essential autoconf libsndfile1-dev libliquid-dev
$ sudo apt install git ninja-build build-essential python3-pip libsndfile1-dev libliquid-dev
$ pip3 install --user meson

Or on macOS (OSX) using Homebrew:
Or on macOS using Homebrew:

$ brew install autoconf automake libsndfile liquid-dsp
$ brew install meson libsndfile liquid-dsp
$ xcode-select --install

2. Clone the repository (unless you downloaded a release zip file):
Expand All @@ -64,23 +65,12 @@ Or on macOS (OSX) using Homebrew:

3. Compile redsea:

$ ./autogen.sh && ./configure && make

4. Install:

$ make install
$ meson setup build && cd build && meson compile

How to later get the latest updates and recompile:

$ git pull
$ ./autogen.sh && ./configure && make clean && make
$ make install

For a slower machine it can take some time to compile the TMC support. This can
be disabled (`./configure --disable-tmc`).

If you only need to decode hex or binary input and don't need demodulation,
you can compile redsea without liquid-dsp (`./configure --without-liquid`).
$ cd build && meson compile

[liquid-dsp]: https://github.com/jgaeddert/liquid-dsp/releases/tag/v1.3.2

Expand Down Expand Up @@ -174,7 +164,7 @@ type:
* For realtime decoding, a Raspberry Pi 1 or faster
* ~8 MB of free memory (~128 MB for RDS-TMC)
* C++14 compiler
* GNU autotools
* meson + ninja (for building)
* libiconv 1.16
* libsndfile 1.0.31
* [liquid-dsp][liquid-dsp] release 1.3.2
Expand All @@ -185,7 +175,7 @@ type:

### Can't find liquid-dsp on macOS

If you've installed [liquid-dsp][liquid-dsp] yet `configure` can't find it, it's
If you've installed [liquid-dsp][liquid-dsp] yet meson can't find it, it's
possible that XCode command line tools aren't installed. Run this command to fix
it:

Expand Down
2 changes: 0 additions & 2 deletions autogen.sh

This file was deleted.

91 changes: 0 additions & 91 deletions configure.ac

This file was deleted.

63 changes: 63 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
project('redsea', 'cpp', default_options : ['cpp_std=c++14', 'warning_level=3', 'buildtype=release'],
version: '0.22-SNAPSHOT')

# Store version number to be compiled in
conf = configuration_data()
conf.set_quoted('VERSION', meson.project_version())
configure_file(output : 'config.h',
configuration : conf)

### Compiler options ###

cc = meson.get_compiler('cpp')
add_project_arguments(cc.get_supported_arguments([
'-Wno-unknown-pragmas']), language: 'cpp')

if get_option('buildtype') == 'release'
add_project_arguments('-O3', language : 'cpp')
endif

### Dependencies ###

iconv = dependency('iconv')
sndfile = dependency('sndfile')

# Detecting liquid-dsp in a portable fashion
if build_machine.system() == 'darwin'
fs = import('fs')
# Homebrew system
if fs.is_dir('/opt/homebrew/lib')
liquid_lib = cc.find_library('liquid',
dirs : ['/opt/homebrew/lib'])
liquid_inc = include_directories('/opt/homebrew/include')
# MacPorts system
else
liquid_lib = cc.find_library('liquid',
dirs : ['/opt/local/lib'])
liquid_inc = include_directories('/opt/local/include')
endif
liquid = declare_dependency(dependencies : liquid_lib,
include_directories : liquid_inc)
else
liquid = cc.find_library('liquid')
endif

sources = [
'src/block_sync.cc',
'src/channel.cc',
'src/common.cc',
'src/groups.cc',
'src/input.cc',
'src/liquid_wrappers.cc',
'src/options.cc',
'src/rdsstring.cc',
'src/redsea.cc',
'src/subcarrier.cc',
'src/tables.cc',
'src/tmc/tmc.cc',
'src/tmc/locationdb.cc',
'src/util.cc',
'ext/json/jsoncpp.cpp'
]

executable('redsea', sources, dependencies: [iconv, sndfile, liquid])
9 changes: 0 additions & 9 deletions src/Makefile.am

This file was deleted.

1 change: 0 additions & 1 deletion src/block_sync.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include <map>
#include <vector>

#include "config.h"
#include "src/groups.h"
#include "src/options.h"

Expand Down
2 changes: 0 additions & 2 deletions src/channel.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
#ifndef CHANNEL_H_
#define CHANNEL_H_

#include "config.h"

#include "src/block_sync.h"
#include "src/common.h"
#include "src/options.h"
Expand Down
15 changes: 1 addition & 14 deletions src/groups.cc
Original file line number Diff line number Diff line change
Expand Up @@ -221,11 +221,7 @@ Station::Station() : Station(0x0000, Options(), 0) {
}

Station::Station(uint16_t _pi, const Options& options, int which_channel, bool has_pi) :
pi_(_pi), has_pi_(has_pi), options_(options), which_channel_(which_channel)
#ifdef ENABLE_TMC
, tmc_(options)
#endif
{
pi_(_pi), has_pi_(has_pi), options_(options), which_channel_(which_channel), tmc_(options) {
writer_builder_["indentation"] = "";
writer_builder_["precision"] = 7;
writer_builder_.settings_["emitUTF8"] = true;
Expand Down Expand Up @@ -323,12 +319,9 @@ void Station::updateAndPrint(const Group& group, std::ostream* stream) {
} else if (type.number == 7 && type.version == GroupType::Version::A) {
decodeType7A(group);
} else if (type.number == 8 && type.version == GroupType::Version::A) {
#ifdef ENABLE_TMC

if (group.has(BLOCK2) && group.has(BLOCK3) && group.has(BLOCK4))
tmc_.receiveUserGroup(getBits<5>(group.getBlock2(), 0), group.getBlock3(),
group.getBlock4(), &json_);
#endif
} else if (type.number == 9 && type.version == GroupType::Version::A) {
decodeType9A(group);

Expand Down Expand Up @@ -666,11 +659,7 @@ void Station::decodeType3A(const Group& group) {
// RDS-TMC
case 0xCD46:
case 0xCD47:
#ifdef ENABLE_TMC
tmc_.receiveSystemGroup(oda_message, &json_);
#else
json_["debug"].append("redsea compiled without TMC support");
#endif
break;

default:
Expand Down Expand Up @@ -1024,11 +1013,9 @@ void Station::decodeODAGroup(const Group& group) {
// RDS-TMC
case 0xCD46:
case 0xCD47:
#ifdef ENABLE_TMC
if (group.has(BLOCK2) && group.has(BLOCK3) && group.has(BLOCK4))
tmc_.receiveUserGroup(getBits<5>(group.getBlock2(), 0), group.getBlock3(),
group.getBlock4(), &json_);
#endif
break;

default:
Expand Down
3 changes: 0 additions & 3 deletions src/groups.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@

#include <ext/json/json.h>

#include "config.h"
#include "src/common.h"
#include "src/options.h"
#include "src/rdsstring.h"
Expand Down Expand Up @@ -250,9 +249,7 @@ class Station {
std::unique_ptr<Json::StreamWriter> writer_;
Json::Value json_;

#ifdef ENABLE_TMC
tmc::TMCService tmc_;
#endif
};

void parseRadioTextPlus(const Group& group, RadioText& rt, Json::Value& json_el);
Expand Down
2 changes: 0 additions & 2 deletions src/input.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
#include <array>
#include <vector>

#include "config.h"

#include <sndfile.h>

#include "src/common.h"
Expand Down
8 changes: 2 additions & 6 deletions src/liquid_wrappers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,12 @@
*/
#include "src/liquid_wrappers.h"

#include "config.h"
#ifdef HAVE_LIQUID

#include <cassert>
#include <complex>

// https://github.com/jgaeddert/liquid-dsp/issues/229
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
// https://github.com/jgaeddert/liquid-dsp/issues/229
#pragma clang diagnostic ignored "-Wreturn-type-c-linkage"
extern "C" {
#include "liquid/liquid.h"
Expand Down Expand Up @@ -195,5 +193,3 @@ unsigned int Resampler::execute(float in,
}

} // namespace liquid

#endif
Loading

0 comments on commit 279748c

Please sign in to comment.