-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_all.sh
executable file
·153 lines (134 loc) · 2.98 KB
/
build_all.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
#!/bin/sh
#QUICK FIX : don't build wrench code
ROAM_WRENCH=0
WEB_CC=0
BUILD_WEB_MODE=""
DUMMYGL_MODE=0
CMN_OPTS=${CMN_OPTS-""}
if [ "$#" -gt 0 ]; then
case $1 in
clean)
./build.sh clean
exit 0
;;
web)
WEB_CC=1
BUILD_WEB_MODE="web"
shift
if [ "$1" = "wasm" ]; then
BUILD_WEB_MODE="web wasm"
shift
fi
;;
dummygl)
DUMMYGL_MODE=1
shift
;;
esac
fi
DL_CMD=""
if [ -x "`command -v curl`" ]; then
DL_MODE="CURL"
DL_CMD="curl -o"
elif [ -x "`command -v wget`" ]; then
DL_MODE="WGET"
DL_CMD="wget -O"
fi
# ---- get wrench
:'
WRENCH_DIR=wrench/src
WRENCH_SRCS="wrench.h wrench.cpp"
WRENCH_TAG=${WRENCH_TAG-"v3.0.0"}
WRENCH_SRC_URL=https://raw.githubusercontent.com/jingoro2112/wrench/$WRENCH_TAG/src
print ${WRENCH_SRC_URL}
NEED_WRENCH=0
if [ ! -d $WRENCH_DIR ]; then
mkdir -p $WRENCH_DIR
NEED_WRENCH=1
else
for src in $WRENCH_SRCS; do
if [ $NEED_WRENCH -ne 1 ]; then
if [ ! -f $WRENCH_DIR/$src ]; then
NEED_WRENCH=1
fi
fi
done
fi
if [ $NEED_WRENCH -ne 0 ]; then
printf "Downloading wrench sources...\n"
for src in $WRENCH_SRCS; do
if [ ! -f $WRENCH_DIR/$src ]; then
printf " $src\n"
$DL_CMD $WRENCH_DIR/$src $WRENCH_SRC_URL/$src
fi
done
fi
'
# ---- get minion
MINION_DIR=minion
MINION_SRC_URL=https://raw.githubusercontent.com/schaban/rv_minion/main
MINION_SRCS="minion.c minion.h minion_instrs.c minion_regs.c"
NEED_MINION=0
if [ ! -d $MINION_DIR ]; then
mkdir -p $MINION_DIR
NEED_MINION=1
else
for src in $MINION_SRCS; do
sname=$src
if [ $sname = minion.c ]; then
sname=minion.cpp
fi
if [ $NEED_MINION -ne 1 ]; then
if [ ! -f $MINION_DIR/$sname ]; then
NEED_MINION=1
fi
fi
done
fi
if [ $NEED_MINION -ne 0 ]; then
printf "Downloading minion sources...\n"
for src in $MINION_SRCS; do
sname=$src
if [ $sname = minion.c ]; then
sname=minion.cpp
fi
if [ ! -f $MINION_DIR/$sname ]; then
printf " $src - $sname\n"
$DL_CMD $MINION_DIR/$sname $MINION_SRC_URL/$src
fi
done
fi
# ---- build lua
if [ ! -f lua/lua.a ]; then
printf "Building Lua...\n"
cd lua
if [ $WEB_CC -ne 0 ]; then
CC=emcc AR=emar ./lua_build.sh -O3 -flto $CMN_OPTS
else
./lua_build.sh -O3 -flto $CMN_OPTS
fi
cd ..
fi
# ---- build qjs
if [ ! -f qjs/quickjs.a ]; then
printf "Building QuickJS...\n"
cd qjs
if [ $WEB_CC -ne 0 ]; then
CC=emcc AR=emar ./qjs_build.sh -O3 -flto $CMN_OPTS
else
./qjs_build.sh -O3 -flto $CMN_OPTS
fi
cd ..
fi
#ROAM_FLAGS="-DROAM_WRENCH=${ROAM_WRENCH-1} -DROAM_QJS=1 -DROAM_LUA=1 -DROAM_MINION=1"
#DEP_WRENCH="-I $WRENCH_DIR $WRENCH_DIR/wrench.cpp"
ROAM_FLAGS="-DROAM_QJS=1 -DROAM_LUA=1 -DROAM_MINION=1"
DEP_WRENCH=""
DEP_MINION="-I $MINION_DIR $MINION_DIR/minion.cpp"
DEP_OPTS="$DEP_WRENCH $DEP_MINION $ROAM_FLAGS -I qjs/src qjs/quickjs.a -I lua/src lua/lua.a"
OPTI_OPTS="-O3 -flto=auto"
if [ $DUMMYGL_MODE -ne 0 ]; then
ALT_LIBS="" ALT_DEFS="-DDUMMY_GL" ./build.sh $DEP_OPTS $OPTI_OPTS $CMN_OPTS $*
else
./build.sh $BUILD_WEB_MODE $DEP_OPTS $OPTI_OPTS $CMN_OPTS $*
fi