diff --git a/.gitignore b/.gitignore index d5636f1..5fb2c65 100755 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ dist/* build/* **/.DS_Store app.spec +tank4eta.spec diff --git a/build_osx b/build_osx new file mode 100755 index 0000000..1627e1d --- /dev/null +++ b/build_osx @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +pyinstaller --add-data data:data -n tank4eta --noconsole --osx-bundle-identifier com.doycho.tank4eta -i etc/icon.icns app.py +cp etc/osx-builder/launcher dist/tank4eta.app/Contents/MacOS/ +sed -i 's/MacOS\/tank4eta/MacOS\/launcher/' dist/tank4eta.app/Contents/Info.plist + diff --git a/etc/icon.icns b/etc/icon.icns new file mode 100644 index 0000000..7480380 Binary files /dev/null and b/etc/icon.icns differ diff --git a/etc/osx-builder/create_icns b/etc/osx-builder/create_icns new file mode 100755 index 0000000..81329f4 --- /dev/null +++ b/etc/osx-builder/create_icns @@ -0,0 +1,47 @@ +#!/usr/bin/env bash + +function die { + echo "ERROR: $1" > /dev/null 1>&2 + exit 1 +} + +if [ "$#" -ne 1 ]; then + die "Usage: `basename $0` icon-file.svg" +fi + +ICONNAME=$1 + +if [ ! -f $ICONNAME ]; then + die "Image file for icon not found" +fi + +fileName=$ICONNAME +postfix=${fileName##*.} + +if [[ $postfix == 'svg' ]]; then + qlmanage -z -t -s 1024 -o ./ "$fileName" + fileName=${fileName}.png +fi + +echo $fileName + +mkdir icon.iconset + +sips -z 16 16 "$fileName" --out icon.iconset/icon_16x16.png +sips -z 32 32 "$fileName" --out icon.iconset/icon_16x16@2x.png +cp icon.iconset/icon_16x16@2x.png icon.iconset/icon_32x32.png +sips -z 64 64 "$fileName" --out icon.iconset/icon_32x32@2x.png +sips -z 128 128 "$fileName" --out icon.iconset/icon_128x128.png +sips -z 256 256 "$fileName" --out icon.iconset/icon_128x128@2x.png +cp icon.iconset/icon_128x128@2x.png icon.iconset/icon_256x256.png +sips -z 512 512 "$fileName" --out icon.iconset/icon_256x256@2x.png +cp icon.iconset/icon_256x256@2x.png icon.iconset/icon_512x512.png +sips -z 1024 1024 "$fileName" --out icon.iconset/icon_512x512@2x.png + +# Create .icns file +iconutil -c icns icon.iconset + +# Cleanup +rm -R icon.iconset +rm $fileName + diff --git a/etc/osx-builder/create_osx_app b/etc/osx-builder/create_osx_app deleted file mode 100755 index 8b45d49..0000000 --- a/etc/osx-builder/create_osx_app +++ /dev/null @@ -1,86 +0,0 @@ -#!/bin/bash - -# Mac OSX .app builder - -function die { - echo "ERROR: $1" > /dev/null 1>&2 - exit 1 -} - -if [ "$#" -ne 2 ]; then - die "Usage: `basename $0` AppNameHere icon-file.svg" -fi - -APPNAME=$1 -ICONNAME=$2 - -if [ ! -f $ICONNAME ]; then - die "Image file for icon not found" -fi - -mkdir -p "$APPNAME.app/Contents/"{MacOS,Resources} - -cat > "$APPNAME.app/Contents/Info.plist" < - - - - CFBundleGetInfoString - $APPNAME - CFBundleExecutable - $APPNAME - CFBundleIdentifier - com.example.www - CFBundleName - $APPNAME - CFBundleIconFile - icon.icns - CFBundleShortVersionString - 0.01 - CFBundleInfoDictionaryVersion - 6.0 - CFBundlePackageType - APPL - IFMajorVersion - 0 - IFMinorVersion - 1 - NSHighResolutionCapable - NSSupportsAutomaticGraphicsSwitching - - -END - -cp $ICONNAME "$APPNAME.app/Contents/Resources/" -cd "$APPNAME.app/Contents/Resources/" - -fileName=$ICONNAME -postfix=${fileName##*.} - -if [[ $postfix == 'svg' ]]; then - qlmanage -z -t -s 1024 -o ./ "$fileName" - fileName=${fileName}.png -fi - -echo $fileName - -mkdir icon.iconset - -sips -z 16 16 "$fileName" --out icon.iconset/icon_16x16.png -sips -z 32 32 "$fileName" --out icon.iconset/icon_16x16@2x.png -cp icon.iconset/icon_16x16@2x.png icon.iconset/icon_32x32.png -sips -z 64 64 "$fileName" --out icon.iconset/icon_32x32@2x.png -sips -z 128 128 "$fileName" --out icon.iconset/icon_128x128.png -sips -z 256 256 "$fileName" --out icon.iconset/icon_128x128@2x.png -cp icon.iconset/icon_128x128@2x.png icon.iconset/icon_256x256.png -sips -z 512 512 "$fileName" --out icon.iconset/icon_256x256@2x.png -cp icon.iconset/icon_256x256@2x.png icon.iconset/icon_512x512.png -sips -z 1024 1024 "$fileName" --out icon.iconset/icon_512x512@2x.png - -# Create .icns file -iconutil -c icns icon.iconset - -# Cleanup -rm -R icon.iconset -rm $fileName - diff --git a/etc/osx-builder/launcher b/etc/osx-builder/launcher index e3514de..e853c80 100755 --- a/etc/osx-builder/launcher +++ b/etc/osx-builder/launcher @@ -1,4 +1,4 @@ #!/usr/bin/env bash cd "${0%/*}" -./app +./tank4eta