diff --git a/.gitignore b/.gitignore index 70346a483..3f829341b 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ TuxPaint.app TuxPaint.dmg *.dylib *.dylib.dSYM +.DS_Store diff --git a/Makefile b/Makefile index db1c2aad7..af60bc389 100644 --- a/Makefile +++ b/Makefile @@ -482,7 +482,8 @@ install: install-bin install-data install-man install-doc \ @echo @if [ "x$(OS)" == "xosx" ]; then \ echo "All done! Now you can double click $(BUNDLE) to run the"; \ - echo "program!!!"; \ + echo "program!!! TuxPaint.dmg has also been created for"; \ + echo "distribution."; \ echo; \ echo "For more information, see $(DOC_PREFIX)/README.txt"; \ else \ @@ -591,7 +592,7 @@ clean: @-rm -f templates/.thumbs/*.png @if [ -d templates/.thumbs ]; then rmdir templates/.thumbs; fi @-if [ "x$(BUNDLE)" != "x" ]; then rm -rf $(BUNDLE); fi - @-rm -f TuxPaint.dmg; rm -rf magic/*.dSYM + @-rm -f TuxPaint.dmg temp.dmg; rm -rf magic/*.dSYM @echo # "make uninstall" should remove the various parts from their @@ -1013,7 +1014,7 @@ install-man: @chmod a+rx,g-w,o-w $(MAN_PREFIX)/man1/tp-magic-config.1.gz -# Install the support files for macOS application bundle +# Install the support files for macOS application bundle and create DMG .PHONY: install-bundlefiles install-bundlefiles: @echo @@ -1026,8 +1027,9 @@ install-bundlefiles: @install -m 644 macos/Info.plist $(BUNDLE)/Contents @install -m 644 macos/tuxpaint.icns $(BUNDLE)/Contents/Resources @custom/macos.sh - @echo "...Creating TuxPaint.dmg..." - @hdiutil create -volname "Tux Paint $(VER_VERSION)" -srcfolder $(BUNDLE) -ov -format UDBZ -o TuxPaint.dmg + @echo + @echo "...Creating DMG Distribution File..." + @custom/macos-mkdmg.sh # Build the program! diff --git a/custom/macos-mkdmg.sh b/custom/macos-mkdmg.sh new file mode 100755 index 000000000..27a0f6406 --- /dev/null +++ b/custom/macos-mkdmg.sh @@ -0,0 +1,45 @@ +#!/bin/sh + +BUNDLE=TuxPaint.app +TEMP_DMG=temp.dmg +TEMP_DMG_SIZE=`expr \`du -sm "$BUNDLE" | cut -f1\` \* 15 / 10`m +FINAL_DMG=TuxPaint.dmg +VOLNAME="Tux Paint" +ICON="macos/tuxpaint.icns" +BACKGROUND="macos/background.png" + + +echo " * Creating the temporary image..." +hdiutil create "$TEMP_DMG" -ov -fs HFS+ -size "$TEMP_DMG_SIZE" -volname "$VOLNAME" \ +&& VOLUME=`hdiutil attach "$TEMP_DMG" -nobrowse -noverify -noautoopen | grep Apple_HFS | sed 's/^.*Apple_HFS[[:blank:]]*//'` \ +|| exit 1 + +echo " * Adding the image background..." +mkdir "$VOLUME/.background" \ +&& tiffutil -cathidpicheck "$BACKGROUND" -out "$VOLUME/.background/background.tiff" \ +|| exit 1 + +echo " * Setting the folder icon..." +cp "$ICON" "$VOLUME/.VolumeIcon.icns" \ +&& xattr -wx com.apple.FinderInfo '00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00' "$VOLUME" \ +|| exit 1 + +echo " * Copying the contents..." +ln -s "/Applications" "$VOLUME" \ +&& cp -a "$BUNDLE" "$VOLUME" \ +&& cp -a "macos/DS_Store" "$VOLUME/.DS_Store" \ +|| exit 1 + +echo " * Configuring the folder to open upon mount..." +bless --folder "$VOLUME" --openfolder "$VOLUME" \ +|| exit 1 + +echo " * Unmounting the temporary image..." +hdiutil detach "$VOLUME" + +echo " * Creating the final image..." +hdiutil convert "$TEMP_DMG" -ov -format "UDBZ" -imagekey "zlib-level=9" -o "$FINAL_DMG" + +echo " * Deleting the temporary image..." +rm -f "$TEMP_DMG" + diff --git a/macos/DS_Store b/macos/DS_Store new file mode 100644 index 000000000..d8ac20b95 Binary files /dev/null and b/macos/DS_Store differ diff --git a/macos/background.png b/macos/background.png new file mode 100644 index 000000000..c50906308 Binary files /dev/null and b/macos/background.png differ