mirror of https://github.com/wb2osz/direwolf.git
Mac OS X patches.
This commit is contained in:
parent
50c5542f78
commit
37179479ca
130
Makefile.macosx
130
Makefile.macosx
|
@ -24,7 +24,7 @@
|
||||||
# 3. Removed fsk_fast_filter.h from atest receipe, clang compiler was having
|
# 3. Removed fsk_fast_filter.h from atest receipe, clang compiler was having
|
||||||
# a hissy fit. Not check with GCC.
|
# a hissy fit. Not check with GCC.
|
||||||
|
|
||||||
APPS := direwolf decode_aprs text2tt tt2text ll2utm utm2ll aclients atest log2gpx gen_packets ttcalc
|
APPS := direwolf decode_aprs text2tt tt2text ll2utm utm2ll aclients atest log2gpx gen_packets ttcalc kissutil
|
||||||
|
|
||||||
all : $(APPS) direwolf.conf
|
all : $(APPS) direwolf.conf
|
||||||
@echo " "
|
@echo " "
|
||||||
|
@ -86,86 +86,14 @@ CFLAGS += -D_BSD_SOURCE
|
||||||
|
|
||||||
# $(info $$CC is [${CC}])
|
# $(info $$CC is [${CC}])
|
||||||
|
|
||||||
#
|
|
||||||
# The DSP filters spend a lot of time spinning around in little
|
|
||||||
# loops multiplying and adding arrays of numbers. The Intel "SSE"
|
|
||||||
# instructions, introduced in 1999 with the Pentium III series,
|
|
||||||
# can speed this up considerably.
|
|
||||||
#
|
|
||||||
# SSE2 instructions, added in 2000, don't seem to offer any advantage.
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# Let's take a look at the effect of the compile options.
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# Times are elapsed time to process Track 2 of the TNC test CD.
|
|
||||||
#
|
|
||||||
# i.e. "./atest 02_Track_2.wav"
|
|
||||||
# Default demodulator type is new "E" added for version 1.2.
|
|
||||||
#
|
|
||||||
|
|
||||||
#
|
# If the compiler is generating code for a 32 bit target (-m32), we can
|
||||||
# ---------- x86 (32 bit) ----------
|
# get much better results by telling it we have at least a Pentium 3
|
||||||
#
|
# which hass the SSE instructions.
|
||||||
|
|
||||||
#
|
|
||||||
# gcc 4.6.3 running on Ubuntu 12.04.05.
|
|
||||||
# Intel(R) Celeron(R) CPU 2.53GHz. Appears to have only 32 bit instructions.
|
|
||||||
# Probably from around 2004 or 2005.
|
|
||||||
#
|
|
||||||
# When gcc is generating code for a 32 bit x86 target, it assumes the ancient
|
|
||||||
# i386 processor. This is good for portability but bad for performance.
|
|
||||||
#
|
|
||||||
# The code can run considerably faster by taking advantage of the SSE instructions
|
|
||||||
# available in the Pentium 3 or later.
|
|
||||||
#
|
|
||||||
# seconds options comments
|
|
||||||
# ------ ------- --------
|
|
||||||
# 524
|
|
||||||
# 183 -O2
|
|
||||||
# 182 -O3
|
|
||||||
# 183 -O3 -ffast-math (should be same as -Ofast)
|
|
||||||
# 184 -Ofast
|
|
||||||
# 189 -O3 -ffast-math -march=pentium
|
|
||||||
# 122 -O3 -ffast-math -msse
|
|
||||||
# 122 -O3 -ffast-math -march=pentium -msse
|
|
||||||
# 121 -O3 -ffast-math -march=pentium3 (this implies -msse)
|
|
||||||
# 120 -O3 -ffast-math -march=native
|
|
||||||
#
|
|
||||||
# Note that "-march=native" is essentially the same as "-march=pentium3."
|
|
||||||
#
|
|
||||||
|
|
||||||
# If the compiler is generating code for the i386 target, we can
|
|
||||||
# get much better results by telling it we have at least a Pentium 3.
|
|
||||||
|
|
||||||
CFLAGS += -march=core2 -msse4.1 -std=gnu99
|
CFLAGS += -march=core2 -msse4.1 -std=gnu99
|
||||||
#CFLAGS += -march=pentium3 -sse
|
#CFLAGS += -march=pentium3 -sse
|
||||||
|
|
||||||
#
|
|
||||||
# gcc 4.8.2 running on Ubuntu 14.04.1.
|
|
||||||
# Intel Core 2 Duo from around 2007 or 2008.
|
|
||||||
#
|
|
||||||
# 64 bit target implies that we have SSE and probably even better vector instructions.
|
|
||||||
#
|
|
||||||
# seconds options comments
|
|
||||||
# ------ ------- --------
|
|
||||||
# 245
|
|
||||||
# 75 -01
|
|
||||||
# 72 -02
|
|
||||||
# 71 -03
|
|
||||||
# 73 -O3 -march=native
|
|
||||||
# 42 -O3 -ffast-math
|
|
||||||
# 42 -Ofast (note below)
|
|
||||||
# 40 -O3 -ffast-math -march=native
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# Note that "-Ofast" is a newer option roughly equivalent to "-O3 -ffast-math".
|
|
||||||
# I use the longer form because it is compatible with older compilers.
|
|
||||||
#
|
|
||||||
# Why don't I don't have "-march=native?"
|
|
||||||
# Older compilers don't recognize "native" as one of the valid options.
|
|
||||||
# One article said it was added with gcc 4.2 but I haven't verified that.
|
|
||||||
#
|
|
||||||
|
|
||||||
# Add -ffastmath in only if compiler version recognizes it.
|
# Add -ffastmath in only if compiler version recognizes it.
|
||||||
|
|
||||||
|
@ -174,22 +102,6 @@ ifneq ($(useffast),)
|
||||||
CFLAGS += -ffast-math
|
CFLAGS += -ffast-math
|
||||||
endif
|
endif
|
||||||
|
|
||||||
#
|
|
||||||
# You would expect "-march=native" to produce the fastest code.
|
|
||||||
# Why don't I use it here?
|
|
||||||
#
|
|
||||||
# 1. In my benchmarks, above, it has a negligible impact if any at all.
|
|
||||||
# 2. Some older versions of gcc don't recognize "native" as a valid choice.
|
|
||||||
# 3. Results are less portable. Not a consideration if you are
|
|
||||||
# building only for your own use but very important for anyone
|
|
||||||
# redistributing a "binary" version.
|
|
||||||
#
|
|
||||||
# If you are planning to distribute the binary version to other
|
|
||||||
# people (in some ham radio software collection, RPM, or DEB package),
|
|
||||||
# avoid # fine tuning it for your particular computer. It could
|
|
||||||
# cause compatibility issues for those with older computers.
|
|
||||||
#
|
|
||||||
|
|
||||||
#CFLAGS += -D_FORTIFY_SOURCE
|
#CFLAGS += -D_FORTIFY_SOURCE
|
||||||
|
|
||||||
# Use PortAudio Library
|
# Use PortAudio Library
|
||||||
|
@ -296,20 +208,15 @@ direwolf.conf : generic.conf
|
||||||
|
|
||||||
|
|
||||||
# Where should we install it?
|
# Where should we install it?
|
||||||
|
# Macports typically installs in /opt/local so maybe you want to use that instead.
|
||||||
# My understanding, of the convention, is that something you compile
|
|
||||||
# from source, that is not a standard part of the operating system,
|
|
||||||
# should go in /usr/local/bin.
|
|
||||||
|
|
||||||
# This is a step in the right direction but not sufficient to use /usr instead.
|
|
||||||
|
|
||||||
INSTALLDIR := /usr/local
|
INSTALLDIR := /usr/local
|
||||||
|
#INSTALLDIR := /opt/local
|
||||||
|
|
||||||
# TODO: Test this better.
|
# TODO: Test this better.
|
||||||
|
|
||||||
# Optional installation into /usr/local/...
|
# Optional installation into INSTALLDIR.
|
||||||
# Needs to be run as root or with sudo.
|
# Needs to be run as root or with sudo.
|
||||||
# TODO: Review file locations.
|
|
||||||
|
|
||||||
# Command to "install" to system directories. "install" for Linux. "ginstall" for Mac.
|
# Command to "install" to system directories. "install" for Linux. "ginstall" for Mac.
|
||||||
|
|
||||||
|
@ -318,8 +225,7 @@ INSTALL=ginstall
|
||||||
.PHONY: install
|
.PHONY: install
|
||||||
install : $(APPS) direwolf.conf tocalls.txt symbols-new.txt symbolsX.txt dw-icon.png
|
install : $(APPS) direwolf.conf tocalls.txt symbols-new.txt symbolsX.txt dw-icon.png
|
||||||
#
|
#
|
||||||
# Applications, not installed with package manager, normally go in /usr/local/bin.
|
# Applications.
|
||||||
# /usr/bin is used instead when installing from .DEB or .RPM package.
|
|
||||||
#
|
#
|
||||||
$(INSTALL) direwolf $(INSTALLDIR)/bin
|
$(INSTALL) direwolf $(INSTALLDIR)/bin
|
||||||
$(INSTALL) decode_aprs $(INSTALLDIR)/bin
|
$(INSTALL) decode_aprs $(INSTALLDIR)/bin
|
||||||
|
@ -332,6 +238,7 @@ install : $(APPS) direwolf.conf tocalls.txt symbols-new.txt symbolsX.txt dw-icon
|
||||||
$(INSTALL) gen_packets $(INSTALLDIR)/bin
|
$(INSTALL) gen_packets $(INSTALLDIR)/bin
|
||||||
$(INSTALL) atest $(INSTALLDIR)/bin
|
$(INSTALL) atest $(INSTALLDIR)/bin
|
||||||
$(INSTALL) ttcalc $(INSTALLDIR)/bin
|
$(INSTALL) ttcalc $(INSTALLDIR)/bin
|
||||||
|
$(INSTALL) kissutil $(INSTALLDIR)/bin
|
||||||
$(INSTALL) dwespeak.sh $(INSTALLDIR)/bin
|
$(INSTALL) dwespeak.sh $(INSTALLDIR)/bin
|
||||||
#
|
#
|
||||||
# Telemetry Toolkit executables. Other .conf and .txt files will go into doc directory.
|
# Telemetry Toolkit executables. Other .conf and .txt files will go into doc directory.
|
||||||
|
@ -347,10 +254,11 @@ install : $(APPS) direwolf.conf tocalls.txt symbols-new.txt symbolsX.txt dw-icon
|
||||||
#
|
#
|
||||||
# Misc. data such as "tocall" to system mapping.
|
# Misc. data such as "tocall" to system mapping.
|
||||||
#
|
#
|
||||||
$(INSTALL) -D --mode=644 tocalls.txt /usr/share/direwolf/tocalls.txt
|
$(INSTALL) -D --mode=644 tocalls.txt $(INSTALLDIR)/share/direwolf/tocalls.txt
|
||||||
$(INSTALL) -D --mode=644 symbols-new.txt /usr/share/direwolf/symbols-new.txt
|
$(INSTALL) -D --mode=644 symbols-new.txt $(INSTALLDIR)/share/direwolf/symbols-new.txt
|
||||||
$(INSTALL) -D --mode=644 symbolsX.txt /usr/share/direwolf/symbolsX.txt
|
$(INSTALL) -D --mode=644 symbolsX.txt $(INSTALLDIR)/share/direwolf/symbolsX.txt
|
||||||
$(INSTALL) -D --mode=644 dw-icon.png /usr/share/direwolf/dw-icon.png
|
$(INSTALL) -D --mode=644 dw-icon.png $(INSTALLDIR)/share/direwolf/dw-icon.png
|
||||||
|
|
||||||
#
|
#
|
||||||
# Documentation. Various plain text files and PDF.
|
# Documentation. Various plain text files and PDF.
|
||||||
#
|
#
|
||||||
|
@ -535,6 +443,14 @@ aclients : aclients.c ax25_pad.c fcs_calc.c textcolor.c
|
||||||
$(CC) $(CFLAGS) -g -o $@ $^
|
$(CC) $(CFLAGS) -g -o $@ $^
|
||||||
|
|
||||||
|
|
||||||
|
# Talk to a KISS TNC.
|
||||||
|
# Note: kiss_frame.c has conditional compilation on KISSUTIL.
|
||||||
|
|
||||||
|
kissutil : kissutil.c kiss_frame.c ax25_pad.o fcs_calc.o textcolor.o serial_port.o dtime_now.o sock.o misc.a
|
||||||
|
$(CC) $(CFLAGS) -g -DKISSUTIL -o $@ $^ $(LDFLAGS)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Touch Tone to Speech sample application.
|
# Touch Tone to Speech sample application.
|
||||||
|
|
||||||
ttcalc : ttcalc.o ax25_pad.o fcs_calc.o textcolor.o
|
ttcalc : ttcalc.o ax25_pad.o fcs_calc.o textcolor.o
|
||||||
|
@ -568,6 +484,7 @@ dist-mac: direwolf decode_aprs text2tt tt2text ll2utm utm2ll aclients log2gpx ge
|
||||||
$(INSTALLDIR)/bin/gen_packets \
|
$(INSTALLDIR)/bin/gen_packets \
|
||||||
$(INSTALLDIR)/bin/atest \
|
$(INSTALLDIR)/bin/atest \
|
||||||
$(INSTALLDIR)/bin/ttcalc \
|
$(INSTALLDIR)/bin/ttcalc \
|
||||||
|
$(INSTALLDIR)/bin/kissutil \
|
||||||
$(INSTALLDIR)/bin/dwespeak.sh \
|
$(INSTALLDIR)/bin/dwespeak.sh \
|
||||||
$(INSTALLDIR)/share/direwolf/tocalls.txt \
|
$(INSTALLDIR)/share/direwolf/tocalls.txt \
|
||||||
$(INSTALLDIR)/share/direwolf/config/direwolf.conf \
|
$(INSTALLDIR)/share/direwolf/config/direwolf.conf \
|
||||||
|
@ -588,6 +505,7 @@ dist-mac: direwolf decode_aprs text2tt tt2text ll2utm utm2ll aclients log2gpx ge
|
||||||
$(INSTALLDIR)/man/man1/decode_aprs.1 \
|
$(INSTALLDIR)/man/man1/decode_aprs.1 \
|
||||||
$(INSTALLDIR)/man/man1/direwolf.1 \
|
$(INSTALLDIR)/man/man1/direwolf.1 \
|
||||||
$(INSTALLDIR)/man/man1/gen_packets.1 \
|
$(INSTALLDIR)/man/man1/gen_packets.1 \
|
||||||
|
$(INSTALLDIR)/man/man1/kissutil.1 \
|
||||||
$(INSTALLDIR)/man/man1/ll2utm.1 \
|
$(INSTALLDIR)/man/man1/ll2utm.1 \
|
||||||
$(INSTALLDIR)/man/man1/log2gpx.1 \
|
$(INSTALLDIR)/man/man1/log2gpx.1 \
|
||||||
$(INSTALLDIR)/man/man1/text2tt.1 \
|
$(INSTALLDIR)/man/man1/text2tt.1 \
|
||||||
|
|
|
@ -3706,8 +3706,12 @@ static int data_extension_comment (decode_aprs_t *A, char *pdext)
|
||||||
*
|
*
|
||||||
* Windows version: File must be in current working directory.
|
* Windows version: File must be in current working directory.
|
||||||
*
|
*
|
||||||
* Linux version: Search order is current working directory
|
* Linux version: Search order is current working directory then
|
||||||
* then /usr/share/direwolf directory.
|
* /usr/local/share/direwolf
|
||||||
|
* /usr/share/direwolf/tocalls.txt
|
||||||
|
*
|
||||||
|
* Mac: Like Linux and then
|
||||||
|
* /opt/local/share/direwolf
|
||||||
*
|
*
|
||||||
*------------------------------------------------------------------*/
|
*------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
@ -3730,11 +3734,20 @@ static struct tocalls_s {
|
||||||
static int num_tocalls = 0;
|
static int num_tocalls = 0;
|
||||||
|
|
||||||
// Make sure the array is null terminated.
|
// Make sure the array is null terminated.
|
||||||
|
// If search order is changed, do the same in symbols.c
|
||||||
|
|
||||||
static const char *search_locations[] = {
|
static const char *search_locations[] = {
|
||||||
(const char *) "tocalls.txt",
|
(const char *) "tocalls.txt",
|
||||||
#ifndef __WIN32__
|
#ifndef __WIN32__
|
||||||
(const char *) "/usr/share/direwolf/tocalls.txt",
|
|
||||||
(const char *) "/usr/local/share/direwolf/tocalls.txt",
|
(const char *) "/usr/local/share/direwolf/tocalls.txt",
|
||||||
|
(const char *) "/usr/share/direwolf/tocalls.txt",
|
||||||
|
#endif
|
||||||
|
#if __APPLE__
|
||||||
|
// https://groups.yahoo.com/neo/groups/direwolf_packet/conversations/messages/2458
|
||||||
|
// Adding the /opt/local tree since macports typically installs there. Users might want their
|
||||||
|
// INSTALLDIR (see Makefile.macosx) to mirror that. If so, then we need to search the /opt/local
|
||||||
|
// path as well.
|
||||||
|
(const char *) "/opt/local/share/direwolf/tocalls.txt",
|
||||||
#endif
|
#endif
|
||||||
(const char *) NULL
|
(const char *) NULL
|
||||||
};
|
};
|
||||||
|
|
16
direwolf.h
16
direwolf.h
|
@ -135,6 +135,22 @@
|
||||||
// which breaks things.
|
// which breaks things.
|
||||||
// Maybe it should just go in ptt.c as originally suggested.
|
// Maybe it should just go in ptt.c as originally suggested.
|
||||||
|
|
||||||
|
// #define __DARWIN_C_LEVEL __DARWIN_C_FULL
|
||||||
|
|
||||||
|
// There is a more involved patch here:
|
||||||
|
// https://groups.yahoo.com/neo/groups/direwolf_packet/conversations/messages/2458
|
||||||
|
|
||||||
|
#ifndef _DARWIN_C_SOURCE
|
||||||
|
#define _DARWIN_C_SOURCE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Defining _DARWIN_C_SOURCE ensures that the definition for the cfmakeraw function (or similar)
|
||||||
|
// are pulled in through the include file <sys/termios.h>.
|
||||||
|
|
||||||
|
#ifdef __DARWIN_C_LEVEL
|
||||||
|
#undef __DARWIN_C_LEVEL
|
||||||
|
#endif
|
||||||
|
|
||||||
#define __DARWIN_C_LEVEL __DARWIN_C_FULL
|
#define __DARWIN_C_LEVEL __DARWIN_C_FULL
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -20,6 +20,8 @@
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <string.h> // needed for Mac.
|
||||||
|
|
||||||
|
|
||||||
/*------------------------------------------------------------------
|
/*------------------------------------------------------------------
|
||||||
*
|
*
|
||||||
|
|
10
kissserial.c
10
kissserial.c
|
@ -105,15 +105,6 @@
|
||||||
#include "xmit.h"
|
#include "xmit.h"
|
||||||
|
|
||||||
|
|
||||||
#if __WIN32__
|
|
||||||
typedef HANDLE MYFDTYPE;
|
|
||||||
#define MYFDERROR INVALID_HANDLE_VALUE
|
|
||||||
#else
|
|
||||||
typedef int MYFDTYPE;
|
|
||||||
#define MYFDERROR (-1)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Save Configuration for later use.
|
* Save Configuration for later use.
|
||||||
*/
|
*/
|
||||||
|
@ -129,6 +120,7 @@ static kiss_frame_t kf;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The serial port device handle.
|
* The serial port device handle.
|
||||||
|
* MYFD... are defined in kissserial.h
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static MYFDTYPE serialport_fd = MYFDERROR;
|
static MYFDTYPE serialport_fd = MYFDERROR;
|
||||||
|
|
11
symbols.c
11
symbols.c
|
@ -261,11 +261,20 @@ static const struct {
|
||||||
|
|
||||||
|
|
||||||
// Make sure the array is null terminated.
|
// Make sure the array is null terminated.
|
||||||
|
// If search order is changed, do the same in decode_aprs.c
|
||||||
|
|
||||||
static const char *search_locations[] = {
|
static const char *search_locations[] = {
|
||||||
(const char *) "symbols-new.txt",
|
(const char *) "symbols-new.txt",
|
||||||
#ifndef __WIN32__
|
#ifndef __WIN32__
|
||||||
(const char *) "/usr/share/direwolf/symbols-new.txt",
|
|
||||||
(const char *) "/usr/local/share/direwolf/symbols-new.txt",
|
(const char *) "/usr/local/share/direwolf/symbols-new.txt",
|
||||||
|
(const char *) "/usr/share/direwolf/symbols-new.txt",
|
||||||
|
#endif
|
||||||
|
#if __APPLE__
|
||||||
|
// https://groups.yahoo.com/neo/groups/direwolf_packet/conversations/messages/2458
|
||||||
|
// Adding the /opt/local tree since macports typically installs there. Users might want their
|
||||||
|
// INSTALLDIR (see Makefile.macosx) to mirror that. If so, then we need to search the /opt/local
|
||||||
|
// path as well.
|
||||||
|
(const char *) "/opt/local/share/direwolf/symbols-new.txt",
|
||||||
#endif
|
#endif
|
||||||
(const char *) NULL
|
(const char *) NULL
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue