Mac OSX build procedure is now better about locating the SDK.

modified:   Makefile.macosx
	new file:   search_sdks.sh
This commit is contained in:
WB2OSZ 2016-01-24 10:11:17 -05:00
parent 4406c1a5e3
commit 107a8125c7
4 changed files with 177 additions and 37 deletions

View File

@ -1,5 +1,5 @@
#
# Makefile for Macintosh 10.8+ version of Dire Wolf.
# Makefile for Macintosh 10.6+ version of Dire Wolf.
#
# TODO: This is a modified version of Makefile.linux and it
@ -9,6 +9,20 @@
# Maybe the most of the differences could go in to platform specific include
# files rather than cluttering it up with too many if blocks.
# Changes:
#
# 16 Dec 2015
# 1. Added condition check for gps/gpsd code. Commented out due to 32/64 bit
# library issues. Macports gpsd build problem.
# 2. SDK version checks are now performed by a bash script 'search_sdks.sh'.
# This should resolve the varied locations Apple stored the SDKs on the different
# Xcode/OS versions. Executing 'make' on the first pass asks the operator
# which SDK he/she wishes to use. Executing 'make clean' resets the SDK
# selection and operator intervention is once again required. Selected SDK
# information resides in a file named './use_this_sdk' in the current working
# directory.
# 3. Removed fsk_fast_filter.h from atest receipe, clang compiler was having
# a hissy fit. Not check with GCC.
all : direwolf decode_aprs text2tt tt2text ll2utm utm2ll aclients atest log2gpx gen_packets ttcalc direwolf.conf
@echo " "
@ -16,34 +30,33 @@ all : direwolf decode_aprs text2tt tt2text ll2utm utm2ll aclients atest log2gpx
@echo " "
@echo " sudo make install"
@echo " "
@echo "System SDK's (10.8 - 10.10) must be located here to make use of them. "
@echo " /Developer/SDKs "
@echo " "
SYS_LIBS :=
SYS_MIN :=
SDK := $(shell find /Developer -maxdepth 1 -type d -name "SDKs")
#SDK := $(shell find /Developer -maxdepth 1 -type d -name "SDKs")
#$(info $$SDK = ${SDK})
ifeq (${SDK},/Developer/SDKs)
SDK := $(shell find /Developer/SDKs -maxdepth 1 -type d -name "MacOSX10.8.sdk")
ifeq (${SDK},/Developer/SDKs/MacOSX10.8.sdk)
SYS_LIBS := -isystem /Developer/SDKs/MacOSX10.8.sdk
SYS_MIN := -mmacosx-version-min=10.8
else
SDK := $(shell find /Developer/SDKs -maxdepth 1 -type d -name "MacOSX10.9.sdk")
ifeq (${SDK},/Developer/SDKs/MacOSX10.9.sdk)
SYS_LIBS := -isystem /Developer/SDKs/MacOSX10.9.sdk
SYS_MIN := -mmacosx-version-min=10.9
else
SDK := $(shell find /Developer/SDKs -maxdepth 1 -type d -name "MacOSX10.10.sdk")
ifeq (${SDK},/Developer/SDKs/MacOSX10.10.sdk)
SYS_LIBS := -isystem /Developer/SDKs/MacOSX10.10.sdk
SYS_MIN := -mmacosx-version-min=10.10
endif
endif
endif
endif
#ifeq (${SDK},/Developer/SDKs)
# SDK := $(shell find /Developer/SDKs -maxdepth 1 -type d -name "MacOSX10.8.sdk")
# ifeq (${SDK},/Developer/SDKs/MacOSX10.8.sdk)
# SYS_LIBS := -isystem /Developer/SDKs/MacOSX10.8.sdk
# SYS_MIN := -mmacosx-version-min=10.8
# else
# SDK := $(shell find /Developer/SDKs -maxdepth 1 -type d -name "MacOSX10.9.sdk")
# ifeq (${SDK},/Developer/SDKs/MacOSX10.9.sdk)
# SYS_LIBS := -isystem /Developer/SDKs/MacOSX10.9.sdk
# SYS_MIN := -mmacosx-version-min=10.9
# else
# SDK := $(shell find /Developer/SDKs -maxdepth 1 -type d -name "MacOSX10.10.sdk")
# ifeq (${SDK},/Developer/SDKs/MacOSX10.10.sdk)
# SYS_LIBS := -isystem /Developer/SDKs/MacOSX10.10.sdk
# SYS_MIN := -mmacosx-version-min=10.10
# endif
# endif
# endif
#endif
SYS_LIBS := $(shell ./search_sdks.sh)
EXTRA_CFLAGS :=
DARWIN_CC := $(shell which clang)
ifeq (${DARWIN_CC},)
@ -184,11 +197,20 @@ LDLIBS += -framework Foundation -framework CoreServices
CFLAGS += -DUSE_PORTAUDIO -I/opt/local/include
# Uncomment following lines to enable GPS interface & tracker function.
# Not available for MacOSX.
# Although MacPorts has gpsd, wonder if it's the same thing.
# Not available for MacOSX (as far as I know).
# Although MacPorts has gpsd, wonder if it's the same thing. Add the check
# just in case it works.
# Well never mind, issue with Macports with 64bit libs ;-( leave the check in
# until (if ever) Macports fixes the issue.
#GPS_HEADER := $(shell find /opt/local/include -maxdepth 1 -type f -name "gps.h")
#ifeq (${GPS_HEADER},)
#GPS_OBJS :=
#else
#CFLAGS += -DENABLE_GPSD
#LDLIBS += -lgps
#LDLIBS += -L/opt/local/lib -lgps -lgpsd
#GPS_OBJS := dwgps.o dwgpsnmea.o dwgpsd.o
#endif
# Name of current directory.
# Used to generate zip file name for distribution.
@ -206,7 +228,7 @@ direwolf : direwolf.o aprs_tt.o audio_portaudio.o audio_stats.o ax25_pad.o beaco
kiss.o kissnet.o latlong.o latlong.o log.o morse.o multi_modem.o \
nmea.o serial_port.o pfilter.o ptt.o rdq.o recv.o redecode.o rrbb.o server.o \
symbols.o telemetry.o textcolor.o tq.o tt_text.o tt_user.o xmit.o \
dwgps.o dwgpsnmea.o dwgpsd.o
dwgps.o dwgpsnmea.o
$(CC) $(CFLAGS) -o $@ $^ -lpthread $(LDLIBS) -lm
@ -221,8 +243,6 @@ fsk_fast_filter.h : demod_afsk.c
$(CC) $(CFLAGS) -o gen_fff -DGEN_FFF demod_afsk.c dsp.c textcolor.c -lm
./gen_fff > fsk_fast_filter.h
# UTM, USNG, MGRS conversions.
geotranz.a : error_string.o mgrs.o polarst.o tranmerc.o ups.o usng.o utm.o
@ -430,10 +450,12 @@ testagc : atest.c demod.c dsp.c demod_afsk.c demod_9600.c hdlc_rec.c hdlc_rec2.o
# Unit test for AFSK demodulator
atest : atest.c fsk_fast_filter.h demod.c dsp.c demod_afsk.c demod_9600.c hdlc_rec.c hdlc_rec2.o multi_modem.o rrbb.o \
atest : atest.c demod.c dsp.c demod_afsk.c demod_9600.c hdlc_rec.c hdlc_rec2.o multi_modem.o rrbb.o \
fcs_calc.c ax25_pad.c decode_aprs.c dwgpsnmea.o dwgps.o serial_port.o telemetry.c latlong.c symbols.c textcolor.c tt_text.c
$(CC) $(CFLAGS) -o $@ $^ -lm
#atest : atest.c fsk_fast_filter.h demod.c dsp.c demod_afsk.c demod_9600.c hdlc_rec.c hdlc_rec2.o multi_modem.o rrbb.o \
# fcs_calc.c ax25_pad.c decode_aprs.c dwgpsnmea.o dwgps.o serial_port.o telemetry.c latlong.c symbols.c textcolor.c tt_text.c
# $(CC) $(CFLAGS) -o $@ $^ -lm
# Unit test for inner digipeater algorithm
@ -492,7 +514,7 @@ depend : $(wildcard *.c)
.PHONY: clean
clean :
rm -f direwolf decode_aprs text2tt tt2text ll2utm utm2ll aclients atest log2gpx gen_packets ttcalc \
fsk_fast_filter.h *.o *.a
fsk_fast_filter.h *.o *.a use_this_sdk
echo " " > tune.h

