#!/bin/sh
# @function install Lua
function InstallLua()
{
    ShowResult "[green]正在安装Lua... [/green]" 1
    
    # install lua
    eval cd ${_PATH_COMPILATION_} ${_SYS_SHOW_INSTALL_DETAILS_}
    eval rm -rf ./lua-5.* ${_SYS_SHOW_INSTALL_DETAILS_}
    eval tar zxvf ${_PATH_SOFTWARE_}/lua-5.* ${_SYS_SHOW_INSTALL_DETAILS_}
    eval cd lua-5.* ${_SYS_SHOW_INSTALL_DETAILS_}
    eval make linux ${_SYS_MAKE_EXT_} ${_SYS_SHOW_INSTALL_DETAILS_}
    eval make install ${_SYS_SHOW_INSTALL_DETAILS_}
    eval \cp -f etc/lua.pc /usr/lib/pkgconfig ${_SYS_SHOW_INSTALL_DETAILS_}
    ldconfig
    
    ShowStatus $?
}

# @function install toLua++
function InstallToLuaXX()
{
    ShowResult "[green]正在安装tolua++... [/green]" 1
    
    # install tolua++
    eval cd ${_PATH_COMPILATION_} ${_SYS_SHOW_INSTALL_DETAILS_}
    eval rm -rf ./tolua* ${_SYS_SHOW_INSTALL_DETAILS_}
    eval tar zxvf ${_PATH_SOFTWARE_}/tolua* ${_SYS_SHOW_INSTALL_DETAILS_}
    eval cd tolua* ${_SYS_SHOW_INSTALL_DETAILS_}
    eval scons install ${_SYS_SHOW_INSTALL_DETAILS_}
    
    ShowStatus $?
}

# @function install lib-luabind
function InstallLibLuabind()
{
    ShowResult "[green]正在解压Luabind库... [/green]" 1
    
    cd /usr/local/lib/
    eval tar zxvf ${_PATH_SOFTWARE_}/libluabind-*.tar.gz ${_SYS_SHOW_INSTALL_DETAILS_}
    
    ShowStatus $?
}

# @function install lua sql
function InstallLuaSQL()
{
    ShowResult "[green]正在安装LuaSQL... [/green]" 1
    
    # install
    eval cd ${_PATH_COMPILATION_} ${_SYS_SHOW_INSTALL_DETAILS_}
    eval rm -rf ./luasql-* ${_SYS_SHOW_INSTALL_DETAILS_}
    eval unzip ${_PATH_SOFTWARE_}/luasql-* ${_SYS_SHOW_INSTALL_DETAILS_}
    eval cd luasql-* ${_SYS_SHOW_INSTALL_DETAILS_}
    eval export C_INCLUDE_PATH=$C_INCLUDE_PATH:/usr/local/include:/usr/local/mysql/include
    eval make ${_SYS_MAKE_EXT_} ${_SYS_SHOW_INSTALL_DETAILS_}
    eval make install ${_SYS_SHOW_INSTALL_DETAILS_}
    eval \cp -f src/mysql.so /usr/local/lib ${_SYS_SHOW_INSTALL_DETAILS_}
    ldconfig
    
    ShowStatus $?
}