Skip to content

Commit

Permalink
build both x86_64 and arm64 macos
Browse files Browse the repository at this point in the history
  • Loading branch information
yuzawa-san committed Oct 21, 2024
1 parent 0418221 commit bf6d30f
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 30 deletions.
44 changes: 25 additions & 19 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,14 @@ jobs:
path: Gqrx-*.AppImage
macos:
name: MacOS
runs-on: macos-13
strategy:
matrix:
arch: [x86_64, arm64]
# NOTE: in the free tier, `macos-13` is x86_64 only, while `macos-14` is arm64 only.
# when we increase the baseline to 14 eventually, we will be losing x86_64 support,
# so hopefully all of the macs will be arm64 by then.
# see https://github.com/actions/runner-images/issues/9741
runs-on: ${{ matrix.arch == 'x86_64' && 'macos-13' || 'macos-14' }}
steps:
- name: Check for Secret availability
id: secret-check
Expand All @@ -79,21 +86,20 @@ jobs:
fi
- name: Install dependencies
run: |
uname -a
# for https://github.com/actions/runner-images/issues/9272
sudo chown -R runner:admin /usr/local/
brew update
brew install --HEAD librtlsdr
brew install airspy airspyhf boost dylibbundler gnuradio hackrf libbladerf libserialport portaudio pybind11 six uhd qt@6 || true
brew tap pothosware/homebrew-pothos
brew install soapyremote
brew install airspy airspyhf boost dylibbundler gnuradio hackrf libbladerf libserialport portaudio pybind11 six soapyremote uhd qt@6 || true
cd /tmp
git clone https://github.com/analogdevicesinc/libiio.git
cd libiio
git checkout v0.23
mkdir build
cd build
cmake ..
cmake -DCMAKE_BUILD_TYPE=Release ..
make -j4
sudo make install
Expand All @@ -102,7 +108,7 @@ jobs:
cd libad9361-iio
mkdir build
cd build
cmake ..
cmake -DCMAKE_BUILD_TYPE=Release ..
make -j4
sudo make install
Expand All @@ -111,27 +117,27 @@ jobs:
cd SoapyPlutoSDR
mkdir build
cd build
cmake ..
cmake -DCMAKE_BUILD_TYPE=Release ..
make -j4
sudo make install
cd /tmp
cp /Library/Frameworks/iio.framework/iio /usr/local/lib/libiio.dylib
install_name_tool -id "/usr/local/lib/libiio.dylib" /usr/local/lib/libiio.dylib
cp /Library/Frameworks/ad9361.framework/ad9361 /usr/local/lib/libad9361.dylib
install_name_tool -id "/usr/local/lib/libad9361.dylib" /usr/local/lib/libad9361.dylib
install_name_tool -delete_rpath /Library/Frameworks /usr/local/lib/libad9361.dylib
install_name_tool -change @rpath/iio.framework/Versions/0.23/iio /usr/local/lib/libiio.dylib /usr/local/lib/libad9361.dylib
install_name_tool -change @rpath/iio.framework/Versions/0.23/iio /usr/local/lib/libiio.dylib /usr/local/lib/SoapySDR/modules0.*/libPlutoSDRSupport.so
install_name_tool -change @rpath/ad9361.framework/Versions/0.2/ad9361 /usr/local/lib/libad9361.dylib /usr/local/lib/SoapySDR/modules0.*/libPlutoSDRSupport.so
sudo cp /Library/Frameworks/iio.framework/iio /usr/local/lib/libiio.dylib
sudo install_name_tool -id "/usr/local/lib/libiio.dylib" /usr/local/lib/libiio.dylib
sudo cp /Library/Frameworks/ad9361.framework/ad9361 /usr/local/lib/libad9361.dylib
sudo install_name_tool -id "/usr/local/lib/libad9361.dylib" /usr/local/lib/libad9361.dylib
sudo install_name_tool -delete_rpath /Library/Frameworks /usr/local/lib/libad9361.dylib
sudo install_name_tool -change @rpath/iio.framework/Versions/0.23/iio /usr/local/lib/libiio.dylib /usr/local/lib/libad9361.dylib
sudo install_name_tool -change @rpath/iio.framework/Versions/0.23/iio /usr/local/lib/libiio.dylib /usr/local/lib/SoapySDR/modules0.*/libPlutoSDRSupport.so
sudo install_name_tool -change @rpath/ad9361.framework/Versions/0.2/ad9361 /usr/local/lib/libad9361.dylib /usr/local/lib/SoapySDR/modules0.*/libPlutoSDRSupport.so
cd /tmp
git clone https://gitea.osmocom.org/sdr/gr-iqbal.git
cd gr-iqbal
git submodule update --init --recursive
mkdir build
cd build
cmake ..
cmake -DCMAKE_BUILD_TYPE=Release ..
make -j4
sudo make install
Expand All @@ -140,7 +146,7 @@ jobs:
cd gr-osmosdr
mkdir build
cd build
cmake -DCMAKE_CXX_FLAGS=-Wno-register ..
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS=-Wno-register ..
LIBRARY_PATH=/usr/local/opt/icu4c/lib make -j4
sudo make install
- name: Install Apple certificate
Expand All @@ -166,7 +172,7 @@ jobs:
with:
fetch-depth: 0
- name: Configure
run: mkdir build && cd build && cmake ..
run: mkdir build && cd build && cmake -DCMAKE_BUILD_TYPE=Release ..
- name: Compile
working-directory: build
run: make -j4
Expand Down Expand Up @@ -206,7 +212,7 @@ jobs:
- name: Save artifact
uses: actions/upload-artifact@v4
with:
name: gqrx-macos-${{ github.run_id }}
name: gqrx-macos-${{ matrix.arch }}-${{ github.run_id }}
path: Gqrx-*.dmg
windows:
runs-on: windows-latest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:
name: MacOS CI
strategy:
matrix:
os: [macos-13, macos-14]
os: [macos-13, macos-latest]
backend: [Portaudio, Gr-audio]
runs-on: ${{ matrix.os }}
steps:
Expand Down
21 changes: 11 additions & 10 deletions macos_bundle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ mkdir -p Gqrx.app/Contents/soapy-modules
<dict>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>CFBundleGetInfoString</key>
<string>Gqrx</string>
<key>CFBundleExecutable</key>
<string>gqrx</string>
<key>CFBundleIdentifier</key>
Expand Down Expand Up @@ -51,21 +49,24 @@ 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
# see https://apple.stackexchange.com/questions/437618/why-is-homebrew-installed-in-opt-homebrew-on-apple-silicon-macs
MACDEPLOYQT6=/usr/local/opt/qt@6/bin/macdeployqt
if [ -f /opt/homebrew/opt/qt@6/bin/macdeployqt ]; then
MACDEPLOYQT6=/opt/homebrew/opt/qt@6/bin/macdeployqt
fi
cp /*/*/lib/SoapySDR/modules*/libPlutoSDRSupport.so Gqrx.app/Contents/soapy-modules
cp /*/*/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
${MACDEPLOYQT6} 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
${MACDEPLOYQT6} Gqrx.app -no-strip -always-overwrite -sign-for-notarization=$IDENTITY
else
/usr/local/opt/qt@6/bin/macdeployqt Gqrx.app -no-strip -always-overwrite
${MACDEPLOYQT6} 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
for f in Gqrx.app/Contents/libs/*.dylib Gqrx.app/Contents/soapy-modules/*.so Gqrx.app/Contents/Frameworks/*.framework Gqrx.app/Contents/Frameworks/*.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
Expand Down

0 comments on commit bf6d30f

Please sign in to comment.