diff --git a/assets/beehive.icns b/assets/beehive.icns deleted file mode 100644 index 00d16650..00000000 Binary files a/assets/beehive.icns and /dev/null differ diff --git a/script/build-app b/script/build-app index 65088ba6..410601a8 100755 --- a/script/build-app +++ b/script/build-app @@ -1,11 +1,12 @@ #!/bin/bash # Build "native" desktop app using nativefier # https://github.com/jiahaog/nativefier +set -e if [ "$(uname)" != "Darwin" ]; then echo "MacOS is the only platform currently supported" >&2 exit 1 -fi +fi if [ ! -f beehive ]; then echo "Run 'make embed' first." >&2 @@ -18,16 +19,25 @@ if !which nativefier >/dev/null 2>&1; then exit 1 fi +BASE_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd )" OS_NAME=$(node -e "console.log(os.platform())") OS_ARCH=$(node -e "console.log(os.arch())") +cleanup_osx() { + if [ -f "$icns_file" ]; then + rm -f $icns_file + fi +} + if [ "$OS_NAME" = "darwin" ]; then + trap cleanup_osx EXIT BIN_PATH=build/app/Beehive-$OS_NAME-$OS_ARCH/Beehive.app/Contents/MacOS/ - nativefier -e 1.6.6 --icon assets/beehive.icns --name Beehive http://localhost:8181 build/app + icns_file=$($BASE_PATH/build-icns) + nativefier -e 1.6.6 --icon $icns_file --name Beehive http://localhost:8181 build/app cp beehive $BIN_PATH/beehived chmod +x $BIN_PATH/beehived mv $BIN_PATH/Beehive $BIN_PATH/Beehive.bin - + cat > $BIN_PATH/Beehive << "EOF" #!/bin/bash set -e diff --git a/script/build-icns b/script/build-icns new file mode 100755 index 00000000..f09632a1 --- /dev/null +++ b/script/build-icns @@ -0,0 +1,30 @@ +#!/bin/bash +set -e + +tmpd=$TMPDIR/beehive.iconset +icns=$TMPDIR/beehive.icns +logfile=$TMPDIR/build-icns.log + +cleanup() { + rm -rf $tmpd + rm -f $logfile +} + +trap cleanup EXIT + +{ + mkdir $tmpd + sips -z 16 16 assets/logo.png --out $tmpd/icon_16x16.png + sips -z 32 32 assets/logo.png --out $tmpd/icon_16x16@2x.png + sips -z 32 32 assets/logo.png --out $tmpd/icon_32x32.png + sips -z 64 64 assets/logo.png --out $tmpd/icon_32x32@2x.png + sips -z 128 128 assets/logo.png --out $tmpd/icon_128x128.png + sips -z 256 256 assets/logo.png --out $tmpd/icon_128x128@2x.png + sips -z 256 256 assets/logo.png --out $tmpd/icon_256x256.png + sips -z 512 512 assets/logo.png --out $tmpd/icon_256x256@2x.png + sips -z 512 512 assets/logo.png --out $tmpd/icon_512x512.png + cp assets/logo.png $tmpd/icon_512x512@2x.png + iconutil -c icns $tmpd +} > $logfile 2>&1 + +echo $icns