diff --git a/.gitignore b/.gitignore index 104ab24c6..e0715b1f0 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ headers*.tar.gz license_template Makefile* bin/qupzilla +bin/QupZilla.dmg lib*.so* bin/core qupzilla.sh diff --git a/mac/QupZilla-template.dmg b/mac/QupZilla-template.dmg deleted file mode 100644 index d96bd2916..000000000 Binary files a/mac/QupZilla-template.dmg and /dev/null differ diff --git a/mac/create_dmg.scpt b/mac/create_dmg.scpt new file mode 100644 index 000000000..d566d02a6 --- /dev/null +++ b/mac/create_dmg.scpt @@ -0,0 +1,36 @@ +tell application "Finder" + tell disk "QupZilla" + open + # Set some defaults + set current view of container window to icon view + + # Turn some things off + set statusbar visible of container window to false + set toolbar visible of container window to false + + # Size metrics { x, y, w, h } + set the bounds of container window to {40, 40, 520, 520} + + # Abstract an object + set theViewOptions to the icon view options of container window + + # Turn some more things off + set arrangement of theViewOptions to not arranged + + # Set background image in HFS+ format referenced from image bundle + set background picture of theViewOptions to file ".background:qupzilla-dmg-background.png" + + # Align the icons to the background mask + set icon size of theViewOptions to 64 + + set position of item "QupZilla" of container window to {55, 390} + set position of item "Applications" of container window to {390, 390} + + # Since this is a dynamic template modifier script tell Finder not to do any registration of applications + update without registering applications + + delay 5 + + close + end tell +end tell diff --git a/mac/create_dmg.sh b/mac/create_dmg.sh index ee14e7e95..2fa3fa289 100755 --- a/mac/create_dmg.sh +++ b/mac/create_dmg.sh @@ -1,26 +1,61 @@ #!/bin/bash +TMP=/tmp BUNDLE_PATH=bin test -d bin || BUNDLE_PATH=../bin -echo "We just want to make sure it's not in use" -hdiutil detach /tmp/tmp-release-qupzilla +WORK_TEMPLATE=tmp-QupZilla-release.dmg.sparseimage -echo "Creating writable DMG from template" -hdiutil convert QupZilla-template.dmg -format UDRW -o /tmp/tmp-qupzilla.dmg +# NOTE: Value must currently match -volname exactly or an error happens in AppleScript with Finder +VOLUME_TEMPLATE=QupZilla -echo "Attach DMG for write" -hdiutil attach /tmp/tmp-qupzilla.dmg -mountpoint /tmp/tmp-qupzilla-release +echo "Ensuring working disk image template is not in use…" +hdiutil detach $TMP/$WORK_TEMPLATE -echo "Copying…" -cp -fpR $BUNDLE_PATH/QupZilla.app/Contents /tmp/tmp-qupzilla-release/QupZilla.app +echo "Creating writable working disk image template…" +hdiutil create -size 200m "$TMP/$WORK_TEMPLATE" -type SPARSE -fs HFS+ -volname "QupZilla" -hdiutil detach /tmp/tmp-qupzilla-release + echo "Attaching working disk image template for modification…" + hdiutil attach "$TMP/$WORK_TEMPLATE" -mountpoint "$TMP/$VOLUME_TEMPLATE" -echo "Creating final compressed(bz2) DMG…" -rm $BUNDLE_PATH/QupZilla.dmg -hdiutil convert /tmp/tmp-qupzilla.dmg -format UDBZ -o $BUNDLE_PATH/QupZilla.dmg + echo "Creating background image folder…" + mkdir "$TMP/$VOLUME_TEMPLATE/.background" -echo "Removing temp files…" -rm /tmp/tmp-qupzilla.dmg -exit + echo "Copying background image…" + cp images/qupzilla-dmg-background.png "$TMP/$VOLUME_TEMPLATE/.background/" + + echo "Creating volume icon set…" + iconutil -c icns images/qupzilla-dmg-icon.iconset -o "$TMP/$VOLUME_TEMPLATE/.VolumeIcon.icns" + + echo "Creating application reference folder…" + mkdir "$TMP/$VOLUME_TEMPLATE/QupZilla.app" + + echo "Creating symbolic link to global Applications folder…" + ln -s /Applications "$TMP/$VOLUME_TEMPLATE/Applications" + + echo "Setting some proprietary window modifications here with AppleScript…" + osascript create_dmg.scpt + + sleep 5 + + echo "Registering that a custom icon has been set…" + SetFile -a C "$TMP/$VOLUME_TEMPLATE" + + echo "Copying application bundle contents…" + cp -fpR "$BUNDLE_PATH/QupZilla.app/Contents" "$TMP/$VOLUME_TEMPLATE/QupZilla.app" + + echo "Blessing folder to automatically open on mount…" + bless -folder "$TMP/$VOLUME_TEMPLATE" --openfolder "$TMP/$VOLUME_TEMPLATE" + + echo "Detaching working disk image template from write…" + hdiutil detach "$TMP/$VOLUME_TEMPLATE" + +echo "Compacting working disk image…" +hdiutil compact "$TMP/$WORK_TEMPLATE" + +echo "Converting working disk image to read only…" +rm "$BUNDLE_PATH/QupZilla.dmg" +hdiutil convert "$TMP/$WORK_TEMPLATE" -format UDBZ -o "$BUNDLE_PATH/QupZilla.dmg" + +echo "Cleaning up" +rm "$TMP/$WORK_TEMPLATE" diff --git a/mac/images/qupzilla-dmg-icon.png b/mac/images/qupzilla-dmg-icon.iconset/icon_256x256.png similarity index 100% rename from mac/images/qupzilla-dmg-icon.png rename to mac/images/qupzilla-dmg-icon.iconset/icon_256x256.png diff --git a/mac/macdeploy.sh b/mac/macdeploy.sh index 89596d7fd..cad37a91e 100755 --- a/mac/macdeploy.sh +++ b/mac/macdeploy.sh @@ -42,7 +42,7 @@ 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' + printf '\nPlease set the environment variable for the Qt platform folder.\n\texample:\n\t$ export QTDIR="$HOME/Qt/5.8/clang_64"\n' exit 1 else printf '\nCopying known, missing, Qt native library plugins to target bundle...\n'