#!/bin/bash -e GQRX_VERSION=$(Gqrx.app/Contents/Info.plist NSPrincipalClass NSApplication CFBundleGetInfoString Gqrx CFBundleExecutable gqrx CFBundleIdentifier dk.gqrx.gqrx CFBundleName Gqrx CFBundleIconFile gqrx.icns CFBundleShortVersionString $GQRX_VERSION CFBundleInfoDictionaryVersion 6.0 CFBundlePackageType APPL IFMajorVersion 1 IFMinorVersion 0 EOM /bin/cat </tmp/Entitlements.plist com.apple.security.cs.allow-unsigned-executable-memory EOM cp build/src/gqrx Gqrx.app/Contents/MacOS cp resources/icons/gqrx.icns Gqrx.app/Contents/Resources cp /usr/local/lib/SoapySDR/modules*/libPlutoSDRSupport.so Gqrx.app/Contents/soapy-modules cp /usr/local/lib/SoapySDR/modules*/libremoteSupport.so Gqrx.app/Contents/soapy-modules chmod 644 Gqrx.app/Contents/soapy-modules/* dylibbundler -s /usr/local/opt/icu4c/lib/ -od -b -x Gqrx.app/Contents/MacOS/gqrx -x Gqrx.app/Contents/soapy-modules/libPlutoSDRSupport.so -x Gqrx.app/Contents/soapy-modules/libremoteSupport.so -d Gqrx.app/Contents/libs/ /usr/local/opt/qt@6/bin/macdeployqt Gqrx.app -no-strip -always-overwrite # TODO: Remove macdeployqt workaround if [ "$1" = "true" ]; then /usr/local/opt/qt@6/bin/macdeployqt Gqrx.app -no-strip -always-overwrite -sign-for-notarization=$IDENTITY else /usr/local/opt/qt@6/bin/macdeployqt Gqrx.app -no-strip -always-overwrite fi cp /usr/local/lib/libbrotlicommon.1.dylib Gqrx.app/Contents/Frameworks # TODO: Remove macdeployqt workaround install_name_tool -change @loader_path/../../../../opt/libpng/lib/libpng16.16.dylib @executable_path/../Frameworks/libpng16.16.dylib Gqrx.app/Contents/Frameworks/libfreetype.6.dylib for f in Gqrx.app/Contents/libs/*.dylib Gqrx.app/Contents/soapy-modules/*.so Gqrx.app/Contents/Frameworks/*.framework Gqrx.app/Contents/Frameworks/libbrotlicommon.1.dylib Gqrx.app/Contents/Frameworks/libsharpyuv.0.dylib Gqrx.app/Contents/Frameworks/libfreetype.6.dylib Gqrx.app/Contents/MacOS/gqrx do if [ "$1" = "true" ]; then codesign --force --verify --verbose --timestamp --options runtime --entitlements /tmp/Entitlements.plist --sign $IDENTITY $f else codesign --remove-signature $f fi done