-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathbuild
executable file
·82 lines (72 loc) · 1.28 KB
/
build
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
#!/bin/sh
LUA="lua"
CC="gcc"
while test $# -gt 0
do
case "$1" in
(*=*) eval $1;;
-h|--help) echo "optionally LUA=lua, PLAT=plat, CC=cc, LUA53=1"; exit;;
esac
shift
done
if test -z $LUA53
then
SOURCE='lua-5.2.2'
LUAVS=''
else
SOURCE='lua-5.3.0/src'
LUAVS='LUA53=1'
fi
quiet () {
cmd=$1
shift
env $cmd $* 2>&1 > /dev/null
}
if ! quiet which $CC
then
echo "compiler $CC cannot be found"
exit
else
if [ "$CC" != "gcc" ]
then
CC="CC=$CC"
else
CC=''
fi
fi
if quiet which $LUA
then
if ! quiet $LUA -llfs -e "print(1)"
then
echo "Please install LuaFileSystem"
exit
fi
else # have to bootstrap!
echo "$LUA not found, bootstrapping"
if [ -z "$PLAT" ]
then
case "$(uname)" in
"Linux" ) PLAT=linux;;
"Darwin" ) PLAT=macosx;;
* ) PLAT=posix;;
esac
HERE=$PWD
cd $SOURCE
if ! make $PLAT
then
echo "bootstrap build borked"
exit
fi
rm lua.o loadlib.o
cd $HERE
sh setpath
LUA=luaboot
fi
fi
# now let Lake do the hard part ...
CMD="env $LUA lake $CC $LUAVS"
echo $CMD
if $CMD
then
env $LUA lake install.lua $LUA53
fi