diff --git a/travis/build-lua.sh b/travis/build-lua.sh index 77d6e528b..18fd6a740 100644 --- a/travis/build-lua.sh +++ b/travis/build-lua.sh @@ -2,9 +2,10 @@ set -e +LUA_ROOT="$HOME/lua53" LUA_URL="http://www.lua.org/ftp/lua-5.3.3.tar.gz" LUA_TAR=$(basename "$LUA_URL") -LUA_DIR="${LUA_TAR%.tar.*}" +LUA_DIR="$LUA_ROOT/${LUA_TAR%.tar.*}" LUA_SHA1="a0341bc3d1415b814cc738b2ec01ae56045d64ef" echo $LUA_TAR @@ -16,8 +17,8 @@ sha1() { download() { echo "Downloading $LUA_URL" - wget -O "$LUA_TAR" "$LUA_URL" - tar xvf "$LUA_TAR" + wget -O "$LUA_ROOT/$LUA_TAR" "$LUA_URL" + tar xvf "$LUA_ROOT/$LUA_TAR" } build() { @@ -26,25 +27,27 @@ build() { } main() { - mkdir -p "$HOME/lua53" - cd "$HOME/lua53" + mkdir -p "$LUA_ROOT" + cd "$LUA_ROOT" mkdir -p bin - if [ "$(sha1 "$LUA_TAR" 2>/dev/null)" != "$LUA_SHA1" ]; then + if [ "$(sha1 "$LUA_ROOT/$LUA_TAR" 2>/dev/null)" != "$LUA_SHA1" ]; then download build else echo "Already downloaded" - fi - if [ -x "$LUA_DIR/src/luac" ]; then - echo "Already built" - else - build + if [ -x "$LUA_DIR/src/luac" ]; then + echo "Already built" + else + build + fi fi - ln -sf "$(pwd)/$LUA_DIR/src/lua" bin/lua5.3 - ln -sf "$(pwd)/$LUA_DIR/src/luac" bin/luac5.3 + echo "Linking" + ln -sf "$LUA_DIR/src/lua" "$LUA_ROOT/bin/lua5.3" + ln -sf "$LUA_DIR/src/luac" "$LUA_ROOT/bin/luac5.3" + echo "Done" } main