Skip to content

Build and Publish PHP Binaries for Android #4

Build and Publish PHP Binaries for Android

Build and Publish PHP Binaries for Android #4

Workflow file for this run

name: Build and Publish PHP Binaries for Android
on:
workflow_dispatch:
inputs:
pipeflags:
description: "compile Script flags"
required: false
type: string
pm-version:
description: "Major PocketMine-MP version specified (can be 4 or 5)"
required: true
type: string
musl-repo:
description: "musl-cross-make repository"
default: "Veha0001/pmmp-droid"
required: true
type: string
publish-release:
description: "Publish the build as a release"
required: true
type: boolean
jobs:
build-android:
name: Build PHP PM${{ inputs.pm-version }} for Android
runs-on: ubuntu-latest
env:
MUSL_DAT: https://github.com/${{ inputs.musl-repo }}/releases/download/build-tc/musl-cross-make-toolchain.tar.xz
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
repository: "pmmp/PHP-Binaries"
- 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: Install tools and dependencies
run: |
sudo apt-get update
sudo apt-get install -y make autoconf automake libtool libtool-bin m4 wget libc-bin gzip bzip2 bison g++ git re2c
- name: Download MUSL toolchain
run: |
wget -q $MUSL_DAT
sudo tar -xJf musl-cross-make-toolchain.tar.xz -C /usr/local
rm -rf musl-cross-make-toolchain.tar.xz
- name: Compile PHP for Android
run: |
set -ex
trap "exit 1" ERR
./compile.sh -t android-aarch64 -x -g -j 4 -P ${{ inputs.pm-version }} ${{ inputs.pipeflags }}
sed -i -E "1 s@^#\!(.*)/[sx]?bin/(.*)@#!\/data\/data\/com.termux\/files\/bin/\2@" bin/php7/bin/php-config
- name: Create tarball
run: |
tar -czf ./PHP-Android-aarch64-PM${{ inputs.pm-version }}.tar.gz bin
- uses: actions/upload-artifact@v4
with:
name: PHP-Android-aarch64-PM${{ inputs.pm-version }}
path: |
bin
install.log
compile.sh
- name: Publish Release
if: ${{ inputs['publish-release'] }}
uses: softprops/action-gh-release@v2
with:
repository: Veha0001/pmmp-droid
make_latest: true
files: ./PHP-Android-aarch64-PM${{ inputs.pm-version }}.tar.gz
name: PHP PM${{ inputs.pm-version }} Android
tag_name: php-pm${{ inputs.pm-version }}-latest
body: |
## PHP ${{ inputs.php-version-base }} PM${{ inputs.pm-version }} Release
This release includes the compiled PHP binaries for Android with **PocketMine-MP** version ${{ inputs.pm-version }}.x
## Release Notes
[![Runner](https://img.shields.io/badge/Build-Action-lightgreen?style=for-the-badge&logo=githubactions&logoColor=white)](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
> [!NOTE]
> If you see the error message `unexpected e_type: 2`, it's likely because you're using the Play Store version of Termux.
> To fix this, run your program in proot-distro or switch to the F-Droid or GitHub version of Termux.
:information_source: **Linux/MacOS users**: Please see [this page](https://doc.pmmp.io/en/rtfd/faq/installation/opcache.so.html) to fix extension loading errors. Also, check out the [PocketMine-MP Linux/MacOS installer](https://doc.pmmp.io/en/rtfd/installation/get-dot-pmmp-dot-io.html).
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}