Skip to content

Instantly share code, notes, and snippets.

@kiyor
Created September 23, 2014 18:26
Show Gist options
  • Save kiyor/0812bcd4f1e7288fdf9e to your computer and use it in GitHub Desktop.
Save kiyor/0812bcd4f1e7288fdf9e to your computer and use it in GitHub Desktop.
#!/bin/bash
############################################
# File Name : buildluajit.sh
# Purpose :
# Creation Date : 03-14-2014
# Last Modified : Fri 14 Mar 2014 07:17:12 PM UTC
# Created By : Kiyor
############################################
if [[ -f /usr/local/rvm/bin/rvm ]]; then
if [[ -s "$HOME/.rvm/scripts/rvm" ]]; then
source "$HOME/.rvm/scripts/rvm"
elif [[ -s "/usr/local/rvm/scripts/rvm" ]]; then
source "/usr/local/rvm/scripts/rvm"
else
printf "ERROR: An RVM installation was not found.\n"
exit 1
fi
rvm use 1.8.7 2>/dev/null
fi
current_dir=`pwd`
build_dir=`mktemp -d -t build-luajit.XXXXX`
install_dir=${build_dir}/PKG
mkdir -p $install_dir
cd ${build_dir} || exit 2
git clone http://luajit.org/git/luajit-2.0.git
cd luajit-2.0
make && DESTDIR=${install_dir} make install
mkdir -p ${install_dir}/usr/lib64/
cd ${install_dir}/usr/lib64
ln -s ../local/lib/libluajit-5.1.so.2 libluajit-5.1.so.2
ln -s liblua-5.1.so liblua.so
cd ${build_dir} || exit 2
git clone https://github.com/mpx/lua-cjson.git
cd lua-cjson
make && DESTDIR=${install_dir} make install
cd $pwd
fpm -C ${install_dir} -s dir -t rpm -n my-luajit-cjson -v 2.0.3 --iteration 1 .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment