From 1ef3037f4d671d524b1776b73277f0e2df3135fe Mon Sep 17 00:00:00 2001 From: Don Hardman Date: Thu, 22 Jan 2026 22:37:14 +0700 Subject: [PATCH 01/14] feat: add llm-php-ext build support across platforms - Add Rust toolchain installation via rustup - Install cargo-php for building PHP extensions - Clone and build llm-php-ext with static linking - Enable llm extension in PHP configure for Alpine, Linux, and OSX --- .github/workflows/release.yml | 6 +++--- .github/workflows/test.yml | 2 +- build-alpine | 7 +++++-- build-bash-base.sh | 14 +++++++++++++- build-linux | 12 ++++++++++-- build-osx | 9 +++++++-- helper.sh | 7 +++++++ 7 files changed, 46 insertions(+), 11 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e8b900a..22a3888 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -103,7 +103,7 @@ jobs: use_buildx: true run: "" - name: AMD64 native on OSX - os: macos-13 + os: macos-15 arch: x86_64 use_buildx: false run: ./build-osx @@ -557,7 +557,7 @@ jobs: - artifact_suffix: ubuntu-22.04-arm64 asset_name_suffix: linux-arm64.tar.gz asset_content_type: application/gzip - - artifact_suffix: macos-13-x86_64 + - artifact_suffix: macos-15-x86_64 asset_name_suffix: macos-x86_64.tar.gz asset_content_type: application/gzip - artifact_suffix: macos-14-arm64 @@ -811,7 +811,7 @@ jobs: arch: aarch delimiter: "_" distro: 10 - - artifact: artifact-macos-13-x86_64 + - artifact: artifact-macos-15-x86_64 type: arc arch: x86_64 delimiter: "-" diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 62c4ca6..bfb0a81 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -30,7 +30,7 @@ jobs: arch: amd64 build_type: jammy - job_name: 'Build static on amd64 OSX' - os: macos-13 + os: macos-15 use_docker: false script_name: ./build-osx arch: amd64 diff --git a/build-alpine b/build-alpine index e21b067..0af8e0c 100755 --- a/build-alpine +++ b/build-alpine @@ -22,7 +22,7 @@ install_deps() { ln -s /usr/bin/objcopy "/usr/bin/${arch}-alpine-linux-musl-objcopy" export CROSS_COMPILE="/usr/bin/${arch}-alpine-linux-musl-" - apk add curl git autoconf bison re2c pkgconf zlib-dev zstd-dev openssl-libs-static openssl-dev zlib-static zlib-dev gnu-libiconv-dev + apk add curl git autoconf bison re2c pkgconf zlib-dev zstd-dev openssl-libs-static openssl-dev zlib-static zlib-dev gnu-libiconv-dev clang-dev llvm-dev install_curl @@ -31,6 +31,8 @@ install_deps() { install_zlib install_rdkafka + + install_rust } install_dev_deps() { @@ -39,7 +41,7 @@ install_dev_deps() { install_libxml2 } -export -f install_deps install_dev_deps +export -f install_deps install_dev_deps install_rust . build-bash-base.sh "$@" if [ "$BUILD_DEV" -eq 1 ]; then @@ -61,6 +63,7 @@ ENABLE_STATIC=yes --with-rdkafka \ --enable-jchash \ --enable-simdjson \ + --enable-llm \ --with-openssl --with-zlib --with-zip \ --enable-filter \ --with-curl \ diff --git a/build-bash-base.sh b/build-bash-base.sh index 5e6f7f4..71e80ed 100644 --- a/build-bash-base.sh +++ b/build-bash-base.sh @@ -14,6 +14,7 @@ SWOOLE_REV="3e1a1f89930ba0bbea1f5ee31bcd0ee701a87aab" RDKAFKA_REV="53398031f1cd96e437e9705b67b4dc19d955acb6" JCHASH_REV="8ed50cc8c211effe1c214eae1e3240622e0f11b0" SIMDJSON_REV="9a2745669fea733a40f9443b1a793846d0759b89" +LLM_REV="449ecb2dc64deeb5969d109451c3655947a7d26c" SKIP_SYSTEM_DEPS="$2" BUILD_DEV="$3" BUILD_STATIC=1 # Always build static but dev @@ -79,7 +80,18 @@ else fi cd .. -cd .. +# llm +git clone https://github.com/manticoresoftware/llm-php-ext.git llm +cd llm && git checkout "$LLM_REV" +if [ "$(uname)" == "Darwin" ]; then + # macOS: Use LLVM 17 from Homebrew + LLVM_PREFIX="$(brew --prefix llvm@17 2>/dev/null || echo /opt/homebrew/opt/llvm@17)" + LIBCLANG_PATH="$LLVM_PREFIX/lib" + LLVM_CONFIG_PATH="$LLVM_PREFIX/bin/llvm-config" + LLVM_PATH="$LLVM_PREFIX/bin" + export LIBCLANG_PATH="$LIBCLANG_PATH" LLVM_CONFIG_PATH="$LLVM_CONFIG_PATH" PATH="$LLVM_PATH:$PATH" +fi +cd ../.. BUILD_EXTRA=() if [[ "$BUILD_DEV" == "1" ]]; then diff --git a/build-linux b/build-linux index 0eeb67c..eead013 100755 --- a/build-linux +++ b/build-linux @@ -17,14 +17,21 @@ set -xe install_deps() { sudo apt-get update -y - sudo apt-get install -y curl build-essential autoconf automake bison re2c libzstd-dev pkg-config git libssl-dev zlib1g-dev libzip-dev libonig-dev cmake libcurl4-openssl-dev libzip-dev librdkafka-dev libiconv-hook-dev + sudo apt-get install -y curl build-essential autoconf automake bison re2c libzstd-dev pkg-config git libssl-dev zlib1g-dev libzip-dev libonig-dev cmake libcurl4-openssl-dev libzip-dev librdkafka-dev libiconv-hook-dev wget + # Install LLVM 17 directly from apt.llvm.org + wget -qO - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo gpg --dearmor -o /usr/share/keyrings/llvm-archive-keyring.gpg + echo "deb [signed-by=/usr/share/keyrings/llvm-archive-keyring.gpg] http://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main" | sudo tee /etc/apt/sources.list.d/llvm.list > /dev/null + sudo apt-get update -y + sudo apt-get install -y clang-17 lldb-17 lld-17 clangd-17 clang-tidy-17 clang-format-17 clang-tools-17 llvm-17-dev libomp-17-dev libc++-17-dev libc++abi-17-dev libclang-common-17-dev libclang-17-dev libclang-cpp17-dev || echo "LLVM 17 packages not all available, continuing..." + + install_rust } install_dev_deps() { sudo apt-get install -y libonig-dev libgmp-dev libxml2-dev } -export -f install_deps install_dev_deps +export -f install_deps install_dev_deps install_rust . build-bash-base.sh "$@" @@ -47,6 +54,7 @@ ENABLE_STATIC=yes --with-rdkafka \ --enable-jchash \ --enable-simdjson \ + --enable-llm \ --with-openssl --with-zlib --with-zip --with-iconv \ --enable-filter \ --with-curl \ diff --git a/build-osx b/build-osx index 3b81dcd..88224ae 100755 --- a/build-osx +++ b/build-osx @@ -7,8 +7,10 @@ # you can find it at https://www.php.net/license/3_01.txt set -e +. helper.sh + install_deps() { - brew install bash curl autoconf automake bison re2c zstd git openssl zlib cmake libzip librdkafka libiconv + brew install bash curl autoconf automake bison re2c zstd git openssl zlib cmake libzip librdkafka libiconv llvm@17 OPENSSL_PREFIX="$(brew --prefix openssl)" LIBRDKAFKA_PREFIX="$(brew --prefix librdkafka)" @@ -21,13 +23,15 @@ install_deps() { export CPPFLAGS="-I${OPENSSL_PREFIX}/include -I${LIBRDKAFKA_PREFIX}/include -I${ICONV_PREFIX}/include" export PKG_CONFIG_PATH="${OPENSSL_PREFIX}/lib/pkgconfig" + + install_rust } install_dev_deps() { brew install libxml2 oniguruma libgmp } -export -f install_deps install_dev_deps +export -f install_deps install_dev_deps install_rust . ./build-bash-base.sh "$@" hide_dynamic_libs() { @@ -95,6 +99,7 @@ chmod +x configure --with-rdkafka \ --enable-jchash \ --enable-simdjson \ + --enable-llm \ --with-openssl --with-zlib --with-zip --with-iconv=$(brew --prefix libiconv) \ --enable-filter \ --with-curl \ diff --git a/helper.sh b/helper.sh index 7d2de89..d26935d 100644 --- a/helper.sh +++ b/helper.sh @@ -1,6 +1,13 @@ #!/usr/bin/env bash set -ex +install_rust() { + # Install Rust toolchain + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + # Source cargo environment + . "$HOME/.cargo/env" +} + install_curl() { test -d curl-8.0.0 && rm -fr "$_" curl -sSL https://github.com/curl/curl/releases/download/curl-8_0_0/curl-8.0.0.tar.gz | tar -xzf - From deaca2703fafeaff37fe47b68e9ca409a6ad33b0 Mon Sep 17 00:00:00 2001 From: Don Hardman Date: Fri, 23 Jan 2026 14:45:00 +0700 Subject: [PATCH 02/14] chore(php): update version to 8.4.17 - Update PHP version in release and test workflows - Update build scripts and Dockerfiles - Update documentation references --- .github/workflows/release.yml | 2 +- .github/workflows/test.yml | 2 +- Dockerfile | 2 +- Dockerfile-dist | 2 +- README.md | 8 ++++---- helper.sh | 4 ++-- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 22a3888..86fa6c7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,7 +13,7 @@ on: env: APP_NAME: 'manticore-executor' DOCKER_TAG: 'manticoresearch/manticore-executor' - PHP_VERSION: '8.3.15' + PHP_VERSION: '8.4.17' MAINTAINER: 'Manticore' DESC: 'Custom built PHP executor for Manticore.' EXTRA_NAME: 'manticore-extra' diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bfb0a81..5d27ec4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,7 +7,7 @@ on: env: APP_NAME: 'manticore-executor' - PHP_VERSION: '8.3.15' + PHP_VERSION: '8.4.17' MAINTAINER: 'Manticore' DESC: 'Custom built PHP executor for Manticore.' diff --git a/Dockerfile b/Dockerfile index 48df418..529f48a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,7 @@ ARG BUILD_DEV=0 COPY . /src RUN apk add bash && \ cd /src && \ - ./build-alpine 8.4.2 0 $BUILD_DEV && \ + ./build-alpine 8.4.17 0 $BUILD_DEV && \ mv build/dist/bin/php /usr/bin/manticore-executor && \ ln -s /usr/bin/manticore-executor /usr/bin/php && \ cd ../.. diff --git a/Dockerfile-dist b/Dockerfile-dist index a40efd4..45dd505 100644 --- a/Dockerfile-dist +++ b/Dockerfile-dist @@ -6,7 +6,7 @@ RUN apt-get update -y && \ COPY ./build-linux ./build-linux COPY ./build-bash-base.sh ./build-bash-base.sh COPY ./helper.sh ./helper.sh -RUN ./build-linux 8.4.2 0 0 && \ +RUN ./build-linux 8.4.17 0 0 && \ cp build/dist/bin/php /usr/bin/manticore-executor && \ rm -fr build diff --git a/README.md b/README.md index 7c440d8..eb99c66 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ Manticore Executor is a custom built PHP binary which: By default, we disable all extensions and enable only those required to run our scripts. -We build executor from `PHP 8.4.2` with the following extensions enabled and compiled into the executable statically: +We build executor from `PHP 8.4.17` with the following extensions enabled and compiled into the executable statically: * pcntl * posix @@ -83,10 +83,10 @@ Several scripts used to build the final package: * `build-linux` * `build-osx` -The scripts accept a version of PHP as a parameter. The current version is `8.4.2`. To build the binary, you should run the following example: +The scripts accept a version of PHP as a parameter. The current version is `8.4.17`. To build the binary, you should run the following example: ```bash -./build-linux "8.4.2" +./build-linux "8.4.17" ``` -The command above will build the package on Linux with **PHP** `8.4.2`. Once it's done, you can find your binary in folder `dist/bin`. \ No newline at end of file +The command above will build the package on Linux with **PHP** `8.4.17`. Once it's done, you can find your binary in folder `dist/bin`. \ No newline at end of file diff --git a/helper.sh b/helper.sh index d26935d..404296b 100644 --- a/helper.sh +++ b/helper.sh @@ -71,7 +71,7 @@ build_dev_conf() { git checkout 68eb143bd5700a6fe041826118aeb9a13a3fcef3 cd .. - # It does not work with PHP 8.4.2 + # It does not work with PHP 8.4.17 # git clone https://github.com/tideways/php-xhprof-extension.git tideways_xhprof && cd "$_" # git checkout 7877082945fcccced12676749676af1736a00f65 # cd .. @@ -91,4 +91,4 @@ fix_static_linking() { sed -ie 's/PHP_INI_ENTRY("openssl.cafile", NULL, PHP_INI_PERDIR, NULL)/PHP_INI_ENTRY("openssl.cafile", "\/etc\/ssl\/cert.pem", PHP_INI_PERDIR, NULL)/g' ext/openssl/openssl.c sed -ie 's/-export-dynamic//g' Makefile sed -ie 's/-o $(SAPI_CLI_PATH)/-all-static -o $(SAPI_CLI_PATH)/g' Makefile -} +} \ No newline at end of file From a3815f00fd94e9e2ecda7c9c3c6dc155bf0408e8 Mon Sep 17 00:00:00 2001 From: Don Hardman Date: Fri, 23 Jan 2026 17:03:25 +0700 Subject: [PATCH 03/14] Subject: chore: install PHP 8.4 for Rust extension builds - Add PHP 8.4 packages to Alpine (php84, php84-dev, php84-cli) - Add PPA and PHP 8.4 packages to Linux (php8.4, php8.4-dev, php8.4-cli) - Add PHP 8.4 to macOS homebrew (php@8.4) - Update DS, SWOOLE, and LLM extension revisions - Update PHP version reference comment to 8.4.17 --- build-alpine | 2 +- build-bash-base.sh | 8 ++++---- build-linux | 5 ++++- build-osx | 2 +- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/build-alpine b/build-alpine index 0af8e0c..4519da9 100755 --- a/build-alpine +++ b/build-alpine @@ -22,7 +22,7 @@ install_deps() { ln -s /usr/bin/objcopy "/usr/bin/${arch}-alpine-linux-musl-objcopy" export CROSS_COMPILE="/usr/bin/${arch}-alpine-linux-musl-" - apk add curl git autoconf bison re2c pkgconf zlib-dev zstd-dev openssl-libs-static openssl-dev zlib-static zlib-dev gnu-libiconv-dev clang-dev llvm-dev + apk add php84 php84-dev php84-cli curl git autoconf bison re2c pkgconf zlib-dev zstd-dev openssl-libs-static openssl-dev zlib-static zlib-dev gnu-libiconv-dev clang-dev llvm-dev install_curl diff --git a/build-bash-base.sh b/build-bash-base.sh index 71e80ed..08664c5 100644 --- a/build-bash-base.sh +++ b/build-bash-base.sh @@ -9,12 +9,12 @@ set -e PHP_VERSION="$1" ZSTD_REV="2dfcd6524ccdcef6dfdaa97d7f3716b866885093" -DS_REV="da4d2f2a2c0f3732b34562636849c5e52e79e6c3" -SWOOLE_REV="3e1a1f89930ba0bbea1f5ee31bcd0ee701a87aab" +DS_REV="118c06b8863386ceada4238f3cec18ab84c9efb7" +SWOOLE_REV="d611ff3ca60e8c9425b2e2e3ba1a9004faab64f5" RDKAFKA_REV="53398031f1cd96e437e9705b67b4dc19d955acb6" JCHASH_REV="8ed50cc8c211effe1c214eae1e3240622e0f11b0" SIMDJSON_REV="9a2745669fea733a40f9443b1a793846d0759b89" -LLM_REV="449ecb2dc64deeb5969d109451c3655947a7d26c" +LLM_REV="ab494ede997c56340774a405be766c61ed405f22" SKIP_SYSTEM_DEPS="$2" BUILD_DEV="$3" BUILD_STATIC=1 # Always build static but dev @@ -114,7 +114,7 @@ if [[ "$BUILD_DEV" == "1" ]]; then # "--enable-memprof" # "--enable-memprof-debug" # - # It does not work with PHP 8.4.2 + # It does not work with PHP 8.4.17 # "--enable-tideways-xhprof" # "--enable-xdebug" ) diff --git a/build-linux b/build-linux index eead013..588ccd0 100755 --- a/build-linux +++ b/build-linux @@ -17,7 +17,10 @@ set -xe install_deps() { sudo apt-get update -y - sudo apt-get install -y curl build-essential autoconf automake bison re2c libzstd-dev pkg-config git libssl-dev zlib1g-dev libzip-dev libonig-dev cmake libcurl4-openssl-dev libzip-dev librdkafka-dev libiconv-hook-dev wget + sudo apt-get install -y software-properties-common + sudo add-apt-repository ppa:ondrej/php -y + sudo apt-get update -y + sudo apt-get install -y php8.4 php8.4-dev php8.4-cli build-essential clang libclang-dev pkg-config curl autoconf automake bison re2c libzstd-dev git libssl-dev zlib1g-dev libzip-dev libonig-dev cmake libcurl4-openssl-dev librdkafka-dev libiconv-hook-dev wget # Install LLVM 17 directly from apt.llvm.org wget -qO - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo gpg --dearmor -o /usr/share/keyrings/llvm-archive-keyring.gpg echo "deb [signed-by=/usr/share/keyrings/llvm-archive-keyring.gpg] http://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main" | sudo tee /etc/apt/sources.list.d/llvm.list > /dev/null diff --git a/build-osx b/build-osx index 88224ae..4f0396e 100755 --- a/build-osx +++ b/build-osx @@ -10,7 +10,7 @@ set -e . helper.sh install_deps() { - brew install bash curl autoconf automake bison re2c zstd git openssl zlib cmake libzip librdkafka libiconv llvm@17 + brew install php@8.4 bash curl autoconf automake bison re2c zstd git openssl zlib cmake libzip librdkafka libiconv llvm@17 OPENSSL_PREFIX="$(brew --prefix openssl)" LIBRDKAFKA_PREFIX="$(brew --prefix librdkafka)" From a7abd935924858c706d850c907f1ecd1074cbbda Mon Sep 17 00:00:00 2001 From: Don Hardman Date: Fri, 23 Jan 2026 17:08:37 +0700 Subject: [PATCH 04/14] chore: update Alpine to 3.21 and remove bison re2c --- .github/workflows/test.yml | 2 +- Dockerfile | 2 +- build-alpine | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5d27ec4..415af9b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -52,7 +52,7 @@ jobs: run: ${{ matrix.script_name }} ${{ env.PHP_VERSION }} - name: Build binary using Docker if: ${{ matrix.use_docker == true }} - run: docker run -v ${PWD}:/src -w /src alpine:3.17 sh -c "apk add sudo bash; ${{ matrix.script_name }} ${{ env.PHP_VERSION }}" + run: docker run -v ${PWD}:/src -w /src alpine:3.21 sh -c "apk add sudo bash; ${{ matrix.script_name }} ${{ env.PHP_VERSION }}" - name: Create artifact run: | os="${{ runner.os }}" diff --git a/Dockerfile b/Dockerfile index 529f48a..cde0639 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM alpine:3.17 +FROM alpine:3.21 ARG BUILD_DEV=0 # Install the manticore-executor binary diff --git a/build-alpine b/build-alpine index 4519da9..9b2097c 100755 --- a/build-alpine +++ b/build-alpine @@ -22,7 +22,7 @@ install_deps() { ln -s /usr/bin/objcopy "/usr/bin/${arch}-alpine-linux-musl-objcopy" export CROSS_COMPILE="/usr/bin/${arch}-alpine-linux-musl-" - apk add php84 php84-dev php84-cli curl git autoconf bison re2c pkgconf zlib-dev zstd-dev openssl-libs-static openssl-dev zlib-static zlib-dev gnu-libiconv-dev clang-dev llvm-dev + apk add php84 php84-dev curl git autoconf bison re2c pkgconf zlib-dev zstd-dev openssl-libs-static openssl-dev zlib-static zlib-dev gnu-libiconv-dev clang-dev llvm-dev install_curl From aa8c8feebde0827fbaaee408a5950409a7a1689c Mon Sep 17 00:00:00 2001 From: Don Hardman Date: Fri, 23 Jan 2026 17:22:22 +0700 Subject: [PATCH 05/14] build: fix PHP 8.4 installation on macOS --- build-osx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/build-osx b/build-osx index 4f0396e..f6bf769 100755 --- a/build-osx +++ b/build-osx @@ -10,7 +10,9 @@ set -e . helper.sh install_deps() { - brew install php@8.4 bash curl autoconf automake bison re2c zstd git openssl zlib cmake libzip librdkafka libiconv llvm@17 + brew tap shivammathur/php + brew install shivammathur/php/php@8.4 bash curl autoconf automake bison re2c zstd git openssl zlib cmake libzip librdkafka libiconv llvm@17 + brew link --overwrite --force shivammathur/php/php@8.4 OPENSSL_PREFIX="$(brew --prefix openssl)" LIBRDKAFKA_PREFIX="$(brew --prefix librdkafka)" From 5b731787d782dc638339ecd8a375162e22653f67 Mon Sep 17 00:00:00 2001 From: Don Hardman Date: Fri, 23 Jan 2026 17:33:22 +0700 Subject: [PATCH 06/14] ci: use proper macOS runners for Intel and ARM builds - Specify macos-15-intel for x86_64 builds - Use macos-15 for ARM64 builds instead of deprecated macos-14 --- .github/workflows/release.yml | 4 ++-- .github/workflows/test.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 86fa6c7..1a40a25 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -103,12 +103,12 @@ jobs: use_buildx: true run: "" - name: AMD64 native on OSX - os: macos-15 + os: macos-15-intel arch: x86_64 use_buildx: false run: ./build-osx - name: ARM64 native on OSX - os: macos-14 + os: macos-15 arch: arm64 use_buildx: false run: ./build-osx diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 415af9b..b53b56b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -30,13 +30,13 @@ jobs: arch: amd64 build_type: jammy - job_name: 'Build static on amd64 OSX' - os: macos-15 + os: macos-15-intel use_docker: false script_name: ./build-osx arch: amd64 build_type: osx - job_name: 'Build static on arm64 OSX' - os: macos-14 + os: macos-15 use_docker: false script_name: ./build-osx arch: arm64 From 79c85430472dc26104b837f932651ea7dec3b3e6 Mon Sep 17 00:00:00 2001 From: Don Hardman Date: Fri, 23 Jan 2026 17:41:20 +0700 Subject: [PATCH 07/14] fix(alpine): add php84 symlinks for standard command access --- build-alpine | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/build-alpine b/build-alpine index 9b2097c..f85ff43 100755 --- a/build-alpine +++ b/build-alpine @@ -24,6 +24,11 @@ install_deps() { apk add php84 php84-dev curl git autoconf bison re2c pkgconf zlib-dev zstd-dev openssl-libs-static openssl-dev zlib-static zlib-dev gnu-libiconv-dev clang-dev llvm-dev + # Create symlinks for php84 to be accessible as php + ln -sf /usr/bin/php84 /usr/bin/php + ln -sf /usr/bin/php-config84 /usr/bin/php-config + ln -sf /usr/bin/phpize84 /usr/bin/phpize + install_curl install_libzip From 704d00f37aecb33d0727af4fea73bbe99249133b Mon Sep 17 00:00:00 2001 From: Don Hardman Date: Fri, 23 Jan 2026 17:53:33 +0700 Subject: [PATCH 08/14] fix(build-osx): add PHP bin directory to PATH --- build-osx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build-osx b/build-osx index f6bf769..c154792 100755 --- a/build-osx +++ b/build-osx @@ -14,6 +14,10 @@ install_deps() { brew install shivammathur/php/php@8.4 bash curl autoconf automake bison re2c zstd git openssl zlib cmake libzip librdkafka libiconv llvm@17 brew link --overwrite --force shivammathur/php/php@8.4 + # Add PHP to PATH + PHP_PREFIX="$(brew --prefix shivammathur/php/php@8.4)" + export PATH="${PHP_PREFIX}/bin:${PATH}" + OPENSSL_PREFIX="$(brew --prefix openssl)" LIBRDKAFKA_PREFIX="$(brew --prefix librdkafka)" ICONV_PREFIX="$(brew --prefix libiconv)" From abfb1e0dede638225982b123a0a739d20b1b9578 Mon Sep 17 00:00:00 2001 From: Don Hardman Date: Fri, 23 Jan 2026 18:29:31 +0700 Subject: [PATCH 09/14] chore(build): bump LLM revision hash --- build-bash-base.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-bash-base.sh b/build-bash-base.sh index 08664c5..5bc23c2 100644 --- a/build-bash-base.sh +++ b/build-bash-base.sh @@ -14,7 +14,7 @@ SWOOLE_REV="d611ff3ca60e8c9425b2e2e3ba1a9004faab64f5" RDKAFKA_REV="53398031f1cd96e437e9705b67b4dc19d955acb6" JCHASH_REV="8ed50cc8c211effe1c214eae1e3240622e0f11b0" SIMDJSON_REV="9a2745669fea733a40f9443b1a793846d0759b89" -LLM_REV="ab494ede997c56340774a405be766c61ed405f22" +LLM_REV="3dab1b6b6b3a00ae409ba3bcd8c2476d7cffc758" SKIP_SYSTEM_DEPS="$2" BUILD_DEV="$3" BUILD_STATIC=1 # Always build static but dev From 849fcfd964c0d9a8a3f80fea1fb5dc1fb7c05ac3 Mon Sep 17 00:00:00 2001 From: Don Hardman Date: Fri, 23 Jan 2026 18:41:50 +0700 Subject: [PATCH 10/14] chore(build): update LLM dependency hash --- build-bash-base.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-bash-base.sh b/build-bash-base.sh index 5bc23c2..4332526 100644 --- a/build-bash-base.sh +++ b/build-bash-base.sh @@ -14,7 +14,7 @@ SWOOLE_REV="d611ff3ca60e8c9425b2e2e3ba1a9004faab64f5" RDKAFKA_REV="53398031f1cd96e437e9705b67b4dc19d955acb6" JCHASH_REV="8ed50cc8c211effe1c214eae1e3240622e0f11b0" SIMDJSON_REV="9a2745669fea733a40f9443b1a793846d0759b89" -LLM_REV="3dab1b6b6b3a00ae409ba3bcd8c2476d7cffc758" +LLM_REV="3f14843e065633fb01ae980a72b4f86ff5d2443e" SKIP_SYSTEM_DEPS="$2" BUILD_DEV="$3" BUILD_STATIC=1 # Always build static but dev From 825110d660302ba3921814cbde92b63a56ec9000 Mon Sep 17 00:00:00 2001 From: Don Hardman Date: Fri, 23 Jan 2026 19:03:17 +0700 Subject: [PATCH 11/14] update ZSTD and LLM revisions --- build-bash-base.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/build-bash-base.sh b/build-bash-base.sh index 4332526..5aaa656 100644 --- a/build-bash-base.sh +++ b/build-bash-base.sh @@ -8,13 +8,14 @@ set -e PHP_VERSION="$1" -ZSTD_REV="2dfcd6524ccdcef6dfdaa97d7f3716b866885093" +ZSTD_REV="d6d26eb805058fc672686715a7b5e39d8f65dd36" DS_REV="118c06b8863386ceada4238f3cec18ab84c9efb7" SWOOLE_REV="d611ff3ca60e8c9425b2e2e3ba1a9004faab64f5" RDKAFKA_REV="53398031f1cd96e437e9705b67b4dc19d955acb6" + JCHASH_REV="8ed50cc8c211effe1c214eae1e3240622e0f11b0" SIMDJSON_REV="9a2745669fea733a40f9443b1a793846d0759b89" -LLM_REV="3f14843e065633fb01ae980a72b4f86ff5d2443e" +LLM_REV="8ef13fa0911de91fddebe0bde48ba7569a055482" SKIP_SYSTEM_DEPS="$2" BUILD_DEV="$3" BUILD_STATIC=1 # Always build static but dev From 7655c715c80895df563be3a170f597af6a55dae8 Mon Sep 17 00:00:00 2001 From: Don Hardman Date: Sat, 24 Jan 2026 15:30:35 +0700 Subject: [PATCH 12/14] chore(osx): clean up PHP installation PATH handling - Append LLVM to PATH instead of prepending to preserve PHP access - Add brew bin directory to PATH for better PHP discovery - Remove hide_dynamic_libs/restore_dynamic_libs mechanism as unneeded - Add PHP verification step for ext-php-rs build --- build-bash-base.sh | 6 +++++- build-osx | 34 +++------------------------------- 2 files changed, 8 insertions(+), 32 deletions(-) diff --git a/build-bash-base.sh b/build-bash-base.sh index 5aaa656..122d186 100644 --- a/build-bash-base.sh +++ b/build-bash-base.sh @@ -90,7 +90,11 @@ if [ "$(uname)" == "Darwin" ]; then LIBCLANG_PATH="$LLVM_PREFIX/lib" LLVM_CONFIG_PATH="$LLVM_PREFIX/bin/llvm-config" LLVM_PATH="$LLVM_PREFIX/bin" - export LIBCLANG_PATH="$LIBCLANG_PATH" LLVM_CONFIG_PATH="$LLVM_CONFIG_PATH" PATH="$LLVM_PATH:$PATH" + # Ensure PHP is still accessible by appending LLVM to PATH instead of prepending + export LIBCLANG_PATH="$LIBCLANG_PATH" LLVM_CONFIG_PATH="$LLVM_CONFIG_PATH" PATH="$PATH:$LLVM_PATH" + # Verify PHP is accessible + echo "Verifying PHP is accessible for ext-php-rs build..." + which php && php --version || echo "WARNING: php not found in PATH!" fi cd ../.. diff --git a/build-osx b/build-osx index c154792..f41c1ff 100755 --- a/build-osx +++ b/build-osx @@ -14,9 +14,10 @@ install_deps() { brew install shivammathur/php/php@8.4 bash curl autoconf automake bison re2c zstd git openssl zlib cmake libzip librdkafka libiconv llvm@17 brew link --overwrite --force shivammathur/php/php@8.4 - # Add PHP to PATH + # Add PHP to PATH - include both versioned path and brew bin directory PHP_PREFIX="$(brew --prefix shivammathur/php/php@8.4)" - export PATH="${PHP_PREFIX}/bin:${PATH}" + BREW_PREFIX="$(brew --prefix)" + export PATH="${PHP_PREFIX}/bin:${BREW_PREFIX}/bin:${PATH}" OPENSSL_PREFIX="$(brew --prefix openssl)" LIBRDKAFKA_PREFIX="$(brew --prefix librdkafka)" @@ -40,33 +41,6 @@ install_dev_deps() { export -f install_deps install_dev_deps install_rust . ./build-bash-base.sh "$@" -hide_dynamic_libs() { - ! which brew && return - for lib in "$@"; do - LIB_PATH=$(brew --prefix "$lib") - if ls "$LIB_PATH"/lib/*.dylib; then - for f in "$LIB_PATH"/lib/*.dylib; do - mv "$f" "$f.bak" - done - fi - done -} - -restore_dynamic_libs() { - ! which brew && return - for lib in "$@"; do - LIB_PATH=$(brew --prefix "$lib") - if ls "$LIB_PATH"/lib/*.dylib.bak; then - for f in "$LIB_PATH"/lib/*.dylib.bak; do - mv "$f" "${f%*.bak}" - done - fi - done -} - -# Leave only static libs on -hide_dynamic_libs zstd zlib - MAKE_LDFLAGS= ENABLE_SHARED=yes ENABLE_STATIC=no @@ -120,5 +94,3 @@ make LDFLAGS=$MAKE_LDFLAGS -j8 make install-cli strip dist/bin/php -# Return skipped dynamic libs -restore_dynamic_libs zstd zlib From 3ef7c6c770b8a0a293dd88e82cce44b96e001602 Mon Sep 17 00:00:00 2001 From: Don Hardman Date: Sat, 24 Jan 2026 16:19:43 +0700 Subject: [PATCH 13/14] build: add zstd-static for static linking --- build-alpine | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-alpine b/build-alpine index f85ff43..7023292 100755 --- a/build-alpine +++ b/build-alpine @@ -22,7 +22,7 @@ install_deps() { ln -s /usr/bin/objcopy "/usr/bin/${arch}-alpine-linux-musl-objcopy" export CROSS_COMPILE="/usr/bin/${arch}-alpine-linux-musl-" - apk add php84 php84-dev curl git autoconf bison re2c pkgconf zlib-dev zstd-dev openssl-libs-static openssl-dev zlib-static zlib-dev gnu-libiconv-dev clang-dev llvm-dev + apk add php84 php84-dev curl git autoconf bison re2c pkgconf zlib-dev zstd-static zstd-dev openssl-libs-static openssl-dev zlib-static zlib-dev gnu-libiconv-dev clang-dev llvm-dev # Create symlinks for php84 to be accessible as php ln -sf /usr/bin/php84 /usr/bin/php From aa179174f94b6b07317aa37251b0892a3d4edc66 Mon Sep 17 00:00:00 2001 From: Don Hardman Date: Mon, 26 Jan 2026 16:09:47 +0700 Subject: [PATCH 14/14] chore(build): remove intermediate php binaries after build --- build-alpine | 5 +++++ build-linux | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/build-alpine b/build-alpine index 7023292..59d8b93 100755 --- a/build-alpine +++ b/build-alpine @@ -85,3 +85,8 @@ fix_static_linking make LDFLAGS=$MAKE_LDFLAGS -j8 make install-cli + +# Remove php84 that was used for building before installing php +apk del php84 php84-dev +rm -f /usr/bin/php /usr/bin/php-config /usr/bin/phpize + diff --git a/build-linux b/build-linux index 588ccd0..8c7346a 100755 --- a/build-linux +++ b/build-linux @@ -70,3 +70,7 @@ ENABLE_STATIC=yes make -j8 make install-cli + +# Remove php84 that was used for building before installing php +sudo apt-get remove -y php8.4-dev php8.4-cli php8.4 +