2012-04-04 21:12:52 +02:00
|
|
|
#!/bin/bash
|
2012-04-05 09:36:37 +02:00
|
|
|
#
|
|
|
|
# Usage: ./macdeploy.sh [<full-path-to-macdeployqt>]
|
2014-02-05 01:37:26 +01:00
|
|
|
#
|
2012-04-05 09:36:37 +02:00
|
|
|
# macdeployqt is usually located in QTDIR/bin/macdeployqt
|
|
|
|
# If path to macdeployqt is not specified, using it from PATH
|
|
|
|
|
2014-02-05 01:37:26 +01:00
|
|
|
MACDEPLOYQT="macdeployqt"
|
2016-04-03 11:10:39 +02:00
|
|
|
LIBRARY_NAME="libQupZilla.2.dylib"
|
2017-01-31 19:16:14 +01:00
|
|
|
PLUGINS="QupZilla.app/Contents/Resources/plugins"
|
|
|
|
QTPLUGINS="QupZilla.app/Contents/PlugIns"
|
2012-04-04 21:12:52 +02:00
|
|
|
|
2012-04-05 09:36:37 +02:00
|
|
|
if [ -n "$1" ]; then
|
2014-02-05 01:37:26 +01:00
|
|
|
MACDEPLOYQT=$1
|
2012-04-04 21:12:52 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
# cd to directory with bundle
|
2012-04-05 09:36:37 +02:00
|
|
|
test -d bin || cd ..
|
|
|
|
cd bin
|
2012-04-04 21:12:52 +02:00
|
|
|
|
|
|
|
# copy libQupZilla into bundle
|
2012-04-04 23:28:19 +02:00
|
|
|
cp $LIBRARY_NAME QupZilla.app/Contents/MacOS/
|
2012-04-04 21:12:52 +02:00
|
|
|
|
2017-01-31 19:16:14 +01:00
|
|
|
# copy all QupZilla plugins into bundle
|
|
|
|
test -d $PLUGINS || mkdir $PLUGINS
|
|
|
|
cp plugins/*.dylib $PLUGINS/
|
2012-04-04 21:12:52 +02:00
|
|
|
|
|
|
|
# fix libQupZilla
|
2012-04-04 23:28:19 +02:00
|
|
|
install_name_tool -change $LIBRARY_NAME @executable_path/$LIBRARY_NAME QupZilla.app/Contents/MacOS/QupZilla
|
2012-04-04 21:12:52 +02:00
|
|
|
|
|
|
|
# fix plugins
|
2017-01-31 19:16:14 +01:00
|
|
|
for plugin in $PLUGINS/*.dylib
|
2012-04-04 21:12:52 +02:00
|
|
|
do
|
2012-04-04 23:28:19 +02:00
|
|
|
install_name_tool -change $LIBRARY_NAME @executable_path/$LIBRARY_NAME $plugin
|
2012-04-04 21:12:52 +02:00
|
|
|
done
|
|
|
|
|
2017-01-31 19:16:14 +01:00
|
|
|
# prompt and optionally copy additional Qt native plugin(s) into bundle
|
|
|
|
echo -n "Do you wish to redistribute known, missing, Qt Library plugins (y/n)? "
|
|
|
|
old_stty_cfg=$(stty -g)
|
|
|
|
stty raw -echo
|
|
|
|
answer=$( while ! head -c 1 | grep -i '[yn]'; do true; done )
|
|
|
|
stty $old_stty_cfg
|
|
|
|
if echo "$answer" | grep -iq "^y"; then
|
|
|
|
if [ -z ${QTDIR+x} ]; then
|
|
|
|
printf '\nPlease set the environment variable for the Qt platform folder.\n\texample:\n\t$ export QTDIR="$HOME/Qt/5.7/clang_64"\n'
|
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
printf '\nCopying known, missing, Qt native library plugins to target bundle...\n'
|
|
|
|
|
|
|
|
mkdir -p $QTPLUGINS
|
|
|
|
|
|
|
|
FILE="$QTDIR/plugins/iconengines/libqsvgicon.dylib"
|
|
|
|
if [ -f "$FILE" ]; then
|
|
|
|
cp $FILE $QTPLUGINS/
|
|
|
|
else
|
|
|
|
echo "$FILE: No such file"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
printf '\nChecking for prior deploy image Qt native library plugins at target bundle...\n'
|
|
|
|
|
|
|
|
rm -Rf $QTPLUGINS
|
|
|
|
fi
|
|
|
|
|
2012-04-04 21:12:52 +02:00
|
|
|
# run macdeployqt
|
2014-02-05 01:37:26 +01:00
|
|
|
$MACDEPLOYQT QupZilla.app
|
|
|
|
|
|
|
|
# create final dmg image
|
2015-11-24 17:40:52 +01:00
|
|
|
cd ../mac
|
2014-02-05 01:37:26 +01:00
|
|
|
./create_dmg.sh
|