-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathgenerate.sh
executable file
·50 lines (38 loc) · 989 Bytes
/
generate.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
#!/usr/bin/env bash
# Test the generating capabilities of the current state of
# XHB. Creates something like haskell modules from
# the proto XML files. Will download the XML files with
# curl if they can't be found.
#
# Thanks for testing out XHB!
#
# -Antoine
OUT_DIR=generated
TEST_PROG=xcb-build-generate
. shared.sh
# apply hacks to generated code
[ -f patch ] && {
[ -d patched ] && rm -rf patched
cp -r ${OUT_DIR} patched
cd patched
patch -u -p 1 < ../patch || {
cd ..
echo "failed to patch properly"
exit ${GENERAL_ERROR}
}
cd ..
}
# rebuild SmokeTest.hs
[ -d patched ] && {
[ -f SmokeTest.hs ] && rm -f SmokeTest.hs
[ -f SmokeTest.hs ] || {
echo "module SmokeTest where" > SmokeTest.hs
cd patched
find . | grep \.hs$ | sed -e "s|^\./||" -e "s|\(.*\)\.hs|import \1|" -e "s|/|.|g" >> ../SmokeTest.hs
cd ..
echo "main = putStrLn \"Hello!\"" >> SmokeTest.hs
}
}
echo "success!"
exit