Build/packaging work for the bladeRF

This commit is contained in:
Oliver Jowett 2017-01-30 21:55:20 +00:00
parent 0a6dc372ad
commit 7700cd90d3
6 changed files with 35 additions and 19 deletions

View file

@ -1,13 +1,11 @@
PROGNAME=dump1090
RTLSDR ?= yes
BLADERF ?= yes
CC=gcc
CPPFLAGS += -DMODES_DUMP1090_VERSION=\"$(DUMP1090_VERSION)\" -DMODES_DUMP1090_VARIANT=\"dump1090-fa\"
ifneq ($(RTLSDR_PREFIX),"")
CPPFLAGS += -I$(RTLSDR_PREFIX)/include
LDFLAGS += -L$(RTLSDR_PREFIX)/lib
endif
ifneq ($(HTMLPATH),"")
CPPFLAGS += -DHTMLPATH=\"$(HTMLPATH)\"
endif
@ -16,21 +14,39 @@ DIALECT = -std=c11
CFLAGS += $(DIALECT) -O2 -g -Wall -Werror -W -D_DEFAULT_SOURCE
LIBS = -lpthread -lm -lrt
ifeq ($(STATIC), yes)
LIBS_RTLSDR = -Wl,-Bstatic -lrtlsdr -Wl,-Bdynamic -lusb-1.0
ifeq ($(RTLSDR), yes)
SDR_OBJ += sdr_rtlsdr.o
CPPFLAGS += -DENABLE_RTLSDR
ifdef RTLSDR_PREFIX
CPPFLAGS += -I$(RTLSDR_PREFIX)/include
LDFLAGS += -L$(RTLSDR_PREFIX)/lib
else
LIBS_RTLSDR = -lrtlsdr -lusb-1.0
CFLAGS += $(shell pkg-config --cflags librtlsdr)
LDFLAGS += $(shell pkg-config --libs-only-L librtlsdr)
endif
LIBS_RTLSDR += -lbladeRF
ifeq ($(STATIC), yes)
LIBS_SDR += -Wl,-Bstatic -lrtlsdr -Wl,-Bdynamic -lusb-1.0
else
LIBS_SDR += -lrtlsdr -lusb-1.0
endif
endif
ifeq ($(BLADERF), yes)
SDR_OBJ += sdr_bladerf.o
CPPFLAGS += -DENABLE_BLADERF
CFLAGS += $(shell pkg-config --cflags libbladeRF)
LIBS_SDR += $(shell pkg-config --libs libbladeRF)
endif
all: dump1090 view1090
%.o: %.c *.h
$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
dump1090: dump1090.o anet.o interactive.o mode_ac.o mode_s.o net_io.o crc.o demod_2400.o stats.o cpr.o icao_filter.o track.o util.o convert.o sdr_ifile.o sdr_rtlsdr.o sdr_bladerf.o sdr.o $(COMPAT)
$(CC) -g -o $@ $^ $(LDFLAGS) $(LIBS) $(LIBS_RTLSDR) -lncurses
dump1090: dump1090.o anet.o interactive.o mode_ac.o mode_s.o net_io.o crc.o demod_2400.o stats.o cpr.o icao_filter.o track.o util.o convert.o sdr_ifile.o sdr.o $(SDR_OBJ) $(COMPAT)
$(CC) -g -o $@ $^ $(LDFLAGS) $(LIBS) $(LIBS_SDR) -lncurses
view1090: view1090.o anet.o interactive.o mode_ac.o mode_s.o net_io.o crc.o stats.o cpr.o icao_filter.o track.o util.o $(COMPAT)
$(CC) -g -o $@ $^ $(LDFLAGS) $(LIBS) -lncurses

View file

@ -22,7 +22,7 @@ install_rtlsdr:
cd rtl-sdr-build && cmake ../rtl-sdr -DCMAKE_INSTALL_PREFIX=./install && make install
override_dh_auto_build: install_rtlsdr
dh_auto_build -- DIALECT=-std=gnu1x HTMLPATH=/usr/share/$(SRCNAME)/html DUMP1090_VERSION=$(DUMP1090_VERSION) STATIC=yes RTLSDR_PREFIX=rtl-sdr-build/install
dh_auto_build -- RTLSDR=yes BLADERF=no DIALECT=-std=gnu1x HTMLPATH=/usr/share/$(SRCNAME)/html DUMP1090_VERSION=$(DUMP1090_VERSION) STATIC=yes RTLSDR_PREFIX=rtl-sdr-build/install
override_dh_auto_test:
dh_auto_test -- DIALECT=-std=gnu1x

4
debian/control vendored
View file

@ -2,7 +2,7 @@ Source: dump1090-fa
Section: embedded
Priority: extra
Maintainer: Oliver Jowett <oliver@mutability.co.uk>
Build-Depends: debhelper(>=9), librtlsdr-dev, libusb-1.0-0-dev, pkg-config, dh-systemd, libncurses5-dev
Build-Depends: debhelper(>=9), librtlsdr-dev, libusb-1.0-0-dev, pkg-config, dh-systemd, libncurses5-dev, libbladerf-dev
Standards-Version: 3.9.3
Homepage: https://github.com/mutability/dump1090
Vcs-Git: https://github.com/mutability/dump1090.git
@ -19,7 +19,7 @@ Description: transitional dummy package for dump1090
Package: dump1090-fa
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, adduser, lighttpd
Depends: ${shlibs:Depends}, ${misc:Depends}, libbladerf1(>=2016.06), libbladerf-udev, adduser, lighttpd
Replaces: dump1090 (<< 3.0)
Breaks: dump1090 (<< 3.0)
Description: ADS-B Ground Station System for RTL-SDR

View file

@ -31,6 +31,9 @@ case "$1" in
adduser --system --home /usr/share/$NAME --no-create-home --quiet "$RUNAS"
fi
# plugdev required for bladeRF USB access
adduser "$RUNAS" plugdev
# set up lighttpd
echo "Enabling lighttpd integration.." >&2
lighty-enable-mod dump1090-fa || true

2
debian/rules vendored
View file

@ -20,7 +20,7 @@ ifeq ($(DEB_HOST_ARCH),armhf)
endif
override_dh_auto_build:
dh_auto_build -- HTMLPATH=/usr/share/$(DEB_SOURCE)/html DUMP1090_VERSION=$(DEB_VERSION) RTLSDR_PREFIX=/usr
dh_auto_build -- RTLSDR=yes BLADERF=yes HTMLPATH=/usr/share/$(DEB_SOURCE)/html DUMP1090_VERSION=$(DEB_VERSION)
override_dh_install:
dh_install

3
sdr.c
View file

@ -20,9 +20,6 @@
#include "dump1090.h"
#define ENABLE_RTLSDR
#define ENABLE_BLADERF
#include "sdr_ifile.h"
#ifdef ENABLE_RTLSDR
# include "sdr_rtlsdr.h"