Skip to content

Instantly share code, notes, and snippets.

@MCPE-PC
Created September 28, 2019 13:40
Show Gist options
  • Save MCPE-PC/d17232951c9c8a5aec4ab538c4fb14a6 to your computer and use it in GitHub Desktop.
Save MCPE-PC/d17232951c9c8a5aec4ab538c4fb14a6 to your computer and use it in GitHub Desktop.
PocketMine-MP master branch compile script
#!/bin/bash
cd -P $(dirname "${BASH_SOURCE[0]}")
WORKING_DIR=$(pwd)
PMMP_BRANCH='master'
PHP_DIR="$WORKING_DIR/bin/php7/bin"
INSTALLED_PHP=false
if [[ -f PocketMine-MP.phar ]]; then
rm PocketMine-MP.phar
echo 'Removed old PocketMine-MP.phar'
fi
if [[ -f "$PHP_DIR/php" ]]; then
echo 'PHP binary already exists, skips installation'
else
INSTALLED_PHP=true
(curl -sL https://raw.githubusercontent.com/pmmp/php-build-scripts/master/compile.sh | bash -s - -g -l -n -f) || exit 1
git clone --depth=50 https://github.com/pmmp/ext-chunkutils2.git
cd ext-chunkutils2
"$PHP_DIR/phpize"
./configure --with-php-config="$PHP_DIR/php-config" > /dev/null
make > /dev/null
cp modules/chunkutils2.so "$WORKING_DIR/bin/php7/lib"
echo "extension=$WORKING_DIR/bin/php7/lib/chunkutils2.so" >> "$PHP_DIR/php.ini"
cd $WORKING_DIR
fi
wget https://getcomposer.org/composer.phar -q
git clone --branch="$PMMP_BRANCH" --recursive https://github.com/pmmp/PocketMine-MP.git
cd PocketMine-MP
"$PHP_DIR/php" "$WORKING_DIR/composer.phar" install || exit 1
"$PHP_DIR/php" -dphar.readonly=0 tests/plugins/PocketMine-DevTools/src/DevTools/ConsoleScript.php --make resources,src,vendor --relative ./ --entry src/PocketMine.php --out "$WORKING_DIR/PocketMine-MP.phar"
if [[ ! -f "$WORKING_DIR/start.sh" ]]; then
mv start.sh $WORKING_DIR
fi
cd $WORKING_DIR
if $INSTALLED_PHP; then
rm -rf ext-chunkutils2 install_data
rm install.log
fi
rm -rf PocketMine-DevTools PocketMine-MP
rm composer.phar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment