]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/blob - misc/build_helpers/icons/make-osx-icon.sh
Build Tahoe-LAFS icon for OS X and Windows. refs ticket:2323
[tahoe-lafs/tahoe-lafs.git] / misc / build_helpers / icons / make-osx-icon.sh
1 #! /bin/bash
2 # Based on <http://stackoverflow.com/a/23688878/393146> and
3 # <http://stackoverflow.com/a/11788723/393146>.
4 # converts the passed-in svgs to icns format
5
6 if [[ "$#" -eq 0 ]]; then
7     echo "Usage: $0 svg1 [svg2 [...]]"
8     exit 0
9 fi
10
11 temp="$(mktemp -d)"
12 declare -a res=(16 32 64 128 256 512 1024)
13 for f in "$*"; do
14     name="`basename -s .svg "$f"`"
15     iconset="$temp/${name}.iconset"
16     mkdir -p "$iconset"
17     for r in "${res[@]}"; do
18         inkscape -z -e "$iconset/${name}${r}x${r}.png" -w "$r" -h "$r" "$f"
19     done
20     ln "$iconset/${name}32x32.png" "$iconset/${name}16x16@2x.png"
21     mv "$iconset/${name}64x64.png" "$iconset/${name}32x32@2x.png"
22     ln "$iconset/${name}256x256.png" "$iconset/${name}128x128@2x.png"
23     ln "$iconset/${name}512x512.png" "$iconset/${name}256x256@2x.png"
24     mv "$iconset/${name}1024x1024.png" "$iconset/${name}512x512@2x.png"
25     iconutil -c icns -o "${name}.icns" "$iconset"
26 done
27 rm -rf "$temp"