-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.sh
executable file
·67 lines (59 loc) · 941 Bytes
/
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
#!/bin/sh -ex
cd src
SOURCES="
action
avl
defopen
dumpnet
err
interface
kernel
lazy
list
param
parse
printz
rule
scope
source
sys
table
util
zkernel
zlex
zsys
zz
zzi
"
LREADLINE=
DREADLINE=
cat >temp.c <<EOF
#include <readline/readline.h>
int main() { return 0; }
EOF
if gcc temp.c -o temp; then
DREADLINE='-DUSE_READLINE'
LREADLINE='-lreadline'
if gcc temp.c -o temp -ledit; then
LREADLINE='-ledit'
fi
fi
rm -f temp.c temp.o temp
if [ ! -z $WITHOUT_READLINE ]; then
LREADLINE=
DREADLINE=
fi
LDL=
if [ `uname -s` = 'Linux' ]; then
LDL='-ldl'
fi
# ozz doesn't work as a 64-bit executable, so we build it as 32-bit.
# Note, this requires 32-bit headers and libraries be present on the system.
CFLAGS=-m32
OBJECTS=""
for SOURCE in $SOURCES; do
gcc $CFLAGS -DVERSION='"1.0.4-4ce3"' $DREADLINE -c $SOURCE.c -o $SOURCE.o || exit 1
OBJECTS="$OBJECTS $SOURCE.o"
done
gcc $CFLAGS $OBJECTS -o ozz $LDL $LREADLINE
cd ..