Skip to content

Commit 7b3cc08

Browse files
committed
bundle mosquitto for silicon
1 parent 99a467a commit 7b3cc08

File tree

1 file changed

+34
-1
lines changed

1 file changed

+34
-1
lines changed

.github/workflows/build.yml

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,39 @@ jobs:
148148
configuration: ${{ matrix.config }}
149149
use-xcpretty: true
150150

151+
- name: Bundle Libraries
152+
if: ${{ matrix.arch == 'arm64' }}
153+
run: |
154+
# 1. Define Paths
155+
APP_PATH="Builds/MacOSX_CI/build/${{ matrix.config }}/${{ env.ProjectName }}.app"
156+
FRAMEWORKS_DIR="$APP_PATH/Contents/Frameworks"
157+
EXECUTABLE="$APP_PATH/Contents/MacOS/${{ env.ProjectName }}"
158+
159+
echo "Bundling libs into $FRAMEWORKS_DIR"
160+
161+
# 2. Create Frameworks directory
162+
mkdir -p "$FRAMEWORKS_DIR"
163+
164+
# 3. Copy Dylibs
165+
cp External/mosquitto/lib/osx/libmosquitto.dylib "$FRAMEWORKS_DIR/"
166+
cp External/mosquitto/lib/osx/libmosquittopp.dylib "$FRAMEWORKS_DIR/"
167+
168+
# 4. Fix Library IDs (This ensures the libs know they are loaded via rpath)
169+
install_name_tool -id @rpath/libmosquitto.dylib "$FRAMEWORKS_DIR/libmosquitto.dylib"
170+
install_name_tool -id @rpath/libmosquittopp.dylib "$FRAMEWORKS_DIR/libmosquittopp.dylib"
171+
172+
# 5. Fix dependency path in libmosquittopp (It likely points to a hardcoded path for the C lib)
173+
# We try updating both common variations just in case
174+
install_name_tool -change /usr/local/lib/libmosquitto.dylib @rpath/libmosquitto.dylib "$FRAMEWORKS_DIR/libmosquittopp.dylib" || true
175+
install_name_tool -change libmosquitto.dylib @rpath/libmosquitto.dylib "$FRAMEWORKS_DIR/libmosquittopp.dylib" || true
176+
177+
# 6. Add RPATH to Executable (Tells the app to look in Contents/Frameworks)
178+
install_name_tool -add_rpath @executable_path/../Frameworks "$EXECUTABLE" || true
179+
180+
# 7. Re-sign the app (Modifying the binary invalidates signature; required for Apple Silicon)
181+
codesign --force --deep --sign - "$APP_PATH"
182+
# --- NEW STEP ENDS HERE ---
183+
151184
- name: Create Package
152185
id: create_package
153186
run: |
@@ -163,7 +196,7 @@ jobs:
163196
pkg-name: ./Package/${{ steps.create_package.outputs.pkg-name }}
164197
url: ${{ secrets.UPLOADURL }}
165198
pass: ${{ secrets.UPLOADPASS }}
166-
199+
167200
linux:
168201
name: Linux (x64)
169202
runs-on: ubuntu-22.04

0 commit comments

Comments
 (0)