# [pkg-request] / [port-request] dump1090-mutability for FreeBSD



## abcd567 (Dec 7, 2018)

I want to install dump1090-mutability on FreeBSD, but it is not available in FreeBSD repositories (ports,  pkg, comms).
The source code for dump1090-mutability is available at GitHub, *but it is designed for Debian Linux, and does not directly compile on FreeBSD*.

https://github.com/mutability/dump1090

Also it requires some dependencies which are not available in FreeBSD repositories *(librtlsdr-dev, libusb-1.0-0-dev)*

Can anyone help me, and show how to build the pkg for freeBSD from the source code at GitHub? Most likely changes will be required in the "Makefile" of source code to match /suite environment of FreeBSD.


----------



## abcd567 (Dec 7, 2018)

*FOR QUICK REFERENCE*

*List of files in source code:*

```
git clone https://github.com/mutability/dump1090.git

ls dump1090

anet.c     cprtests.c    faup1090.c     net_io.c            tools
anet.h     crc.c         icao_filter.c  net_io.h            track.c
compat     crc.h         icao_filter.h  public_html         track.h
convert.c  debian        interactive.c  README-dump1090.md  util.c
convert.h  demod_2400.c  LICENSE        README-json.md      util.h
COPYING    demod_2400.h  Makefile       README.md           view1090.c
cpr.c      dump1090.c    mode_ac.c      stats.c
cpr.h      dump1090.h    mode_s.c       stats.h
```

.

*The contents of file "Makefile"*

```
cat dump1090/Makefile

#
# When building a package or installing otherwise in the system, make
# sure that the variable PREFIX is defined, e.g. make PREFIX=/usr/local
#
PROGNAME=dump1090

ifndef DUMP1090_VERSION
DUMP1090_VERSION=$(shell git describe --always --tags --match=v*)
endif

ifdef PREFIX
BINDIR=$(PREFIX)/bin
SHAREDIR=$(PREFIX)/share/$(PROGNAME)
EXTRACFLAGS=-DHTMLPATH=\"$(SHAREDIR)\"
endif

CPPFLAGS+=-DMODES_DUMP1090_VERSION=\"$(DUMP1090_VERSION)\"
CFLAGS+=-O2 -g -Wall -Werror -W -Wno-unknown-warning-option -Wno-format-truncation
LIBS=-lpthread -lm
LIBS_RTL=`pkg-config --libs librtlsdr libusb-1.0`
CC=gcc

UNAME := $(shell uname)

ifeq ($(UNAME), Linux)
LIBS+=-lrt
CFLAGS+=-std=c11 -D_DEFAULT_SOURCE
endif
ifeq ($(UNAME), Darwin)
UNAME_R := $(shell uname -r)
ifeq ($(shell expr "$(UNAME_R)" : '1[012345]\.'),3)
CFLAGS+=-std=c11 -DMISSING_GETTIME -DMISSING_NANOSLEEP
COMPAT+=compat/clock_gettime/clock_gettime.o compat/clock_nanosleep/clock_nanosleep.o
else
# Darwin 16 (OS X 10.12) supplies clock_gettime() and clockid_t
CFLAGS+=-std=c11 -DMISSING_NANOSLEEP -DCLOCKID_T
COMPAT+=compat/clock_nanosleep/clock_nanosleep.o
endif
endif

ifeq ($(UNAME), OpenBSD)
CFLAGS+= -DMISSING_NANOSLEEP
COMPAT+= compat/clock_nanosleep/clock_nanosleep.o
endif

all: dump1090 view1090

%.o: %.c *.h
        $(CC) $(CPPFLAGS) $(CFLAGS) $(EXTRACFLAGS) -c $< -o $@

dump1090.o: CFLAGS += `pkg-config --cflags librtlsdr libusb-1.0`

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 $(COMPAT)
        $(CC) -g -o $@ $^ $(LIBS) $(LIBS_RTL) $(LDFLAGS)

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 $@ $^ $(LIBS) $(LDFLAGS)

faup1090: faup1090.o anet.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 $@ $^ $(LIBS) $(LDFLAGS)

clean:
        rm -f *.o compat/clock_gettime/*.o compat/clock_nanosleep/*.o dump1090 view1090 faup1090 cprtests crctests

test: cprtests
        ./cprtests

cprtests: cpr.o cprtests.o
        $(CC) $(CPPFLAGS) $(CFLAGS) $(EXTRACFLAGS) -g -o $@ $^ -lm

crctests: crc.c crc.h
        $(CC) $(CPPFLAGS) $(CFLAGS) $(EXTRACFLAGS) -g -DCRCDEBUG -o $@ $<
```


----------



## SirDice (Dec 10, 2018)

abcd567 said:


> Can anyone help me, and show how to build the pkg for FreeBSD from the source code at GitHub?


FreeBSD Porter's Handbook


----------



## abcd567 (Dec 12, 2018)

Thanks Sensucht94.

Will go through the Handbook. It is a lot of reading. 

I am totally new to FreeBSD, only few weeks in it. Used Debian & Ubuntu for 3 years before trying to switch to FreeBSD.


----------

