#!/bin/bash

set -e
sudo apt-get install build-essential libpcre3 libpcre3-dev libssl-dev zlib1g-dev nginx-full

tmpdir=$(dirname $0)/../package-update.tmp

rm -rf $tmpdir
mkdir -p $tmpdir
cd $tmpdir
base=$(dirname $(pwd))

git clone https://github.com/openresty/luajit2

cd luajit2
sed -i 's!^ *export PREFIX=.*$!export PREFIX= '$base'/src/usr/local!' Makefile


make
make install

cd $base

rm -rf $tmpdir

git add src/

git commit -m 'Neues lua modul kompiliert'

git push
