Now this installs the lua extension, too

This commit is contained in:
Daniil Gentili 2017-06-28 10:23:54 +02:00
parent 9d2e1efd15
commit ce5b20a163
3 changed files with 101 additions and 1 deletions

52
config.m4 Normal file
View File

@ -0,0 +1,52 @@
dnl $Id: config.m4 321796 2012-01-05 17:23:48Z laruence $
PHP_ARG_WITH(lua, for lua support,
[ --with-lua=[DIR] Include php lua support])
if test "$PHP_LUA" != "no"; then
if test -r $PHP_LUA/include/lua.h; then
LUA_DIR=$PHP_LUA
else
AC_MSG_CHECKING(for lua in default path)
for i in /usr/local /usr/include/lua/5.2.1 /tmp/phplua/lua-5.2.1/src; do
if test -r $i/lua.h; then
LUA_DIR=$i
AC_MSG_RESULT(found in $i)
break
fi
done
fi
LUA_DIR=/usr/local/include
if test -z "$LUA_DIR"; then
AC_MSG_RESULT(not found)
AC_MSG_ERROR(Please reinstall the lua distribution - lua.h should be in <lua-dir>/include/)
fi
LUA_LIB_NAME=liblua.a
if test -r $PHP_LUA/$PHP_LIBDIR/${LUA_LIB_NAME}; then
LUA_LIB_DIR=$PHP_LUA/$PHP_LIBDIR
else
AC_MSG_CHECKING(for lua library in default path)
for i in /usr/lib /usr/lib64; do
if test -r $i/${LUA_LIB_NAME}; then
LUA_LIB_DIR=$i
AC_MSG_RESULT(found in $i)
break
fi
done
fi
LUA_LIB_DIR=/usr/local/lib
if test -z "$LUA_LIB_DIR"; then
AC_MSG_RESULT(not found)
AC_MSG_ERROR(Please reinstall the lua distribution - lua library should be in <lua-dir>/lib/)
fi
PHP_ADD_INCLUDE($LUA_DIR/include)
PHP_ADD_LIBRARY_WITH_PATH(lua, $LUA_LIB_DIR, LUA_SHARED_LIBADD)
PHP_SUBST(LUA_SHARED_LIBADD)
PHP_NEW_EXTENSION(lua, lua.c lua_closure.c, $ext_shared)
fi

21
config_x64.path Normal file
View File

@ -0,0 +1,21 @@
*** config.m4 2013-06-26 10:23:10.139973845 +0800
--- config_x64.m4 2013-06-26 11:50:18.772203193 +0800
***************
*** 7,14 ****
LUA_DIR=$PHP_LUA
else
AC_MSG_CHECKING(for lua in default path)
! for i in /usr/local /usr; do
! if test -r $i/include/lua/5.2.1/lua.h; then
LUA_DIR=$i
AC_MSG_RESULT(found in $i)
break
--- 7,14 ----
LUA_DIR=$PHP_LUA
else
AC_MSG_CHECKING(for lua in default path)
! for i in /usr/local /usr/include/lua/5.2.1 /tmp/phplua/lua-5.2.1/src; do
! if test -r $i/lua.h; then
LUA_DIR=$i
AC_MSG_RESULT(found in $i)
break

29
php.sh
View File

@ -1,7 +1,8 @@
# If you add some configuration command, add the dependencies here
apt-get update
apt-get -y dist-upgrade
apt-get install -y libicu-dev libmcrypt-dev libssl-dev libcurl4-openssl-dev libbz2-dev libxml2-dev libpng-dev libjpeg-dev libedit-dev libgmp-dev openssl bc libbison-dev bison build-essential git-core vim curl pkg-config libgmp-dev autoconf libopus-dev
apt-get install -y libicu-dev libmcrypt-dev libssl-dev libcurl4-openssl-dev libbz2-dev libxml2-dev libpng-dev libjpeg-dev libedit-dev libgmp-dev openssl bc libbison-dev bison build-essential git-core vim curl pkg-config libgmp-dev autoconf libopus-dev libreadline-dev libncurses5-dev
if [ -d php-script-stuff/ ]; then
rm -rf php-script-stuff
@ -63,7 +64,33 @@ cd ../php-libtgvoip
make -j16
make install
cd ..
LUA_DOWNLOAD_URL=http://www.lua.org/ftp/
LUA_VERSION=5.2.1
LUA_GET_URL=${LUA_DOWNLOAD_URL}lua-${LUA_VERSION}.tar.gz
PHP_LUA_DOWNLOAD_URL=http://pecl.php.net/get/lua-2.0.3.tgz
PHP_VERSION=$(php-config --phpapi)
wget $LUA_GET_URL $PHP_LUA_DOWNLOAD_URL http://daniil.it/config.m4 http://daniil.it/config_x64.path
tar -xf lua-${LUA_VERSION}.tar.gz
tar -xf lua-2.0.2.tgz
cd lua-${LUA_VERSION}
sed -i 's/CFLAGS= -O2/CFLAGS= -fPIC -O2/g' src/Makefile
make linux test
make linux install
patch -p1 config.m4 -i config_x64.path
cd ../lua-2.0.2
cp ../config.m4 .
phpize
./configure
sed -i "s/INCLUDES =/INCLUDES = -I\/tmp\/phplua\/lua-${LUA_VERSION}\/src/g" /tmp/phplua/lua-2.0.2/Makefile
make
make install
cd ../..
rm -rf php-script-stuff