From b69230a9974bf8874c06eac8bca6e22c6a1d17be Mon Sep 17 00:00:00 2001 From: c vw Date: Wed, 17 Jul 2019 16:28:57 +0200 Subject: [PATCH] Fixes for MacOS (Semaphores etc). --- MacOS/Info.plist | 2 ++ MacOS/pihpsdr.sh | 10 +++++++++- Makefile.mac | 32 ++++++++++++++++++-------------- README.MacOS | 14 ++++++++++++++ 4 files changed, 43 insertions(+), 15 deletions(-) diff --git a/MacOS/Info.plist b/MacOS/Info.plist index 9bca968..09c46c3 100644 --- a/MacOS/Info.plist +++ b/MacOS/Info.plist @@ -12,5 +12,7 @@ APPL CFBundleSignature BNDL + NSMicrophoneUsageDescription + Allow for using Sound input devices diff --git a/MacOS/pihpsdr.sh b/MacOS/pihpsdr.sh index 314c755..6008ba4 100755 --- a/MacOS/pihpsdr.sh +++ b/MacOS/pihpsdr.sh @@ -8,7 +8,15 @@ # A full-fledged wrapper here would set dozens of # environment variables. # +# +# Use $HOME/.pihpsdr as the working dir, +# copy hpsdr.png to that location + this=`dirname $0` -cd $this/../Resources +cd $HOME +mkdir .pihpsdr +cd .pihpsdr # if this fails, stay in $HOME + +cp $this/../Resources/hpsdr.png . exec $this/pihpsdr-bin diff --git a/Makefile.mac b/Makefile.mac index ec053b9..efff0b6 100644 --- a/Makefile.mac +++ b/Makefile.mac @@ -456,11 +456,14 @@ release: $(PROGRAM) # ############################################################################# -hpsdrsim.o: hpsdrsim.c - $(CC) -c -O $(PORTAUDIO_OPTIONS) hpsdrsim.c +hpsdrsim.o: hpsdrsim.c + $(CC) -c -O -DPORTAUDIO hpsdrsim.c -hpsdrsim: hpsdrsim.o - $(LINK) -o hpsdrsim hpsdrsim.o $(AUDIO_LIBS) -lm -lpthread +newhpsdrsim.o: newhpsdrsim.c + $(CC) -c -O newhpsdrsim.c + +hpsdrsim: hpsdrsim.o newhpsdrsim.o + $(LINK) -o hpsdrsim hpsdrsim.o newhpsdrsim.o -lportaudio -lm -lpthread ############################################################################# # @@ -507,17 +510,18 @@ app: $(OBJS) $(REMOTE_OBJS) $(USBOZY_OBJS) $(LIMESDR_OBJS) $(FREEDV_OBJS) \ libfn="`basename $$lib`"; \ cp "$$lib" "pihpsdr.app/Contents/Frameworks/$$libfn"; \ chmod u+w "pihpsdr.app/Contents/Frameworks/$$libfn"; \ - install_name_tool -id "@executable_path/../Frameworks/$libfn" "pihpsdr.app/Contents/Frameworks/$$libfn"; \ + install_name_tool -id "@executable_path/../Frameworks/$$libfn" "pihpsdr.app/Contents/Frameworks/$$libfn"; \ install_name_tool -change "$$lib" "@executable_path/../Frameworks/$$libfn" pihpsdr.app/Contents/MacOS/pihpsdr-bin; \ done -# -# Make "app" and copy local files app bundle -# -localapp: app - cp wdspWisdom00 pihpsdr.app/Contents/Resources - cp *.props pihpsdr.app/Contents/Resources - cp midi.inp pihpsdr.app/Contents/Resources - cp ip.addr pihpsdr.app/Contents/Resources - + @# once more to install libraries on which libs just copied depend (such as wdsp -> fftw) + @for file in pihpsdr.app/Contents/Frameworks/*.dylib; do \ + for lib in `otool -L pihpsdr.app/Contents/Frameworks/*.dylib | grep -v pihpsdr.app | grep -v "executable_path" | grep dylib | sed -e "s/ (.*//" | grep -Ev "/(usr/lib|System)" | grep -Ev /libg | grep -Ev pango | grep -Ev cairo`; do \ + libfn="`basename $$lib`"; \ + cp "$$lib" "pihpsdr.app/Contents/Frameworks/$$libfn"; \ + chmod u+w "pihpsdr.app/Contents/Frameworks/$$libfn"; \ + install_name_tool -id "@executable_path/../Frameworks/$$libfn" "pihpsdr.app/Contents/Frameworks/$$libfn"; \ + install_name_tool -change "$$lib" "@executable_path/../Frameworks/$$libfn" $$file; \ + done; \ + done ############################################################################# diff --git a/README.MacOS b/README.MacOS index 08bf331..b475c45 100644 --- a/README.MacOS +++ b/README.MacOS @@ -87,6 +87,20 @@ there, "make -f Makefile.mac install" will put libwdsp.dylib in /usr/local/lib. This is needed by piHPSDR. The pihpsdr Makefile.mac assumes that WDSP can be linked with simply through the "-lwdsp" linker option. +The following shell scripts installs all these prerequisites. At the beginning +you have to give the administrator password. If the MacOS keychain ask you for +permission, just answer with "Don't allow". + +#!/bin/sh + +xcode-select --install +/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" +brew install portaudio +brew install fftw +brew install gtk+3 +brew install pkg-config +brew install git + =================== COMPILE and INSTALL =================== -- 2.45.2