Add disk writer tool.
[dcpomatic.git] / graphics / update
1 #!/bin/bash
2 #
3 # Update generated stuff in graphics/ from the source files.
4 #
5 # It would be nice to do this with waf but:
6 # a) getting the wscript right is a complete pain in the arse
7 # b) running Inkscape from the command line on OS X is a complete pain in the arse
8
9 pwd=`pwd`
10 if [ `basename $pwd` != "graphics" ]; then
11     echo "$0: run within graphics/"
12     exit 1
13 fi
14
15 svg_apps="dcpomatic2_kdm dcpomatic2_server dcpomatic2_batch dcpomatic2_player dcpomatic2_playlist dcpomatic2_disk"
16
17 if [ `uname -s` == "Darwin" ]; then
18     # Convert OS X icons using OS X-only iconutil
19     for p in dcpomatic2 $svg_apps; do
20         iconutil --convert icns --output osx/$p.icns osx/$p.iconset
21     done
22 else
23
24     for c in icotool convert inkscape; do
25         if [ ! -x "$(command -v $c)" ]; then
26             echo "$c is required"
27             exit 1
28         fi
29     done
30
31     INKSCAPE="inkscape -z -C -e"
32
33     # OS X application icons
34     mkdir -p osx
35     for r in 16 32 128 256 512; do
36         for p in dcpomatic2; do
37             mkdir -p osx/$p.iconset
38             convert src/dcpomatic.png -resize $rx$r osx/$p.iconset/icon_${r}x${r}.png
39             convert src/dcpomatic.png -resize $rx$r osx/$p.iconset/icon_${r}x${r}@2x.png
40         done
41         for p in $svg_apps; do
42             mkdir -p osx/$p.iconset
43             $INKSCAPE osx/$p.iconset/icon_${r}x${r}.png -w $r -h $r src/$p.svg
44             $INKSCAPE osx/$p.iconset/icon_${r}x${r}@2x.png -w $r -h $r src/$p.svg
45         done
46     done
47
48     # Linux application icons
49     mkdir -p linux
50     for r in 16 22 32 48 64 128 256 512; do
51         mkdir -p linux/$r
52         convert src/dcpomatic.png -resize $rx$r linux/$r/dcpomatic2.png
53         for p in $svg_apps; do
54             $INKSCAPE linux/$r/$p.png src/$p.svg -w $r -h $r
55         done
56     done
57
58     # Windows application icons
59     mkdir -p windows
60     for p in dcpomatic2 $svg_apps; do
61         icotool -c -o windows/$p.ico linux/16/$p.png linux/32/$p.png linux/48/$p.png linux/64/$p.png linux/128/$p.png
62     done
63     convert src/dcpomatic.png -resize 400x400 windows/dcpomatic.bmp
64
65     # OS X preferences icons
66     # servers.png does not have an SVG version
67     mkdir -p osx/preferences
68     for i in colour_conversions defaults email kdm_email cover_sheet keys tms notifications locations sound; do
69         $INKSCAPE osx/preferences/$i.png src/$i.svg -w 32 -h 32
70     done
71
72     # OS X menu bar icon for the server
73     $INKSCAPE osx/dcpomatic_small.png -w 64 -h 64 src/dcpomatic_small.svg
74
75     # Splash screen (all platforms)
76     $INKSCAPE splash.png src/splash.svg -w 400 -h 300
77
78     # Timeline toolbar icons (all platforms)
79     for i in select zoom zoom_all snap sequence; do
80         $INKSCAPE $i.png src/$i.svg -w 32 -h 32
81     done
82
83     # Playlist editor tick/no-tick
84     $INKSCAPE tick.png src/tick.svg -w 16 -h 16
85     $INKSCAPE no_tick.png src/no_tick.svg -w 16 -h 16
86
87     # favicon
88     mkdir -p web
89     convert src/web.png -resize 256x256 -transparent white web/favicon-256x256.png
90     for r in 16 32 64 128; do
91         convert web/favicon-256x256.png -resize $rx$r web/favicon-${r}x${r}.png
92     done
93     convert web/favicon-16x16.png web/favicon-32x32.png web/favicon-64x64.png web/favicon-128x128.png web/favicon-256x256.png web/favicon.ico
94     convert src/web.png -resize 123x123 -transparent white web/logo.png
95 fi