-
Notifications
You must be signed in to change notification settings - Fork 0
/
runbuild
executable file
·33 lines (29 loc) · 1006 Bytes
/
runbuild
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
#!/bin/sh -e
# This file is dedicated to the public domain.
good() {
export LD_LIBRARY_PATH="$full_build_dir/out/lib:$LD_LIBRARY_PATH"
export PATH="$full_build_dir/out/bin:$PATH"
export LUA_CPATH="$full_build_dir/out/lib/lua/5.4/?.so"
exec build "$@"
}
bad() {
echo "build hasn't been built, try ./strap" >&2
echo "(or, if you used a non-default compiler, set CC for this script too)" >&2
exit 1
}
dir="`dirname "$0"`"
if [ -f "$dir/build/.runbuild-cache" ]; then
full_build_dir="$dir/`cat "$dir/build/.runbuild-cache"`"
good "$@"
fi
if ! [ -d "$dir/build" ]; then bad; fi
. "$dir/scripts/lib.sh"
if [ "$CC" != "" ]; then cc="$CC"; else . "$dir/scripts/cc-pick.sh"; fi
. "$dir/scripts/cc-target.sh"
. "$dir/scripts/cc-info.sh"
full_build_dir="$dir/build/$target_os-$target_arch-$cc_type-$cc_ver"
if ! [ -x "$full_build_dir/out/bin/build" ]; then bad; fi
printf "%s" "build/$target_os-$target_arch-$cc_type-$cc_ver" > \
"$dir/build/.runbuild-cache"
good "$@"
# vi: sw=4 ts=4 noet tw=80 cc=80