[3.0] Refactor windows extensions (#1073)

This commit is contained in:
Jerry Ma
2026-04-11 15:01:25 +08:00
committed by GitHub
138 changed files with 2595 additions and 524 deletions

View File

@@ -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
@@ -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
@@ -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
@@ -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
@@ -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 }}"
@@ -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"
@@ -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
@@ -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:

3
.gitignore vendored
View File

@@ -67,3 +67,6 @@ spc.exe
# dumped files from StaticPHP v3
/dump-*.json
# config parse cache
/.spc.cache.php

57
TODO.md Normal file
View File

@@ -0,0 +1,57 @@
# v3 TODO List
Tracking items identified during the v2 → v3 migration audit.
---
## Commands
- [ ] Implement `craft` command (drives full build from `craft.yml`; should be easier with v3 vendor/registry mode)
- [x] Migrate `micro:combine` command (combine `micro.sfx` with PHP code + INI injection)
- [ ] Implement `dump-extensions` command (extract required extensions from `composer.json` / `composer.lock`)
- [ ] Design and implement v3 dev toolchain commands (WIP — needs design decision):
- [ ] `dev:extensions` / equivalent listing command
- [ ] `dev:php-version`, `dev:ext-version`, `dev:lib-version`
- [ ] Doc generation commands (`dev:gen-ext-docs`, `dev:gen-ext-dep-docs`, `dev:gen-lib-dep-docs`) — pending v3 doc design
---
## Source Patches (SourcePatcher → Artifact migration)
The following v2 `SourcePatcher` hooks are not yet migrated to v3 `src/Package/Artifact/` classes:
- [ ] Migrate `patchSQLSRVWin32` — removes `/sdl` compile flag to prevent Zend build failure on Windows
- [ ] Migrate `patchSQLSRVPhp85` — fixes `pdo_sqlsrv` directory layout for PHP 8.5
- [ ] Migrate `patchYamlWin32` — patches `config.w32` `_a.lib` detection logic for the `yaml` extension
- [ ] Migrate `patchImagickWith84` — applies PHP 8.4 compatibility patch for `imagick` based on version detection
---
## Extension Package Classes (Unix)
Extensions that had non-trivial v2 build logic and are missing a v3 `src/Package/Extension/` class:
- [x] `gettext` — macOS: fix `config.m4` bracket syntax for cross-version compatibility + append frameworks to linker flags (critical for macOS linking; this is a Unix-side gap, not Windows-only)
---
## Windows Extensions (Early Stage)
Windows extension support is still in early stage. The following extensions had Windows-specific configure args or patches in v2 and are pending v3 Windows implementation:
- [ ] `amqp` — Windows configure args
- [ ] `com_dotnet` — Windows-only extension
- [ ] `dom` — remove `dllmain.c` from `config.w32`
- [ ] `ev` — fix `PHP_EV_SHARED` in `config.w32`
- [ ] `gmssl` — add `CHECK_LIB("gmssl.lib")` to `config.w32`
- [ ] `intl` — fix `PHP_INTL_SHARED` in `config.w32`
- [ ] `lz4` — Windows configure args
- [ ] `mbregex` — Windows configure args
- [ ] `sqlsrv` / `pdo_sqlsrv` — complex conditional build logic (independent `sqlsrv` without `pdo_sqlsrv`)
- [ ] `xml` — remove `dllmain.c` from `config.w32`; handles `soap`, `xmlreader`, `xmlwriter`, `simplexml`
---
## Documentation
- [ ] Write v3 user documentation (currently zero v3 docs)

View File

@@ -1,4 +1,12 @@
#!/usr/bin/env bash
# Use SPC_XDEBUG=profile to enable Xdebug profiling mode, which will generate profiling files in /tmp.
# Otherwise, it will enable Xdebug debugging mode, which allows you to connect a debugger to port 9003.
if [ "$SPC_XDEBUG" = "profile" ]; then
XDEBUG_PREFIX="-d xdebug.mode=profile -d xdebug.start_with_request=yes -d xdebug.output_dir=/tmp -d xdebug.output_name=spc-profile.%t.%p.%r"
else
XDEBUG_PREFIX="-d xdebug.mode=debug -d xdebug.client_host=127.0.0.1 -d xdebug.client_port=9003 -d xdebug.start_with_request=yes"
fi
# This script runs the 'spc' command with Xdebug enabled for debugging purposes.
php -d xdebug.mode=debug -d xdebug.client_host=127.0.0.1 -d xdebug.client_port=9003 -d xdebug.start_with_request=yes "$(dirname "$0")/../bin/spc" "$@"
php $XDEBUG_PREFIX "$(dirname "$0")/../bin/spc" "$@"

View File

