From 9624b9c35e6134742a51dc9dd9b869752e4375dd Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Pueyo Date: Wed, 24 Apr 2013 00:41:37 +0200 Subject: [PATCH] Added libevent dependency --- README.md | 2 ++ compile_php.sh | 33 +++++++++++++++++++++++++++++++-- src/config.php | 2 +- src/dependencies.php | 5 +++++ 4 files changed, 39 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 2333302c3..24c80549b 100644 --- a/README.md +++ b/README.md @@ -39,10 +39,12 @@ The entire server is done in PHP, and has been tested, profiled and optimized to * __[PHP Sockets](http://php.net/manual/en/book.sockets.php)__ * __[PHP SQLite3](http://php.net/manual/en/book.sqlite3.php)__ * __[PHP BCMath](http://php.net/manual/en/book.bc.php)__ +* __[PHP libevent](http://pecl.php.net/package/libevent)__ by _[Antony Dovgal](http://pecl.php.net/user/tony2001)_ * __[PHP pthreads](https://github.com/krakjoe/pthreads)__ by _[krakjoe](https://github.com/krakjoe)_: Threading for PHP - Share Nothing, Do Everything. * __[PHP NBT](https://github.com/TheFrozenFire/PHP-NBT-Decoder-Encoder/blob/master/nbt.class.php)__ by _[TheFrozenFire](https://github.com/TheFrozenFire)_: Class for reading in NBT-format files (modified to handle Little-Endian files). * __[Spyc](https://github.com/mustangostang/spyc/blob/master/Spyc.php)__ by _[Vlad Andersen](https://github.com/mustangostang)_: A simple YAML loader/dumper class for PHP. * __[ANSICON](https://github.com/adoxa/ansicon)__ by _[Jason Hood](https://github.com/adoxa)_: Process ANSI escape sequences for Windows console programs. +* __[libevent](http://libevent.org/)__: An event notification library * __[cURL](http://curl.haxx.se/)__: cURL is a command line tool for transferring data with URL syntax * __[Zlib](http://www.zlib.net/)__: A Massively Spiffy Yet Delicately Unobtrusive Compression Library * __[Source RCON Protocol](https://developer.valvesoftware.com/wiki/Source_RCON_Protocol)__ diff --git a/compile_php.sh b/compile_php.sh index c5f585e18..ea91c43e8 100644 --- a/compile_php.sh +++ b/compile_php.sh @@ -1,5 +1,5 @@ #!/bin/bash -COMPILER_VERSION="0.11" +COMPILER_VERSION="0.12" PHP_VERSION="5.4.14" ZEND_VM="GOTO" @@ -7,8 +7,10 @@ ZEND_VM="GOTO" ZLIB_VERSION="1.2.7" PTHREADS_VERSION="53eb5d9ee6ec9c00ffa698681ecd132edeb5b8b2" CURL_VERSION="curl-7_30_0" +LIBEVENT_VERSION="release-1.4.14b-stable" +PHP_LIBEVENT_VERSION="0.0.5" -echo "[PocketMine] PHP installer and compiler for Linux & Mac - by @shoghicp v$COMPILER_VERSION" +echo "[PocketMine] PHP installer and compiler for Linux & Mac - v$COMPILER_VERSION" DIR="$(pwd)" date > "$DIR/install.log" 2>&1 uname -a >> "$DIR/install.log" 2>&1 @@ -53,6 +55,25 @@ cd .. rm -r -f ./zlib echo " done!" +#libevent +echo -n "[libevent] downloading $LIBEVENT_VERSION..." +wget https://github.com/libevent/libevent/archive/$LIBEVENT_VERSION.tar.gz --no-check-certificate -q -O - | tar -zx >> "$DIR/install.log" 2>&1 +mv libevent-$LIBEVENT_VERSION libevent +echo -n " checking..." +cd libevent +./autogen.sh >> "$DIR/install.log" 2>&1 +./configure --prefix="$DIR/install_data/php/ext/libevent" \ +--disable-shared >> "$DIR/install.log" 2>&1 +echo -n " compiling..." +make >> "$DIR/install.log" 2>&1 +echo -n " installing..." +make install >> "$DIR/install.log" 2>&1 +echo -n " cleaning..." +cd .. +rm -r -f ./libevent +echo " done!" + +#curl echo -n "[cURL] downloading $CURL_VERSION..." wget https://github.com/bagder/curl/archive/$CURL_VERSION.tar.gz --no-check-certificate -q -O - | tar -zx >> "$DIR/install.log" 2>&1 mv curl-$CURL_VERSION curl @@ -76,6 +97,13 @@ wget https://github.com/krakjoe/pthreads/archive/$PTHREADS_VERSION.tar.gz --no-c mv pthreads-$PTHREADS_VERSION "$DIR/install_data/php/ext/pthreads" echo " done!" +#php-libevent +echo -n "[PHP libevent] downloading $PHP_LIBEVENT_VERSION..." +wget http://pecl.php.net/get/libevent-$PHP_LIBEVENT_VERSION.tgz -q -O - | tar -zx >> "$DIR/install.log" 2>&1 +mv libevent-$PHP_LIBEVENT_VERSION "$DIR/install_data/php/ext/libevent" +echo " done!" + + echo -n "[PHP]" set +e if which free >/dev/null; then @@ -103,6 +131,7 @@ rm -f ./configure >> "$DIR/install.log" 2>&1 --enable-bcmath \ --with-curl="$DIR/install_data/php/ext/curl" \ --with-zlib="$DIR/install_data/php/ext/zlib" \ +--with-libevent-dir="$DIR/install_data/php/ext/libevent" \ --disable-libxml \ --disable-xml \ --disable-dom \ diff --git a/src/config.php b/src/config.php index cbf769de4..eaeb73d24 100644 --- a/src/config.php +++ b/src/config.php @@ -46,6 +46,6 @@ define("TEST_MD5", "1e0d28177b73dfd09f922502fe767bec"); define("MAJOR_VERSION", "Alpha_1.3dev"); define("CURRENT_STRUCTURE", 5); define("CURRENT_PROTOCOL", 9); -define("CURRENT_MINECRAFT_VERSION", "0.6.1"); +define("CURRENT_MINECRAFT_VERSION", "0.6.1 alpha"); define("CURRENT_API_VERSION", 6); define("CURRENT_PHP_VERSION", "5.5"); \ No newline at end of file diff --git a/src/dependencies.php b/src/dependencies.php index 6f6f156b7..ecd421fad 100644 --- a/src/dependencies.php +++ b/src/dependencies.php @@ -65,6 +65,11 @@ if(!extension_loaded("pthreads") and @dl((PHP_SHLIB_SUFFIX === "dll" ? "php_":"" ++$errors; } +if(!extension_loaded("libevent") and @dl((PHP_SHLIB_SUFFIX === "dll" ? "php_":"") . "libevent." . PHP_SHLIB_SUFFIX) === false){ + console("[ERROR] Unable to find the libevent extension.", true, true, 0); + ++$errors; +} + if(!extension_loaded("curl") and @dl((PHP_SHLIB_SUFFIX === "dll" ? "php_":"") . "curl." . PHP_SHLIB_SUFFIX) === false){ console("[ERROR] Unable to find the cURL extension.", true, true, 0); ++$errors;