pmmp / PHP-Binaries

Compile scripts used to build PHP for PocketMine-MP on multiple platforms
116 stars 163 forks source link

Custom PHP build scripts for PocketMine-MP

Build status

Looking for prebuilt binaries? Head over to releases

compile.sh

Bash script used to compile PHP on MacOS and Linux platforms. Make sure you have make autoconf automake libtool m4 wget getconf gzip bzip2 bison g++ git cmake pkg-config re2c ca-certificates.

Recommendations

Common pitfalls

Additional notes

Mac OSX (native compile)

Android 64-bit (cross-compile)

Script flags Description
-c Uses the folder specified for caching downloaded tarballs, zipballs etc.
-d Compiles with debugging symbols and disables optimizations (slow, but useful for debugging segfaults)
-D Compiles with separated debugging symbols, but leaves optimizations enabled (used for distributed binaries)
-g Will compile GD2
-j Set make threads to #
-l Uses the folder specified for caching compilation artifacts (useful for rapid rebuild and testing)
-n Don't remove sources after completing compilation
-s Will compile everything statically
-t Set target
-v Enable Valgrind support in PHP
-x Specifies we are doing cross-compile
-P Compiles extensions for the major PocketMine-MP version specified (can be 4 or 5)

Example:

Target Arguments
linux64 -t linux64 -j4 -P5
linux64, PM4 -t linux64 -j4 -P4
mac64 -t mac-x86-64 -j4 -P5
android-aarch64 -t android-aarch64 -x -j4 -P5

windows-compile-vs.bat

Batch script utilizing Visual Studio on Windows to compile PHP binaries from sources. Ensure you have Visual Studio 2019, git, 7z and wget installed in your PATH.

This script doesn't accept parameters, but the following environment variables are influential:

Variable Description
PHP_DEBUG_BUILD Disables optimisations and builds PHP with detailed debugging information (useful for debugging segfaults)
SOURCES_PATH Where to put the downloaded sources for compilation
VS_EDITION Edition of Visual Studio installed, set to Community by default
PM_VERSION_MAJOR Major version of PocketMine-MP to build extensions for (defaults to 4, can be 4 or 5)