@@ -49,7 +49,7 @@
"scripts": {
"analyse": "phpstan analyse --memory-limit 300M",
"cs-fix": "php-cs-fixer fix",
"lint-config": "bin/spc dev:lint-config",
"lint-config": "php bin/spc dev:lint-config",
"test": "vendor/bin/phpunit tests/ --no-coverage",
"build:phar": "vendor/bin/box compile"
},
@@ -63,6 +63,9 @@
"optimize-autoloader": true,
"sort-packages": true
},
"suggest": {
"ext-yaml": "Speeds up YAML config file parsing"
},
"funding": [
{
"type": "other",

379
composer.lock generated
View File

@@ -4,20 +4,20 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "f30595c9c60e55083112410cd1ffb203",
"content-hash": "1d5518bdf7730190aead0e953abff538",
"packages": [
{
"name": "laravel/prompts",
"version": "v0.3.12",
"version": "v0.3.15",
"source": {
"type": "git",
"url": "https://github.com/laravel/prompts.git",
"reference": "4861ded9003b7f8a158176a0b7666f74ee761be8"
"reference": "4bb8107ec97651fd3f17f897d6489dbc4d8fb999"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/prompts/zipball/4861ded9003b7f8a158176a0b7666f74ee761be8",
"reference": "4861ded9003b7f8a158176a0b7666f74ee761be8",
"url": "https://api.github.com/repos/laravel/prompts/zipball/4bb8107ec97651fd3f17f897d6489dbc4d8fb999",
"reference": "4bb8107ec97651fd3f17f897d6489dbc4d8fb999",
"shasum": ""
},
"require": {
@@ -61,22 +61,22 @@
"description": "Add beautiful and user-friendly forms to your command-line applications.",
"support": {
"issues": "https://github.com/laravel/prompts/issues",
"source": "https://github.com/laravel/prompts/tree/v0.3.12"
"source": "https://github.com/laravel/prompts/tree/v0.3.15"
},
"time": "2026-02-03T06:57:26+00:00"
"time": "2026-03-17T13:45:17+00:00"
},
{
"name": "laravel/serializable-closure",
"version": "v2.0.9",
"version": "v2.0.10",
"source": {
"type": "git",
"url": "https://github.com/laravel/serializable-closure.git",
"reference": "8f631589ab07b7b52fead814965f5a800459cb3e"
"reference": "870fc81d2f879903dfc5b60bf8a0f94a1609e669"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/serializable-closure/zipball/8f631589ab07b7b52fead814965f5a800459cb3e",
"reference": "8f631589ab07b7b52fead814965f5a800459cb3e",
"url": "https://api.github.com/repos/laravel/serializable-closure/zipball/870fc81d2f879903dfc5b60bf8a0f94a1609e669",
"reference": "870fc81d2f879903dfc5b60bf8a0f94a1609e669",
"shasum": ""
},
"require": {
@@ -124,168 +124,7 @@
"issues": "https://github.com/laravel/serializable-closure/issues",
"source": "https://github.com/laravel/serializable-closure"
},
"time": "2026-02-03T06:55:34+00:00"
},
{
"name": "nette/php-generator",
"version": "v4.2.1",
"source": {
"type": "git",
"url": "https://github.com/nette/php-generator.git",
"reference": "52aff4d9b12f20ca9f3e31a559b646d2fd21dd61"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nette/php-generator/zipball/52aff4d9b12f20ca9f3e31a559b646d2fd21dd61",
"reference": "52aff4d9b12f20ca9f3e31a559b646d2fd21dd61",
"shasum": ""
},
"require": {
"nette/utils": "^4.0.6",
"php": "8.1 - 8.5"
},
"require-dev": {
"jetbrains/phpstorm-attributes": "^1.2",
"nette/tester": "^2.6",
"nikic/php-parser": "^5.0",
"phpstan/phpstan": "^2.0@stable",
"tracy/tracy": "^2.8"
},
"suggest": {
"nikic/php-parser": "to use ClassType::from(withBodies: true) & ClassType::fromCode()"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "4.2-dev"
}
},
"autoload": {
"psr-4": {
"Nette\\": "src"
},
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause",
"GPL-2.0-only",
"GPL-3.0-only"
],
"authors": [
{
"name": "David Grudl",
"homepage": "https://davidgrudl.com"
},
{
"name": "Nette Community",
"homepage": "https://nette.org/contributors"
}
],
"description": "🐘 Nette PHP Generator: generates neat PHP code for you. Supports new PHP 8.5 features.",
"homepage": "https://nette.org",
"keywords": [
"code",
"nette",
"php",
"scaffolding"
],
"support": {
"issues": "https://github.com/nette/php-generator/issues",
"source": "https://github.com/nette/php-generator/tree/v4.2.1"
},
"time": "2026-02-09T05:43:31+00:00"
},
{
"name": "nette/utils",
"version": "v4.1.2",
"source": {
"type": "git",
"url": "https://github.com/nette/utils.git",
"reference": "f76b5dc3d6c6d3043c8d937df2698515b99cbaf5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nette/utils/zipball/f76b5dc3d6c6d3043c8d937df2698515b99cbaf5",
"reference": "f76b5dc3d6c6d3043c8d937df2698515b99cbaf5",
"shasum": ""
},
"require": {
"php": "8.2 - 8.5"
},
"conflict": {
"nette/finder": "<3",
"nette/schema": "<1.2.2"
},
"require-dev": {
"jetbrains/phpstorm-attributes": "^1.2",
"nette/tester": "^2.5",
"phpstan/phpstan": "^2.0@stable",
"tracy/tracy": "^2.9"
},
"suggest": {
"ext-gd": "to use Image",
"ext-iconv": "to use Strings::webalize(), toAscii(), chr() and reverse()",
"ext-intl": "to use Strings::webalize(), toAscii(), normalize() and compare()",
"ext-json": "to use Nette\\Utils\\Json",
"ext-mbstring": "to use Strings::lower() etc...",
"ext-tokenizer": "to use Nette\\Utils\\Reflection::getUseStatements()"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "4.1-dev"
}
},
"autoload": {
"psr-4": {
"Nette\\": "src"
},
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause",
"GPL-2.0-only",
"GPL-3.0-only"
],
"authors": [
{
"name": "David Grudl",
"homepage": "https://davidgrudl.com"
},
{
"name": "Nette Community",
"homepage": "https://nette.org/contributors"
}
],
"description": "🛠 Nette Utils: lightweight utilities for string & array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.",
"homepage": "https://nette.org",
"keywords": [
"array",
"core",
"datetime",
"images",
"json",
"nette",
"paginator",
"password",
"slugify",
"string",
"unicode",
"utf-8",
"utility",
"validation"
],
"support": {
"issues": "https://github.com/nette/utils/issues",
"source": "https://github.com/nette/utils/tree/v4.1.2"
},
"time": "2026-02-03T17:21:09+00:00"
"time": "2026-02-20T19:59:49+00:00"
},
{
"name": "php-di/invoker",
@@ -520,16 +359,16 @@
},
{
"name": "symfony/console",
"version": "v7.4.4",
"version": "v7.4.7",
"source": {
"type": "git",
"url": "https://github.com/symfony/console.git",
"reference": "41e38717ac1dd7a46b6bda7d6a82af2d98a78894"
"reference": "e1e6770440fb9c9b0cf725f81d1361ad1835329d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/41e38717ac1dd7a46b6bda7d6a82af2d98a78894",
"reference": "41e38717ac1dd7a46b6bda7d6a82af2d98a78894",
"url": "https://api.github.com/repos/symfony/console/zipball/e1e6770440fb9c9b0cf725f81d1361ad1835329d",
"reference": "e1e6770440fb9c9b0cf725f81d1361ad1835329d",
"shasum": ""
},
"require": {
@@ -594,7 +433,7 @@
"terminal"
],
"support": {
"source": "https://github.com/symfony/console/tree/v7.4.4"
"source": "https://github.com/symfony/console/tree/v7.4.7"
},
"funding": [
{
@@ -614,7 +453,7 @@
"type": "tidelift"
}
],
"time": "2026-01-13T11:36:38+00:00"
"time": "2026-03-06T14:06:20+00:00"
},
{
"name": "symfony/deprecation-contracts",
@@ -1172,16 +1011,16 @@
},
{
"name": "symfony/string",
"version": "v8.0.4",
"version": "v8.0.6",
"source": {
"type": "git",
"url": "https://github.com/symfony/string.git",
"reference": "758b372d6882506821ed666032e43020c4f57194"
"reference": "6c9e1108041b5dce21a9a4984b531c4923aa9ec4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/string/zipball/758b372d6882506821ed666032e43020c4f57194",
"reference": "758b372d6882506821ed666032e43020c4f57194",
"url": "https://api.github.com/repos/symfony/string/zipball/6c9e1108041b5dce21a9a4984b531c4923aa9ec4",
"reference": "6c9e1108041b5dce21a9a4984b531c4923aa9ec4",
"shasum": ""
},
"require": {
@@ -1238,7 +1077,7 @@
"utf8"
],
"support": {
"source": "https://github.com/symfony/string/tree/v8.0.4"
"source": "https://github.com/symfony/string/tree/v8.0.6"
},
"funding": [
{
@@ -1258,20 +1097,20 @@
"type": "tidelift"
}
],
"time": "2026-01-12T12:37:40+00:00"
"time": "2026-02-09T10:14:57+00:00"
},
{
"name": "symfony/yaml",
"version": "v7.4.1",
"version": "v7.4.6",
"source": {
"type": "git",
"url": "https://github.com/symfony/yaml.git",
"reference": "24dd4de28d2e3988b311751ac49e684d783e2345"
"reference": "58751048de17bae71c5aa0d13cb19d79bca26391"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/yaml/zipball/24dd4de28d2e3988b311751ac49e684d783e2345",
"reference": "24dd4de28d2e3988b311751ac49e684d783e2345",
"url": "https://api.github.com/repos/symfony/yaml/zipball/58751048de17bae71c5aa0d13cb19d79bca26391",
"reference": "58751048de17bae71c5aa0d13cb19d79bca26391",
"shasum": ""
},
"require": {
@@ -1314,7 +1153,7 @@
"description": "Loads and dumps YAML files",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/yaml/tree/v7.4.1"
"source": "https://github.com/symfony/yaml/tree/v7.4.6"
},
"funding": [
{
@@ -1334,7 +1173,7 @@
"type": "tidelift"
}
],
"time": "2025-12-04T18:11:45+00:00"
"time": "2026-02-09T09:33:46+00:00"
},
{
"name": "zhamao/logger",
@@ -2217,7 +2056,7 @@
},
{
"name": "captainhook/captainhook-phar",
"version": "5.28.0",
"version": "5.29.0",
"source": {
"type": "git",
"url": "https://github.com/captainhook-git/captainhook-phar.git",
@@ -2271,7 +2110,7 @@
],
"support": {
"issues": "https://github.com/captainhook-git/captainhook/issues",
"source": "https://github.com/captainhook-git/captainhook-phar/tree/5.28.0"
"source": "https://github.com/captainhook-git/captainhook-phar/tree/5.29.0"
},
"funding": [
{
@@ -2968,16 +2807,16 @@
},
{
"name": "friendsofphp/php-cs-fixer",
"version": "v3.93.1",
"version": "v3.94.2",
"source": {
"type": "git",
"url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git",
"reference": "b3546ab487c0762c39f308dc1ec0ea2c461fc21a"
"reference": "7787ceff91365ba7d623ec410b8f429cdebb4f63"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/b3546ab487c0762c39f308dc1ec0ea2c461fc21a",
"reference": "b3546ab487c0762c39f308dc1ec0ea2c461fc21a",
"url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/7787ceff91365ba7d623ec410b8f429cdebb4f63",
"reference": "7787ceff91365ba7d623ec410b8f429cdebb4f63",
"shasum": ""
},
"require": {
@@ -2994,7 +2833,7 @@
"react/event-loop": "^1.5",
"react/socket": "^1.16",
"react/stream": "^1.4",
"sebastian/diff": "^4.0.6 || ^5.1.1 || ^6.0.2 || ^7.0",
"sebastian/diff": "^4.0.6 || ^5.1.1 || ^6.0.2 || ^7.0 || ^8.0",
"symfony/console": "^5.4.47 || ^6.4.24 || ^7.0 || ^8.0",
"symfony/event-dispatcher": "^5.4.45 || ^6.4.24 || ^7.0 || ^8.0",
"symfony/filesystem": "^5.4.45 || ^6.4.24 || ^7.0 || ^8.0",
@@ -3008,18 +2847,18 @@
"symfony/stopwatch": "^5.4.45 || ^6.4.24 || ^7.0 || ^8.0"
},
"require-dev": {
"facile-it/paraunit": "^1.3.1 || ^2.7",
"infection/infection": "^0.32",
"justinrainbow/json-schema": "^6.6",
"facile-it/paraunit": "^1.3.1 || ^2.7.1",
"infection/infection": "^0.32.3",
"justinrainbow/json-schema": "^6.6.4",
"keradus/cli-executor": "^2.3",
"mikey179/vfsstream": "^1.6.12",
"php-coveralls/php-coveralls": "^2.9",
"php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.6",
"php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.6",
"phpunit/phpunit": "^9.6.31 || ^10.5.60 || ^11.5.48",
"php-coveralls/php-coveralls": "^2.9.1",
"php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.7",
"php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.7",
"phpunit/phpunit": "^9.6.34 || ^10.5.63 || ^11.5.51",
"symfony/polyfill-php85": "^1.33",
"symfony/var-dumper": "^5.4.48 || ^6.4.26 || ^7.4.0 || ^8.0",
"symfony/yaml": "^5.4.45 || ^6.4.30 || ^7.4.1 || ^8.0"
"symfony/var-dumper": "^5.4.48 || ^6.4.32 || ^7.4.4 || ^8.0.4",
"symfony/yaml": "^5.4.45 || ^6.4.30 || ^7.4.1 || ^8.0.1"
},
"suggest": {
"ext-dom": "For handling output formats in XML",
@@ -3060,7 +2899,7 @@
],
"support": {
"issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues",
"source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.93.1"
"source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.94.2"
},
"funding": [
{
@@ -3068,20 +2907,20 @@
"type": "github"
}
],
"time": "2026-01-28T23:50:50+00:00"
"time": "2026-02-20T16:13:53+00:00"
},
{
"name": "humbug/box",
"version": "4.6.10",
"version": "4.7.0",
"source": {
"type": "git",
"url": "https://github.com/box-project/box.git",
"reference": "6dc6a1314d63e9d75c8195c996e1081e68514c36"
"reference": "9c2a430118f61ba4a20bc4969931494503f5da6a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/box-project/box/zipball/6dc6a1314d63e9d75c8195c996e1081e68514c36",
"reference": "6dc6a1314d63e9d75c8195c996e1081e68514c36",
"url": "https://api.github.com/repos/box-project/box/zipball/9c2a430118f61ba4a20bc4969931494503f5da6a",
"reference": "9c2a430118f61ba4a20bc4969931494503f5da6a",
"shasum": ""
},
"require": {
@@ -3180,9 +3019,9 @@
],
"support": {
"issues": "https://github.com/box-project/box/issues",
"source": "https://github.com/box-project/box/tree/4.6.10"
"source": "https://github.com/box-project/box/tree/4.7.0"
},
"time": "2025-10-31T18:38:02+00:00"
"time": "2026-03-18T09:34:43+00:00"
},
{
"name": "humbug/php-scoper",
@@ -3317,16 +3156,16 @@
},
{
"name": "justinrainbow/json-schema",
"version": "6.6.4",
"version": "v6.7.2",
"source": {
"type": "git",
"url": "https://github.com/jsonrainbow/json-schema.git",
"reference": "2eeb75d21cf73211335888e7f5e6fd7440723ec7"
"reference": "6fea66c7204683af437864e7c4e7abf383d14bc0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/jsonrainbow/json-schema/zipball/2eeb75d21cf73211335888e7f5e6fd7440723ec7",
"reference": "2eeb75d21cf73211335888e7f5e6fd7440723ec7",
"url": "https://api.github.com/repos/jsonrainbow/json-schema/zipball/6fea66c7204683af437864e7c4e7abf383d14bc0",
"reference": "6fea66c7204683af437864e7c4e7abf383d14bc0",
"shasum": ""
},
"require": {
@@ -3386,9 +3225,9 @@
],
"support": {
"issues": "https://github.com/jsonrainbow/json-schema/issues",
"source": "https://github.com/jsonrainbow/json-schema/tree/6.6.4"
"source": "https://github.com/jsonrainbow/json-schema/tree/v6.7.2"
},
"time": "2025-12-19T15:01:32+00:00"
"time": "2026-02-15T15:06:22+00:00"
},
{
"name": "kelunik/certificate",
@@ -3450,20 +3289,20 @@
},
{
"name": "league/uri",
"version": "7.8.0",
"version": "7.8.1",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/uri.git",
"reference": "4436c6ec8d458e4244448b069cc572d088230b76"
"reference": "08cf38e3924d4f56238125547b5720496fac8fd4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thephpleague/uri/zipball/4436c6ec8d458e4244448b069cc572d088230b76",
"reference": "4436c6ec8d458e4244448b069cc572d088230b76",
"url": "https://api.github.com/repos/thephpleague/uri/zipball/08cf38e3924d4f56238125547b5720496fac8fd4",
"reference": "08cf38e3924d4f56238125547b5720496fac8fd4",
"shasum": ""
},
"require": {
"league/uri-interfaces": "^7.8",
"league/uri-interfaces": "^7.8.1",
"php": "^8.1",
"psr/http-factory": "^1"
},
@@ -3536,7 +3375,7 @@
"docs": "https://uri.thephpleague.com",
"forum": "https://thephpleague.slack.com",
"issues": "https://github.com/thephpleague/uri-src/issues",
"source": "https://github.com/thephpleague/uri/tree/7.8.0"
"source": "https://github.com/thephpleague/uri/tree/7.8.1"
},
"funding": [
{
@@ -3544,20 +3383,20 @@
"type": "github"
}
],
"time": "2026-01-14T17:24:56+00:00"
"time": "2026-03-15T20:22:25+00:00"
},
{
"name": "league/uri-interfaces",
"version": "7.8.0",
"version": "7.8.1",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/uri-interfaces.git",
"reference": "c5c5cd056110fc8afaba29fa6b72a43ced42acd4"
"reference": "85d5c77c5d6d3af6c54db4a78246364908f3c928"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thephpleague/uri-interfaces/zipball/c5c5cd056110fc8afaba29fa6b72a43ced42acd4",
"reference": "c5c5cd056110fc8afaba29fa6b72a43ced42acd4",
"url": "https://api.github.com/repos/thephpleague/uri-interfaces/zipball/85d5c77c5d6d3af6c54db4a78246364908f3c928",
"reference": "85d5c77c5d6d3af6c54db4a78246364908f3c928",
"shasum": ""
},
"require": {
@@ -3620,7 +3459,7 @@
"docs": "https://uri.thephpleague.com",
"forum": "https://thephpleague.slack.com",
"issues": "https://github.com/thephpleague/uri-src/issues",
"source": "https://github.com/thephpleague/uri-interfaces/tree/7.8.0"
"source": "https://github.com/thephpleague/uri-interfaces/tree/7.8.1"
},
"funding": [
{
@@ -3628,7 +3467,7 @@
"type": "github"
}
],
"time": "2026-01-15T06:54:53+00:00"
"time": "2026-03-08T20:05:35+00:00"
},
{
"name": "marc-mabe/php-enum",
@@ -4260,16 +4099,16 @@
},
{
"name": "phpdocumentor/reflection-docblock",
"version": "5.6.6",
"version": "5.6.7",
"source": {
"type": "git",
"url": "https://github.com/phpDocumentor/ReflectionDocBlock.git",
"reference": "5cee1d3dfc2d2aa6599834520911d246f656bcb8"
"reference": "31a105931bc8ffa3a123383829772e832fd8d903"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/5cee1d3dfc2d2aa6599834520911d246f656bcb8",
"reference": "5cee1d3dfc2d2aa6599834520911d246f656bcb8",
"url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/31a105931bc8ffa3a123383829772e832fd8d903",
"reference": "31a105931bc8ffa3a123383829772e832fd8d903",
"shasum": ""
},
"require": {
@@ -4318,9 +4157,9 @@
"description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.",
"support": {
"issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues",
"source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.6.6"
"source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.6.7"
},
"time": "2025-12-22T21:13:58+00:00"
"time": "2026-03-18T20:47:46+00:00"
},
{
"name": "phpdocumentor/type-resolver",
@@ -4429,11 +4268,11 @@
},
{
"name": "phpstan/phpstan",
"version": "2.1.38",
"version": "2.1.42",
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/dfaf1f530e1663aa167bc3e52197adb221582629",
"reference": "dfaf1f530e1663aa167bc3e52197adb221582629",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/1279e1ce86ba768f0780c9d889852b4e02ff40d0",
"reference": "1279e1ce86ba768f0780c9d889852b4e02ff40d0",
"shasum": ""
},
"require": {
@@ -4478,7 +4317,7 @@
"type": "github"
}
],
"time": "2026-01-30T17:12:46+00:00"
"time": "2026-03-17T14:58:32+00:00"
},
{
"name": "phpunit/php-code-coverage",
@@ -6894,16 +6733,16 @@
},
{
"name": "symfony/filesystem",
"version": "v7.4.0",
"version": "v7.4.6",
"source": {
"type": "git",
"url": "https://github.com/symfony/filesystem.git",
"reference": "d551b38811096d0be9c4691d406991b47c0c630a"
"reference": "3ebc794fa5315e59fd122561623c2e2e4280538e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/filesystem/zipball/d551b38811096d0be9c4691d406991b47c0c630a",
"reference": "d551b38811096d0be9c4691d406991b47c0c630a",
"url": "https://api.github.com/repos/symfony/filesystem/zipball/3ebc794fa5315e59fd122561623c2e2e4280538e",
"reference": "3ebc794fa5315e59fd122561623c2e2e4280538e",
"shasum": ""
},
"require": {
@@ -6940,7 +6779,7 @@
"description": "Provides basic utilities for the filesystem",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/filesystem/tree/v7.4.0"
"source": "https://github.com/symfony/filesystem/tree/v7.4.6"
},
"funding": [
{
@@ -6960,20 +6799,20 @@
"type": "tidelift"
}
],
"time": "2025-11-27T13:27:24+00:00"
"time": "2026-02-25T16:50:00+00:00"
},
{
"name": "symfony/finder",
"version": "v7.4.5",
"version": "v7.4.6",
"source": {
"type": "git",
"url": "https://github.com/symfony/finder.git",
"reference": "ad4daa7c38668dcb031e63bc99ea9bd42196a2cb"
"reference": "8655bf1076b7a3a346cb11413ffdabff50c7ffcf"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/finder/zipball/ad4daa7c38668dcb031e63bc99ea9bd42196a2cb",
"reference": "ad4daa7c38668dcb031e63bc99ea9bd42196a2cb",
"url": "https://api.github.com/repos/symfony/finder/zipball/8655bf1076b7a3a346cb11413ffdabff50c7ffcf",
"reference": "8655bf1076b7a3a346cb11413ffdabff50c7ffcf",
"shasum": ""
},
"require": {
@@ -7008,7 +6847,7 @@
"description": "Finds files and directories via an intuitive fluent interface",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/finder/tree/v7.4.5"
"source": "https://github.com/symfony/finder/tree/v7.4.6"
},
"funding": [
{
@@ -7028,7 +6867,7 @@
"type": "tidelift"
}
],
"time": "2026-01-26T15:07:59+00:00"
"time": "2026-01-29T09:40:50+00:00"
},
{
"name": "symfony/options-resolver",
@@ -7333,16 +7172,16 @@
},
{
"name": "symfony/var-dumper",
"version": "v7.4.4",
"version": "v7.4.6",
"source": {
"type": "git",
"url": "https://github.com/symfony/var-dumper.git",
"reference": "0e4769b46a0c3c62390d124635ce59f66874b282"
"reference": "045321c440ac18347b136c63d2e9bf28a2dc0291"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/0e4769b46a0c3c62390d124635ce59f66874b282",
"reference": "0e4769b46a0c3c62390d124635ce59f66874b282",
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/045321c440ac18347b136c63d2e9bf28a2dc0291",
"reference": "045321c440ac18347b136c63d2e9bf28a2dc0291",
"shasum": ""
},
"require": {
@@ -7396,7 +7235,7 @@
"dump"
],
"support": {
"source": "https://github.com/symfony/var-dumper/tree/v7.4.4"
"source": "https://github.com/symfony/var-dumper/tree/v7.4.6"
},
"funding": [
{
@@ -7416,20 +7255,20 @@
"type": "tidelift"
}
],
"time": "2026-01-01T22:13:48+00:00"
"time": "2026-02-15T10:53:20+00:00"
},
{
"name": "thecodingmachine/safe",
"version": "v3.3.0",
"version": "v3.4.0",
"source": {
"type": "git",
"url": "https://github.com/thecodingmachine/safe.git",
"reference": "2cdd579eeaa2e78e51c7509b50cc9fb89a956236"
"reference": "705683a25bacf0d4860c7dea4d7947bfd09eea19"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thecodingmachine/safe/zipball/2cdd579eeaa2e78e51c7509b50cc9fb89a956236",
"reference": "2cdd579eeaa2e78e51c7509b50cc9fb89a956236",
"url": "https://api.github.com/repos/thecodingmachine/safe/zipball/705683a25bacf0d4860c7dea4d7947bfd09eea19",
"reference": "705683a25bacf0d4860c7dea4d7947bfd09eea19",
"shasum": ""
},
"require": {
@@ -7539,7 +7378,7 @@
"description": "PHP core functions that throw exceptions instead of returning FALSE on error",
"support": {
"issues": "https://github.com/thecodingmachine/safe/issues",
"source": "https://github.com/thecodingmachine/safe/tree/v3.3.0"
"source": "https://github.com/thecodingmachine/safe/tree/v3.4.0"
},
"funding": [
{
@@ -7550,12 +7389,16 @@
"url": "https://github.com/shish",
"type": "github"
},
{
"url": "https://github.com/silasjoisten",
"type": "github"
},
{
"url": "https://github.com/staabm",
"type": "github"
}
],
"time": "2025-05-14T06:15:44+00:00"
"time": "2026-02-04T18:08:13+00:00"
},
{
"name": "theseer/tokenizer",

View File

@@ -63,7 +63,8 @@
],
"ext-depends-windows": [
"zlib",
"openssl"
"openssl",
"brotli"
]
},
"dba": {
@@ -252,6 +253,7 @@
"arg-type-unix": "enable-path",
"cpp-extension": true,
"lib-depends": [
"grpc",
"zlib",
"openssl",
"libcares"

View File

@@ -109,8 +109,7 @@
"krb5"
],
"lib-suggests-windows": [
"brotli",
"zstd"
"brotli"
],
"frameworks": [
"CoreFoundation",
@@ -143,9 +142,7 @@
"zlib"
],
"lib-suggests": [
"libpng",
"bzip2",
"brotli"
"libpng"
]
},
"gettext": {
@@ -355,6 +352,9 @@
"static-libs-unix": [
"libaom.a"
],
"static-libs-windows": [
"aom.lib"
],
"cpp-library": true
},
"libargon2": {
@@ -493,7 +493,7 @@
"static-libs-windows": [
"libjpeg_a.lib"
],
"lib-suggests-windows": [
"lib-depends": [
"zlib"
]
},
@@ -762,7 +762,6 @@
"xz"
],
"lib-suggests-windows": [
"zstd",
"openssl"
]
},
@@ -862,6 +861,9 @@
},
"openssl": {
"source": "openssl",
"pkg-configs": [
"openssl"
],
"static-libs-unix": [
"libssl.a",
"libcrypto.a"
@@ -974,6 +976,11 @@
},
"unixodbc": {
"source": "unixodbc",
"pkg-configs": [
"odbc",
"odbccr",
"odbcinst"
],
"static-libs-unix": [
"libodbc.a",
"libodbccr.a",
@@ -991,6 +998,9 @@
],
"headers": [
"wtr/watcher-c.h"
],
"frameworks": [
"CoreServices"
]
},
"xz": {
@@ -1015,6 +1025,9 @@
},
"zlib": {
"source": "zlib",
"pkg-configs": [
"zlib"
],
"static-libs-unix": [
"libz.a"
],
@@ -1028,6 +1041,9 @@
},
"zstd": {
"source": "zstd",
"pkg-configs": [
"libzstd"
],
"static-libs-unix": [
"libzstd.a"
],

View File

@@ -9,6 +9,12 @@ ext-bz2:
arg-type@windows: with
ext-calendar:
type: php-extension
ext-com_dotnet:
type: php-extension
php-extension:
os:
- Windows
arg-type@windows: '--enable-com-dotnet=yes'
ext-ctype:
type: php-extension
ext-curl:
@@ -16,6 +22,7 @@ ext-curl:
depends:
- curl
depends@windows:
- curl
- ext-zlib
- ext-openssl
php-extension:
@@ -29,17 +36,20 @@ ext-dba:
ext-dom:
type: php-extension
depends:
- libxml2
- ext-xml
php-extension:
arg-type: '--enable-dom@shared_suffix@ --with-libxml=@build_root_path@'
arg-type: enable
arg-type@windows: with
ext-exif:
type: php-extension
depends@windows:
- ext-mbstring
ext-ffi:
type: php-extension
depends@unix:
- libffi
depends@windows:
- libffi-win
php-extension:
arg-type@unix: '--with-ffi=@shared_suffix@ --enable-zend-signals'
arg-type@windows: with
@@ -64,28 +74,37 @@ ext-gd:
- freetype
php-extension:
arg-type: custom
arg-type@windows: with
ext-gettext:
type: php-extension
depends:
depends@unix:
- gettext
depends@windows:
- gettext-win
php-extension:
arg-type: with-path
arg-type@windows: with
ext-gmp:
type: php-extension
depends:
depends@unix:
- gmp
depends@windows:
- mpir
php-extension:
arg-type: with-path
arg-type@windows: with
ext-iconv:
type: php-extension
depends@unix:
- libiconv
depends@windows:
- libiconv-win
php-extension:
arg-type@unix: with-path
arg-type@windows: with
ext-intl:
type: php-extension
depends@unix:
depends:
- icu
ext-ldap:
type: php-extension
@@ -96,15 +115,20 @@ ext-ldap:
- libsodium
- ext-openssl
php-extension:
os:
- Linux
- Darwin
arg-type: with-path
arg-type@windows: with
ext-libxml:
type: php-extension
depends:
- ext-xml
- libxml2
php-extension:
build-with-php: true
build-shared: false
arg-type: none
arg-type@unix: with-path
arg-type@windows: with
ext-mbregex:
type: php-extension
depends:
@@ -140,6 +164,7 @@ ext-odbc:
- unixodbc
php-extension:
arg-type@unix: '--with-unixODBC@shared_path_suffix@'
arg-type@windows: enable
ext-opcache:
type: php-extension
php-extension:
@@ -163,10 +188,17 @@ ext-password-argon2:
- libargon2
- ext-openssl
php-extension:
os:
- Linux
- Darwin
arg-type: custom
display-name: ''
ext-pcntl:
type: php-extension
php-extension:
os:
- Linux
- Darwin
ext-pdo:
type: php-extension
ext-pdo_mysql:
@@ -180,7 +212,6 @@ ext-pdo_odbc:
type: php-extension
depends:
- ext-pdo
- ext-odbc
depends@unix:
- unixodbc
- ext-pdo
@@ -189,7 +220,7 @@ ext-pdo_odbc:
arg-type: custom
ext-pdo_pgsql:
type: php-extension
depends@unix:
depends:
- ext-pdo
- ext-pgsql
- postgresql
@@ -206,7 +237,7 @@ ext-pdo_sqlite:
arg-type: with
ext-pgsql:
type: php-extension
depends@unix:
depends:
- postgresql
php-extension:
arg-type: custom
@@ -216,15 +247,19 @@ ext-phar:
- zlib
ext-posix:
type: php-extension
php-extension:
os:
- Linux
- Darwin
ext-readline:
type: php-extension
depends:
depends@unix:
- libedit
depends@windows:
- wineditline
php-extension:
support:
Windows: wip
BSD: wip
arg-type: '--with-libedit --without-readline'
arg-type@windows: with
build-shared: false
build-static: true
ext-session:
@@ -238,7 +273,7 @@ ext-simplexml:
depends:
- ext-xml
php-extension:
arg-type@unix: '--enable-simplexml@shared_suffix@ --with-libxml=@build_root_path@'
arg-type@unix: enable
arg-type@windows: with
build-with-php: true
ext-snmp:
@@ -246,6 +281,9 @@ ext-snmp:
depends:
- net-snmp
php-extension:
os:
- Linux
- Darwin
arg-type: with
ext-soap:
type: php-extension
@@ -253,8 +291,7 @@ ext-soap:
- ext-xml
- ext-session
php-extension:
arg-type@unix: '--enable-soap@shared_suffix@ --with-libxml=@build_root_path@'
arg-type@windows: with
arg-type: enable
build-with-php: true
ext-sockets:
type: php-extension
@@ -275,28 +312,22 @@ ext-sqlite3:
ext-sysvmsg:
type: php-extension
php-extension:
support:
Windows: 'no'
BSD: wip
os:
- Linux
- Darwin
ext-sysvsem:
type: php-extension
php-extension:
support:
Windows: 'no'
BSD: wip
os:
- Linux
- Darwin
ext-sysvshm:
type: php-extension
php-extension:
support:
BSD: wip
ext-tidy:
type: php-extension
depends:
- tidy
php-extension:
support:
Windows: wip
BSD: wip
arg-type: with-path
ext-tokenizer:
type: php-extension
@@ -305,27 +336,27 @@ ext-tokenizer:
ext-xml:
type: php-extension
depends:
- libxml2
- ext-libxml
depends@windows:
- libxml2
- ext-iconv
- ext-libxml
php-extension:
arg-type: '--enable-xml@shared_suffix@ --with-libxml=@build_root_path@'
arg-type@unix: enable
arg-type@windows: with
build-with-php: true
ext-xmlreader:
type: php-extension
depends:
- libxml2
- ext-xml
php-extension:
arg-type: '--enable-xmlreader@shared_suffix@ --with-libxml=@build_root_path@'
arg-type: enable
build-with-php: true
ext-xmlwriter:
type: php-extension
depends:
- libxml2
- ext-xml
php-extension:
arg-type: '--enable-xmlwriter@shared_suffix@ --with-libxml=@build_root_path@'
arg-type: enable
build-with-php: true
ext-xsl:
type: php-extension
@@ -342,6 +373,6 @@ ext-zlib:
- zlib
php-extension:
arg-type: custom
arg-type@windows: with
arg-type@windows: enable
build-with-php: true
build-shared: false

View File

@@ -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@'

View File

@@ -14,6 +14,7 @@ ext-event:
suggests:
- ext-sockets
php-extension:
support:
Windows: wip
os:
- Linux
- Darwin
arg-type: custom

View File

@@ -7,3 +7,7 @@ ext-excimer:
metadata:
license-files: [LICENSE]
license: PHP-3.01
php-extension:
os:
- Linux
- Darwin

View File

@@ -11,4 +11,7 @@ ext-grpc:
- grpc
lang: cpp
php-extension:
os:
- Linux
- Darwin
arg-type@unix: enable-path

View File

@@ -10,4 +10,7 @@ ext-imagick:
depends:
- imagemagick
php-extension:
os:
- Linux
- Darwin
arg-type: custom

View File

@@ -12,4 +12,7 @@ ext-imap:
suggests:
- ext-openssl
php-extension:
os:
- Linux
- Darwin
arg-type: custom

View File

@@ -7,3 +7,6 @@ ext-inotify:
metadata:
license-files: [LICENSE]
license: PHP-3.01
php-extension:
os:
- Linux

View File

@@ -2,8 +2,9 @@ ext-lz4:
type: php-extension
artifact:
source:
type: ghtagtar
repo: kjdev/php-ext-lz4
type: git
url: 'https://github.com/kjdev/php-ext-lz4.git'
rev: master
extract: php-src/ext/lz4
metadata:
license-files: [LICENSE]

View File

@@ -9,7 +9,9 @@ ext-mongodb:
metadata:
license-files: [LICENSE]
license: PHP-3.01
suggests:
depends@windows:
- ext-openssl
suggests@unix:
- icu
- openssl
- zstd
@@ -18,4 +20,5 @@ ext-mongodb:
- CoreFoundation
- Security
php-extension:
arg-type: custom
arg-type@unix: custom
arg-type@windows: '--enable-mongodb --with-mongodb-client-side-encryption'

View File

@@ -7,3 +7,7 @@ ext-parallel:
metadata:
license-files: [LICENSE]
license: PHP-3.01
depends@windows:
- pthreads4w
php-extension:
arg-type@windows: with

View File

@@ -7,3 +7,7 @@ ext-protobuf:
metadata:
license-files: [LICENSE]
license: BSD-3-Clause
php-extension:
os:
- Linux
- Darwin

View File

@@ -12,4 +12,7 @@ ext-rdkafka:
- librdkafka
lang: cpp
php-extension:
os:
- Linux
- Darwin
arg-type: custom

View File

@@ -16,3 +16,4 @@ ext-snappy:
lang: cpp
php-extension:
arg-type@unix: '--enable-snappy --with-snappy-includedir=@build_root_path@'
arg-type@windows: '--enable-snappy'

View File

@@ -11,4 +11,7 @@ ext-spx:
depends:
- ext-zlib
php-extension:
os:
- Linux
- Darwin
arg-type: '--enable-SPX@shared_suffix@'

View File

@@ -34,6 +34,9 @@ ext-swoole:
- ext-swoole-hook-odbc
lang: cpp
php-extension:
os:
- Linux
- Darwin
arg-type: custom
ext-swoole-hook-mysql:
type: php-extension
@@ -44,6 +47,9 @@ ext-swoole-hook-mysql:
suggests:
- ext-mysqli
php-extension:
os:
- Linux
- Darwin
arg-type: none
display-name: swoole
ext-swoole-hook-odbc:
@@ -52,6 +58,9 @@ ext-swoole-hook-odbc:
- ext-pdo
- unixodbc
php-extension:
os:
- Linux
- Darwin
arg-type: none
display-name: swoole
ext-swoole-hook-pgsql:
@@ -60,6 +69,9 @@ ext-swoole-hook-pgsql:
- ext-pgsql
- ext-pdo
php-extension:
os:
- Linux
- Darwin
arg-type: none
display-name: swoole
ext-swoole-hook-sqlite:
@@ -68,5 +80,8 @@ ext-swoole-hook-sqlite:
- ext-sqlite3
- ext-pdo
php-extension:
os:
- Linux
- Darwin
arg-type: none
display-name: swoole

View File

@@ -8,7 +8,4 @@ ext-trader:
license-files: [LICENSE]
license: BSD-2-Clause
php-extension:
support:
BSD: wip
Windows: wip
arg-type: enable

View File

@@ -10,7 +10,7 @@ ext-uuid:
depends:
- libuuid
php-extension:
support:
Windows: wip
BSD: wip
os:
- Linux
- Darwin
arg-type: with-path

View File

@@ -12,7 +12,4 @@ ext-uv:
- libuv
- ext-sockets
php-extension:
support:
Windows: wip
BSD: wip
arg-type: with-path

View File

@@ -8,6 +8,9 @@ ext-xdebug:
license-files: [LICENSE]
license: Xdebug-1.03
php-extension:
os:
- Linux
- Darwin
zend-extension: true
build-static: false
build-shared: true

View File

@@ -11,8 +11,8 @@ ext-xhprof:
depends:
- ext-ctype
php-extension:
support:
Windows: wip
BSD: wip
os:
- Linux
- Darwin
arg-type: enable
build-with-php: true

View File

@@ -13,6 +13,5 @@ ext-xlswriter:
suggests:
- openssl
php-extension:
support:
BSD: wip
arg-type: custom
arg-type@windows: '--with-xlswriter'

View File

@@ -13,3 +13,4 @@ ext-xz:
- xz
php-extension:
arg-type: with-path
arg-type@windows: enable

View File

@@ -8,10 +8,8 @@ ext-zip:
metadata:
license-files: [LICENSE]
license: PHP-3.01
depends@unix:
depends:
- libzip
php-extension:
support:
BSD: wip
arg-type: custom
arg-type@windows: enable

View File

@@ -11,5 +11,8 @@ ext-zstd:
license: MIT
depends:
- zstd
suggests:
- ext-apcu
php-extension:
arg-type: '--enable-zstd --with-libzstd=@build_root_path@'
arg-type@windows: '--enable-zstd'

View File

@@ -0,0 +1,9 @@
gettext-win:
type: library
artifact:
source:
type: git
url: 'https://github.com/winlibs/gettext.git'
rev: master
static-libs@windows:
- libintl_a.lib

View File

@@ -1,6 +1,11 @@
glfw:
type: library
artifact: glfw
headers:
- GLFW/glfw3.h
- GLFW/glfw3native.h
lang: cpp
static-libs@unix:
- libglfw3.a
static-libs@windows:
- glfw3.lib

View File

@@ -2,9 +2,8 @@ krb5:
type: library
artifact:
source:
type: ghtagtar
repo: krb5/krb5
match: krb5.+-final
type: url
url: 'https://web.mit.edu/kerberos/dist/krb5/1.22/krb5-1.22.2.tar.gz'
metadata:
license-files: [NOTICE]
license: BSD-3-Clause

View File

@@ -11,3 +11,5 @@ liblz4:
license: BSD-2-Clause
static-libs@unix:
- liblz4.a
static-libs@windows:
- lz4.lib

View File

@@ -14,3 +14,5 @@ libmaxminddb:
- maxminddb_config.h
static-libs@unix:
- libmaxminddb.a
static-libs@windows:
- libmaxminddb.lib

View File

@@ -9,3 +9,5 @@ libuv:
license: MIT
static-libs@unix:
- libuv.a
static-libs@windows:
- libuv.lib

View File

@@ -13,3 +13,6 @@ libxslt:
static-libs@unix:
- libxslt.a
- libexslt.a
static-libs@windows:
- libxslt_a.lib
- libexslt_a.lib

9
config/pkg/lib/mpir.yml Normal file
View File

@@ -0,0 +1,9 @@
mpir:
type: library
artifact:
source:
type: git
url: 'https://github.com/winlibs/mpir.git'
rev: master
static-libs@windows:
- mpir_a.lib

View File

@@ -15,6 +15,13 @@ snappy:
- snappy-c.h
- snappy-sinksource.h
- snappy-stubs-public.h
headers@windows:
- snappy.h
- snappy-c.h
- snappy-sinksource.h
- snappy-stubs-public.h
lang: cpp
static-libs@unix:
- libsnappy.a
static-libs@windows:
- snappy.lib

View File

@@ -10,3 +10,5 @@ tidy:
license: W3C
static-libs@unix:
- libtidy.a
static-libs@windows:
- tidy_a.lib

View File

@@ -8,6 +8,8 @@ watcher:
metadata:
license-files: [license]
license: MIT
frameworks:
- CoreServices
headers:
- wtr/watcher-c.h
lang: cpp

View File

@@ -0,0 +1,14 @@
wineditline:
type: library
artifact:
source:
type: git
url: 'https://github.com/winlibs/wineditline.git'
rev: master
metadata:
license-files: [COPYING]
license: GPL-2.0-or-later
headers:
- editline
static-libs@windows:
- edit_a.lib

View File

@@ -18,4 +18,4 @@ zstd:
static-libs@unix:
- libzstd.a
static-libs@windows:
- zstd_static.lib
- zstd.lib

View File

@@ -462,10 +462,8 @@
}
},
"krb5": {
"type": "ghtagtar",
"repo": "krb5/krb5",
"match": "krb5.+-final",
"prefer-stable": true,
"type": "url",
"url": "https://web.mit.edu/kerberos/dist/krb5/1.22/krb5-1.22.2.tar.gz",
"license": {
"type": "file",
"path": "NOTICE"
@@ -641,6 +639,7 @@
"libjpeg": {
"type": "ghtar",
"repo": "libjpeg-turbo/libjpeg-turbo",
"prefer-stable": true,
"license": {
"type": "file",
"path": "LICENSE.md"
@@ -1054,7 +1053,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": {

View File

@@ -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.

View File

@@ -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`,则会在构建时输出所有日志,包括编译的日志,以供排查错误。

View File

@@ -0,0 +1,31 @@
<?php
declare(strict_types=1);
namespace Package\Artifact;
use StaticPHP\Attribute\Artifact\AfterSourceExtract;
use StaticPHP\Attribute\PatchDescription;
use StaticPHP\Util\SourcePatcher;
class imagick
{
#[AfterSourceExtract('ext-imagick')]
#[PatchDescription('Patch imagick for PHP 8.4 compatibility (versions < 3.8.0)')]
public function patchImagickWith84(): void
{
// match imagick version id
$file = SOURCE_PATH . '/php-src/ext/imagick/php_imagick.h';
if (!file_exists($file)) {
return;
}
$content = file_get_contents($file);
if (preg_match('/#define PHP_IMAGICK_EXTNUM\s+(\d+)/', $content, $match) === 0) {
return;
}
$extnum = intval($match[1]);
if ($extnum < 30800) {
SourcePatcher::patchFile('imagick_php84_before_30800.patch', SOURCE_PATH . '/php-src/ext/imagick');
}
}
}

View File

@@ -45,7 +45,13 @@ class php_src
FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/ext/gd/libgd/gdft.c', '#ifndef MSWIN32', '#ifndef _WIN32');
}
// custom config.w32, because official config.w32 is hard-coded many things
$origin = $ver_id >= 80100 ? file_get_contents(ROOT_DIR . '/src/globals/extra/gd_config_81.w32') : file_get_contents(ROOT_DIR . '/src/globals/extra/gd_config_80.w32');
if ($ver_id >= 80500) {
$origin = file_get_contents(ROOT_DIR . '/src/globals/extra/gd_config_85.w32');
} elseif ($ver_id >= 80100) {
$origin = file_get_contents(ROOT_DIR . '/src/globals/extra/gd_config_81.w32');
} else {
$origin = file_get_contents(ROOT_DIR . '/src/globals/extra/gd_config_80.w32');
}
file_put_contents(SOURCE_PATH . '/php-src/ext/gd/config.w32.bak', file_get_contents(SOURCE_PATH . '/php-src/ext/gd/config.w32'));
file_put_contents(SOURCE_PATH . '/php-src/ext/gd/config.w32', $origin);
}

View File

@@ -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'));
}
}
}

View File

@@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace Package\Extension;
use Package\Target\php;
use StaticPHP\Attribute\Package\BeforeStage;
use StaticPHP\Attribute\Package\Extension;
use StaticPHP\Package\PhpExtensionPackage;
use StaticPHP\Util\FileSystem;
#[Extension('ev')]
class ev extends PhpExtensionPackage
{
#[BeforeStage('php', [php::class, 'buildconfForWindows'], 'ext-ev')]
public function patchBeforeBuildconf(): bool
{
/*
* replace EXTENSION('ev', php_ev_sources, true, ' /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1');
* to EXTENSION('ev', php_ev_sources, PHP_EV_SHARED, ' /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1');
*/
FileSystem::replaceFileLineContainsString(
"{$this->getSourceDir()}\\config.w32",
'EXTENSION(\'ev\'',
" EXTENSION('ev', php_ev_sources, PHP_EV_SHARED, ' /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1');"
);
return true;
}
}

View File

@@ -16,6 +16,7 @@ use StaticPHP\Util\FileSystem;
class glfw extends PhpExtensionPackage
{
#[BeforeStage('php', [php::class, 'buildconfForUnix'], 'ext-glfw')]
#[BeforeStage('php', [php::class, 'buildconfForWindows'], 'ext-glfw')]
#[PatchDescription('Patch glfw extension before buildconf')]
public function patchBeforeBuildconf(): void
{

View File

@@ -29,6 +29,15 @@ class grpc extends PhpExtensionPackage
'zend_ce_exception,',
);
// Fix include path conflict with pdo_sqlsrv: grpc's PHP ext dir is added to the global include path via
$grpc_php_dir = "{$this->getSourceDir()}/src/php/ext/grpc";
if (file_exists("{$grpc_php_dir}/version.h")) {
copy("{$grpc_php_dir}/version.h", "{$grpc_php_dir}/php_grpc_version.h");
unlink("{$grpc_php_dir}/version.h");
FileSystem::replaceFileStr("{$grpc_php_dir}/php_grpc.h", '#include "version.h"', '#include "php_grpc_version.h"');
FileSystem::replaceFileStr("{$grpc_php_dir}/php_grpc.c", '#include "version.h"', '#include "php_grpc_version.h"');
}
// custom config.m4 content for grpc extension, to prevent building libgrpc.a again
$config_m4 = <<<'M4'
PHP_ARG_ENABLE(grpc, [whether to enable grpc support], [AS_HELP_STRING([--enable-grpc], [Enable grpc support])])

View File

@@ -0,0 +1,29 @@
<?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;
use StaticPHP\Package\PackageInstaller;
use StaticPHP\Package\PhpExtensionPackage;
use StaticPHP\Util\FileSystem;
#[Extension('intl')]
class intl extends PhpExtensionPackage
{
#[BeforeStage('php', [php::class, 'buildconfForWindows'], 'ext-intl')]
#[PatchDescription('Fix intl config.w32: replace hardcoded true with PHP_INTL_SHARED for static build support')]
public function patchBeforeBuildconfForWindows(PackageInstaller $installer): void
{
$php_src = $installer->getTargetPackage('php')->getSourceDir();
FileSystem::replaceFileStr(
"{$php_src}/ext/intl/config.w32",
'EXTENSION("intl", "php_intl.c intl_convert.c intl_convertcpp.cpp intl_error.c ", true,',
'EXTENSION("intl", "php_intl.c intl_convert.c intl_convertcpp.cpp intl_error.c ", PHP_INTL_SHARED,'
);
}
}

View File

@@ -15,6 +15,7 @@ use StaticPHP\Util\FileSystem;
class maxminddb extends PhpExtensionPackage
{
#[BeforeStage('php', [php::class, 'buildconfForUnix'], 'ext-maxminddb')]
#[BeforeStage('php', [php::class, 'buildconfForWindows'], 'ext-maxminddb')]
#[PatchDescription('Patch maxminddb extension for buildconf to support new source structure')]
public function patchBeforeBuildconf(): void
{

View File

@@ -12,6 +12,7 @@ class mbregex
{
#[CustomPhpConfigureArg('Linux')]
#[CustomPhpConfigureArg('Darwin')]
#[CustomPhpConfigureArg('Windows')]
public function getUnixConfigureArg(): string
{
return '';

View File

@@ -19,4 +19,10 @@ class mbstring
$arg .= $installer->isPackageResolved('ext-mbregex') === false ? ' --disable-mbregex' : ' --enable-mbregex';
return $arg;
}
#[CustomPhpConfigureArg('Windows')]
public function getWinConfigureArg(PackageInstaller $installer): string
{
return '--enable-mbstring ' . ($installer->isPackageResolved('ext-mbregex') ? '--enable-mbregex' : ' --disable-mbregex');
}
}

View File

@@ -4,14 +4,27 @@ declare(strict_types=1);
namespace Package\Extension;
use Package\Target\php;
use StaticPHP\Attribute\Package\BeforeStage;
use StaticPHP\Attribute\Package\CustomPhpConfigureArg;
use StaticPHP\Attribute\Package\Extension;
use StaticPHP\Package\PackageInstaller;
use StaticPHP\Package\PhpExtensionPackage;
use StaticPHP\Util\FileSystem;
#[Extension('mongodb')]
class mongodb extends PhpExtensionPackage
{
#[BeforeStage('php', [php::class, 'buildconfForWindows'], 'ext-mongodb')]
public function patchBeforeBuild(): void
{
FileSystem::replaceFileStr(
"{$this->getSourceDir()}/config.w32",
'ADD_FLAG("CFLAGS_MONGODB", "/D KMS_MESSAGE_LITTLE_ENDIAN=1 /D MONGOCRYPT_LITTLE_ENDIAN=1 /D MLIB_USER=1");',
'ADD_FLAG("CFLAGS_MONGODB", "/D KMS_MESSAGE_LITTLE_ENDIAN=1 /D MONGOCRYPT_LITTLE_ENDIAN=1 /D MLIB_USER=1");' . "\n ADD_FLAG(\"CFLAGS_MONGODB\", \"/utf-8\");",
);
}
#[CustomPhpConfigureArg('Darwin')]
#[CustomPhpConfigureArg('Linux')]
public function getUnixConfigureArg(bool $shared, PackageInstaller $installer): string

View File

@@ -29,6 +29,7 @@ class opcache extends PhpExtensionPackage
}
#[BeforeStage('php', [php::class, 'buildconfForUnix'], 'ext-opcache')]
#[BeforeStage('php', [php::class, 'buildconfForWindows'], 'ext-opcache')]
#[PatchDescription('Fix static opcache build for PHP 8.2.0 to 8.4.x')]
public function patchBeforeBuildconf(PackageInstaller $installer): bool
{

View File

@@ -0,0 +1,39 @@
<?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;
use StaticPHP\Util\FileSystem;
#[Extension('pdo_sqlsrv')]
class pdo_sqlsrv
{
#[BeforeStage('php', [php::class, 'buildconfForWindows'], 'ext-pdo_sqlsrv')]
#[PatchDescription('Remove /sdl flag from pdo_sqlsrv config.w32 to prevent strict SDL check compilation failures')]
public function patchBeforeBuildconfForWindows(): void
{
// Fix the compilation issue of pdo_sqlsrv on Windows (/sdl check is too strict and will cause Zend compilation to fail)
if (file_exists(SOURCE_PATH . '/php-src/ext/pdo_sqlsrv/config.w32')) {
FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/ext/pdo_sqlsrv/config.w32', '/sdl', '');
}
}
#[BeforeStage('php', [php::class, 'buildconfForUnix'], 'ext-pdo_sqlsrv')]
#[PatchDescription('Fix pdo_sqlsrv directory structure for PHP 8.5+ (source layout changed)')]
public function patchDirectoryStructureForPhp85(): void
{
$source_dir = SOURCE_PATH . '/php-src/ext/pdo_sqlsrv';
if (!file_exists($source_dir . '/config.m4') && is_dir($source_dir . '/source/pdo_sqlsrv')) {
FileSystem::moveFileOrDir($source_dir . '/LICENSE', $source_dir . '/source/pdo_sqlsrv/LICENSE');
FileSystem::moveFileOrDir($source_dir . '/source/shared', $source_dir . '/source/pdo_sqlsrv/shared');
FileSystem::moveFileOrDir($source_dir . '/source/pdo_sqlsrv', SOURCE_PATH . '/pdo_sqlsrv');
FileSystem::removeDir($source_dir);
FileSystem::moveFileOrDir(SOURCE_PATH . '/pdo_sqlsrv', $source_dir);
}
}
}

View File

@@ -0,0 +1,40 @@
<?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;
use StaticPHP\Package\PackageInstaller;
use StaticPHP\Package\PhpExtensionPackage;
use StaticPHP\Util\FileSystem;
#[Extension('sqlsrv')]
class sqlsrv extends PhpExtensionPackage
{
#[BeforeStage('php', [php::class, 'buildconfForWindows'], 'ext-sqlsrv')]
#[PatchDescription('Remove /sdl /W4 /WX flags from sqlsrv config.w32 to prevent strict compilation failures on Windows (these flags get merged into STATIC_EXT_CFLAGS and applied to Zend engine files)')]
public function patchBeforeBuildconfForWindows(): void
{
// Fix the compilation issue of sqlsrv on Windows (/sdl causes C4703 to be treated as errors in Zend files)
if (file_exists(SOURCE_PATH . '/php-src/ext/sqlsrv/config.w32')) {
FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/ext/sqlsrv/config.w32', '/sdl /W4 /WX', '');
}
}
#[BeforeStage('php', [php::class, 'makeForWindows'], 'ext-sqlsrv')]
#[PatchDescription('Fix sqlsrv Makefile: remove /sdl /W4 /WX flags to prevent build errors on Windows')]
public function patchBeforeMake(PackageInstaller $installer): bool
{
$makefile = $installer->getTargetPackage('php')->getSourceDir() . '\Makefile';
$makeContent = file_get_contents($makefile);
$makeContent = preg_replace('/^(CFLAGS_(?:PDO_)?SQLSRV=.*?)\s+\/sdl\b/m', '$1', $makeContent);
$makeContent = preg_replace('/^(CFLAGS_(?:PDO_)?SQLSRV=.*?)\s+\/W4\b/m', '$1', $makeContent);
$makeContent = preg_replace('/^(CFLAGS_(?:PDO_)?SQLSRV=.*?)\s+\/WX\b/m', '$1', $makeContent);
file_put_contents($makefile, $makeContent);
return true;
}
}

View File

@@ -17,6 +17,7 @@ class swow extends PhpExtensionPackage
{
#[CustomPhpConfigureArg('Darwin')]
#[CustomPhpConfigureArg('Linux')]
#[CustomPhpConfigureArg('Windows')]
public function configureArg(PackageInstaller $installer): string
{
$arg = '--enable-swow';

View File

@@ -24,6 +24,21 @@ class uv extends PhpExtensionPackage
}
}
#[BeforeStage('php', [php::class, 'buildconfForWindows'], 'ext-uv')]
public function patchBeforeBuild(): void
{
FileSystem::replaceFileStr(
"{$this->getSourceDir()}/php_uv.c",
'#if !defined(PHP_WIN32) || defined(HAVE_SOCKET)',
'#if !defined(PHP_WIN32) || (defined(HAVE_SOCKETS) && !defined(COMPILE_DL_SOCKETS))',
);
FileSystem::replaceFileStr(
"{$this->getSourceDir()}/config.w32",
'CHECK_LIB("Ws2_32.lib","uv", PHP_UV);',
"CHECK_LIB(\"Ws2_32.lib\",\"uv\" , PHP_UV);\n\tCHECK_LIB(\"dbghelp.lib\",\"uv\", PHP_UV);",
);
}
#[BeforeStage('ext-uv', [PhpExtensionPackage::class, 'makeForUnix'])]
public function patchBeforeSharedMake(PhpExtensionPackage $pkg): bool
{

View File

@@ -4,10 +4,15 @@ declare(strict_types=1);
namespace Package\Extension;
use Package\Target\php;
use StaticPHP\Attribute\Package\BeforeStage;
use StaticPHP\Attribute\Package\CustomPhpConfigureArg;
use StaticPHP\Attribute\Package\Extension;
use StaticPHP\Attribute\PatchDescription;
use StaticPHP\Package\PackageInstaller;
use StaticPHP\Package\PhpExtensionPackage;
use StaticPHP\Util\GlobalEnvManager;
use StaticPHP\Util\SourcePatcher;
#[Extension('xlswriter')]
class xlswriter extends PhpExtensionPackage
@@ -22,4 +27,31 @@ class xlswriter extends PhpExtensionPackage
}
return $arg;
}
#[BeforeStage('php', [php::class, 'makeForUnix'], 'ext-xlswriter')]
#[PatchDescription('Fix Unix build: add -std=gnu17 to CFLAGS to fix build errors on older GCC versions')]
public function patchBeforeUnixMake(): void
{
GlobalEnvManager::putenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS=' . getenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS') . ' -std=gnu17');
}
#[BeforeStage('php', [php::class, 'makeForWindows'], 'ext-xlswriter')]
#[PatchDescription('Fix Windows build: apply win32 patch and add UTF-8 BOM to theme.c')]
public function patchBeforeMakeForWindows(): void
{
// fix windows build with openssl extension duplicate symbol bug
SourcePatcher::patchFile('spc_fix_xlswriter_win32.patch', $this->getSourceDir());
$content = file_get_contents($this->getSourceDir() . '/library/libxlsxwriter/src/theme.c');
$bom = pack('CCC', 0xEF, 0xBB, 0xBF);
if (!str_starts_with($content, $bom)) {
file_put_contents($this->getSourceDir() . '/library/libxlsxwriter/src/theme.c', $bom . $content);
}
}
public function getSharedExtensionEnv(): array
{
$parent = parent::getSharedExtensionEnv();
$parent['CFLAGS'] .= ' -std=gnu17';
return $parent;
}
}

View File

@@ -0,0 +1,21 @@
<?php
declare(strict_types=1);
namespace Package\Extension;
use Package\Target\php;
use StaticPHP\Attribute\Package\BeforeStage;
use StaticPHP\Attribute\Package\Extension;
use StaticPHP\Package\PhpExtensionPackage;
use StaticPHP\Util\FileSystem;
#[Extension('xz')]
class xz extends PhpExtensionPackage
{
#[BeforeStage('php', [php::class, 'buildconfForWindows'], 'ext-xz')]
public function patchBeforeBuildconf(): void
{
FileSystem::replaceFileStr($this->getSourceDir() . '/config.w32', 'true', 'PHP_XZ_SHARED');
}
}

View File

@@ -0,0 +1,28 @@
<?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;
use StaticPHP\Util\FileSystem;
#[Extension('yaml')]
class yaml
{
#[BeforeStage('php', [php::class, 'buildconfForWindows'], 'ext-yaml')]
#[PatchDescription('Fix yaml config.w32 to always link against static libyaml on Windows')]
public function patchBeforeBuildconfForWindows(): void
{
// Force static libyaml linkage: config.w32 normally only picks libs ending in '_a.lib',
// but libyaml may not follow that naming convention, so we add 'yes' == 'yes' to always match.
FileSystem::replaceFileStr(
SOURCE_PATH . '/php-src/ext/yaml/config.w32',
"lib.substr(lib.length - 6, 6) == '_a.lib'",
"lib.substr(lib.length - 6, 6) == '_a.lib' || 'yes' == 'yes'"
);
}
}

View File

@@ -0,0 +1,55 @@
<?php
declare(strict_types=1);
namespace Package\Library;
use StaticPHP\Attribute\Package\BuildFor;
use StaticPHP\Attribute\Package\Library;
use StaticPHP\Attribute\Package\PatchBeforeBuild;
use StaticPHP\Attribute\Package\Validate;
use StaticPHP\DI\ApplicationContext;
use StaticPHP\Exception\EnvironmentException;
use StaticPHP\Package\LibraryPackage;
use StaticPHP\Util\FileSystem;
use StaticPHP\Util\System\WindowsUtil;
#[Library('gettext-win')]
class gettext_win
{
#[Validate]
public function validate(): void
{
$ver = WindowsUtil::findVisualStudio();
$vs_ver_dir = match ($ver['major_version']) {
'17' => '\MSVC17',
'16' => '\MSVC16',
default => throw new EnvironmentException("Current VS version {$ver['major_version']} is not supported yet!"),
};
ApplicationContext::set('gettext_win_vs_ver_dir', $vs_ver_dir);
}
#[PatchBeforeBuild]
public function patchBeforeBuild(LibraryPackage $lib): void
{
$vs_ver_dir = ApplicationContext::get('gettext_win_vs_ver_dir');
$vcxproj = "{$lib->getSourceDir()}{$vs_ver_dir}\\libintl_static\\libintl_static.vcxproj";
// libintl_static uses /MD (MultiThreadedDLL) in Release configs, which causes unresolved __imp_* symbols
// when linking into PHP statically. Patch to /MT (MultiThreaded) for static CRT compatibility.
FileSystem::replaceFileStr($vcxproj, '<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>', '<RuntimeLibrary>MultiThreaded</RuntimeLibrary>');
}
#[BuildFor('Windows')]
public function build(LibraryPackage $lib): void
{
$vs_ver_dir = ApplicationContext::get('gettext_win_vs_ver_dir');
cmd()->cd("{$lib->getSourceDir()}{$vs_ver_dir}\\libintl_static")
->exec('msbuild libintl_static.vcxproj /t:Rebuild /p:Configuration=Release /p:Platform=x64 /p:WindowsTargetPlatformVersion=10.0');
FileSystem::createDir($lib->getLibDir());
FileSystem::createDir($lib->getIncludeDir());
// libintl_a.lib is the static library output; copy as libintl.lib for linker compatibility
FileSystem::copy("{$lib->getSourceDir()}{$vs_ver_dir}\\libintl_static\\x64\\Release\\libintl_a.lib", "{$lib->getLibDir()}\\libintl_a.lib");
// libgnuintl.h is the public API header, installed as libintl.h
FileSystem::copy("{$lib->getSourceDir()}\\source\\gettext-runtime\\intl\\libgnuintl.h", "{$lib->getIncludeDir()}\\libintl.h");
}
}

View File

@@ -11,6 +11,7 @@ use StaticPHP\Exception\BuildFailureException;
use StaticPHP\Exception\ValidationException;
use StaticPHP\Package\LibraryPackage;
use StaticPHP\Runtime\Executor\UnixCMakeExecutor;
use StaticPHP\Runtime\Executor\WindowsCMakeExecutor;
use StaticPHP\Runtime\SystemTarget;
use StaticPHP\Toolchain\Interface\ToolchainInterface;
@@ -97,4 +98,19 @@ class glfw
// patch pkgconf
$lib->patchPkgconfPrefix(['glfw3.pc']);
}
#[BuildFor('Windows')]
public function buildForWin(LibraryPackage $lib): void
{
WindowsCMakeExecutor::create($lib)
->setWorkingDir("{$lib->getSourceDir()}/vendor/glfw")
->setBuildDir("{$lib->getSourceDir()}/vendor/glfw")
->setReset(false)
->addConfigureArgs(
'-DGLFW_BUILD_EXAMPLES=OFF',
'-DGLFW_BUILD_TESTS=OFF',
'-DGLFW_BUILD_DOCS=OFF',
)
->build();
}
}

View File

@@ -19,7 +19,9 @@ class krb5
#[BuildFor('Darwin')]
public function build(LibraryPackage $lib, PackageInstaller $installer): void
{
shell()->cd($lib->getSourceRoot())->exec('autoreconf -if');
if (!file_exists($lib->getSourceRoot() . '/configure')) {
shell()->cd($lib->getSourceRoot())->exec('autoreconf -if');
}
$resolved = array_keys($installer->getResolvedPackages());
$spc = new SPCConfigUtil(['no_php' => true, 'libs_only_deps' => true]);

View File

@@ -22,6 +22,10 @@ class libjpeg
->addConfigureArgs(
'-DENABLE_STATIC=ON',
'-DENABLE_SHARED=OFF',
'-DWITH_SYSTEM_ZLIB=ON',
'-DWITH_TOOLS=OFF',
'-DWITH_TESTS=OFF',
'-DWITH_SIMD=OFF',
)
->build();
// patch pkgconfig
@@ -37,6 +41,7 @@ class libjpeg
'-DENABLE_STATIC=ON',
'-DBUILD_TESTING=OFF',
'-DWITH_JAVA=OFF',
'-DWITH_SIMD=OFF',
'-DWITH_CRT_DLL=OFF',
)
->optionalPackage('zlib', '-DENABLE_ZLIB_COMPRESSION=ON', '-DENABLE_ZLIB_COMPRESSION=OFF')

View File

@@ -10,6 +10,7 @@ use StaticPHP\Attribute\Package\PatchBeforeBuild;
use StaticPHP\Attribute\PatchDescription;
use StaticPHP\Package\LibraryPackage;
use StaticPHP\Package\PackageBuilder;
use StaticPHP\Runtime\Executor\WindowsCMakeExecutor;
use StaticPHP\Util\FileSystem;
#[Library('liblz4')]
@@ -22,6 +23,16 @@ class liblz4
FileSystem::replaceFileStr($lib->getSourceDir() . '/programs/Makefile', 'install: lz4', "install: lz4\n\ninstallewfwef: lz4");
}
#[BuildFor('Windows')]
public function buildWin(LibraryPackage $lib): void
{
WindowsCMakeExecutor::create($lib)
->setWorkingDir("{$lib->getSourceDir()}/build/cmake")
->setBuildDir("{$lib->getSourceDir()}/_win_build")
->addConfigureArgs('-DLZ4_BUILD_CLI=OFF')
->build();
}
#[BuildFor('Darwin')]
#[BuildFor('Linux')]
public function buildUnix(LibraryPackage $lib, PackageBuilder $builder): void

View File

@@ -8,6 +8,8 @@ use StaticPHP\Attribute\Package\BuildFor;
use StaticPHP\Attribute\Package\Library;
use StaticPHP\Package\LibraryPackage;
use StaticPHP\Runtime\Executor\UnixCMakeExecutor;
use StaticPHP\Runtime\Executor\WindowsCMakeExecutor;
use StaticPHP\Util\FileSystem;
#[Library('libmaxminddb')]
class libmaxminddb
@@ -23,4 +25,18 @@ class libmaxminddb
)
->build();
}
#[BuildFor('Windows')]
public function buildWindows(LibraryPackage $lib): void
{
WindowsCMakeExecutor::create($lib)
->addConfigureArgs(
'-DBUILD_TESTING=OFF',
'-DMAXMINDDB_BUILD_BINARIES=OFF',
)
->build();
if (!file_exists($lib->getLibDir() . '\libmaxminddb.lib')) {
FileSystem::copy("{$lib->getLibDir()}\\maxminddb.lib", "{$lib->getLibDir()}\\libmaxminddb.lib");
}
}
}

View File

@@ -8,6 +8,7 @@ use StaticPHP\Attribute\Package\BuildFor;
use StaticPHP\Attribute\Package\Library;
use StaticPHP\Package\LibraryPackage;
use StaticPHP\Runtime\Executor\UnixCMakeExecutor;
use StaticPHP\Runtime\Executor\WindowsCMakeExecutor;
#[Library('libuv')]
class libuv
@@ -22,4 +23,12 @@ class libuv
// patch pkgconfig
$lib->patchPkgconfPrefix(['libuv-static.pc']);
}
#[BuildFor('Windows')]
public function buildWindows(LibraryPackage $lib): void
{
WindowsCMakeExecutor::create($lib)
->addConfigureArgs('-DLIBUV_BUILD_SHARED=OFF')
->build();
}
}

View File

@@ -9,7 +9,9 @@ use StaticPHP\Attribute\Package\Library;
use StaticPHP\Package\LibraryPackage;
use StaticPHP\Package\PackageInstaller;
use StaticPHP\Runtime\Executor\UnixAutoconfExecutor;
use StaticPHP\Runtime\Executor\WindowsCMakeExecutor;
use StaticPHP\Runtime\SystemTarget;
use StaticPHP\Util\FileSystem;
use StaticPHP\Util\SPCConfigUtil;
#[Library('libxslt')]
@@ -49,4 +51,20 @@ class libxslt
->exec("{$AR} -t libxslt.a | grep '\\.a$' | xargs -n1 {$AR} d libxslt.a")
->exec("{$AR} -t libexslt.a | grep '\\.a$' | xargs -n1 {$AR} d libexslt.a");
}
#[BuildFor('Windows')]
public function buildWin(LibraryPackage $lib, PackageInstaller $installer): void
{
WindowsCMakeExecutor::create($lib)
->addConfigureArgs(
'-DBUILD_SHARED_LIBS=OFF',
'-DLIBXSLT_WITH_PROFILER=OFF',
'-DLIBXSLT_WITH_PROGRAMS=OFF',
'-DLIBXSLT_WITH_PYTHON=OFF',
'-DLIBXSLT_WITH_TESTS=OFF',
)
->build();
FileSystem::copy($lib->getLibDir() . '\libxslts.lib', $lib->getLibDir() . '\libxslt_a.lib');
FileSystem::copy($lib->getLibDir() . '\libexslts.lib', $lib->getLibDir() . '\libexslt_a.lib');
}
}

View File

@@ -0,0 +1,44 @@
<?php
declare(strict_types=1);
namespace Package\Library;
use StaticPHP\Attribute\Package\BuildFor;
use StaticPHP\Attribute\Package\Library;
use StaticPHP\Attribute\Package\Validate;
use StaticPHP\DI\ApplicationContext;
use StaticPHP\Exception\EnvironmentException;
use StaticPHP\Package\LibraryPackage;
use StaticPHP\Util\FileSystem;
use StaticPHP\Util\System\WindowsUtil;
#[Library('mpir')]
class mpir
{
#[Validate]
public function validate(): void
{
$ver = WindowsUtil::findVisualStudio();
$vs_ver_dir = match ($ver['major_version']) {
'17' => '\build.vc17',
'16' => '\build.vc16',
default => throw new EnvironmentException("Current VS version {$ver['major_version']} is not supported yet!"),
};
ApplicationContext::set('mpir_vs_ver_dir', $vs_ver_dir);
}
#[BuildFor('Windows')]
public function build(LibraryPackage $lib): void
{
$vs_ver_dir = ApplicationContext::get('mpir_vs_ver_dir');
cmd()->cd("{$lib->getSourceDir()}{$vs_ver_dir}\\lib_mpir_gc")
->exec('msbuild lib_mpir_gc.vcxproj /t:Rebuild /p:Configuration=Release /p:Platform=x64');
FileSystem::createDir($lib->getLibDir());
FileSystem::createDir($lib->getIncludeDir());
FileSystem::copy("{$lib->getSourceDir()}{$vs_ver_dir}\\lib_mpir_gc\\x64\\Release\\mpir_a.lib", "{$lib->getLibDir()}\\mpir_a.lib");
// mpir.h and gmp.h are generated by the prebuild step into the source root
FileSystem::copy("{$lib->getSourceDir()}\\mpir.h", "{$lib->getIncludeDir()}\\mpir.h");
FileSystem::copy("{$lib->getSourceDir()}\\gmp.h", "{$lib->getIncludeDir()}\\gmp.h");
}
}

View File

@@ -9,6 +9,7 @@ use StaticPHP\Attribute\Package\Library;
use StaticPHP\Package\LibraryPackage;
use StaticPHP\Runtime\Executor\UnixAutoconfExecutor;
use StaticPHP\Runtime\Executor\WindowsCMakeExecutor;
use StaticPHP\Util\FileSystem;
#[Library('nghttp2')]
class nghttp2
@@ -26,6 +27,8 @@ class nghttp2
'-DBUILD_TESTING=OFF',
)
->build();
FileSystem::replaceFileStr($lib->getIncludeDir() . '\nghttp2\nghttp2.h', '#ifdef NGHTTP2_STATICLIB', '#if 1');
}
#[BuildFor('Linux')]

View File

@@ -24,7 +24,7 @@ class ngtcp2
'-DBUILD_SHARED_LIBS=OFF',
'-DENABLE_STATIC_CRT=ON',
'-DENABLE_LIB_ONLY=ON',
'-DENABLE_OPENSSL=ON',
'-DENABLE_OPENSSL=OFF',
)
->build();
}

View File

@@ -8,6 +8,7 @@ use StaticPHP\Attribute\Package\BuildFor;
use StaticPHP\Attribute\Package\Library;
use StaticPHP\Package\LibraryPackage;
use StaticPHP\Runtime\Executor\UnixCMakeExecutor;
use StaticPHP\Runtime\Executor\WindowsCMakeExecutor;
#[Library('snappy')]
class snappy
@@ -24,4 +25,15 @@ class snappy
)
->build('../..');
}
#[BuildFor('Windows')]
public function buildWin(LibraryPackage $lib): void
{
WindowsCMakeExecutor::create($lib)
->addConfigureArgs(
'-DSNAPPY_BUILD_TESTS=OFF',
'-DSNAPPY_BUILD_BENCHMARKS=OFF',
)
->build();
}
}

View File

@@ -8,6 +8,8 @@ use StaticPHP\Attribute\Package\BuildFor;
use StaticPHP\Attribute\Package\Library;
use StaticPHP\Package\LibraryPackage;
use StaticPHP\Runtime\Executor\UnixCMakeExecutor;
use StaticPHP\Runtime\Executor\WindowsCMakeExecutor;
use StaticPHP\Util\FileSystem;
#[Library('tidy')]
class tidy
@@ -28,4 +30,18 @@ class tidy
$cmake->build();
$lib->patchPkgconfPrefix(['tidy.pc']);
}
#[BuildFor('Windows')]
public function buildWindows(LibraryPackage $lib): void
{
$cmake = WindowsCMakeExecutor::create($lib)
->setBuildDir("{$lib->getSourceDir()}/build-dir")
->addConfigureArgs(
'-DSUPPORT_CONSOLE_APP=OFF',
'-DBUILD_SHARED_LIB=OFF'
)->build();
// rename tidy_static.lib to tidy_a.lib
FileSystem::moveFileOrDir($lib->getLibDir() . '\tidy_static.lib', $lib->getLibDir() . '\tidy_a.lib');
}
}

View File

@@ -0,0 +1,23 @@
<?php
declare(strict_types=1);
namespace Package\Library;
use StaticPHP\Attribute\Package\BuildFor;
use StaticPHP\Attribute\Package\Library;
use StaticPHP\Package\LibraryPackage;
use StaticPHP\Runtime\Executor\WindowsCMakeExecutor;
use StaticPHP\Util\FileSystem;
#[Library('wineditline')]
class wineditline
{
#[BuildFor('Windows')]
public function build(LibraryPackage $lib): void
{
WindowsCMakeExecutor::create($lib)->build();
FileSystem::copy($lib->getSourceDir() . '\lib64\edit_a.lib', $lib->getLibDir() . '\edit_a.lib');
FileSystem::copyDir($lib->getSourceDir() . '\include\editline', $lib->getIncludeDir() . '\editline');
}
}

View File

@@ -9,6 +9,7 @@ use StaticPHP\Attribute\Package\Library;
use StaticPHP\Package\LibraryPackage;
use StaticPHP\Runtime\Executor\UnixCMakeExecutor;
use StaticPHP\Runtime\Executor\WindowsCMakeExecutor;
use StaticPHP\Util\FileSystem;
#[Library('zstd')]
class zstd
@@ -24,6 +25,7 @@ class zstd
'-DZSTD_BUILD_SHARED=OFF',
)
->build();
FileSystem::copy($package->getLibDir() . '\zstd_static.lib', $package->getLibDir() . '/zstd.lib');
}
#[BuildFor('Linux')]

View File

@@ -12,6 +12,7 @@ use StaticPHP\Attribute\Package\BeforeStage;
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;
@@ -29,6 +30,7 @@ use StaticPHP\Toolchain\Interface\ToolchainInterface;
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;
@@ -339,6 +341,35 @@ class php extends TargetPackage
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 = [];

View File

@@ -469,27 +469,6 @@ trait unix
$package->runStage([$this, 'unixBuildSharedExt']);
}
#[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');
}
}
}
/**
* Patch phpize and php-config if needed
*/
@@ -598,7 +577,7 @@ trait unix
copy(ROOT_DIR . '/src/globals/common-tests/embed.c', $sample_file_path . '/embed.c');
copy(ROOT_DIR . '/src/globals/common-tests/embed.php', $sample_file_path . '/embed.php');
$config = new SPCConfigUtil()->config(array_map(fn ($x) => $x->getName(), $installer->getResolvedPackages()));
$config = new SPCConfigUtil()->config($installer->getAvailableResolvedPackageNames());
$lens = "{$config['cflags']} {$config['ldflags']} {$config['libs']}";
if ($toolchain->isStatic()) {
$lens .= ' -static';
@@ -662,7 +641,7 @@ trait unix
/**
* Generate micro extension test php code.
*/
private function generateMicroExtTests(PackageInstaller $installer): string
protected function generateMicroExtTests(PackageInstaller $installer): string
{
$php = "<?php\n\necho '[micro-test-start]' . PHP_EOL;\n";
foreach ($installer->getResolvedPackages(PhpExtensionPackage::class) as $ext) {
@@ -756,7 +735,7 @@ trait unix
*/
private function makeVars(PackageInstaller $installer): array
{
$config = new SPCConfigUtil(['libs_only_deps' => true])->config(array_map(fn ($x) => $x->getName(), $installer->getResolvedPackages()));
$config = new SPCConfigUtil(['libs_only_deps' => true])->config($installer->getAvailableResolvedPackageNames());
$static = ApplicationContext::get(ToolchainInterface::class)->isStatic() ? '-all-static' : '';
$pie = SystemTarget::getTargetOS() === 'Linux' ? '-pie' : '';

View File

@@ -8,10 +8,15 @@ use StaticPHP\Attribute\Package\BeforeStage;
use StaticPHP\Attribute\Package\BuildFor;
use StaticPHP\Attribute\Package\Stage;
use StaticPHP\Attribute\PatchDescription;
use StaticPHP\Config\PackageConfig;
use StaticPHP\Exception\PatchException;
use StaticPHP\Exception\SPCInternalException;
use StaticPHP\Exception\ValidationException;
use StaticPHP\Exception\WrongUsageException;
use StaticPHP\Package\LibraryPackage;
use StaticPHP\Package\PackageBuilder;
use StaticPHP\Package\PackageInstaller;
use StaticPHP\Package\PhpExtensionPackage;
use StaticPHP\Package\TargetPackage;
use StaticPHP\Util\FileSystem;
use StaticPHP\Util\InteractiveTerm;
@@ -30,11 +35,17 @@ trait windows
}
#[Stage]
public function buildconfForWindows(TargetPackage $package): void
public function buildconfForWindows(TargetPackage $package, PackageInstaller $installer): void
{
InteractiveTerm::setMessage('Building php: ' . ConsoleColor::yellow('./buildconf.bat'));
V2CompatLayer::emitPatchPoint('before-php-buildconf');
cmd()->cd($package->getSourceDir())->exec('.\buildconf.bat');
if ($package->getBuildOption('enable-micro-win32') && $installer->isPackageResolved('php-micro')) {
SourcePatcher::patchMicroWin32();
} else {
SourcePatcher::unpatchMicroWin32();
}
}
#[Stage]
@@ -52,9 +63,11 @@ trait windows
$cli = $installer->isPackageResolved('php-cli');
$cgi = $installer->isPackageResolved('php-cgi');
$micro = $installer->isPackageResolved('php-micro');
$embed = $installer->isPackageResolved('php-embed');
$args[] = $cli ? '--enable-cli=yes' : '--enable-cli=no';
$args[] = $cgi ? '--enable-cgi=yes' : '--enable-cgi=no';
$args[] = $micro ? '--enable-micro=yes' : '--enable-micro=no';
$args[] = $embed ? '--enable-embed=yes' : '--enable-embed=no';
// zts
$args[] = $package->getBuildOption('enable-zts', false) ? '--enable-zts=yes' : '--enable-zts=no';
@@ -103,13 +116,26 @@ trait windows
}
#[Stage]
public function makeCliForWindows(TargetPackage $package, PackageBuilder $builder): void
public function makeCliForWindows(TargetPackage $package, PackageBuilder $builder, PackageInstaller $installer): void
{
InteractiveTerm::setMessage('Building php: ' . ConsoleColor::yellow('php.exe'));
// extra lib
$extra_libs = getenv('SPC_EXTRA_LIBS') ?: '';
// Collect static-libs@windows from all resolved library packages.
// PHP's configure.bat only adds libs declared by enabled extensions via config.w32;
// transitive library-only deps (e.g. zlibstatic.lib needed by libcrypto.lib) are
// not covered. Inject them here so the final link step has all required symbols.
$resolved_libs = [];
foreach ($installer->getResolvedPackages(LibraryPackage::class) as $lib) {
foreach (PackageConfig::get($lib->getName(), 'static-libs', []) as $lib_file) {
if (file_exists("{$package->getLibDir()}\\{$lib_file}")) {
$resolved_libs[] = $lib_file;
}
}
}
$resolved_libs = array_unique($resolved_libs);
// extra lib
$extra_libs = trim((getenv('SPC_EXTRA_LIBS') ?: '') . ' ' . implode(' ', $resolved_libs));
// Add debug symbols for release build if --no-strip is specified
// We need to modify CFLAGS to replace /Ox with /Zi and add /DEBUG to LDFLAGS
$debug_overrides = '';
@@ -131,6 +157,68 @@ trait windows
$this->deployWindowsBinary($builder, $package, 'php-cli');
}
#[BeforeStage('php', [self::class, 'makeCgiForWindows'])]
#[PatchDescription('Patch Windows Makefile for CGI target')]
public function patchCGITarget(TargetPackage $package): void
{
// search Makefile code line contains "$(BUILD_DIR)\php-cgi.exe:"
$content = FileSystem::readFile("{$package->getSourceDir()}\\Makefile");
$lines = explode("\r\n", $content);
$line_num = 0;
$found = false;
foreach ($lines as $v) {
if (str_contains($v, '$(BUILD_DIR)\php-cgi.exe:')) {
$found = $line_num;
break;
}
++$line_num;
}
if ($found === false) {
throw new PatchException('Windows Makefile patching for php-cgi.exe target', 'Cannot patch windows CGI Makefile, Makefile does not contain "$(BUILD_DIR)\php-cgi.exe:" line');
}
$lines[$line_num] = '$(BUILD_DIR)\php-cgi.exe: $(DEPS_CGI) $(CGI_GLOBAL_OBJS) $(PHP_GLOBAL_OBJS) $(STATIC_EXT_OBJS) $(ASM_OBJS) $(BUILD_DIR)\php-cgi.exe.res $(BUILD_DIR)\php-cgi.exe.manifest';
$lines[$line_num + 1] = "\t" . '@"$(LINK)" /nologo $(PHP_GLOBAL_OBJS_RESP) $(CGI_GLOBAL_OBJS_RESP) $(STATIC_EXT_OBJS_RESP) $(STATIC_EXT_LIBS) $(ASM_OBJS) $(LIBS) $(LIBS_CGI) $(BUILD_DIR)\php-cgi.exe.res /out:$(BUILD_DIR)\php-cgi.exe $(LDFLAGS) $(LDFLAGS_CGI) /ltcg /nodefaultlib:msvcrt /nodefaultlib:msvcrtd /ignore:4286';
FileSystem::writeFile("{$package->getSourceDir()}\\Makefile", implode("\r\n", $lines));
// Patch cgi-static, comment ZEND_TSRMLS_CACHE_DEFINE()
FileSystem::replaceFileRegex("{$package->getSourceDir()}\\sapi\\cgi\\cgi_main.c", '/^ZEND_TSRMLS_CACHE_DEFINE\(\)/m', '// ZEND_TSRMLS_CACHE_DEFINE()');
}
#[Stage]
public function makeCgiForWindows(TargetPackage $package, PackageBuilder $builder, PackageInstaller $installer): void
{
InteractiveTerm::setMessage('Building php: ' . ConsoleColor::yellow('php-cgi.exe'));
// Collect static-libs@windows from all resolved library packages.
$resolved_libs = [];
foreach ($installer->getResolvedPackages(LibraryPackage::class) as $lib) {
foreach (PackageConfig::get($lib->getName(), 'static-libs', []) as $lib_file) {
if (file_exists("{$package->getLibDir()}\\{$lib_file}")) {
$resolved_libs[] = $lib_file;
}
}
}
$resolved_libs = array_unique($resolved_libs);
// extra lib
$extra_libs = trim((getenv('SPC_EXTRA_LIBS') ?: '') . ' ' . implode(' ', $resolved_libs));
// Add debug symbols for release build if --no-strip is specified
$debug_overrides = '';
if ($package->getBuildOption('no-strip', false)) {
$makefile_content = file_get_contents("{$package->getSourceDir()}\\Makefile");
if (preg_match('/^CFLAGS=(.+?)$/m', $makefile_content, $matches)) {
$cflags = $matches[1];
$cflags = str_replace('/Ox ', '/O2 /Zi ', $cflags);
$debug_overrides = '"CFLAGS=' . $cflags . '" "LDFLAGS=/DEBUG /LTCG /INCREMENTAL:NO" "LDFLAGS_CGI=/DEBUG" ';
}
}
cmd()->cd($package->getSourceDir())
->exec("nmake /nologo {$debug_overrides}LIBS_CGI=\"ws2_32.lib kernel32.lib advapi32.lib {$extra_libs}\" EXTRA_LD_FLAGS_PROGRAM= php-cgi.exe");
$this->deployWindowsBinary($builder, $package, 'php-cgi');
}
#[Stage]
public function makeForWindows(TargetPackage $package, PackageInstaller $installer): void
{
@@ -147,6 +235,193 @@ trait windows
if ($installer->isPackageResolved('php-micro')) {
$package->runStage([$this, 'makeMicroForWindows']);
}
if ($installer->isPackageResolved('php-embed')) {
$package->runStage([$this, 'makeEmbedForWindows']);
}
}
#[Stage]
public function makeMicroForWindows(TargetPackage $package, PackageBuilder $builder, PackageInstaller $installer): void
{
InteractiveTerm::setMessage('Building php: ' . ConsoleColor::yellow('micro.sfx'));
// workaround for fiber (originally from https://github.com/dixyes/lwmbs/blob/master/windows/MicroBuild.php)
$makefile = FileSystem::readFile("{$package->getSourceDir()}\\Makefile");
if ($this->getPHPVersionID() >= 80200 && str_contains($makefile, 'FIBER_ASM_ARCH')) {
$makefile .= "\r\n" . '$(MICRO_SFX): $(BUILD_DIR)\Zend\jump_$(FIBER_ASM_ARCH)_ms_pe_masm.obj $(BUILD_DIR)\Zend\make_$(FIBER_ASM_ARCH)_ms_pe_masm.obj' . "\r\n\r\n";
} elseif ($this->getPHPVersionID() >= 80400 && str_contains($makefile, 'FIBER_ASM_ABI')) {
$makefile .= "\r\n" . '$(MICRO_SFX): $(BUILD_DIR)\Zend\jump_$(FIBER_ASM_ABI).obj $(BUILD_DIR)\Zend\make_$(FIBER_ASM_ABI).obj' . "\r\n\r\n";
}
FileSystem::writeFile("{$package->getSourceDir()}\\Makefile", $makefile);
// Collect static-libs@windows from all resolved library packages.
$resolved_libs = [];
foreach ($installer->getResolvedPackages(LibraryPackage::class) as $lib) {
foreach (PackageConfig::get($lib->getName(), 'static-libs', []) as $lib_file) {
if (file_exists("{$package->getLibDir()}\\{$lib_file}")) {
$resolved_libs[] = $lib_file;
}
}
}
$resolved_libs = array_unique($resolved_libs);
// extra lib
$extra_libs = trim((getenv('SPC_EXTRA_LIBS') ?: '') . ' ' . implode(' ', $resolved_libs));
// Add debug symbols for release build if --no-strip is specified
$debug_overrides = '';
if ($package->getBuildOption('no-strip', false)) {
$makefile_content = file_get_contents("{$package->getSourceDir()}\\Makefile");
if (preg_match('/^CFLAGS=(.+?)$/m', $makefile_content, $matches)) {
$cflags = $matches[1];
$cflags = str_replace('/Ox ', '/O2 /Zi ', $cflags);
$debug_overrides = '"CFLAGS=' . $cflags . '" "LDFLAGS=/DEBUG /LTCG /INCREMENTAL:NO" "LDFLAGS_MICRO=/DEBUG" ';
}
}
$fake_cli = $package->getBuildOption('with-micro-fake-cli', false) ? ' /DPHP_MICRO_FAKE_CLI' : '';
// phar patch for micro
$phar_patched = false;
if ($installer->isPackageResolved('ext-phar')) {
$phar_patched = true;
SourcePatcher::patchMicroPhar(self::getPHPVersionID());
}
try {
cmd()->cd($package->getSourceDir())
->exec("nmake /nologo {$debug_overrides}LIBS_MICRO=\"ws2_32.lib shell32.lib {$extra_libs}\" CFLAGS_MICRO=\"/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1{$fake_cli}\" EXTRA_LD_FLAGS_PROGRAM= micro");
} finally {
if ($phar_patched) {
SourcePatcher::unpatchMicroPhar();
}
}
$this->deployWindowsBinary($builder, $package, 'php-micro');
}
#[BeforeStage('php', [self::class, 'makeEmbedForWindows'])]
#[PatchDescription('Patch Windows Makefile for embed static library target')]
public function patchEmbedTarget(TargetPackage $package): void
{
$makefile_path = "{$package->getSourceDir()}\\Makefile";
$content = FileSystem::readFile($makefile_path);
// PHP's configure.bat generates PHP_LDFLAGS with /nodefaultlib:libcmt to avoid CRT
// duplication in a normal /MD build. But our static build compiles everything with /MT,
// so every .obj file has DEFAULTLIB:LIBCMT embedded. Removing /nodefaultlib:libcmt lets
// the linker pick up libcmt.lib. We also exclude the dynamic CRT (/nodefaultlib:msvcrt
// /nodefaultlib:msvcrtd) to keep the DLL dependency-free, consistent with CLI/CGI/micro.
$content = str_replace(
'PHP_LDFLAGS=$(DLL_LDFLAGS) /nodefaultlib:libcmt /def:$(PHPDEF)',
'PHP_LDFLAGS=$(DLL_LDFLAGS) /nodefaultlib:msvcrt /nodefaultlib:msvcrtd /def:$(PHPDEF) /ltcg /ignore:4286',
$content
);
// Patch embed lib target to build a REAL static library instead of just an import lib.
// The default embed target only includes embed SAPI objects and links against php8.lib (import lib).
// We need to include PHP core objects (PHP_GLOBAL_OBJS) and static extension objects (STATIC_EXT_OBJS)
// to create a self-contained static library that doesn't require php8.dll at runtime.
$major = intdiv($this->getPHPVersionID(), 10000);
$embed_lib = "php{$major}embed.lib";
// Find and replace the embed lib build rule
// Actual Makefile format (note the backslash before $(PHPLIB)):
// $(BUILD_DIR)\php8embed.lib: $(DEPS_EMBED) $(EMBED_GLOBAL_OBJS) $(BUILD_DIR)\$(PHPLIB) $(BUILD_DIR)\php8embed.lib.res $(BUILD_DIR)\php8embed.lib.manifest
// @$(MAKE_LIB) /nologo /out:$(BUILD_DIR)\php8embed.lib $(ARFLAGS) $(EMBED_GLOBAL_OBJS_RESP) $(BUILD_DIR)\$(PHPLIB) $(ARFLAGS_EMBED) $(LIBS_EMBED) $(BUILD_DIR)\php8embed.lib.res
$lines = explode("\r\n", $content);
$new_lines = [];
$i = 0;
while ($i < count($lines)) {
$line = $lines[$i];
// Check if this is the embed lib target dependency line (contains the lib name and $(BUILD_DIR)\$(PHPLIB))
if (str_contains($line, "\$(BUILD_DIR)\\{$embed_lib}:") && str_contains($line, '$(BUILD_DIR)\$(PHPLIB)')) {
// Replace the dependency line
// Original: $(BUILD_DIR)\php8embed.lib: $(DEPS_EMBED) $(EMBED_GLOBAL_OBJS) $(BUILD_DIR)\$(PHPLIB) $(BUILD_DIR)\php8embed.lib.res $(BUILD_DIR)\php8embed.lib.manifest
// New: $(BUILD_DIR)\php8embed.lib: $(DEPS_EMBED) $(EMBED_GLOBAL_OBJS) $(PHP_GLOBAL_OBJS) $(STATIC_EXT_OBJS) $(ASM_OBJS) $(BUILD_DIR)\php8embed.lib.res $(BUILD_DIR)\php8embed.lib.manifest
$new_deps = "\$(BUILD_DIR)\\{$embed_lib}: \$(DEPS_EMBED) \$(EMBED_GLOBAL_OBJS) \$(PHP_GLOBAL_OBJS) \$(STATIC_EXT_OBJS) \$(ASM_OBJS) \$(BUILD_DIR)\\{$embed_lib}.res \$(BUILD_DIR)\\{$embed_lib}.manifest";
$new_lines[] = $new_deps;
// Skip the original line (we replaced it)
++$i;
// Now look for the lib.exe command line (should be the next non-empty line starting with tab)
while ($i < count($lines) && trim($lines[$i]) === '') {
$new_lines[] = $lines[$i];
++$i;
}
// Replace the lib.exe command to include PHP_GLOBAL_OBJS_RESP and STATIC_EXT_OBJS_RESP
// Original: @$(MAKE_LIB) /nologo /out:$(BUILD_DIR)\php8embed.lib $(ARFLAGS) $(EMBED_GLOBAL_OBJS_RESP) $(BUILD_DIR)\$(PHPLIB) $(ARFLAGS_EMBED) $(LIBS_EMBED) $(BUILD_DIR)\php8embed.lib.res
// New: @$(MAKE_LIB) /nologo /out:$(BUILD_DIR)\php8embed.lib $(ARFLAGS) $(EMBED_GLOBAL_OBJS_RESP) $(PHP_GLOBAL_OBJS_RESP) $(STATIC_EXT_OBJS_RESP) $(ASM_OBJS) $(STATIC_EXT_LIBS) $(ARFLAGS_EMBED) $(LIBS_EMBED) $(BUILD_DIR)\php8embed.lib.res
if ($i < count($lines) && str_contains($lines[$i], '$(MAKE_LIB)')) {
$cmd_line = $lines[$i];
// Remove $(BUILD_DIR)\$(PHPLIB) from the command (note the backslash)
$cmd_line = str_replace(' $(BUILD_DIR)\$(PHPLIB)', '', $cmd_line);
// Add PHP_GLOBAL_OBJS_RESP and STATIC_EXT_OBJS_RESP after EMBED_GLOBAL_OBJS_RESP
$cmd_line = str_replace(
'$(EMBED_GLOBAL_OBJS_RESP)',
'$(EMBED_GLOBAL_OBJS_RESP) $(PHP_GLOBAL_OBJS_RESP) $(STATIC_EXT_OBJS_RESP) $(ASM_OBJS) $(STATIC_EXT_LIBS)',
$cmd_line
);
$new_lines[] = $cmd_line;
++$i;
}
} else {
$new_lines[] = $line;
++$i;
}
}
$content = implode("\r\n", $new_lines);
FileSystem::writeFile($makefile_path, $content);
}
#[Stage]
public function makeEmbedForWindows(TargetPackage $package, PackageBuilder $builder, PackageInstaller $installer): void
{
$major = intdiv($this->getPHPVersionID(), 10000);
$embed_lib = "php{$major}embed.lib";
InteractiveTerm::setMessage('Building php: ' . ConsoleColor::yellow($embed_lib));
// Add debug symbols for release build if --no-strip is specified
$debug_overrides = '';
if ($package->getBuildOption('no-strip', false)) {
$makefile_content = file_get_contents("{$package->getSourceDir()}\\Makefile");
if (preg_match('/^CFLAGS=(.+?)$/m', $makefile_content, $matches)) {
$cflags = $matches[1];
$cflags = str_replace('/Ox ', '/O2 /Zi ', $cflags);
$debug_overrides = '"CFLAGS=' . $cflags . '" "LDFLAGS=/DEBUG /LTCG /INCREMENTAL:NO" ';
}
}
// Build the embed static library (patched to include PHP core and extension objects)
cmd()->cd($package->getSourceDir())
->exec("nmake /nologo {$debug_overrides}{$embed_lib}");
// Deploy: php8embed.lib is now a REAL static library containing all PHP code
$rel_type = 'Release'; // TODO: Debug build support
$ts = $builder->getOption('enable-zts') ? '_TS' : '';
$build_dir = "{$package->getSourceDir()}\\x64\\{$rel_type}{$ts}";
// copy static embed lib to buildroot/lib
$embed_lib_src = "{$build_dir}\\{$embed_lib}";
if (file_exists($embed_lib_src)) {
FileSystem::copy($embed_lib_src, "{$package->getLibDir()}\\{$embed_lib}");
$package->setOutput('Static library path for embed SAPI', "{$package->getLibDir()}\\{$embed_lib}");
}
// Note: We no longer deploy php8.dll because the embed static library is self-contained.
// All PHP core code, extensions, and embed SAPI are statically linked into php8embed.lib.
// copy .pdb debug info if --no-strip
$debug_dir = BUILD_ROOT_PATH . '\debug';
if ($builder->getOption('no-strip', false)) {
$pdb = "{$build_dir}\\php{$major}embed.pdb";
if (file_exists($pdb)) {
FileSystem::createDir($debug_dir);
FileSystem::copy($pdb, "{$debug_dir}\\php{$major}embed.pdb");
}
}
// Install PHP headers for embed SAPI development
$this->installPhpHeadersForWindows($package, $installer);
}
#[BuildFor('Windows')]
@@ -215,6 +490,195 @@ trait windows
}
}
#[Stage]
public function smokeTestForWindows(PackageBuilder $builder, TargetPackage $package, PackageInstaller $installer): void
{
// analyse --no-smoke-test option
$no_smoke_test = $builder->getOption('no-smoke-test');
$option = match ($no_smoke_test) {
false => false,
null => 'all',
default => parse_comma_list($no_smoke_test),
};
$valid_tests = ['cli', 'cgi', 'micro', 'micro-exts', 'embed'];
// compat: --without-micro-ext-test is equivalent to --no-smoke-test=micro-exts
if ($builder->getOption('without-micro-ext-test', false)) {
$valid_tests = array_diff($valid_tests, ['micro-exts']);
}
if (is_array($option)) {
foreach ($option as $test) {
if (!in_array($test, $valid_tests, true)) {
throw new WrongUsageException("Invalid value for --no-smoke-test: {$test}. Valid values are: " . implode(', ', $valid_tests));
}
$valid_tests = array_diff($valid_tests, [$test]);
}
} elseif ($option === 'all') {
$valid_tests = [];
}
// remove all .dll from buildroot/bin/
$dlls = glob(BUILD_BIN_PATH . '\*.dll') ?: [];
foreach ($dlls as $dll) {
@unlink($dll);
}
if (in_array('cli', $valid_tests, true) && $installer->isPackageResolved('php-cli')) {
$package->runStage([$this, 'smokeTestCliForWindows']);
}
if (in_array('cgi', $valid_tests, true) && $installer->isPackageResolved('php-cgi')) {
$package->runStage([$this, 'smokeTestCgiForWindows']);
}
if (in_array('micro', $valid_tests, true) && $installer->isPackageResolved('php-micro')) {
$skipExtTest = !in_array('micro-exts', $valid_tests, true);
$package->runStage([$this, 'smokeTestMicroForWindows'], ['skipExtTest' => $skipExtTest]);
}
if (in_array('embed', $valid_tests, true) && $installer->isPackageResolved('php-embed')) {
$package->runStage([$this, 'smokeTestEmbedForWindows'], ['installer' => $installer]);
}
}
#[Stage]
public function smokeTestCliForWindows(PackageInstaller $installer): void
{
InteractiveTerm::setMessage('Running basic php-cli smoke test');
[$ret, $output] = cmd()->execWithResult(BUILD_BIN_PATH . '\php.exe -n -r "echo \"hello\";"');
$raw_output = implode('', $output);
if ($ret !== 0 || trim($raw_output) !== 'hello') {
throw new ValidationException("cli failed smoke test. code: {$ret}, output: {$raw_output}", validation_module: 'php-cli smoke test');
}
$exts = $installer->getResolvedPackages(PhpExtensionPackage::class);
foreach ($exts as $ext) {
InteractiveTerm::setMessage('Running php-cli smoke test for ' . ConsoleColor::yellow($ext->getExtensionName()) . ' extension');
$ext->runSmokeTestCliWindows();
}
}
#[Stage]
public function smokeTestCgiForWindows(): void
{
InteractiveTerm::setMessage('Running basic php-cgi smoke test');
FileSystem::writeFile(SOURCE_PATH . '\php-cgi-test.php', '<?php echo "<h1>Hello, World!</h1>"; ?>');
[$ret, $output] = cmd()->execWithResult(BUILD_BIN_PATH . '\php-cgi.exe -n -f ' . SOURCE_PATH . '\php-cgi-test.php');
$raw_output = implode("\n", $output);
if ($ret !== 0 || !str_contains($raw_output, 'Hello, World!')) {
throw new ValidationException("cgi failed smoke test. code: {$ret}, output: {$raw_output}", validation_module: 'php-cgi smoke test');
}
}
#[Stage]
public function smokeTestMicroForWindows(PackageInstaller $installer, bool $skipExtTest = false): void
{
$micro_sfx = BUILD_BIN_PATH . '\micro.sfx';
InteractiveTerm::setMessage('Running php-micro smoke test');
$content = $skipExtTest
? '<?php echo "[micro-test-start][micro-test-end]";'
: $this->generateMicroExtTests($installer);
$test_file = SOURCE_PATH . '\micro_ext_test.exe';
if (file_exists($test_file)) {
@unlink($test_file);
}
file_put_contents($test_file, file_get_contents($micro_sfx) . $content);
[$ret, $out] = cmd()->execWithResult($test_file);
$raw_out = trim(implode('', $out));
if ($ret !== 0 || !str_starts_with($raw_out, '[micro-test-start]') || !str_ends_with($raw_out, '[micro-test-end]')) {
throw new ValidationException(
"micro_ext_test failed. code: {$ret}, output: {$raw_out}",
validation_module: 'phpmicro sanity check item [micro_ext_test]'
);
}
}
#[Stage]
public function smokeTestEmbedForWindows(PackageInstaller $installer, TargetPackage $package): void
{
$test_dir = SOURCE_PATH . '\embed-test';
FileSystem::createDir($test_dir);
// Create embed.c test file (Windows version)
$embed_c = <<<'C_CODE'
#include <sapi/embed/php_embed.h>
int main(int argc, char **argv) {
PHP_EMBED_START_BLOCK(argc, argv)
zend_file_handle file_handle;
zend_stream_init_filename(&file_handle, "embed.php");
if (!php_execute_script(&file_handle)) {
php_printf("Failed to execute PHP script.\n");
}
PHP_EMBED_END_BLOCK()
return 0;
}
C_CODE;
FileSystem::writeFile($test_dir . '\embed.c', $embed_c);
// Create embed.php test file
FileSystem::writeFile($test_dir . '\embed.php', "<?php\n\ndeclare(strict_types=1);\necho 'hello' . PHP_EOL;\n");
// Get build configuration using spc-config
$util = new \StaticPHP\Util\SPCConfigUtil();
$config = $util->config(array_map(fn ($x) => $x->getName(), $installer->getResolvedPackages()));
// Build the embed test executable using cl.exe
// Note: MSVCToolchain already initialized the VC environment, no need for vcvarsall
InteractiveTerm::setMessage('Running php-embed build smoke test');
// For Windows, we need to use PHP source directory headers directly
// because Windows PHP doesn't use php_config.h like Unix
$source_dir = $package->getSourceDir();
$rel_type = 'Release';
$ts = $package->getBuildOption('enable-zts', false) ? '_TS' : '';
$build_dir = "{$source_dir}\\x64\\{$rel_type}{$ts}";
// Build include flags pointing to source dirs (like PHP Windows build does)
// Note: embed.c uses #include <sapi/embed/php_embed.h>, so we need $source_dir itself
$include_flags = sprintf(
'/I"%s" /I"%s\main" /I"%s\Zend" /I"%s\TSRM" /I"%s" ' .
'/D ZEND_WIN32=1 /D PHP_WIN32=1 /D WIN32 /D _WINDOWS /D WINDOWS=1 /D _MBCS /D _USE_MATH_DEFINES',
$build_dir,
$source_dir,
$source_dir,
$source_dir,
$source_dir
);
// MSVC cl.exe format: compiler flags must come before /link, linker flags after
// ldflags contains /LIBPATH which must be after /link
$compile_cmd = sprintf(
'cl.exe /nologo /O2 /MT /Z7 %s embed.c /Fe:embed.exe /link /LIBPATH:"%s\lib" %s %s',
$include_flags,
BUILD_ROOT_PATH,
$config['libs'],
'kernel32.lib ole32.lib user32.lib advapi32.lib shell32.lib ws2_32.lib dnsapi.lib psapi.lib bcrypt.lib' // Windows system libs (match Makefile LIBS)
);
// Log command explicitly (workaround for cmd() not logging complex commands properly)
logger()->debug('Embed smoke test compile command: ' . $compile_cmd);
[$ret, $out] = cmd()->cd($test_dir)->execWithResult($compile_cmd);
if ($ret !== 0) {
throw new ValidationException(
'embed failed to build. Error message: ' . implode("\n", $out),
validation_module: 'php-embed build smoke test'
);
}
// Run the embed test
InteractiveTerm::setMessage('Running php-embed run smoke test');
[$ret, $output] = cmd()->cd($test_dir)->execWithResult('embed.exe');
$raw_output = implode('', $output);
if ($ret !== 0 || trim($raw_output) !== 'hello') {
throw new ValidationException(
'embed failed to run. Error message: ' . $raw_output,
validation_module: 'php-embed run smoke test'
);
}
}
protected function deployWindowsBinary(PackageBuilder $builder, TargetPackage $package, string $sapi): void
{
$rel_type = 'Release'; // TODO: Debug build support
@@ -231,9 +695,98 @@ trait windows
$builder->deployBinary($src_file, $dst_file);
// make debug info file path
$output_label = match ($sapi) {
'php-cli' => 'Binary path for cli SAPI',
'php-cgi' => 'Binary path for cgi SAPI',
'php-micro' => 'Binary path for micro SAPI',
default => null,
};
if ($output_label) {
$package->setOutput($output_label, $dst_file);
}
// copy .pdb debug info file
if ($builder->getOption('no-strip', false) && file_exists("{$src[0]}\\{$src[2]}")) {
FileSystem::createDir($debug_dir);
FileSystem::copy("{$src[0]}\\{$src[2]}", "{$debug_dir}\\{$src[2]}");
}
}
/**
* Install PHP headers to buildroot/include for embed SAPI development.
* This mirrors the 'make install-headers' behavior on Unix.
*/
private function installPhpHeadersForWindows(TargetPackage $package, PackageInstaller $installer): void
{
InteractiveTerm::setMessage('Installing PHP headers for embed SAPI');
$source_dir = $package->getSourceDir();
$include_dir = $package->getIncludeDir();
$php_include_dir = "{$include_dir}\\php";
// Create directory structure
FileSystem::createDir("{$php_include_dir}\\main");
FileSystem::createDir("{$php_include_dir}\\Zend");
FileSystem::createDir("{$php_include_dir}\\TSRM");
FileSystem::createDir("{$php_include_dir}\\sapi\\embed");
// Copy main/*.h
foreach (glob("{$source_dir}\\main\\*.h") as $h) {
FileSystem::copy($h, "{$php_include_dir}\\main\\" . basename($h));
}
// Copy Zend/*.h
foreach (glob("{$source_dir}\\Zend\\*.h") as $h) {
$target = "{$php_include_dir}\\Zend\\" . basename($h);
FileSystem::copy($h, $target);
// Fix GCC-specific #warning directive not supported by MSVC
if (basename($h) === 'zend_atomic.h') {
FileSystem::replaceFileStr($target, '#warning No atomics support detected. Please open an issue with platform details.', '#pragma message("No atomics support detected. Please open an issue with platform details.")');
}
}
// Copy TSRM/*.h
foreach (glob("{$source_dir}\\TSRM\\*.h") as $h) {
FileSystem::copy($h, "{$php_include_dir}\\TSRM\\" . basename($h));
}
// Copy embed SAPI header
FileSystem::copy("{$source_dir}\\sapi\\embed\\php_embed.h", "{$php_include_dir}\\sapi\\embed\\php_embed.h");
// Copy generated config.h (config.w32.h on Windows) to php_config.h
$rel_type = 'Release';
$ts = $package->getBuildOption('enable-zts', false) ? '_TS' : '';
$build_dir = "{$source_dir}\\x64\\{$rel_type}{$ts}";
// Always copy config.w32.h from source (it's used for both build and headers)
if (file_exists("{$source_dir}\\main\\config.w32.h")) {
FileSystem::copy("{$source_dir}\\main\\config.w32.h", "{$php_include_dir}\\main\\php_config.h");
}
// Windows: zend_config.w32.h must be copied as zend_config.h for Zend headers to work
if (file_exists("{$source_dir}\\Zend\\zend_config.w32.h")) {
FileSystem::copy("{$source_dir}\\Zend\\zend_config.w32.h", "{$php_include_dir}\\Zend\\zend_config.h");
}
// Copy extension headers for enabled extensions
foreach ($installer->getResolvedPackages(PhpExtensionPackage::class) as $ext) {
$ext_name = $ext->getExtensionName();
$ext_dir = "{$source_dir}\\ext\\{$ext_name}";
if (is_dir($ext_dir)) {
$target_ext_dir = "{$php_include_dir}\\ext\\{$ext_name}";
FileSystem::createDir($target_ext_dir);
foreach (glob("{$ext_dir}\\*.h") as $h) {
FileSystem::copy($h, "{$target_ext_dir}\\" . basename($h));
}
// Also copy any arginfo headers
foreach (glob("{$ext_dir}\\*_arginfo.h") as $h) {
if (!file_exists("{$target_ext_dir}\\" . basename($h))) {
FileSystem::copy($h, "{$target_ext_dir}\\" . basename($h));
}
}
}
}
$package->setOutput('PHP headers path for embed SAPI', $php_include_dir);
}
}

View File

@@ -34,7 +34,7 @@ use Symfony\Component\Console\Application;
*/
final class ConsoleApplication extends Application
{
public const string VERSION = '2.8.3';
public const string VERSION = '2.8.5';
public function __construct()
{

View File

@@ -96,7 +96,8 @@ class Extension
fn ($x) => $x->getStaticLibFiles(),
$this->getLibraryDependencies(recursive: true)
);
return implode(' ', $ret);
$libs = implode(' ', $ret);
return deduplicate_flags($libs);
}
/**

View File

@@ -365,6 +365,27 @@ abstract class LibraryBase
protected function isLibraryInstalled(): bool
{
if ($pkg_configs = Config::getLib(static::NAME, 'pkg-configs', [])) {
$pkg_config_path = getenv('PKG_CONFIG_PATH') ?: '';
$search_paths = array_unique(array_filter(explode(is_unix() ? ':' : ';', $pkg_config_path)));
foreach ($pkg_configs as $name) {
$found = false;
foreach ($search_paths as $path) {
if (file_exists($path . "/{$name}.pc")) {
$found = true;
break;
}
}
if (!$found) {
return false;
}
}
// allow using system dependencies if pkg_config_path is explicitly defined
if (count($search_paths) > 1) {
return true;
}
}
foreach (Config::getLib(static::NAME, 'static-libs', []) as $name) {
if (!file_exists(BUILD_LIB_PATH . "/{$name}")) {
return false;

View File

@@ -11,7 +11,6 @@ use SPC\store\FileSystem;
use SPC\util\CustomExt;
use SPC\util\GlobalEnvManager;
use SPC\util\SPCConfigUtil;
use SPC\util\SPCTarget;
#[CustomExt('grpc')]
class grpc extends Extension
@@ -21,18 +20,59 @@ class grpc extends Extension
if ($this->builder instanceof WindowsBuilder) {
throw new ValidationException('grpc extension does not support windows yet');
}
// Fix deprecated PHP API usage in call.c
FileSystem::replaceFileStr(
$this->source_dir . '/src/php/ext/grpc/call.c',
"{$this->source_dir}/src/php/ext/grpc/call.c",
'zend_exception_get_default(TSRMLS_C),',
'zend_ce_exception,',
);
if (SPCTarget::getTargetOS() === 'Darwin') {
FileSystem::replaceFileRegex(
$this->source_dir . '/config.m4',
'/GRPC_LIBDIR=.*$/m',
'GRPC_LIBDIR=' . BUILD_LIB_PATH . "\n" . 'LDFLAGS="$LDFLAGS -framework CoreFoundation"'
);
// Fix include path conflict with pdo_sqlsrv: grpc's PHP ext dir is added to the global include path via
$grpc_php_dir = "{$this->source_dir}/src/php/ext/grpc";
if (file_exists("{$grpc_php_dir}/version.h")) {
copy("{$grpc_php_dir}/version.h", "{$grpc_php_dir}/php_grpc_version.h");
unlink("{$grpc_php_dir}/version.h");
FileSystem::replaceFileStr("{$grpc_php_dir}/php_grpc.h", '#include "version.h"', '#include "php_grpc_version.h"');
FileSystem::replaceFileStr("{$grpc_php_dir}/php_grpc.c", '#include "version.h"', '#include "php_grpc_version.h"');
}
$config_m4 = <<<'M4'
PHP_ARG_ENABLE(grpc, [whether to enable grpc support], [AS_HELP_STRING([--enable-grpc], [Enable grpc support])])
if test "$PHP_GRPC" != "no"; then
PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/include)
PHP_ADD_INCLUDE(PHP_EXT_SRCDIR()/src/php/ext/grpc)
GRPC_LIBDIR=@@build_lib_path@@
PHP_ADD_LIBPATH($GRPC_LIBDIR)
PHP_ADD_LIBRARY(grpc,,GRPC_SHARED_LIBADD)
LIBS="-lpthread $LIBS"
PHP_ADD_LIBRARY(pthread)
case $host in
*darwin*)
PHP_ADD_LIBRARY(c++,1,GRPC_SHARED_LIBADD)
;;
*)
PHP_ADD_LIBRARY(stdc++,1,GRPC_SHARED_LIBADD)
PHP_ADD_LIBRARY(rt,,GRPC_SHARED_LIBADD)
PHP_ADD_LIBRARY(rt)
;;
esac
PHP_NEW_EXTENSION(grpc, @grpc_c_files@, $ext_shared, , -DGRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK=1)
PHP_SUBST(GRPC_SHARED_LIBADD)
PHP_INSTALL_HEADERS([ext/grpc], [php_grpc.h])
fi
M4;
$replace = get_pack_replace();
// load grpc c files from src/php/ext/grpc
$c_files = glob($this->source_dir . '/src/php/ext/grpc/*.c');
$replace['@grpc_c_files@'] = implode(" \\\n ", array_map(fn ($f) => 'src/php/ext/grpc/' . basename($f), $c_files));
$config_m4 = str_replace(array_keys($replace), array_values($replace), $config_m4);
file_put_contents($this->source_dir . '/config.m4', $config_m4);
copy($this->source_dir . '/src/php/ext/grpc/php_grpc.h', $this->source_dir . '/php_grpc.h');
return true;
}
@@ -48,7 +88,6 @@ class grpc extends Extension
public function patchBeforeMake(): bool
{
parent::patchBeforeMake();
// add -Wno-strict-prototypes
GlobalEnvManager::putenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS=' . getenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS') . ' -Wno-strict-prototypes');
return true;
}

View File

@@ -33,4 +33,14 @@ class sqlsrv extends Extension
}
return false;
}
public function patchBeforeMake(): bool
{
$makefile = SOURCE_PATH . '/php-src/Makefile';
$makeContent = file_get_contents($makefile);
$makeContent = preg_replace('/^(CFLAGS_(?:PDO_)?SQLSRV=.*?)\s+\/W4\b/m', '$1', $makeContent);
$makeContent = preg_replace('/^(CFLAGS_(?:PDO_)?SQLSRV=.*?)\s+\/WX\b/m', '$1', $makeContent);
file_put_contents($makefile, $makeContent);
return true;
}
}

View File

@@ -50,19 +50,16 @@ class swoole extends Extension
// commonly used feature: coroutine-time
$arg .= ' --enable-swoole-coro-time --with-pic';
$arg .= ' --enable-swoole-ssh --enable-swoole-curl';
$arg .= $this->builder->getOption('enable-zts') ? ' --enable-swoole-thread --disable-thread-context' : ' --disable-swoole-thread --enable-thread-context';
// required features: curl, openssl (but curl hook is buggy for php 8.0)
$arg .= $this->builder->getPHPVersionID() >= 80100 ? ' --enable-swoole-curl' : ' --disable-swoole-curl';
$arg .= ' --enable-openssl';
// additional features that only require libraries
$arg .= $this->builder->getLib('libcares') ? ' --enable-cares' : '';
$arg .= $this->builder->getLib('brotli') ? (' --enable-brotli --with-brotli-dir=' . BUILD_ROOT_PATH) : '';
$arg .= $this->builder->getLib('nghttp2') ? (' --with-nghttp2-dir=' . BUILD_ROOT_PATH) : '';
$arg .= $this->builder->getLib('zstd') ? ' --enable-zstd' : '';
$arg .= $this->builder->getLib('liburing') ? ' --enable-iouring' : '';
$arg .= $this->builder->getLib('liburing') && getenv('SPC_LIBC') !== 'glibc' ? ' --enable-iouring --enable-uring-socket' : '--disable-iouring';
$arg .= $this->builder->getExt('sockets') ? ' --enable-sockets' : '';
// enable additional features that require the pdo extension, but conflict with pdo_* extensions
@@ -74,6 +71,7 @@ class swoole extends Extension
$config = (new SPCConfigUtil($this->builder))->getLibraryConfig($this->builder->getLib('unixodbc'));
$arg .= ' --with-swoole-odbc=unixODBC,' . BUILD_ROOT_PATH . ' SWOOLE_ODBC_LIBS="' . $config['libs'] . '"';
}
$arg .= $this->builder->getExt('ftp')?->isBuildStatic() ? ' --disable-swoole-ftp' : ' --enable-swoole-ftp';
if ($this->getExtVersion() >= '6.1.0') {
$arg .= ' --enable-swoole-stdext';

View File

@@ -7,6 +7,7 @@ namespace SPC\builder\extension;
use SPC\builder\Extension;
use SPC\store\SourcePatcher;
use SPC\util\CustomExt;
use SPC\util\GlobalEnvManager;
#[CustomExt('xlswriter')]
class xlswriter extends Extension
@@ -28,6 +29,13 @@ class xlswriter extends Extension
public function patchBeforeMake(): bool
{
$patched = parent::patchBeforeMake();
// Remove when https://github.com/viest/php-ext-xlswriter/pull/560 is merged
if (PHP_OS_FAMILY !== 'Windows') {
GlobalEnvManager::putenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS=' . getenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS') . ' -std=gnu17');
$patched = true;
}
if (PHP_OS_FAMILY === 'Windows') {
// fix windows build with openssl extension duplicate symbol bug
SourcePatcher::patchFile('spc_fix_xlswriter_win32.patch', $this->source_dir);
@@ -40,4 +48,10 @@ class xlswriter extends Extension
}
return $patched;
}
// Remove when https://github.com/viest/php-ext-xlswriter/pull/560 is merged
protected function getExtraEnv(): array
{
return ['CFLAGS' => '-std=gnu17'];
}
}

View File

@@ -162,7 +162,7 @@ class LinuxBuilder extends UnixBuilderBase
throw new WrongUsageException(
"You're building against musl libc statically (the default on Linux), but you're trying to build shared extensions.\n" .
'Static musl libc does not implement `dlopen`, so your php binary is not able to load shared extensions.' . "\n" .
'Either use SPC_LIBC=glibc to link against glibc on a glibc OS, or use SPC_TARGET="native-native-musl -dynamic" to link against musl libc dynamically using `zig cc`.'
'Either use SPC_LIBC=glibc to link against glibc on a glibc OS, use SPC_TARGET="native-native-musl -dynamic" to link against musl libc dynamically using `zig cc` or use SPC_MUSL_DYNAMIC=true on alpine.'
);
}
logger()->info('Building shared extensions...');

View File

@@ -72,6 +72,10 @@ trait UnixSystemUtilTrait
if (!is_file($symbol_file)) {
throw new SPCInternalException("The symbol file {$symbol_file} does not exist, please check if nm command is available.");
}
// https://github.com/ziglang/zig/issues/24662
if (ToolchainManager::getToolchainClass() === ZigToolchain::class) {
return '-Wl,--export-dynamic'; // needs release 0.16, can be removed then
}
// macOS/zig
if (SPCTarget::getTargetOS() !== 'Linux' || ToolchainManager::getToolchainClass() === ZigToolchain::class) {
return "-Wl,-exported_symbols_list,{$symbol_file}";

View File

@@ -457,6 +457,7 @@ abstract class UnixBuilderBase extends BuilderBase
'XCADDY_GO_BUILD_FLAGS' => '-buildmode=pie ' .
'-ldflags \"-linkmode=external ' . $extLdFlags . ' ' .
'-X \'github.com/caddyserver/caddy/v2/modules/caddyhttp.ServerHeader=FrankenPHP Caddy\' ' .
'-X \'github.com/caddyserver/caddy/v2.CustomBinaryName=frankenphp\' ' .
'-X \'github.com/caddyserver/caddy/v2.CustomVersion=FrankenPHP ' .
"v{$frankenPhpVersion} PHP {$libphpVersion} Caddy'\\\" " .
"-tags={$muslTags}nobadger,nomysql,nopgx{$nobrotli}{$nowatcher}",

View File

@@ -13,8 +13,8 @@ trait freetype
{
$cmake = UnixCMakeExecutor::create($this)
->optionalLib('libpng', ...cmake_boolean_args('FT_DISABLE_PNG', true))
->optionalLib('bzip2', ...cmake_boolean_args('FT_DISABLE_BZIP2', true))
->optionalLib('brotli', ...cmake_boolean_args('FT_DISABLE_BROTLI', true))
->addConfigureArgs('-DFT_DISABLE_BZIP2=ON')
->addConfigureArgs('-DFT_DISABLE_BROTLI=ON')
->addConfigureArgs('-DFT_DISABLE_HARFBUZZ=ON');
// fix cmake 4.0 compatibility

View File

@@ -13,7 +13,10 @@ trait krb5
{
$origin_source_dir = $this->source_dir;
$this->source_dir .= '/src';
shell()->cd($this->source_dir)->exec('autoreconf -if');
shell()->cd($this->source_dir)->exec('ls -lah');
if (!file_exists($this->source_dir . '/configure')) {
shell()->cd($this->source_dir)->exec('autoreconf -if');
}
$libs = array_map(fn ($x) => $x->getName(), $this->getDependencies(true));
$spc = new SPCConfigUtil($this->builder, ['no_php' => true, 'libs_only_deps' => true]);
$config = $spc->config(libraries: $libs, include_suggest_lib: $this->builder->getOption('with-suggested-libs', false));

View File

@@ -11,7 +11,10 @@ trait libde265
protected function build(): void
{
UnixCMakeExecutor::create($this)
->addConfigureArgs('-DENABLE_SDL=OFF')
->addConfigureArgs(
'-DENABLE_SDL=OFF',
'-DENABLE_DECODER=OFF'
)
->build();
$this->patchPkgconfPrefix(['libde265.pc']);
}

View File

@@ -14,6 +14,10 @@ trait libjpeg
->addConfigureArgs(
'-DENABLE_STATIC=ON',
'-DENABLE_SHARED=OFF',
'-DWITH_SYSTEM_ZLIB=ON',
'-DWITH_TOOLS=OFF',
'-DWITH_TESTS=OFF',
'-DWITH_SIMD=OFF',
)
->build();
// patch pkgconfig

Some files were not shown because too many files have changed in this diff Show More