Skip to content

Commit

Permalink
Add an OSX build script for creating an .app bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
ironsmile committed Feb 4, 2018
1 parent 0782a83 commit 78822cc
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 87 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ dist/*
build/*
**/.DS_Store
app.spec
tank4eta.spec
6 changes: 6 additions & 0 deletions build_osx
Original file line number Diff line number Diff line change
@@ -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

Binary file added etc/icon.icns
Binary file not shown.
47 changes: 47 additions & 0 deletions etc/osx-builder/create_icns
Original file line number Diff line number Diff line change
@@ -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/[email protected]
cp icon.iconset/[email protected] icon.iconset/icon_32x32.png
sips -z 64 64 "$fileName" --out icon.iconset/[email protected]
sips -z 128 128 "$fileName" --out icon.iconset/icon_128x128.png
sips -z 256 256 "$fileName" --out icon.iconset/[email protected]
cp icon.iconset/[email protected] icon.iconset/icon_256x256.png
sips -z 512 512 "$fileName" --out icon.iconset/[email protected]
cp icon.iconset/[email protected] icon.iconset/icon_512x512.png
sips -z 1024 1024 "$fileName" --out icon.iconset/[email protected]

# Create .icns file
iconutil -c icns icon.iconset

# Cleanup
rm -R icon.iconset
rm $fileName

86 changes: 0 additions & 86 deletions etc/osx-builder/create_osx_app

This file was deleted.

2 changes: 1 addition & 1 deletion etc/osx-builder/launcher
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env bash
cd "${0%/*}"
./app
./tank4eta

0 comments on commit 78822cc

Please sign in to comment.