forked from stevedonovan/luabuild
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build
executable file
·69 lines (60 loc) · 1.1 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
#!/bin/bash
LUA="lua"
CC="gcc"
while [ $# -gt 0 ]
do
case "$1" in
(*=*) eval $1;;
-h|--help) echo "optionally LUA=lua, PLAT=plat, CC=cc"; exit;;
esac
shift
done
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
pushd lua-5.2.1
if ! make $PLAT
then
echo "bootstrap build borked"
exit
fi
rm lua.o loadlib.o
popd
. setpath
fi
fi
# now let Lake do the hard part ...
if env $LUA lake $CC
then
env $LUA lake install.lua
fi