View File

@ -116,7 +116,7 @@ static struct gps_data_t gpsdata;
* actually need the data and we don't have a lot of extra unnecessary
* busy work going on.
*
* The current version of gpsd, supplied with Raspian, is 3.6 from back in
* The current version of gpsd, supplied with Raspian (Wheezy), is 3.6 from back in
* May 2012, is missing support for the shared memory interface.
*
* I tried to download a newer source and build with shared memory support
@ -132,6 +132,11 @@ static struct gps_data_t gpsdata;
* sudo scons udev-install
*
* For now, we will use the socket interface. Maybe get back to this again someday.
*
* Update: January 2016.
*
* I'm told that it might work in Raspian, Jessie version.
* Haven't tried it yet.
*/

View File

@ -98,10 +98,14 @@ Both of these are equivalent. "-B 9600" automatically selects scrambled baseban
Both of these generate 200 Hz shift, 300 baud, suitable for HF SSB transceiver.
.RE
.P
.B echo -n "WB2OSZ>WORLD:Hello, world!" | gen_packets -a 25 -o x.wav -
.B echo -n 'WB2OSZ>WORLD:Hello, world!' | gen_packets -a 25 -o x.wav -
.PD 0
.P
.PD
.B atest x.wav
.P
.RS
Read message from stdin and put quarter volume sound into the file x.wav.
Read message from stdin and put quarter volume sound into the file x.wav. Decode the sound file.
.RE
.P

