Chris@745: #!/bin/bash Chris@745: Chris@1055: set -eu Chris@1055: Chris@745: app="$1" Chris@745: if [ -z "$app" ]; then Chris@745: echo "Usage: $0 " Chris@745: echo "Provide appname without the .app extension, please" Chris@745: exit 2 Chris@745: fi Chris@745: Chris@1082: frameworks="QtCore QtNetwork QtGui QtXml QtSvg QtWidgets QtPrintSupport QtDBus" Chris@745: cannam@1881: plugins="gif icns ico jpeg tga tiff wbmp webp cocoa minimal offscreen macstyle" Chris@745: Chris@745: qtdir=$(grep "Command:" Makefile | head -1 | awk '{ print $3; }' | sed s,/bin/.*,,) Chris@745: Chris@745: if [ ! -d "$qtdir" ]; then Chris@745: echo "Failed to discover Qt installation directory from Makefile, exiting" Chris@745: exit 2 Chris@745: fi Chris@745: Chris@745: fdir="$app.app/Contents/Frameworks" Chris@745: pdir="$app.app/Contents/plugins" Chris@745: Chris@745: mkdir -p "$fdir" Chris@745: mkdir -p "$pdir" Chris@745: Chris@745: echo Chris@745: echo "Copying frameworks..." Chris@745: for fwk in $frameworks; do Chris@1432: if [ ! -d "$qtdir/lib/$fwk.framework" ]; then Chris@1432: if [ "$fwk" = "QtDBus" ]; then Chris@1432: echo "QtDBus.framework not found, assuming Qt was built without DBus support" Chris@1432: continue Chris@1432: fi Chris@1432: fi Chris@745: cp -v "$qtdir/lib/$fwk.framework/$fwk" "$fdir" || exit 2 Chris@745: done Chris@745: Chris@745: echo "Done" Chris@745: Chris@745: echo Chris@745: echo "Copying plugins..." Chris@745: for plug in $plugins; do Chris@772: pfile=$(ls "$qtdir"/plugins/*/libq"$plug".dylib) Chris@745: if [ ! -f "$pfile" ]; then Chris@745: echo "Failed to find plugin $plug, exiting" Chris@745: exit 2 Chris@745: fi Chris@772: target="$pdir"/${pfile##?*plugins/} Chris@772: tdir=`dirname "$target"` Chris@772: mkdir -p "$tdir" Chris@772: cp -v "$pfile" "$target" || exit 2 Chris@745: done Chris@745: Chris@2379: # Sometimes the copied-in files are read-only: correct that Chris@2379: chmod -R u+w "$app.app" Chris@2379: Chris@745: echo "Done" Chris@745: Chris@772: