From 21f6bc6b40cd21ff544b9f41a2effa4159286e80 Mon Sep 17 00:00:00 2001
From: c vw <dl1ycf@darc.de>
Date: Wed, 13 May 2020 16:03:19 +0200
Subject: [PATCH] No longer put the required libs into the app bundle, assume
 they are where they must sit. This is too error prone anyway. So a
 "distribution" of the app file in the future must contain the required
 libraries in their place.

---
 Makefile.mac | 39 +++++++++++++++++++++------------------
 1 file changed, 21 insertions(+), 18 deletions(-)

diff --git a/Makefile.mac b/Makefile.mac
index e3d09cb..753af2c 100644
--- a/Makefile.mac
+++ b/Makefile.mac
@@ -478,7 +478,7 @@ hpsdrsim:       hpsdrsim.o newhpsdrsim.o
 #############################################################################
 app:	$(OBJS) $(REMOTE_OBJS) $(USBOZY_OBJS) \
 		$(LOCALCW_OBJS) \
-		$(PURESIGNAL_OBJS) $(MIDI_OBJS) $(STEMLAB_OBJS)
+		$(PURESIGNAL_OBJS) $(MIDI_OBJS) $(SOAPYSDR_OBJS) $(STEMLAB_OBJS)
 	$(LINK) -headerpad_max_install_names -o $(PROGRAM) $(OBJS) $(REMOTE_OBJS) \
 		$(USBOZY_OBJS)  \
 		$(SOAPYSDR_OBJS) $(LOCALCW_OBJS) $(PURESIGNAL_OBJS) \
@@ -493,22 +493,25 @@ app:	$(OBJS) $(REMOTE_OBJS) $(USBOZY_OBJS) \
 	@cp MacOS/hpsdr.icns pihpsdr.app/Contents/Resources/hpsdr.icns
 	@cp MacOS/pihpsdr.sh pihpsdr.app/Contents/MacOS/pihpsdr
 	@cp MacOS/hpsdr.png pihpsdr.app/Contents/Resources
-	@for lib in `otool -L pihpsdr.app/Contents/MacOS/pihpsdr-bin | 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" pihpsdr.app/Contents/MacOS/pihpsdr-bin; \
-	done
-	@# 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
+#
+#       DO NOT copy libs, this app file will only run on a Mac which has these libs in the correct place
+#
+#	@for lib in `otool -L pihpsdr.app/Contents/MacOS/pihpsdr-bin | 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" pihpsdr.app/Contents/MacOS/pihpsdr-bin; \
+#	done
+#	@# 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
 #############################################################################
 
-- 
2.45.2