Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
ad356b4
Fix grpc build
crazywhalecc Mar 9, 2026
16e772e
add back in zig workaround as 0.16.x is not released yet
henderkes Mar 10, 2026
b690566
simplify rm command
henderkes Mar 10, 2026
f93ad27
allow using some libs as system provided (work around mssql linking v…
henderkes Mar 10, 2026
2277390
fix removeConfigureArgs in UnixAutoconfExecutor.php
henderkes Mar 10, 2026
1edf14e
set custom binary name for frankenphp
henderkes Mar 10, 2026
5d5a50a
Update src/SPC/builder/LibraryBase.php
henderkes Mar 10, 2026
9634b8b
set custom binary name for frankenphp, allow linking against system o…
henderkes Mar 10, 2026
4fa5292
Use custom config.m4 for grpc extension
crazywhalecc Mar 10, 2026
086c855
Use custom config.m4 for grpc extension
crazywhalecc Mar 10, 2026
2350d2d
Merge branch 'main' into fix/grpc-build
crazywhalecc Mar 10, 2026
92f5b56
fix: FrankenPHP build args
dunglas Mar 10, 2026
e31f648
fix: FrankenPHP build args (#1057)
henderkes Mar 10, 2026
281b958
Fix grpc build (#1055)
crazywhalecc Mar 10, 2026
e49a5d7
make php 8.5 default
henderkes Mar 11, 2026
901da8f
remove ldtl from odbc libs private (using built in ltdl)
henderkes Mar 11, 2026
ef4b299
test
henderkes Mar 11, 2026
a335d05
cs fix
henderkes Mar 11, 2026
70285cb
actually update to 8.5
henderkes Mar 11, 2026
a232f57
test bulk
henderkes Mar 11, 2026
1b8b53d
update swoole args for 6.2
henderkes Mar 11, 2026
1049a3c
curl is always supported now (swoole no longer supports php < 8.1)
henderkes Mar 11, 2026
1fcb74a
swoole-ftp conflicts with ftp
henderkes Mar 11, 2026
85b0cd8
only disable when building ftp static, shared is fine
henderkes Mar 11, 2026
4625c6a
update default php version to 8.5 (#1058)
henderkes Mar 11, 2026
60b2aea
fix libde265 on ancient debian OS?
henderkes Mar 18, 2026
463ec54
Merge branch 'main' into fix/lide265
henderkes Mar 18, 2026
f2fa298
why is it not failing here?
henderkes Mar 18, 2026
823fe96
attempt
henderkes Mar 18, 2026
5491502
Fix zlib produced lib file names from different zlib version (#1066)
crazywhalecc Mar 20, 2026
b970bf8
Fix gd build on PHP 8.5 (#1043)
crazywhalecc Mar 20, 2026
295df19
Add shared-extensions, frankenphp and zts to build-unix workflow (#1062)
N-Silbernagel Mar 20, 2026
5404926
Merge branch 'main' into fix/lide265
henderkes Mar 20, 2026
4c6b7a3
fix libde265 on ancient debian OS (#1064)
henderkes Mar 20, 2026
963e2a0
Add Windows builders for libaom and brotli libraries
Mar 22, 2026
c03508a
Improve zlib Windows library detection for future zlib versions (#1070)
hmennen90 Mar 22, 2026
864678a
Merge branch 'main' into feat/windows-libaom-brotli
hmennen90 Mar 22, 2026
a99b6be
Remove freetype useless lib suggestions
crazywhalecc Mar 23, 2026
d076df6
Bump version number
crazywhalecc Mar 23, 2026
d35cbd7
Add Windows builders for libaom and brotli (#1072)
crazywhalecc Mar 23, 2026
13a15b1
Use alpha1 as version number
crazywhalecc Mar 24, 2026
2fa0770
Fix zlib extension wrong arg
crazywhalecc Mar 24, 2026
94dd44e
Add ext-amqp
crazywhalecc Mar 24, 2026
ecf712b
hard code protobuf version while we're on v2
henderkes Mar 26, 2026
766f7fa
hard code protobuf version while we're on v2 (#1075)
henderkes Mar 26, 2026
844bb69
Fix ext-curl implementation
crazywhalecc Mar 27, 2026
daae5f2
libjpeg-turbo mustn't compile zlib symbols on its own
henderkes Mar 29, 2026
8f7897e
test
henderkes Mar 29, 2026
5a5f54b
brilliant to test php 8.1
henderkes Mar 29, 2026
d535e4f
libjpeg-turbo mustn't compile zlib symbols on its own (#1077)
henderkes Mar 30, 2026
b96586e
Add curl extension and enhance Windows build process
crazywhalecc Mar 31, 2026
d316ea8
Merge branch 'main' into v3-refactor/win-exts
crazywhalecc Mar 31, 2026
852a043
Disable openssl for ngtcp2 temporarily
crazywhalecc Apr 3, 2026
51b8a0c
Fix upx packing for win
crazywhalecc Apr 3, 2026
c671cfd
Add cli, cgi, micro output
crazywhalecc Apr 3, 2026
e5e6e26
Add cli, cgi, micro output
crazywhalecc Apr 3, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 77 additions & 2 deletions .github/workflows/build-unix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ on:
description: Extensions to build (comma separated)
required: true
type: string
shared-extensions:
description: Shared extensions to build (optional, comma separated)
type: string
extra-libs:
description: Extra libraries to build (optional, comma separated)
type: string
Expand All @@ -42,6 +45,14 @@ on:
build-fpm:
description: Build fpm binary
type: boolean
build-frankenphp:
description: Build frankenphp binary (requires ZTS)
type: boolean
default: false
enable-zts:
description: Enable ZTS
type: boolean
default: false
prefer-pre-built:
description: Prefer pre-built binaries (reduce build time)
type: boolean
Expand Down Expand Up @@ -73,6 +84,9 @@ on:
description: Extensions to build (comma separated)
required: true
type: string
shared-extensions:
description: Shared extensions to build (optional, comma separated)
type: string
extra-libs:
description: Extra libraries to build (optional, comma separated)
type: string
Expand All @@ -86,6 +100,14 @@ on:
build-fpm:
description: Build fpm binary
type: boolean
build-frankenphp:
description: Build frankenphp binary (requires ZTS)
type: boolean
default: false
enable-zts:
description: Enable ZTS
type: boolean
default: false
prefer-pre-built:
description: Prefer pre-built binaries (reduce build time)
type: boolean
Expand Down Expand Up @@ -152,8 +174,19 @@ jobs:
RUNS_ON="macos-15"
;;
esac
DOWN_CMD="$DOWN_CMD --with-php=${{ inputs.php-version }} --for-extensions=${{ inputs.extensions }} --ignore-cache-sources=php-src"
BUILD_CMD="$BUILD_CMD ${{ inputs.extensions }}"
STATIC_EXTS="${{ inputs.extensions }}"
SHARED_EXTS="${{ inputs['shared-extensions'] }}"
BUILD_FRANKENPHP="${{ inputs['build-frankenphp'] }}"
ENABLE_ZTS="${{ inputs['enable-zts'] }}"
ALL_EXTS="$STATIC_EXTS"
if [ -n "$SHARED_EXTS" ]; then
ALL_EXTS="$ALL_EXTS,$SHARED_EXTS"
fi
DOWN_CMD="$DOWN_CMD --with-php=${{ inputs.php-version }} --for-extensions=$ALL_EXTS --ignore-cache-sources=php-src"
BUILD_CMD="$BUILD_CMD $STATIC_EXTS"
if [ -n "$SHARED_EXTS" ]; then
BUILD_CMD="$BUILD_CMD --build-shared=$SHARED_EXTS"
fi
if [ -n "${{ inputs.extra-libs }}" ]; then
DOWN_CMD="$DOWN_CMD --for-libs=${{ inputs.extra-libs }}"
BUILD_CMD="$BUILD_CMD --with-libs=${{ inputs.extra-libs }}"
Expand All @@ -177,6 +210,12 @@ jobs:
if [ ${{ inputs.build-fpm }} == true ]; then
BUILD_CMD="$BUILD_CMD --build-fpm"
fi
if [ "$BUILD_FRANKENPHP" = "true" ]; then
BUILD_CMD="$BUILD_CMD --build-frankenphp"
fi
if [ "$ENABLE_ZTS" = "true" ]; then
BUILD_CMD="$BUILD_CMD --enable-zts"
fi
echo 'download='"$DOWN_CMD" >> "$GITHUB_OUTPUT"
echo 'build='"$BUILD_CMD" >> "$GITHUB_OUTPUT"
echo 'run='"$RUNS_ON" >> "$GITHUB_OUTPUT"
Expand All @@ -199,6 +238,27 @@ jobs:
env:
phpts: nts

- if: ${{ inputs['build-frankenphp'] == true }}
name: "Install go-xcaddy for FrankenPHP"
run: |
case "${{ inputs.os }}" in
linux-x86_64|linux-aarch64)
./bin/spc-alpine-docker install-pkg go-xcaddy
;;
linux-x86_64-glibc|linux-aarch64-glibc)
./bin/spc-gnu-docker install-pkg go-xcaddy
;;
macos-x86_64|macos-aarch64)
composer update --no-dev --classmap-authoritative
./bin/spc doctor --auto-fix
./bin/spc install-pkg go-xcaddy
;;
*)
echo "Unsupported OS for go-xcaddy install: ${{ inputs.os }}"
exit 1
;;
esac

# Cache downloaded source
- id: cache-download
uses: actions/cache@v4
Expand Down Expand Up @@ -245,7 +305,22 @@ jobs:
name: php-fpm-${{ inputs.php-version }}-${{ inputs.os }}
path: buildroot/bin/php-fpm

# Upload frankenphp executable
- if: ${{ inputs['build-frankenphp'] == true }}
name: "Upload FrankenPHP SAPI"
uses: actions/upload-artifact@v4
with:
name: php-frankenphp-${{ inputs.php-version }}-${{ inputs.os }}
path: buildroot/bin/frankenphp

# Upload extensions metadata
- if: ${{ inputs['shared-extensions'] != '' }}
name: "Upload shared extensions"
uses: actions/upload-artifact@v4
with:
name: php-shared-ext-${{ inputs.php-version }}-${{ inputs.os }}
path: |
buildroot/modules/*.so
- uses: actions/upload-artifact@v4
name: "Upload License Files"
with:
Expand Down
1 change: 1 addition & 0 deletions config/ext.json
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@
"arg-type-unix": "enable-path",
"cpp-extension": true,
"lib-depends": [
"grpc",
"zlib",
"openssl",
"libcares"
Expand Down
23 changes: 19 additions & 4 deletions config/lib.json
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,7 @@
"zlib"
],
"lib-suggests": [
"libpng",
"bzip2",
"brotli"
"libpng"
]
},
"gettext": {
Expand Down Expand Up @@ -355,6 +353,9 @@
"static-libs-unix": [
"libaom.a"
],
"static-libs-windows": [
"aom.lib"
],
"cpp-library": true
},
"libargon2": {
Expand Down Expand Up @@ -493,7 +494,7 @@
"static-libs-windows": [
"libjpeg_a.lib"
],
"lib-suggests-windows": [
"lib-depends": [
"zlib"
]
},
Expand Down Expand Up @@ -862,6 +863,9 @@
},
"openssl": {
"source": "openssl",
"pkg-configs": [
"openssl"
],
"static-libs-unix": [
"libssl.a",
"libcrypto.a"
Expand Down Expand Up @@ -974,6 +978,11 @@
},
"unixodbc": {
"source": "unixodbc",
"pkg-configs": [
"odbc",
"odbccr",
"odbcinst"
],
"static-libs-unix": [
"libodbc.a",
"libodbccr.a",
Expand Down Expand Up @@ -1015,6 +1024,9 @@
},
"zlib": {
"source": "zlib",
"pkg-configs": [
"zlib"
],
"static-libs-unix": [
"libz.a"
],
Expand All @@ -1028,6 +1040,9 @@
},
"zstd": {
"source": "zstd",
"pkg-configs": [
"libzstd"
],
"static-libs-unix": [
"libzstd.a"
],
Expand Down
3 changes: 2 additions & 1 deletion config/pkg/ext/builtin-extensions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ ext-curl:
depends:
- curl
depends@windows:
- curl
- ext-zlib
- ext-openssl
php-extension:
Expand Down Expand Up @@ -342,6 +343,6 @@ ext-zlib:
- zlib
php-extension:
arg-type: custom
arg-type@windows: with
arg-type@windows: enable
build-with-php: true
build-shared: false
1 change: 1 addition & 0 deletions config/pkg/ext/ext-amqp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ ext-amqp:
depends:
- librabbitmq
depends@windows:
- librabbitmq
- ext-openssl
php-extension:
arg-type: '--with-amqp@shared_suffix@ --with-librabbitmq-dir=@build_root_path@'
Expand Down
3 changes: 2 additions & 1 deletion config/source.json
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,7 @@
"libjpeg": {
"type": "ghtar",
"repo": "libjpeg-turbo/libjpeg-turbo",
"prefer-stable": true,
"license": {
"type": "file",
"path": "LICENSE.md"
Expand Down Expand Up @@ -1054,7 +1055,7 @@
},
"protobuf": {
"type": "url",
"url": "https://pecl.php.net/get/protobuf",
"url": "https://pecl.php.net/get/protobuf-5.34.1.tgz",
"path": "php-src/ext/protobuf",
"filename": "protobuf.tgz",
"license": {
Expand Down
6 changes: 4 additions & 2 deletions docs/en/guide/action-build.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ while also defining the extensions to compile.

1. Fork project.
2. Go to the Actions of the project and select `CI`.
3. Select `Run workflow`, fill in the PHP version you want to compile, the target type, and the list of extensions. (extensions comma separated, e.g. `bcmath,curl,mbstring`)
4. After waiting for about a period of time, enter the corresponding task and get `Artifacts`.
3. Select `Run workflow`, fill in the PHP version you want to compile, the target type, and the list of static extensions. (comma separated, e.g. `bcmath,curl,mbstring`)
4. If you need shared extensions (for example `xdebug`), set `shared-extensions` (comma separated, e.g. `xdebug`).
5. If you need FrankenPHP, enable `build-frankenphp` and also enable `enable-zts`.
6. After waiting for about a period of time, enter the corresponding task and get `Artifacts`.

If you enable `debug`, all logs will be output at build time, including compiled logs, for troubleshooting.

Expand Down
4 changes: 3 additions & 1 deletion docs/zh/guide/action-build.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ Action 构建指的是直接使用 GitHub Action 进行编译。
1. Fork 本项目。
2. 进入项目的 Actions,选择 CI 开头的 Workflow(根据你需要的操作系统选择)。
3. 选择 `Run workflow`,填入你要编译的 PHP 版本、目标类型、扩展列表。(扩展列表使用英文逗号分割,例如 `bcmath,curl,mbstring`)
4. 等待大约一段时间后,进入对应的任务中,获取 `Artifacts`。
4. 如果需要共享扩展(例如 `xdebug`),请设置 `shared-extensions`(使用英文逗号分割,例如 `xdebug`)。
5. 如果需要 FrankenPHP,请启用 `build-frankenphp`,同时也需要启用 `enable-zts`。
6. 等待大约一段时间后,进入对应的任务中,获取 `Artifacts`。

如果你选择了 `debug`,则会在构建时输出所有日志,包括编译的日志,以供排查错误。

Expand Down
26 changes: 26 additions & 0 deletions src/Package/Extension/curl.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

declare(strict_types=1);

namespace Package\Extension;

use Package\Target\php;
use StaticPHP\Attribute\Package\BeforeStage;
use StaticPHP\Attribute\Package\Extension;
use StaticPHP\Attribute\PatchDescription;

#[Extension('curl')]
class curl
{
#[BeforeStage('php', [php::class, 'makeForWindows'], 'ext-curl')]
#[PatchDescription('Inject secur32.lib into SPC_EXTRA_LIBS for Schannel SSL support')]
public function addSecur32LibForWindows(): void
{
// curl on Windows uses Schannel (USE_WINDOWS_SSPI=ON, CURL_USE_SCHANNEL=ON),
// which requires secur32.lib for SSL/TLS functions (SslEncryptPackage, etc.).
$extra_libs = getenv('SPC_EXTRA_LIBS') ?: '';
if (!str_contains($extra_libs, 'secur32.lib')) {
putenv('SPC_EXTRA_LIBS=' . trim($extra_libs . ' secur32.lib'));
}
}
}
4 changes: 4 additions & 0 deletions src/Package/Library/nghttp2.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use StaticPHP\Package\LibraryPackage;
use StaticPHP\Runtime\Executor\UnixAutoconfExecutor;
use StaticPHP\Runtime\Executor\WindowsCMakeExecutor;
use StaticPHP\Util\FileSystem;

#[Library('nghttp2')]
class nghttp2
Expand All @@ -26,6 +27,9 @@ public function buildWin(LibraryPackage $lib): void
'-DBUILD_TESTING=OFF',
)
->build();

FileSystem::replaceFileStr($lib->getIncludeDir() . '\nghttp2\nghttp2.h', '#ifdef NGHTTP2_STATICLIB', '#if 1');

}

#[BuildFor('Linux')]
Expand Down
2 changes: 1 addition & 1 deletion src/Package/Library/ngtcp2.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function buildWin(LibraryPackage $lib): void
'-DBUILD_SHARED_LIBS=OFF',
'-DENABLE_STATIC_CRT=ON',
'-DENABLE_LIB_ONLY=ON',
'-DENABLE_OPENSSL=ON',
'-DENABLE_OPENSSL=OFF',
)
->build();
}
Expand Down
31 changes: 31 additions & 0 deletions src/Package/Target/php.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
use StaticPHP\Attribute\Package\Info;
use StaticPHP\Attribute\Package\InitPackage;
use StaticPHP\Attribute\Package\ResolveBuild;
use StaticPHP\Attribute\Package\Stage;
use StaticPHP\Attribute\Package\Target;
use StaticPHP\Attribute\Package\Validate;
use StaticPHP\Config\PackageConfig;
Expand All @@ -29,6 +30,7 @@
use StaticPHP\Toolchain\ToolchainManager;
use StaticPHP\Util\DependencyResolver;
use StaticPHP\Util\FileSystem;
use StaticPHP\Util\InteractiveTerm;
use StaticPHP\Util\SourcePatcher;
use StaticPHP\Util\V2CompatLayer;
use Symfony\Component\Console\Input\InputArgument;
Expand Down Expand Up @@ -339,6 +341,35 @@ public function beforeBuild(PackageBuilder $builder, Package $package): void
FileSystem::removeDir(BUILD_MODULES_PATH);
}

#[Stage('postInstall')]
public function postInstall(TargetPackage $package, PackageInstaller $installer): void
{
if ($package->getName() === 'frankenphp') {
$package->runStage([$this, 'smokeTestFrankenphpForUnix']);
return;
}
if ($package->getName() !== 'php') {
return;
}
if (SystemTarget::isUnix()) {
if ($installer->interactive) {
InteractiveTerm::indicateProgress('Running PHP smoke tests');
}
$package->runStage([$this, 'smokeTestForUnix']);
if ($installer->interactive) {
InteractiveTerm::finish('PHP smoke tests passed');
}
} elseif (SystemTarget::getTargetOS() === 'Windows') {
if ($installer->interactive) {
InteractiveTerm::indicateProgress('Running PHP smoke tests');
}
$package->runStage([$this, 'smokeTestForWindows']);
if ($installer->interactive) {
InteractiveTerm::finish('PHP smoke tests passed');
}
}
}

private function makeStaticExtensionString(PackageInstaller $installer): string
{
$arg = [];
Expand Down
Loading