58 lines
1.7 KiB
Bash
Executable File
58 lines
1.7 KiB
Bash
Executable File
#!/bin/bash
|
|
set -euo pipefail
|
|
|
|
ICON_SVG="static/vectors/icon.svg"
|
|
BUILD_DIR="build/bin"
|
|
ICONSET_DIR="build/icons.iconset"
|
|
MASTER_PNG="build/icon_master.png"
|
|
INKSCAPE="/Applications/Inkscape.app/Contents/MacOS/inkscape"
|
|
|
|
export CC=/usr/bin/clang
|
|
export CXX=/usr/bin/clang++
|
|
export SDKROOT=$(xcrun --show-sdk-path)
|
|
export PATH="$HOME/go/bin:$PATH"
|
|
|
|
if [ ! -f "$ICON_SVG" ]; then
|
|
echo "Warning: $ICON_SVG not found, skipping icon generation"
|
|
else
|
|
# Rasterize SVG faithfully via Inkscape
|
|
"$INKSCAPE" "$ICON_SVG" --export-type=png --export-filename="$MASTER_PNG" -w 1024 -h 1024 2>/dev/null
|
|
|
|
cp "$MASTER_PNG" build/appicon.png
|
|
|
|
# macOS .icns
|
|
rm -rf "$ICONSET_DIR"
|
|
mkdir -p "$ICONSET_DIR"
|
|
for size in 16 32 64 128 256 512; do
|
|
sips -z $size $size "$MASTER_PNG" --out "$ICONSET_DIR/icon_${size}x${size}.png" >/dev/null
|
|
double=$((size * 2))
|
|
sips -z $double $double "$MASTER_PNG" --out "$ICONSET_DIR/icon_${size}x${size}@2x.png" >/dev/null
|
|
done
|
|
iconutil -c icns "$ICONSET_DIR" -o build/appicon.icns
|
|
rm -rf "$ICONSET_DIR"
|
|
mkdir -p build/darwin
|
|
cp build/appicon.icns build/darwin/appicon.icns
|
|
|
|
# Windows .ico
|
|
mkdir -p build/windows
|
|
magick "$MASTER_PNG" \
|
|
\( +clone -resize 16x16 \) \
|
|
\( +clone -resize 32x32 \) \
|
|
\( +clone -resize 48x48 \) \
|
|
\( +clone -resize 64x64 \) \
|
|
\( +clone -resize 128x128 \) \
|
|
\( +clone -resize 256x256 \) \
|
|
-delete 0 build/windows/icon.ico
|
|
|
|
rm -f "$MASTER_PNG"
|
|
fi
|
|
|
|
echo "Building macOS (darwin/arm64)..."
|
|
wails build -clean -platform darwin/arm64
|
|
|
|
echo "Cross-compiling Windows (windows/amd64)..."
|
|
wails build -platform windows/amd64 -skipbindings
|
|
|
|
echo "Done. Outputs in $BUILD_DIR/"
|
|
ls -lh "$BUILD_DIR/"
|