diff --git a/BUILDING.md b/BUILDING.md new file mode 100644 index 000000000..910f876d4 --- /dev/null +++ b/BUILDING.md @@ -0,0 +1,38 @@ +# Building +## Pre-requisites +- A bash shell (git bash is sufficient for Windows) +- [`git`](https://git-scm.com) available in your shell +- PHP 7.2 or newer available in your shell +- [`composer`](https://getcomposer.org) available in your shell + +## Custom PHP binaries +Because PocketMine-MP requires several non-standard PHP extensions and configuration, PMMP provides scripts to build custom binaries for running PocketMine-MP, as well as prebuilt binaries. + +- [Prebuilt binaries](https://jenkins.pmmp.io/job/PHP-7.3-Aggregate) +- [Compile scripts](https://github.com/pmmp/php-build-scripts) are provided as a submodule in the path `build/php` + +If you use a custom binary, you'll need to replace `composer` usages in this guide with `path/to/your/php path/to/your/composer.phar`. + +## Setting up environment +1. `git clone --recursive https://github.com/pmmp/PocketMine-MP.git` +2. `composer install` + +## Checking out a different branch to build +1. `git checkout ` +2. `git submodule update --init` +3. Re-run `composer install` to synchronize dependencies. + +## Optimizing for release builds +1. Add the flags `--no-dev --classmap-authoritative` to your `composer install` command. This will reduce build size and improve autoloading speed. +2. Preprocess the source code by running `build/preprocessor/PreProcessor.php`. Usage instructions are provided in `build/php/README.md`. + +### Note +Preprocessor requires that the `cpp` (c preprocessor) is available in your PATH. + +## Building `PocketMine-MP.phar` +Run `build/server.phar` using your preferred PHP binary. It'll drop a `PocketMine-MP.phar` into the current working directory. + +You can also use the `--out` option to change the output filename. + +## Running PocketMine-MP from source code +Run `src/pocketmine/PocketMine.php` using your preferred PHP binary. \ No newline at end of file diff --git a/README.md b/README.md index ec613ee56..f3b2776c1 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ - [StackOverflow](https://stackoverflow.com/tags/pocketmine) ## For developers + * [Building and running from source](BUILDING.md) * [Latest API documentation](https://jenkins.pmmp.io/job/PocketMine-MP-doc/doxygen/) - Doxygen documentation generated from development * [DevTools](https://github.com/pmmp/PocketMine-DevTools/) - Development tools plugin for creating plugins * [ExamplePlugin](https://github.com/pmmp/ExamplePlugin/) - Example plugin demonstrating some basic API features