109
search_sdks.sh Normal file
View File

@ -0,0 +1,109 @@
#!/bin/bash
#
# This file is part of Dire Wolf, an amateur radio packet TNC.
#
# Bash script to search for SDKs on various MacOSX versions.
#
# Copyright (C) 2015 Robert Stiles
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
FILENAME="./use_this_sdk"
selected_sdk=""
valid_flag=0
system_sdk=""
if [ -f $FILENAME ]; then
selected_sdk=`cat $FILENAME`
if [ -d $selected_sdk ]; then
valid_flag=1
fi
fi
if [ $valid_flag -eq "0" ]; then
echo " " >&2
echo " " >&2
echo "Searching for SDKs.... (Wait for results)" >&2
echo " " >&2
echo "Enter the number and press Enter/Return Key" >&2
echo " " >&2
echo " " >&2
prompt="Select SDK to use:"
loc1=( $(find /Applications/XCode.app -type d -name "MacOSX10.*.sdk") )
loc2=( $(find /Developer/SDKs -maxdepth 1 -type d -name "MacOSX10.*.sdk") )
options=("${loc1[@]}" "${loc2[@]}")
if [ "${#options[@]}" -lt "2" ]; then
echo "$options"
fi
PS3="$prompt "
select opt in "${options[@]}" "Do not use any SDK" ; do
if (( REPLY == 1 + ${#options[@]} )) ; then
echo " "
break
elif (( REPLY > 0 && REPLY <= ${#options[@]} )) ; then
selected_sdk="$opt"
break
fi
done
if [ ! -z "$selected_sdk" ]; then
echo "$selected_sdk" > $FILENAME
else
echo " " > $FILENAME
fi
fi
if [ ! -z "$selected_sdk" ]; then
temp_str="$selected_sdk"
min_str=""
flag=true
# Search for the last MacOSX in the string.
while [ "${#temp_str}" -gt 4 ]; do
temp_str="${temp_str#*MacOSX}"
temp_str="${temp_str%%.sdk}"
min_str="$temp_str"
temp_str="${temp_str:1}"
done
# Remove the "u" if 10.4u Universal SDK is used.
min_str="${min_str%%u}"
system_sdk="-isystem ${selected_sdk} -mmacosx-version-min=${min_str}"
else
system_sdk=" "
fi
echo " " >&2
echo "*******************************************************************" >&2
if [ -z "${system_sdk}" ]; then
echo "SDK Selected: None" >&2
else
echo "SDK Selected: ${system_sdk}" >&2
fi
echo "To change SDK version execute 'make clean' followed by 'make'." >&2
echo "*******************************************************************" >&2
echo " " >&2
echo ${system_sdk}