Skip to content

Commit a50b984

Browse files
jhoyt4linuxdude42
authored andcommitted
macOS: fix missing qt framework issue during app packaging
Add code to locate and correct missing Qt framworks "skipped" by macdeployqt when bundling the mythfrontend app. This issue only occurs on homebrew based builds that use QtWebengine. For some reason, QtQuickWidgets.framework does not get copied into the app framework by macdeployqt. This update searches for any missing Qt frameworks, copies the missing frameworks into the app bundle, and corrects any libraries contained in the framework.
1 parent 9b8f002 commit a50b984

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

platform/darwin/fixAppBundle.zsh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,33 @@ installLibs(){
110110
done <<< "$pathDepList"
111111
}
112112

113+
fixMissingQt(){
114+
# occasionally macdeployqt misses some linked Qt frameworks that are rpathd in a non-standard way
115+
# We need to find the missing frameworks, copy them into the app bundle, and link them appropriately
116+
117+
# find all @rpath Qt Frameworks
118+
QT_FMWKS=$(otool -L $APP_FMWK_DIR/Qt*.framework/Versions/Current/Qt*|grep "@rpath"|grep "Qt.*framework"|sort -u|sed 's^.*@rpath/^^' | sed 's^\.framework.*^.framework^')
119+
while read qtFMWK; do
120+
if [ ! -d $APP_FMWK_DIR/$qtFMWK ]; then
121+
echo '\033[0;34m'" +++ installLibs: Installing $qtFMWK into app"'\033[m'
122+
# copy in the Qt* framework and set variables
123+
sourcePath=$(find "$PKGMGR_PREFIX" -name "$qtFMWK" -print -quit)
124+
cp -RHn "$sourcePath" "$APP_FMWK_DIR/"
125+
libName=${qtFMWK%".framework"}
126+
# update the framework's library file ID to point to its new position in the app bundle
127+
# install name tool needs the real file, so use greadlink to get the final path from the symlink
128+
libFile=$(greadlink -f $APP_FMWK_DIR/$qtFMWK/$libName)
129+
newID="@executable_path/../Frameworks/$qtFMWK/Versions/Current/$libName"
130+
NAME_TOOL_CMD="install_name_tool -id $newID $libFile"
131+
eval "${NAME_TOOL_CMD}"
132+
# update links to (and copy in missing) any linked libraries required by the framework
133+
installLibs $libFile
134+
fi
135+
done <<< "$QT_FMWKS"
136+
}
137+
138+
# Fix any Qt Frameworks missed by macdeployqt
139+
fixMissingQt
113140
# Look over all dylibs in the APP Bundle and correct any dylib path's that macdeployqt misses.
114141
for fileName in $APP_CONTENTS_DIR/**/*(.); do
115142
if [[ -d $fileName || -L $fileName ]]; then continue; fi

0 commit comments

Comments
 (0)