Skip to content

Instantly share code, notes, and snippets.

@dktapps
Last active February 9, 2019 14:10
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dktapps/5be048b687f585a42885628aa1bd1de7 to your computer and use it in GitHub Desktop.
Save dktapps/5be048b687f585a42885628aa1bd1de7 to your computer and use it in GitHub Desktop.

Building PocketMine-MP from source (Linux/Mac)

Pre-requisites

  • Install git
  • Download and install PHP >= 7.2.0 ZTS with the required extensions
    • PMMP-provided binaries
    • This document will not cover the process of compiling PHP with the required extensions manually, but if you do you will need to:
      • enable CLI (--enable-cli)
      • enable ZTS (--enable-maintainer-zts)
      • include all of the extensions required in composer.json (most are standard, the rest need to be installed manually using PECL or other tools)

Note about prebuilt binaries

If you use a prebuilt binary provided by us, replace php with <path to wherever your bin folder is>/bin/php7/bin/php Example: ~/downloads/bin/php7/bin/php

Setting up environment from scratch

  1. In your CLI, run cd to move to the directory where you want to build PocketMine-MP.
  2. Clone the PocketMine-MP git repository: git clone https://github.com/pmmp/PocketMine-MP.git --recursive
  3. cd into the directory: cd PocketMine-MP
  4. If you don't already have it, download composer: curl https://getcomposer.org/installer | php

Now you're ready to build the phar file.

Building PocketMine-MP.phar

  1. Run php composer.phar install
  2. (optional) Preprocess the source code: php tests/preprocessor/PreProcessor.php --path src
  3. Run php tests/plugins/PocketMine-DevTools/src/DevTools/ConsoleScript.php --make src,vendor,resources --relative ./ --entry src/pocketmine/PocketMine.php --out PocketMine-MP.phar
  4. Run the server to check it works: php PocketMine-MP.phar

Building an update

  • In your CLI, cd into the git repository your previously cloned.
  • Run git pull
  • Run git submodule update --init --recursive
  • Run php composer.phar install (this is necessary to update dependencies)

Now rebuild the phar file.

Building other branches

If you want to build a different branch (other than master):

  • If building from scratch: add --branch=<branch you want to clone> to the git clone command.
  • If building an update: run git checkout -f <branch you want to use> before running git pull.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment