Created
April 5, 2015 18:41
-
-
Save yagop/6a0e06d98d682ca32667 to your computer and use it in GitHub Desktop.
Luarocks as self-contained
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# This script installs luarocks as self-contained inside .luarocks of current dir | |
THIS_DIR=$(cd $(dirname $0); pwd) | |
git clone https://github.com/keplerproject/luarocks.git | |
cd luarocks | |
git checkout tags/v2.2.1 # Current stable | |
PREFIX="$THIS_DIR/.luarocks" | |
./configure --prefix=$PREFIX --sysconfdir=$PREFIX/luarocks --force-config | |
RET=$?; if [ $RET -ne 0 ]; then echo "Error. Exiting."; exit $RET; fi | |
make build && make install | |
RET=$?; if [ $RET -ne 0 ]; then echo "Error. Exiting."; exit $RET; fi | |
cd .. | |
rm -rf luarocks | |
# IMPORTANT! | |
export LUA_CPATH=";;${PREFIX}/lib/lua/5.2/?.so" | |
export LUA_PATH=";;${PREFIX}/share/lua/5.2/?.lua;${PREFIX}/share/lua/5.2/?/init.lua" | |
# Maybe you want: | |
# echo "export LUA_CPATH=\"$LUA_CPATH\"" >> ~/.bashrc | |
# echo "export LUA_PATH=\"$LUA_PATH\"" >> ~/.bashrc | |
# echo "export PATH=$PREFIX/bin:${PATH}" >> ~/.bashrc | |
# Now you can ./.luarocks/bin/luarocks whatever | |
# Or luarocks whatever |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment