diff --git a/.github/workflows/main-pm-matrix.yml b/.github/workflows/main-pm-matrix.yml new file mode 100644 index 00000000..3b65614b --- /dev/null +++ b/.github/workflows/main-pm-matrix.yml @@ -0,0 +1,164 @@ +name: Build PHP binaries + +on: + workflow_call: + inputs: + pm-version-major: + description: 'PocketMine-MP major version' + required: true + type: number + +jobs: + linux: + name: Linux + runs-on: ubuntu-20.04 + + steps: + - uses: actions/checkout@v4 + + - name: Install tools and dependencies + run: | + sudo apt-get update + sudo apt-get install make autoconf automake libtool libtool-bin m4 wget libc-bin gzip bzip2 bison g++ git re2c + + - name: Prepare compile.sh download cache + id: download-cache + uses: actions/cache@v4 + with: + path: ./download_cache + key: compile-sh-cache-ssl-https-${{ hashFiles('./compile.sh') }} + restore-keys: compile-sh-cache-ssl-https- + + - name: Compile PHP + run: | + # 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 -g -P ${{ inputs.pm-version-major }} -c ./download_cache -D + + - name: Create tarball + run: | + tar -czf ./PHP-Linux-x86_64-PM${{ inputs.pm-version-major }}.tar.gz bin + tar -czf ./PHP-Linux-x86_64-PM${{ inputs.pm-version-major }}-debugging-symbols.tar.gz bin-debug + + - name: Upload artifacts + uses: actions/upload-artifact@v4 + if: always() + with: + name: Linux-PM${{ inputs.pm-version-major }} + path: | + ./PHP-Linux-x86_64-PM${{ inputs.pm-version-major }}*.tar.gz + install.log + compile.sh + if-no-files-found: error + + - name: Prepare workspace for upload + if: failure() + run: tar -czf workspace.tar.gz install_data + + - name: Upload workspace + uses: actions/upload-artifact@v4 + if: failure() + with: + name: Linux-workspace-PM${{ inputs.pm-version-major }} + path: | + workspace.tar.gz + if-no-files-found: error + + macos: + name: MacOS ${{ matrix.artifact-name }} + runs-on: ${{ matrix.image }} + strategy: + matrix: + include: + - target-name: mac-x86-64 + artifact-name: x86_64 + image: macos-12 + - target-name: mac-arm64 + artifact-name: arm64 + image: macos-14 + + steps: + - uses: actions/checkout@v4 + + - name: Install tools and dependencies + run: brew install libtool autoconf automake pkg-config bison re2c + + - name: Prepare compile.sh download cache + id: download-cache + uses: actions/cache@v4 + with: + path: ./download_cache + key: compile-sh-cache-ssl-https-${{ hashFiles('./compile.sh') }} + restore-keys: compile-sh-cache-ssl-https- + + - name: Compile PHP + run: | + export PATH="/usr/local/opt/bison/bin:$PATH" + set -ex + trap "exit 1" ERR + ./compile.sh -t ${{ matrix.target-name }} -j4 -g -P ${{ inputs.pm-version-major }} -c ./download_cache -D + + - name: Create tarball + run: | + tar -czf ./PHP-MacOS-${{ matrix.artifact-name }}-PM${{ inputs.pm-version-major }}.tar.gz bin + tar -czf ./PHP-MacOS-${{ matrix.artifact-name }}-PM${{ inputs.pm-version-major }}-debugging-symbols.tar.gz bin-debug + + - name: Upload artifacts + uses: actions/upload-artifact@v4 + if: always() + with: + name: MacOS-${{ matrix.artifact-name }}-PM${{ inputs.pm-version-major }} + path: | + ./PHP-MacOS-${{ matrix.artifact-name}}-PM${{ inputs.pm-version-major }}*.tar.gz + install.log + compile.sh + if-no-files-found: error + + - name: Prepare workspace for upload + if: failure() + run: tar -czf workspace.tar.gz install_data + + - name: Upload workspace + uses: actions/upload-artifact@v4 + if: failure() + with: + name: MacOS-${{ matrix.artifact-name }}-workspace-PM${{ inputs.pm-version-major }} + path: | + workspace.tar.gz + if-no-files-found: error + + windows: + name: Windows + runs-on: windows-2019 + + steps: + - uses: actions/checkout@v4 + + - name: Install tools and dependencies + run: choco install wget --no-progress + + - name: Compile PHP + run: .\windows-compile-vs.bat + env: + VS_EDITION: Enterprise + SOURCES_PATH: ${{ github.workspace }}\pocketmine-php-sdk + PM_VERSION_MAJOR: ${{ inputs.pm-version-major }} + + - name: Rename artifacts + run: | + mkdir temp + move php-debug-pack-*.zip temp/PHP-Windows-x64-PM${{ inputs.pm-version-major }}-debugging-symbols.zip + move php-*.zip temp/PHP-Windows-x64-PM${{ inputs.pm-version-major }}.zip + move temp\*.zip . + + - name: Upload artifacts + uses: actions/upload-artifact@v4 + if: always() + with: + name: Windows-PM${{ inputs.pm-version-major }} + path: | + PHP-Windows-x64*.zip + compile.log + windows-compile-vs.bat + if-no-files-found: error diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c0dfead5..514b2a2b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,4 +1,4 @@ -name: Build PHP binaries +name: Build and publish PHP binaries on: push: @@ -134,7 +134,7 @@ jobs: path: ${{ github.workspace }} - name: Update latest branch release - uses: ncipollo/release-action@v1.13.0 + uses: ncipollo/release-action@v1.14.0 with: artifacts: | ${{ github.workspace }}/Linux-PM*/*.tar.gz @@ -148,7 +148,7 @@ jobs: prerelease: ${{ endsWith(github.ref_name, '-preview') }} - name: Publish unique release - uses: ncipollo/release-action@v1.13.0 + uses: ncipollo/release-action@v1.14.0 with: artifacts: | ${{ github.workspace }}/Linux-PM*/*.tar.gz diff --git a/compile.sh b/compile.sh index eb833b4c..a4001ae4 100755 --- a/compile.sh +++ b/compile.sh @@ -1,34 +1,32 @@ #!/usr/bin/env bash -[ -z "$PHP_VERSION" ] && PHP_VERSION="8.2.13" +[ -z "$PHP_VERSION" ] && PHP_VERSION="8.2.17" -ZLIB_VERSION="1.3" +ZLIB_VERSION="1.3.1" GMP_VERSION="6.3.0" -CURL_VERSION="curl-8_5_0" +CURL_VERSION="curl-8_7_1" YAML_VERSION="0.2.5" LEVELDB_VERSION="1c7564468b41610da4f498430e795ca4de0931ff" LIBXML_VERSION="2.10.1" #2.10.2 requires automake 1.16.3, which isn't easily available on Ubuntu 20.04 -LIBPNG_VERSION="1.6.40" -LIBJPEG_VERSION="9e" -OPENSSL_VERSION="3.1.4" +LIBPNG_VERSION="1.6.43" +LIBJPEG_VERSION="9f" +OPENSSL_VERSION="3.2.1" LIBZIP_VERSION="1.10.1" -SQLITE3_VERSION="3440200" #3.44.2 -LIBDEFLATE_VERSION="dd12ff2b36d603dbb7fa8838fe7e7176fcbd4f6f" #1.19 +SQLITE3_VERSION="3450200" #3.45.2 +LIBDEFLATE_VERSION="275aa5141db6eda3587214e0f1d3a134768f557d" #1.20 LIBZSTD_VER="1.5.5" - -EXT_PTHREADS_VERSION="4.2.2" EXT_PMMPTHREAD_VERSION="6.1.0" EXT_YAML_VERSION="2.2.3" EXT_LEVELDB_VERSION="317fdcd8415e1566fc2835ce2bdb8e19b890f9f3" EXT_CHUNKUTILS2_VERSION="0.3.5" -EXT_XDEBUG_VERSION="3.3.0" +EXT_XDEBUG_VERSION="3.3.1" EXT_IGBINARY_VERSION="3.2.15" -EXT_CRYPTO_VERSION="0.3.2" +EXT_CRYPTO_VERSION="abbe7cbf869f96e69f2ce897271a61d32f43c7c0" EXT_RECURSIONGUARD_VERSION="0.1.0" EXT_LIBDEFLATE_VERSION="0.2.1" EXT_MORTON_VERSION="0.1.2" EXT_XXHASH_VERSION="0.2.0" EXT_ARRAYDEBUG_VERSION="0.2.0" -EXT_ENCODING_VERSION="0.2.3" +EXT_ENCODING_VERSION="0.3.0" EXT_ZSTD_VERSION="0.12.3" function write_out { @@ -240,6 +238,9 @@ done if [ "$PM_VERSION_MAJOR" == "" ]; then write_error "Please specify PocketMine-MP major version target with -P (e.g. -P5)" exit 1 +elif [ "$PM_VERSION_MAJOR" -lt 5 ]; then + write_error "PocketMine-MP 4.x and older are no longer supported" + exit 1 fi write_out "opt" "Compiling with configuration for PocketMine-MP $PM_VERSION_MAJOR" @@ -1080,13 +1081,8 @@ function get_pecl_extension { cd "$BUILD_DIR/php" write_out "PHP" "Downloading additional extensions..." -if [ "$PM_VERSION_MAJOR" -ge 5 ]; then - get_github_extension "pmmpthread" "$EXT_PMMPTHREAD_VERSION" "pmmp" "ext-pmmpthread" - THREAD_EXT_FLAGS="--enable-pmmpthread" -else - get_github_extension "pthreads" "$EXT_PTHREADS_VERSION" "pmmp" "ext-pmmpthread" #"v" needed for release tags because github removes the "v" - THREAD_EXT_FLAGS="--enable-pthreads" -fi +get_github_extension "pmmpthread" "$EXT_PMMPTHREAD_VERSION" "pmmp" "ext-pmmpthread" + get_github_extension "yaml" "$EXT_YAML_VERSION" "php" "pecl-file_formats-yaml" #get_pecl_extension "yaml" "$EXT_YAML_VERSION" @@ -1208,7 +1204,7 @@ $HAS_DEBUG \ --enable-mbstring \ --disable-mbregex \ --enable-calendar \ -$THREAD_EXT_FLAGS \ +--enable-pmmpthread \ --enable-fileinfo \ --with-libxml \ --enable-xml \ diff --git a/windows-compile-vs.bat b/windows-compile-vs.bat index 5e669d61..a6476df0 100644 --- a/windows-compile-vs.bat +++ b/windows-compile-vs.bat @@ -3,7 +3,7 @@ REM For future users: This file MUST have CRLF line endings. If it doesn't, lots of inexplicable undesirable strange behaviour will result. REM Also: Don't modify this version with sed, or it will screw up your line endings. set PHP_MAJOR_VER=8.2 -set PHP_VER=%PHP_MAJOR_VER%.13 +set PHP_VER=%PHP_MAJOR_VER%.17 set PHP_GIT_REV=php-%PHP_VER% set PHP_DISPLAY_VER=%PHP_VER% set PHP_SDK_VER=2.2.0 @@ -24,20 +24,19 @@ set LEVELDB_MCPE_VER=1c7564468b41610da4f498430e795ca4de0931ff set LIBDEFLATE_VER=dd12ff2b36d603dbb7fa8838fe7e7176fcbd4f6f set LIBZSTD_VER=1.5.5 -set PHP_PTHREADS_VER=4.2.2 set PHP_PMMPTHREAD_VER=6.1.0 set PHP_YAML_VER=2.2.3 set PHP_CHUNKUTILS2_VER=0.3.5 set PHP_IGBINARY_VER=3.2.15 set PHP_LEVELDB_VER=317fdcd8415e1566fc2835ce2bdb8e19b890f9f3 -set PHP_CRYPTO_VER=0.3.2 +set PHP_CRYPTO_VER=abbe7cbf869f96e69f2ce897271a61d32f43c7c0 set PHP_RECURSIONGUARD_VER=0.1.0 set PHP_MORTON_VER=0.1.2 set PHP_LIBDEFLATE_VER=0.2.1 set PHP_XXHASH_VER=0.2.0 -set PHP_XDEBUG_VER=3.3.0 +set PHP_XDEBUG_VER=3.3.1 set PHP_ARRAYDEBUG_VER=0.2.0 -set PHP_ENCODING_VER=0.2.3 +set PHP_ENCODING_VER=0.3.0 set PHP_ZSTD_VER=0.12.3 set script_path=%~dp0 @@ -78,6 +77,10 @@ if "%PM_VERSION_MAJOR%"=="" ( call :pm-echo-error "Please specify PocketMine-MP major version by setting the PM_VERSION_MAJOR environment variable" exit 1 ) +if "%PM_VERSION_MAJOR%" lss "5" ( + call :pm-echo-error "PocketMine-MP 4.x and older are no longer supported" + exit 1 +) call :pm-echo "Compiling with configuration for PocketMine-MP %PM_VERSION_MAJOR%" @@ -237,14 +240,7 @@ cd /D .. call :pm-echo "Getting additional PHP extensions..." cd /D php-src\ext -set THREAD_EXT_FLAGS="" -if "%PM_VERSION_MAJOR%" geq "5" ( - call :get-extension-zip-from-github "pmmpthread" "%PHP_PMMPTHREAD_VER%" "pmmp" "ext-pmmpthread" || exit 1 - set THREAD_EXT_FLAGS="--with-pmmpthread=shared" -) else ( - call :get-extension-zip-from-github "pthreads" "%PHP_PTHREADS_VER%" "pmmp" "ext-pmmpthread" || exit 1 - set THREAD_EXT_FLAGS="--with-pthreads=shared" -) +call :get-extension-zip-from-github "pmmpthread" "%PHP_PMMPTHREAD_VER%" "pmmp" "ext-pmmpthread" || exit 1 call :get-extension-zip-from-github "yaml" "%PHP_YAML_VER%" "php" "pecl-file_formats-yaml" || exit 1 call :get-extension-zip-from-github "chunkutils2" "%PHP_CHUNKUTILS2_VER%" "pmmp" "ext-chunkutils2" || exit 1 call :get-extension-zip-from-github "igbinary" "%PHP_IGBINARY_VER%" "igbinary" "igbinary" || exit 1 @@ -324,7 +320,8 @@ call configure^ --with-mysqlnd^ --with-openssl^ --with-pcre-jit^ - %THREAD_EXT_FLAGS%^ + --with-pmmpthread=shared^ + --with-pmmpthread-sockets^ --with-simplexml^ --with-sodium^ --with-sqlite3=shared^