setup_lua.sh 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #! /bin/bash
  2. # A script for setting up environment for travis-ci testing.
  3. # Sets up Lua and Luarocks.
  4. # LUA must be "lua5.1", "lua5.2" or "luajit".
  5. # PLATFORM must be "linux" or "macosx".
  6. # Original written by Alexey Melnichuk <https://github.com/moteus>
  7. if [ "$LUA" == "luajit" ]; then
  8. curl http://luajit.org/download/LuaJIT-2.0.2.tar.gz | tar xz
  9. cd LuaJIT-2.0.2
  10. make && sudo make install
  11. sudo ln -s /usr/local/bin/luajit /usr/local/bin/lua
  12. cd $TRAVIS_BUILD_DIR;
  13. else
  14. if [ "$LUA" == "lua5.1" ]; then
  15. curl http://www.lua.org/ftp/lua-5.1.5.tar.gz | tar xz
  16. cd lua-5.1.5;
  17. elif [ "$LUA" == "lua5.2" ]; then
  18. curl http://www.lua.org/ftp/lua-5.2.3.tar.gz | tar xz
  19. cd lua-5.2.3;
  20. fi
  21. sudo make $PLATFORM install
  22. cd $TRAVIS_BUILD_DIR;
  23. fi
  24. LUAROCKS_BASE=luarocks-$LUAROCKS_VER
  25. curl http://luarocks.org/releases/$LUAROCKS_BASE.tar.gz | tar xz
  26. cd $LUAROCKS_BASE;
  27. if [ "$LUA" == "luajit" ]; then
  28. ./configure --lua-suffix=jit --with-lua-include=/usr/local/include/luajit-2.0;
  29. else
  30. ./configure;
  31. fi
  32. make build && sudo make install
  33. cd $TRAVIS_BUILD_DIR
  34. rm -rf $LUAROCKS_BASE
  35. if [ "$LUA" == "luajit" ]; then
  36. rm -rf LuaJIT-2.0.2;
  37. elif [ "$LUA" == "lua5.1" ]; then
  38. rm -rf lua-5.1.5;
  39. elif [ "$LUA" == "lua5.2" ]; then
  40. rm -rf lua-5.2.3;
  41. fi