-
Notifications
You must be signed in to change notification settings - Fork 11
/
build.sh
executable file
·200 lines (143 loc) · 4.14 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
#!/usr/bin/env bash
ATOM_URI="com.JiPi.Shadertoys"
# ----------------------------------------------------------------------------
SCRIPTPATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
SCRIPTNAME=`basename $0`
set -o errexit
set -o pipefail
set -o nounset
if [[ "${TRACE-0}" == "1" ]]; then set -o xtrace; fi
cd "$(dirname "$0")"
# ----------------------------------------------------------------------------
function do_clean {
rm -rf assets
rm -rf atom
rm -rf build
rm -rf docs
rm -rf site
rm -f Shaders.csv
}
# ----------------------------------------------------------------------------
function do_csv {
rm -f Shaders.csv
cd 'Tools/Shell/'
lua generate_csv.lua
cd ../..
}
# ----------------------------------------------------------------------------
function do_atom {
rm -rf atom
mkdir atom
cd 'Tools/Shell/'
lua generate_atom.lua
cd ../..
cd "atom/${ATOM_URI}"
mkdir -p Windows/Scripts/Comp
mkdir -p Mac/Scripts/Comp
cp "../../Tools/Scripts/Comp/Shaderfuse/User Menu/Browser.lua" "Windows/Scripts/Comp/Shaderfuse Browser.lua"
cp "../../Tools/Scripts/Comp/Shaderfuse/User Menu/Browser.lua" "Mac/Scripts/Comp/Shaderfuse Browser.lua"
[ -f ../atomize.sh ] && sh ../atomize.sh
zip -r "../${ATOM_URI}.zip" Fuses Windows Mac "${ATOM_URI}.atom"
[ -f ../detomize.sh ] && sh ../detomize.sh
rm -rf Windows
rm -rf Mac
cd ../..
}
# ----------------------------------------------------------------------------
function do_installers {
rm -rf build/Shaderfuse-Installers
rm -f build/Shaderfuse-Installers.zip
cd 'Tools/Shell/'
lua generate_installer.lua
cd ../..
cd build
zip -r Shaderfuse-Installers.zip Shaderfuse-Installers
cd ..
}
# ----------------------------------------------------------------------------
function do_assets {
# this function does just call some of the other
# do_whatsoever functions to then move theire
# generated output into an assets/ directory that
# can then be used as a source for the assets to
# be uploaded with a new GitHub release.
rm -rf assets
mkdir -p assets
do_csv
mv Shaders.csv assets/Shaderfuses.csv
do_atom
mv "atom/${ATOM_URI}.zip" assets/
rm -rf atom
do_installers
mv build/Shaderfuse-Installers.zip assets/
rm -rf build/Shaderfuse-Installers
}
# ----------------------------------------------------------------------------
function do_docs {
rm -rf docs
# copy Shades/ as a basis
cp -rp Shaders docs
# add some more markdown files
cp -rp Tools/Assets/Profiles docs
cp -rp Tools/Documentation docs/
# patch the markdown files and generate overviews
cd 'Tools/Shell/'
lua generate_markdown.lua
cd ../..
cd docs
find . -type f -name 'DESCRIPTION.md' -delete
cd ..
# create the videos list file
lua Tools/Shell/print_videos.lua > docs/Videos.md
# create the installers, as they are referenced in the markdown files
do_installers
cp -rp build/Shaderfuse-Installers/* docs
mv build/Shaderfuse-Installers.zip docs/
rm -rf build/Shaderfuse-Installers/
}
# ----------------------------------------------------------------------------
main() {
local COMMAND="${1-}"
case $COMMAND in
"clean")
do_clean
;;
"csv")
do_csv
;;
"assets")
do_assets
;;
"docs")
do_docs
;;
"atom")
do_atom
;;
"installers")
do_installers
;;
"help" | "-h" | "--help")
echo ""
echo "Usage:"
echo ""
echo " $SCRIPTNAME <command>"
echo ""
echo "The commands are:"
echo ""
echo " atom create the atom package under 'atom/'"
echo " csv create Shaders.csv with a list of all the shaders"
echo " assets create 'assets/' with files to add to a GitHub release"
echo " installers create the drag'n'drop installer lua scripts"
echo " docs create all the input needed for mkdocs"
echo " clean delete any of the autogenerated / temporary content"
echo ""
;;
*)
echo "unknown command '$COMMAND'" >&2
echo "try '$SCRIPTNAME help' for usage" >&2
exit 10
;;
esac
}
main "$@"