mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-10 13:35:29 +00:00
Feature complete: 'libedit'
This commit is contained in:
commit
cca453cc06
@ -297,31 +297,44 @@ class ConsoleLoop extends Thread{
|
||||
public $stop;
|
||||
public $base;
|
||||
public $ev;
|
||||
public $fp;
|
||||
public function __construct(){
|
||||
$this->line = false;
|
||||
$this->stop = false;
|
||||
$this->start();
|
||||
}
|
||||
|
||||
|
||||
public function stop(){
|
||||
$this->stop = true;
|
||||
}
|
||||
|
||||
public function readLine($fp, $events = null){
|
||||
$line = trim(fgets($fp));
|
||||
if($line != ""){
|
||||
$this->line = $line;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private function readLine(){
|
||||
if( $this->fp ){
|
||||
$line = trim( fgets( $this->fp ) );
|
||||
} else {
|
||||
$line = trim( readline( "" ) );
|
||||
if( $line != "" ){
|
||||
readline_add_history( $line );
|
||||
}
|
||||
}
|
||||
|
||||
return $line;
|
||||
}
|
||||
|
||||
public function run(){
|
||||
$fp = fopen("php://stdin", "r");
|
||||
while($this->stop === false and ($line = fgets($fp)) !== false){
|
||||
$this->line = $line;
|
||||
$this->wait();
|
||||
$this->line = false;
|
||||
if( ! extension_loaded( 'readline' ) ){
|
||||
$this->fp = fopen( "php://stdin", "r" );
|
||||
}
|
||||
|
||||
while( $this->stop === false ) {
|
||||
$this->line = $this->readLine();
|
||||
$this->wait();
|
||||
$this->line = false;
|
||||
}
|
||||
@fclose($fp);
|
||||
|
||||
if( ! $this->haveReadline ) {
|
||||
@fclose($fp);
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ COMPILER_VERSION="0.12"
|
||||
PHP_VERSION="5.4.15"
|
||||
ZEND_VM="GOTO"
|
||||
|
||||
LIBEDIT_VERSION="0.3"
|
||||
ZLIB_VERSION="1.2.8"
|
||||
PTHREADS_VERSION="e5d95dfb847c8963c100bd4fb601dde41e0b75d1"
|
||||
CURL_VERSION="curl-7_30_0"
|
||||
@ -36,6 +37,26 @@ wget http://php.net/get/php-$PHP_VERSION.tar.gz/from/this/mirror -q -O - | tar -
|
||||
mv php-$PHP_VERSION php
|
||||
echo " done!"
|
||||
|
||||
#libedit
|
||||
echo -n "[libedit] downloading $LIBEDIT_VERSION..."
|
||||
wget http://download.sourceforge.net/project/libedit/libedit/libedit-$LIBEDIT_VERSION/libedit-$LIBEDIT_VERSION.tar.gz -q -O - | tar -zx >> "$DIR/install.log" 2>&1
|
||||
echo -n " checking..."
|
||||
cd libedit
|
||||
CFLAGS=-fPIC ./configure --prefix="$DIR/install_data/php/ext/libedit" --enable-static >> "$DIR/install.log" 2>&1
|
||||
echo -n " compiling..."
|
||||
if make >> "$DIR/install.log" 2>&1; then
|
||||
echo -n " installing..."
|
||||
make install >> "$DIR/install.log" 2>&1
|
||||
HAVE_LIBEDIT="--with-libedit=$DIR/install_data/php/ext/libedit"
|
||||
else
|
||||
echo -n " disabling..."
|
||||
HAVE_LIBEDIT="--without-libedit"
|
||||
fi
|
||||
echo -n " cleaning..."
|
||||
cd ..
|
||||
rm -r -f ./libedit
|
||||
echo " done!"
|
||||
|
||||
#zlib
|
||||
echo -n "[zlib] downloading $ZLIB_VERSION..."
|
||||
wget http://zlib.net/zlib-$ZLIB_VERSION.tar.gz -q -O - | tar -zx >> "$DIR/install.log" 2>&1
|
||||
@ -103,6 +124,7 @@ rm -f ./configure >> "$DIR/install.log" 2>&1
|
||||
--exec-prefix="$DIR/php5" \
|
||||
--with-curl="$DIR/install_data/php/ext/curl" \
|
||||
--with-zlib="$DIR/install_data/php/ext/zlib" \
|
||||
"$HAVE_LIBEDIT" \
|
||||
--disable-libxml \
|
||||
--disable-xml \
|
||||
--disable-dom \
|
||||
|
Loading…
x
Reference in New Issue
Block a user