| 1 | #!/bin/bashscip-shell filesystem . . `/bin/bash`. |
| 2 | |
| 3 | set -e |
| 4 | |
| 5 | if [scip-shell system . . `[`. -z "$PREFIX" ]; then |
| 6 | echoscip-shell system . . echo. "Missing PREFIX" |
| 7 | exit 1 |
| 8 | fi |
| 9 | |
| 10 | if [scip-shell system . . `[`. -z "$TMPSRC" ]; then |
| 11 | echoscip-shell system . . echo. "Missing TMPSRC" |
| 12 | exit 1 |
| 13 | fi |
| 14 | |
| 15 | export PATH="$PREFIX/bin:$PATH" |
| 16 | |
| 17 | mkdirscip-shell system . . mkdir. -p "$PREFIX" |
| 18 | mkdirscip-shell system . . mkdir. -p "$TMPSRC" |
| 19 | |
| 20 | if [scip-shell system . . `[`. "$LUA_VERSION" == "LUA51" ]; then |
| 21 | URL="http://www.lua.org/ftp/lua-5.1.5.tar.gz" |
| 22 | elif [scip-shell system . . `[`. "$LUA_VERSION" == "LUA52" ]; then |
| 23 | URL="http://www.lua.org/ftp/lua-5.2.4.tar.gz" |
| 24 | elif [scip-shell system . . `[`. "$LUA_VERSION" == "LUA53" ]; then |
| 25 | URL="http://www.lua.org/ftp/lua-5.3.1.tar.gz" |
| 26 | else |
| 27 | echoscip-shell system . . echo. "Invalid Lua version: LUA_VERSION=$LUA_VERSION" |
| 28 | exit 1 |
| 29 | fi |
| 30 | |
| 31 | # Install lua to $PREFIX |
| 32 | mkdirscip-shell system . . mkdir. -p "$TMPSRC/lua-src" && pushd "$TMPSRC/lua-src" |
| 33 | curlscip-shell system . . curl. "$URL" | tarscip-shell system . . tar. xz --strip-components 1 |
| 34 | sedscip-shell system . . sed. -i -e 's~#define LUA_ROOT.*$~#define LUA_ROOT "'"$PREFIX/"'"~g' src/luaconf.h |
| 35 | makescip-shell system . . make. PLAT=$PLAT |
| 36 | makescip-shell system . . make. PLAT=$PLAT INSTALL_TOP="$PREFIX" install |
| 37 | popd |
| 38 | |
| 39 | lua -v |
| 40 | |
| 41 | # Install luarocks to $PREFIX |
| 42 | mkdirscip-shell system . . mkdir. -p "$TMPSRC/luarocks-src" && pushd "$TMPSRC/luarocks-src" |
| 43 | curlscip-shell system . . curl. --location "http://luarocks.org/releases/luarocks-2.2.2.tar.gz" | tarscip-shell system . . tar. xz --strip-components 1 |
| 44 | ./configure --prefix="$PREFIX" |
| 45 | makescip-shell system . . make. install |
| 46 | popd |
| 47 | |
| 48 | luarocks --version |
| 49 |