diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 531f3590..44a41ee7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -40,7 +40,7 @@ jobs: # Used "set -ex" instead of hashbang since script isn't executed with hashbang set -ex trap "exit 1" ERR - ./compile.sh -t linux64 -j 4 -f -g -P ${{ matrix.pm-version-major }} -c ./download_cache + ./compile.sh -t linux64 -j 4 -g -P ${{ matrix.pm-version-major }} -c ./download_cache - name: Create tarball run: tar -czf ./PHP-Linux-x86_64-PM${{ matrix.pm-version-major }}.tar.gz bin @@ -95,7 +95,7 @@ jobs: export PATH="/usr/local/opt/bison/bin:$PATH" set -ex trap "exit 1" ERR - ./compile.sh -t mac-x86-64 -j4 -f -g -P ${{ matrix.pm-version-major }} -c ./download_cache + ./compile.sh -t mac-x86-64 -j4 -g -P ${{ matrix.pm-version-major }} -c ./download_cache - name: Create tarball run: tar -czf ./PHP-MacOS-x86_64-PM${{ matrix.pm-version-major }}.tar.gz bin diff --git a/README.md b/README.md index ce45ca89..1f801937 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,6 @@ 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 -- `-f` makes the compiled binary much faster, don't forget to use it if you're targeting production. - If you're going to use the compiled binary only on the machine you're build it on, remove the `-t` option for best performance - this will allow the script to optimize for the current machine rather than a generic one. - [`ext-gd2`](https://www.php.net/manual/en/book.image.php) is NOT included unless the `-g` flag is provided, as PocketMine-MP doesn't need it. However, if your plugins need it, don't forget to enable it using `-g`. - The `-c` and `-l` options can be used to specify cache folders to speed up recompiling if you're recompiling many times (e.g. to improve the script). @@ -26,29 +25,28 @@ Bash script used to compile PHP on MacOS and Linux platforms. Make sure you have - The `aarch64-linux-musl` toolchain is required. You can compile and install it using https://github.com/pmmp/musl-cross-make (PMMP fork includes musl-libc patches for DNS resolver config path and increasing stack size limit for LevelDB) - It is strongly recommended that you enable abusive optimizations for Android targets (`-f` flag) for best performance. -| Script flags | Description | -|--------------|----------------------------------------------------------------------------------------------------| -| -c | Uses the folder specified for caching downloaded tarballs, zipballs etc. | -| -d | Will compile with debug and the xdebug PHP extension | -| -f | Enable optimizations (increases compile time, but improves performance) | -| -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`) | +| 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) | +| -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 -f`` | -| linux64, PM4 | ``-t linux64 -j4 -P4 -f`` | -| mac64 | ``-t mac-x86-64 -j4 -P5 -f`` | -| android-aarch64 | ``-t android-aarch64 -x -j4 -P5 -f`` | +| 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 diff --git a/compile.sh b/compile.sh index 9cfb5c7a..5b283319 100755 --- a/compile.sh +++ b/compile.sh @@ -132,7 +132,7 @@ HAVE_MYSQLI="--enable-mysqlnd --with-mysqli=mysqlnd" COMPILE_TARGET="" IS_CROSSCOMPILE="no" IS_WINDOWS="no" -DO_OPTIMIZE="no" +DO_OPTIMIZE="yes" DO_STATIC="no" DO_CLEANUP="yes" COMPILE_DEBUG="no" @@ -176,6 +176,7 @@ while getopts "::t:j:sdxfgnva:P:c:l:Ji" OPTION; do write_out "opt" "Will compile everything with debugging symbols, will not remove sources" COMPILE_DEBUG="yes" DO_CLEANUP="no" + DO_OPTIMIZE="no" CFLAGS="$CFLAGS -g" CXXFLAGS="$CXXFLAGS -g" ;; @@ -189,8 +190,7 @@ while getopts "::t:j:sdxfgnva:P:c:l:Ji" OPTION; do CFLAGS="$CFLAGS -static" ;; f) - write_out "opt" "Enabling abusive optimizations..." - DO_OPTIMIZE="yes" + write_out "deprecated" "The -f flag is deprecated, as optimizations are now enabled by default unless -d (debug mode) is specified" ;; g) write_out "opt" "Will enable GD2" @@ -1049,11 +1049,6 @@ get_github_extension "arraydebug" "$EXT_ARRAYDEBUG_VERSION" "pmmp" "ext-arraydeb write_library "PHP" "$PHP_VERSION" -if [ "$DO_OPTIMIZE" != "no" ]; then - PHP_OPTIMIZATION="--enable-inline-optimization " -else - PHP_OPTIMIZATION="--disable-inline-optimization " -fi write_configure cd php rm -f ./aclocal.m4 >> "$DIR/install.log" 2>&1