-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·98 lines (74 loc) · 2.77 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#!/bin/bash
cd "$( dirname "${BASH_SOURCE[0]}" )" || exit
THEME_SVGS="src/svgs"
THEME_INDEX="src/index.theme"
ALIASES="cursorList"
echo -ne "Checking Requirements...\\r"
if [ ! -f $THEME_INDEX ] ; then
echo -e "\\nFAIL: '$THEME_INDEX' missing"
exit 1
elif ! type "inkscape" > /dev/null ; then
echo -e "\\nFAIL: inkscape must be installed"
exit 1
elif ! type "xcursorgen" > /dev/null ; then
echo -e "\\nFAIL: xcursorgen must be installed"
exit 1
fi
echo -e "Checking Requirements... DONE"
# Make output directory
BUILD_DIR="build"
mkdir -p "$BUILD_DIR/3d-white/cursors"
for SIZE in 24 32 48; do
echo -ne "\\033[0KGenerating cursors for size $SIZE...\\r"
# Make output subdirectory
OUTPUT_DIR="$BUILD_DIR/$SIZE"
mkdir -p "$OUTPUT_DIR"
echo -ne "\\033[0KGenerating simple cursor pixmaps...\\r"
for CUR in src/config/*.cursor; do
BASENAME=$CUR
BASENAME=${BASENAME##*/}
BASENAME=${BASENAME%.*}
echo -ne "\\033[0KGenerating $BASENAME @ $SIZE\\r"
inkscape -w $SIZE -f $THEME_SVGS/"$BASENAME".svg -e "$OUTPUT_DIR/$BASENAME.png" > /dev/null
done
echo -e "\\033[0KGenerating simple cursor pixmaps... DONE"
echo -ne "\\033[0KGenerating progress-cursor pixmaps...\\r"
for i in 01 02 03 04 05 06 07 08 09 10; do
inkscape -w $SIZE -f $THEME_SVGS/progress-$i.svg -e "$OUTPUT_DIR/progress-$i.png" > /dev/null
done
echo -e "\\033[0KGenerating progress-cursor pixmaps... DONE"
echo -ne "\\033[0KGenerating wait-cursor pixmaps...\\r"
for i in 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20; do
inkscape -w $SIZE -f $THEME_SVGS/wait-$i.svg -e "$OUTPUT_DIR/wait-$i.png" > /dev/null
done
echo -e "\\033[0KGenerating wait-cursor pixmaps... DONE"
done
echo -ne "Generating cursor theme...\\r"
for CUR in src/config/*.cursor; do
BASENAME=$CUR
BASENAME=${BASENAME##*/}
BASENAME=${BASENAME%.*}
if ! ERR="$( xcursorgen -p build "$CUR" "$BUILD_DIR/3d-white/cursors/$BASENAME" 2>&1 )"; then
echo "FAIL: $CUR $ERR"
fi
done
echo -e "Generating cursor theme... DONE"
echo -ne "Generating shortcuts...\\r"
while read -r ALIAS ; do
FROM=${ALIAS% *}
TO=${ALIAS#* }
if [ -e "$BUILD_DIR/3d-white/cursors/$FROM" ] ; then
continue
fi
ln -sf "$TO" "$BUILD_DIR/3d-white/cursors/$FROM"
done < $ALIASES
echo -e "\\033[0KGenerating shortcuts... DONE"
echo -ne "Copying Theme Index...\\r"
if ! [ -e "$BUILD_DIR/3d-white/index.theme" ] ; then
cp $THEME_INDEX "$BUILD_DIR/3d-white/index.theme"
fi
echo -e "\\033[0KCopying Theme Index... DONE"
echo -ne "Building Theme archive...\\r"
(cd "$BUILD_DIR" && tar -czvf 3d-white.tar.gz 3d-white/)
echo -e "\\033[0KBuilding Theme archive... DONE"
echo "COMPLETE!"