diff --git a/packaging/.gitignore b/buildResources/.gitignore similarity index 100% rename from packaging/.gitignore rename to buildResources/.gitignore diff --git a/packaging/ScratchDesktop.icns b/buildResources/ScratchDesktop.icns similarity index 100% rename from packaging/ScratchDesktop.icns rename to buildResources/ScratchDesktop.icns diff --git a/packaging/ScratchDesktop.ico b/buildResources/ScratchDesktop.ico similarity index 99% rename from packaging/ScratchDesktop.ico rename to buildResources/ScratchDesktop.ico index fa6265a..ead5274 100644 Binary files a/packaging/ScratchDesktop.ico and b/buildResources/ScratchDesktop.ico differ diff --git a/buildResources/Square150x150Logo.png b/buildResources/Square150x150Logo.png new file mode 100644 index 0000000..e11f3fc Binary files /dev/null and b/buildResources/Square150x150Logo.png differ diff --git a/buildResources/Square44x44Logo.png b/buildResources/Square44x44Logo.png new file mode 100644 index 0000000..b68b93b Binary files /dev/null and b/buildResources/Square44x44Logo.png differ diff --git a/buildResources/StoreLogo.png b/buildResources/StoreLogo.png new file mode 100644 index 0000000..9c39a29 Binary files /dev/null and b/buildResources/StoreLogo.png differ diff --git a/buildResources/Wide300x150Logo.png b/buildResources/Wide300x150Logo.png new file mode 100644 index 0000000..daa2f54 Binary files /dev/null and b/buildResources/Wide300x150Logo.png differ diff --git a/packaging/entitlements.plist b/buildResources/entitlements.plist similarity index 100% rename from packaging/entitlements.plist rename to buildResources/entitlements.plist diff --git a/buildResources/make-icons.sh b/buildResources/make-icons.sh new file mode 100755 index 0000000..e551ea0 --- /dev/null +++ b/buildResources/make-icons.sh @@ -0,0 +1,62 @@ +#!/bin/bash +SRC=../src/icon/ScratchDesktop.svg +OUT_ICONSET=ScratchDesktop.iconset +OUT_ICNS=ScratchDesktop.icns +OUT_ICO=ScratchDesktop.ico +TMP_ICO=tmp + +ICO_BASIC_SIZES="16 24 32 48 256" +ICO_EXTRA_SIZES="20 30 36 40 60 64 72 80 96 512" + +if command -v pngcrush >/dev/null 2>&1; then + function optimize () { + pngcrush -new -brute -ow "$@" + } +else + echo "pngcrush is not available - skipping PNG optimization" + function optimize () { + echo "Not optimizing:" "$@" + } +fi + +# usage: resize newWidth newHeight input output [otherOptions...] +function resize () { + WIDTH=$1 + HEIGHT=$2 + SRC=$3 + DST=$4 + shift 4 + convert -background none -resize "${WIDTH}x${HEIGHT}" -extent "${WIDTH}x${HEIGHT}" -gravity center "$@" "${SRC}" "${DST}" + optimize "${DST}" +} + +if command -v convert >/dev/null 2>&1; then + # Mac + if command -v iconutil >/dev/null 2>&1; then + mkdir -p "${OUT_ICONSET}" + for SIZE in 16 32 128 256 512; do + SIZE2=`expr "${SIZE}" '*' 2` + resize "${SIZE}" "${SIZE}" "${SRC}" "${OUT_ICONSET}/icon_${SIZE}x${SIZE}.png" -density 72 -units PixelsPerInch + resize "${SIZE2}" "${SIZE2}" "${SRC}" "${OUT_ICONSET}/icon_${SIZE}x${SIZE}@2x.png" -density 144 -units PixelsPerInch + done + iconutil -c icns --output "${OUT_ICNS}" "${OUT_ICONSET}" + else + echo "iconutil is not available - skipping ICNS and ICONSET" + fi + + # Windows ICO + mkdir -p "${TMP_ICO}" + for SIZE in ${ICO_BASIC_SIZES} ${ICO_EXTRA_SIZES}; do + resize "${SIZE}" "${SIZE}" "${SRC}" "${TMP_ICO}/icon_${SIZE}x${SIZE}.png" + done + # Asking for "Zip" compression actually results in PNG compression + convert "${TMP_ICO}"/icon_*.png -colorspace sRGB -compress Zip "${OUT_ICO}" + + # Windows AppX + resize 44 44 "${SRC}" 'Square44x44Logo.png' + resize 150 150 "${SRC}" 'Square150x150Logo.png' + resize 400 400 "${SRC}" 'StoreLogo.png' + resize 300 150 "${SRC}" 'Wide300x150Logo.png' +else + echo "ImageMagick is not available - cannot convert icons" +fi diff --git a/electron-builder.yaml b/electron-builder.yaml index 74ed854..fb23c82 100644 --- a/electron-builder.yaml +++ b/electron-builder.yaml @@ -1,4 +1,5 @@ directories: + buildResources: buildResources output: dist appId: edu.mit.scratch.scratch-desktop productName: "Scratch Desktop" diff --git a/packaging/make-icon.sh b/packaging/make-icon.sh deleted file mode 100755 index 81316c1..0000000 --- a/packaging/make-icon.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/sh -SRC=../src/icon/ScratchDesktop.svg -OUT_ICONSET=ScratchDesktop.iconset -OUT_ICNS=ScratchDesktop.icns -OUT_ICO=ScratchDesktop.ico -TMP_ICO=tmp - -ICO_BASIC_SIZES="16 24 32 48 256" -ICO_EXTRA_SIZES="20 30 36 40 60 64 72 80 96 512" - -if command -v convert >/dev/null 2>&1; then - # Mac - if command -v iconutil >/dev/null 2>&1; then - mkdir -p "${OUT_ICONSET}" - for SIZE in 16 32 128 256 512; do - SIZE2=`expr "${SIZE}" '*' 2` - convert -background none -density 72 -units PixelsPerInch -resize "!${SIZE}x${SIZE}" "${SRC}" "${OUT_ICONSET}/icon_${SIZE}x${SIZE}.png" - convert -background none -density 144 -units PixelsPerInch -resize "!${SIZE2}x${SIZE2}" "${SRC}" "${OUT_ICONSET}/icon_${SIZE}x${SIZE}@2x.png" - # sips doesn't support SVG - #sips -s dpiWidth 72 -s dpiHeight 72 -z "${SIZE}" "${SIZE}" "${SRC}" --out "${OUT_ICONSET}/icon_${SIZE}x${SIZE}.png" - #sips -s dpiWidth 144 -s dpiHeight 144 -z "${SIZE2}" "${SIZE2}" "${SRC}" --out "${OUT_ICONSET}/icon_${SIZE}x${SIZE}@2x.png" - done - if command -v pngcrush >/dev/null 2>&1; then - for PNG in "${OUT_ICONSET}"/icon_*.png; do - pngcrush -new -brute -ow "${PNG}" - done - else - echo "pngcrush is not available - skipping PNG optimization" - fi - iconutil -c icns --output "${OUT_ICNS}" "${OUT_ICONSET}" - else - echo "iconutil is not available - skipping ICNS and ICONSET" - fi - - # Windows - mkdir -p "${TMP_ICO}" - for SIZE in ${ICO_BASIC_SIZES} ${ICO_EXTRA_SIZES}; do - convert -background none -resize "!${SIZE}x${SIZE}" "${SRC}" "${TMP_ICO}/icon_${SIZE}x${SIZE}.png" - done - if command -v pngcrush >/dev/null 2>&1; then - for PNG in "${TMP_ICO}"/icon_*.png; do - pngcrush -new -brute -ow "${PNG}" - done - else - echo "pngcrush is not available - skipping PNG optimization" - fi - # Asking for "Zip" compression actually results in PNG compression - convert "${TMP_ICO}"/icon_*.png -colorspace sRGB -compress Zip "${OUT_ICO}" -else - echo "ImageMagick is not available - cannot convert icons" -fi