mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-10 02:15:36 +08:00
Compare commits
121 Commits
1ee8bc7d34
...
ttt
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a3003d363e | ||
|
|
b5b4e8f622 | ||
|
|
d316ea81e4 | ||
|
|
b96586e4d3 | ||
|
|
d535e4f102 | ||
|
|
5a5f54bdcd | ||
|
|
8f7897e13b | ||
|
|
daae5f2a7c | ||
|
|
844bb69f0d | ||
|
|
766f7fa34f | ||
|
|
ecf712b2b7 | ||
|
|
94dd44e68d | ||
|
|
2fa07700ef | ||
|
|
13a15b1a5a | ||
|
|
d2c7fee8fa | ||
|
|
9cd3125544 | ||
|
|
590a94a723 | ||
|
|
b625d80dc0 | ||
|
|
93c099dd31 | ||
|
|
fcd0052d12 | ||
|
|
6c52451c6c | ||
|
|
175567fd11 | ||
|
|
bf05af7e16 | ||
|
|
7c3022b7e3 | ||
|
|
2a50015c12 | ||
|
|
1f42f1a479 | ||
|
|
41f5948392 | ||
|
|
6d91f8b2d3 | ||
|
|
141c737380 | ||
|
|
d35cbd7bf8 | ||
|
|
d076df6b04 | ||
|
|
a99b6bebae | ||
|
|
af97263596 | ||
|
|
864678ab46 | ||
|
|
c03508a84b | ||
|
|
963e2a084a | ||
|
|
508cfa67e5 | ||
|
|
08dca4253d | ||
|
|
e4434643ff | ||
|
|
adff728999 | ||
|
|
9af132d67e | ||
|
|
a950f3d716 | ||
|
|
33f33439d1 | ||
|
|
36177e4948 | ||
|
|
801d41efeb | ||
|
|
43d8c9d9d6 | ||
|
|
75dd01aa91 | ||
|
|
bf4d227a55 | ||
|
|
520767638f | ||
|
|
5ff973e446 | ||
|
|
230be2ebe8 | ||
|
|
bd73b4a6dc | ||
|
|
327bb8bc0f | ||
|
|
deb979416f | ||
|
|
f6e00c67cc | ||
|
|
7df861696d | ||
|
|
92861669c2 | ||
|
|
893f640469 | ||
|
|
eff7037e74 | ||
|
|
1213cb578e | ||
|
|
d1ec473f21 | ||
|
|
19bfb6bc83 | ||
|
|
94c579a453 | ||
|
|
d7d41f4d89 | ||
|
|
4c6b7a3d55 | ||
|
|
5404926a14 | ||
|
|
295df19484 | ||
|
|
b970bf8e3a | ||
|
|
54915028d7 | ||
|
|
03cd7e141c | ||
|
|
9f3e353699 | ||
|
|
b21d5716e1 | ||
|
|
464ddeb29d | ||
|
|
0c389d9069 | ||
|
|
1d2916fa8f | ||
|
|
46132ee1c8 | ||
|
|
3c9e868ce1 | ||
|
|
c5efcc0c93 | ||
|
|
64d692e105 | ||
|
|
dc79ac9c9a | ||
|
|
e9be3a41db | ||
|
|
00649d816e | ||
|
|
11376cc6ad | ||
|
|
c6207d8c7c | ||
|
|
b0eff0ba6e | ||
|
|
9d748a6e08 | ||
|
|
b0522205da | ||
|
|
beeb0b8721 | ||
|
|
823fe96942 | ||
|
|
f2fa29809a | ||
|
|
463ec546fa | ||
|
|
9e2a5ce188 | ||
|
|
0b0ecd17c3 | ||
|
|
c81146bf18 | ||
|
|
c1f2fd49a6 | ||
|
|
60b2aea09e | ||
|
|
4625c6a885 | ||
|
|
85b0cd8b4b | ||
|
|
1fcb74ad9b | ||
|
|
1049a3ce66 | ||
|
|
1b8b53d47f | ||
|
|
a232f578a4 | ||
|
|
70285cb53b | ||
|
|
a335d050cf | ||
|
|
ef4b2997a7 | ||
|
|
901da8fa41 | ||
|
|
e49a5d7a50 | ||
|
|
281b958075 | ||
|
|
e31f64864e | ||
|
|
92f5b56c74 | ||
|
|
2350d2d5ca | ||
|
|
086c855a43 | ||
|
|
4fa5292913 | ||
|
|
9634b8bcda | ||
|
|
5d5a50a33c | ||
|
|
1edf14e642 | ||
|
|
2277390a1a | ||
|
|
f93ad27c17 | ||
|
|
b690566b39 | ||
|
|
16e772e1a8 | ||
|
|
ad356b4a23 |
79
.github/workflows/build-unix.yml
vendored
79
.github/workflows/build-unix.yml
vendored
@@ -29,6 +29,9 @@ on:
|
|||||||
description: Extensions to build (comma separated)
|
description: Extensions to build (comma separated)
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
|
shared-extensions:
|
||||||
|
description: Shared extensions to build (optional, comma separated)
|
||||||
|
type: string
|
||||||
extra-libs:
|
extra-libs:
|
||||||
description: Extra libraries to build (optional, comma separated)
|
description: Extra libraries to build (optional, comma separated)
|
||||||
type: string
|
type: string
|
||||||
@@ -42,6 +45,14 @@ on:
|
|||||||
build-fpm:
|
build-fpm:
|
||||||
description: Build fpm binary
|
description: Build fpm binary
|
||||||
type: boolean
|
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:
|
prefer-pre-built:
|
||||||
description: Prefer pre-built binaries (reduce build time)
|
description: Prefer pre-built binaries (reduce build time)
|
||||||
type: boolean
|
type: boolean
|
||||||
@@ -73,6 +84,9 @@ on:
|
|||||||
description: Extensions to build (comma separated)
|
description: Extensions to build (comma separated)
|
||||||
required: true
|
required: true
|
||||||
type: string
|
type: string
|
||||||
|
shared-extensions:
|
||||||
|
description: Shared extensions to build (optional, comma separated)
|
||||||
|
type: string
|
||||||
extra-libs:
|
extra-libs:
|
||||||
description: Extra libraries to build (optional, comma separated)
|
description: Extra libraries to build (optional, comma separated)
|
||||||
type: string
|
type: string
|
||||||
@@ -86,6 +100,14 @@ on:
|
|||||||
build-fpm:
|
build-fpm:
|
||||||
description: Build fpm binary
|
description: Build fpm binary
|
||||||
type: boolean
|
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:
|
prefer-pre-built:
|
||||||
description: Prefer pre-built binaries (reduce build time)
|
description: Prefer pre-built binaries (reduce build time)
|
||||||
type: boolean
|
type: boolean
|
||||||
@@ -152,8 +174,19 @@ jobs:
|
|||||||
RUNS_ON="macos-15"
|
RUNS_ON="macos-15"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
DOWN_CMD="$DOWN_CMD --with-php=${{ inputs.php-version }} --for-extensions=${{ inputs.extensions }} --ignore-cache-sources=php-src"
|
STATIC_EXTS="${{ inputs.extensions }}"
|
||||||
BUILD_CMD="$BUILD_CMD ${{ 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
|
if [ -n "${{ inputs.extra-libs }}" ]; then
|
||||||
DOWN_CMD="$DOWN_CMD --for-libs=${{ inputs.extra-libs }}"
|
DOWN_CMD="$DOWN_CMD --for-libs=${{ inputs.extra-libs }}"
|
||||||
BUILD_CMD="$BUILD_CMD --with-libs=${{ inputs.extra-libs }}"
|
BUILD_CMD="$BUILD_CMD --with-libs=${{ inputs.extra-libs }}"
|
||||||
@@ -177,6 +210,12 @@ jobs:
|
|||||||
if [ ${{ inputs.build-fpm }} == true ]; then
|
if [ ${{ inputs.build-fpm }} == true ]; then
|
||||||
BUILD_CMD="$BUILD_CMD --build-fpm"
|
BUILD_CMD="$BUILD_CMD --build-fpm"
|
||||||
fi
|
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 'download='"$DOWN_CMD" >> "$GITHUB_OUTPUT"
|
||||||
echo 'build='"$BUILD_CMD" >> "$GITHUB_OUTPUT"
|
echo 'build='"$BUILD_CMD" >> "$GITHUB_OUTPUT"
|
||||||
echo 'run='"$RUNS_ON" >> "$GITHUB_OUTPUT"
|
echo 'run='"$RUNS_ON" >> "$GITHUB_OUTPUT"
|
||||||
@@ -199,6 +238,27 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
phpts: nts
|
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
|
# Cache downloaded source
|
||||||
- id: cache-download
|
- id: cache-download
|
||||||
uses: actions/cache@v4
|
uses: actions/cache@v4
|
||||||
@@ -245,7 +305,22 @@ jobs:
|
|||||||
name: php-fpm-${{ inputs.php-version }}-${{ inputs.os }}
|
name: php-fpm-${{ inputs.php-version }}-${{ inputs.os }}
|
||||||
path: buildroot/bin/php-fpm
|
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
|
# 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
|
- uses: actions/upload-artifact@v4
|
||||||
name: "Upload License Files"
|
name: "Upload License Files"
|
||||||
with:
|
with:
|
||||||
|
|||||||
57
TODO.md
Normal file
57
TODO.md
Normal 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)
|
||||||
|
- [ ] 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)
|
||||||
12
bin/spc-debug.ps1
Normal file
12
bin/spc-debug.ps1
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
$PHP_Exec = ".\runtime\php.exe"
|
||||||
|
|
||||||
|
if (-not(Test-Path $PHP_Exec)) {
|
||||||
|
$PHP_Exec = Get-Command php.exe -ErrorAction SilentlyContinue | Select-Object -ExpandProperty Definition
|
||||||
|
if (-not $PHP_Exec) {
|
||||||
|
Write-Host "Error: PHP not found, you need to install PHP on your system or use 'bin/setup-runtime'." -ForegroundColor Red
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
& "$PHP_Exec" -d xdebug.mode=debug -d xdebug.client_host=127.0.0.1 -d xdebug.client_port=9003 -d xdebug.start_with_request=yes ("bin/spc") @args
|
||||||
|
exit $LASTEXITCODE
|
||||||
9
config/artifact/ncurses.yml
Normal file
9
config/artifact/ncurses.yml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
ncurses:
|
||||||
|
binary: hosted
|
||||||
|
metadata:
|
||||||
|
license-files:
|
||||||
|
- COPYING
|
||||||
|
source:
|
||||||
|
type: filelist
|
||||||
|
url: 'https://ftp.gnu.org/pub/gnu/ncurses/'
|
||||||
|
regex: '/href="(?<file>ncurses-(?<version>[^"]+)\.tar\.gz)"/'
|
||||||
@@ -134,6 +134,8 @@ OPENSSLDIR=""
|
|||||||
; build target: macho or macho (possibly we could support macho-universal in the future)
|
; build target: macho or macho (possibly we could support macho-universal in the future)
|
||||||
; Currently we do not support universal and cross-compilation for macOS.
|
; Currently we do not support universal and cross-compilation for macOS.
|
||||||
SPC_TARGET=native-macos
|
SPC_TARGET=native-macos
|
||||||
|
; Whether to use brew version of llvm or system version (valid options: 'system', 'brew', default: 'system')
|
||||||
|
SPC_USE_LLVM=system
|
||||||
; compiler environments (default value is defined by selected toolchain)
|
; compiler environments (default value is defined by selected toolchain)
|
||||||
CC=${SPC_DEFAULT_CC}
|
CC=${SPC_DEFAULT_CC}
|
||||||
CXX=${SPC_DEFAULT_CXX}
|
CXX=${SPC_DEFAULT_CXX}
|
||||||
|
|||||||
@@ -252,6 +252,7 @@
|
|||||||
"arg-type-unix": "enable-path",
|
"arg-type-unix": "enable-path",
|
||||||
"cpp-extension": true,
|
"cpp-extension": true,
|
||||||
"lib-depends": [
|
"lib-depends": [
|
||||||
|
"grpc",
|
||||||
"zlib",
|
"zlib",
|
||||||
"openssl",
|
"openssl",
|
||||||
"libcares"
|
"libcares"
|
||||||
|
|||||||
@@ -143,9 +143,7 @@
|
|||||||
"zlib"
|
"zlib"
|
||||||
],
|
],
|
||||||
"lib-suggests": [
|
"lib-suggests": [
|
||||||
"libpng",
|
"libpng"
|
||||||
"bzip2",
|
|
||||||
"brotli"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"gettext": {
|
"gettext": {
|
||||||
@@ -355,6 +353,9 @@
|
|||||||
"static-libs-unix": [
|
"static-libs-unix": [
|
||||||
"libaom.a"
|
"libaom.a"
|
||||||
],
|
],
|
||||||
|
"static-libs-windows": [
|
||||||
|
"aom.lib"
|
||||||
|
],
|
||||||
"cpp-library": true
|
"cpp-library": true
|
||||||
},
|
},
|
||||||
"libargon2": {
|
"libargon2": {
|
||||||
@@ -493,7 +494,7 @@
|
|||||||
"static-libs-windows": [
|
"static-libs-windows": [
|
||||||
"libjpeg_a.lib"
|
"libjpeg_a.lib"
|
||||||
],
|
],
|
||||||
"lib-suggests-windows": [
|
"lib-depends": [
|
||||||
"zlib"
|
"zlib"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -862,6 +863,9 @@
|
|||||||
},
|
},
|
||||||
"openssl": {
|
"openssl": {
|
||||||
"source": "openssl",
|
"source": "openssl",
|
||||||
|
"pkg-configs": [
|
||||||
|
"openssl"
|
||||||
|
],
|
||||||
"static-libs-unix": [
|
"static-libs-unix": [
|
||||||
"libssl.a",
|
"libssl.a",
|
||||||
"libcrypto.a"
|
"libcrypto.a"
|
||||||
@@ -974,6 +978,11 @@
|
|||||||
},
|
},
|
||||||
"unixodbc": {
|
"unixodbc": {
|
||||||
"source": "unixodbc",
|
"source": "unixodbc",
|
||||||
|
"pkg-configs": [
|
||||||
|
"odbc",
|
||||||
|
"odbccr",
|
||||||
|
"odbcinst"
|
||||||
|
],
|
||||||
"static-libs-unix": [
|
"static-libs-unix": [
|
||||||
"libodbc.a",
|
"libodbc.a",
|
||||||
"libodbccr.a",
|
"libodbccr.a",
|
||||||
@@ -1015,6 +1024,9 @@
|
|||||||
},
|
},
|
||||||
"zlib": {
|
"zlib": {
|
||||||
"source": "zlib",
|
"source": "zlib",
|
||||||
|
"pkg-configs": [
|
||||||
|
"zlib"
|
||||||
|
],
|
||||||
"static-libs-unix": [
|
"static-libs-unix": [
|
||||||
"libz.a"
|
"libz.a"
|
||||||
],
|
],
|
||||||
@@ -1028,6 +1040,9 @@
|
|||||||
},
|
},
|
||||||
"zstd": {
|
"zstd": {
|
||||||
"source": "zstd",
|
"source": "zstd",
|
||||||
|
"pkg-configs": [
|
||||||
|
"libzstd"
|
||||||
|
],
|
||||||
"static-libs-unix": [
|
"static-libs-unix": [
|
||||||
"libzstd.a"
|
"libzstd.a"
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ ext-curl:
|
|||||||
depends:
|
depends:
|
||||||
- curl
|
- curl
|
||||||
depends@windows:
|
depends@windows:
|
||||||
|
- curl
|
||||||
- ext-zlib
|
- ext-zlib
|
||||||
- ext-openssl
|
- ext-openssl
|
||||||
php-extension:
|
php-extension:
|
||||||
@@ -342,6 +343,6 @@ ext-zlib:
|
|||||||
- zlib
|
- zlib
|
||||||
php-extension:
|
php-extension:
|
||||||
arg-type: custom
|
arg-type: custom
|
||||||
arg-type@windows: with
|
arg-type@windows: enable
|
||||||
build-with-php: true
|
build-with-php: true
|
||||||
build-shared: false
|
build-shared: false
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ ext-amqp:
|
|||||||
depends:
|
depends:
|
||||||
- librabbitmq
|
- librabbitmq
|
||||||
depends@windows:
|
depends@windows:
|
||||||
|
- librabbitmq
|
||||||
- ext-openssl
|
- ext-openssl
|
||||||
php-extension:
|
php-extension:
|
||||||
arg-type: '--with-amqp@shared_suffix@ --with-librabbitmq-dir=@build_root_path@'
|
arg-type: '--with-amqp@shared_suffix@ --with-librabbitmq-dir=@build_root_path@'
|
||||||
|
|||||||
15
config/pkg/ext/ext-imap.yml
Normal file
15
config/pkg/ext/ext-imap.yml
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
ext-imap:
|
||||||
|
type: php-extension
|
||||||
|
artifact:
|
||||||
|
source:
|
||||||
|
type: pecl
|
||||||
|
name: imap
|
||||||
|
metadata:
|
||||||
|
license-files: [LICENSE]
|
||||||
|
license: PHP-3.01
|
||||||
|
depends:
|
||||||
|
- imap
|
||||||
|
suggests:
|
||||||
|
- ext-openssl
|
||||||
|
php-extension:
|
||||||
|
arg-type: custom
|
||||||
@@ -15,3 +15,7 @@ brotli:
|
|||||||
- libbrotlicommon
|
- libbrotlicommon
|
||||||
- libbrotlidec
|
- libbrotlidec
|
||||||
- libbrotlienc
|
- libbrotlienc
|
||||||
|
static-libs@windows:
|
||||||
|
- brotlicommon.lib
|
||||||
|
- brotlidec.lib
|
||||||
|
- brotlienc.lib
|
||||||
|
|||||||
@@ -16,3 +16,6 @@ bzip2:
|
|||||||
- bzlib.h
|
- bzlib.h
|
||||||
static-libs@unix:
|
static-libs@unix:
|
||||||
- libbz2.a
|
- libbz2.a
|
||||||
|
static-libs@windows:
|
||||||
|
- libbz2.lib
|
||||||
|
- libbz2_a.lib
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ freetype:
|
|||||||
depends:
|
depends:
|
||||||
- zlib
|
- zlib
|
||||||
suggests:
|
suggests:
|
||||||
|
- libpng
|
||||||
- bzip2
|
- bzip2
|
||||||
- brotli
|
- brotli
|
||||||
headers@unix:
|
headers@unix:
|
||||||
|
|||||||
@@ -6,11 +6,20 @@ icu:
|
|||||||
repo: unicode-org/icu
|
repo: unicode-org/icu
|
||||||
match: icu4c.+-src\.tgz
|
match: icu4c.+-src\.tgz
|
||||||
prefer-stable: true
|
prefer-stable: true
|
||||||
|
binary:
|
||||||
|
windows-x86_64: { type: url, url: 'https://dl.static-php.dev/static-php-cli/deps/icu-static-windows-x64/icu-static-windows-x64.zip', extract: hosted }
|
||||||
metadata:
|
metadata:
|
||||||
license-files: [LICENSE]
|
license-files: ['@/icu.txt']
|
||||||
license: ICU
|
license: ICU
|
||||||
|
headers@windows:
|
||||||
|
- unicode
|
||||||
lang: cpp
|
lang: cpp
|
||||||
pkg-configs:
|
pkg-configs:
|
||||||
- icu-uc
|
- icu-uc
|
||||||
- icu-i18n
|
- icu-i18n
|
||||||
- icu-io
|
- icu-io
|
||||||
|
static-libs@windows:
|
||||||
|
- icudt.lib
|
||||||
|
- icuin.lib
|
||||||
|
- icuio.lib
|
||||||
|
- icuuc.lib
|
||||||
|
|||||||
@@ -10,3 +10,5 @@ libaom:
|
|||||||
lang: cpp
|
lang: cpp
|
||||||
static-libs@unix:
|
static-libs@unix:
|
||||||
- libaom.a
|
- libaom.a
|
||||||
|
static-libs@windows:
|
||||||
|
- aom.lib
|
||||||
|
|||||||
@@ -16,3 +16,5 @@ libavif:
|
|||||||
- libpng
|
- libpng
|
||||||
static-libs@unix:
|
static-libs@unix:
|
||||||
- libavif.a
|
- libavif.a
|
||||||
|
static-libs@windows:
|
||||||
|
- avif.lib
|
||||||
|
|||||||
12
config/pkg/lib/libffi-win.yml
Normal file
12
config/pkg/lib/libffi-win.yml
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
libffi-win:
|
||||||
|
type: library
|
||||||
|
artifact:
|
||||||
|
source:
|
||||||
|
type: git
|
||||||
|
rev: master
|
||||||
|
url: 'https://github.com/static-php/libffi-win.git'
|
||||||
|
metadata:
|
||||||
|
license-files: [LICENSE]
|
||||||
|
license: MIT
|
||||||
|
static-libs@windows:
|
||||||
|
- libffi.lib
|
||||||
13
config/pkg/lib/libiconv-win.yml
Normal file
13
config/pkg/lib/libiconv-win.yml
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
libiconv-win:
|
||||||
|
type: library
|
||||||
|
artifact:
|
||||||
|
source:
|
||||||
|
type: git
|
||||||
|
rev: master
|
||||||
|
url: 'https://github.com/static-php/libiconv-win.git'
|
||||||
|
metadata:
|
||||||
|
license-files: [source/COPYING]
|
||||||
|
license: GPL-3.0-or-later
|
||||||
|
static-libs@windows:
|
||||||
|
- libiconv.lib
|
||||||
|
- libiconv_a.lib
|
||||||
@@ -7,6 +7,10 @@ libjpeg:
|
|||||||
metadata:
|
metadata:
|
||||||
license-files: [LICENSE.md]
|
license-files: [LICENSE.md]
|
||||||
license: IJG
|
license: IJG
|
||||||
|
suggests@windows:
|
||||||
|
- zlib
|
||||||
static-libs@unix:
|
static-libs@unix:
|
||||||
- libjpeg.a
|
- libjpeg.a
|
||||||
- libturbojpeg.a
|
- libturbojpeg.a
|
||||||
|
static-libs@windows:
|
||||||
|
- libjpeg_a.lib
|
||||||
|
|||||||
@@ -14,3 +14,6 @@ libpng:
|
|||||||
- zlib
|
- zlib
|
||||||
static-libs@unix:
|
static-libs@unix:
|
||||||
- libpng16.a
|
- libpng16.a
|
||||||
|
static-libs@windows:
|
||||||
|
- libpng16_static.lib
|
||||||
|
- libpng_a.lib
|
||||||
|
|||||||
@@ -12,3 +12,5 @@ librabbitmq:
|
|||||||
- openssl
|
- openssl
|
||||||
static-libs@unix:
|
static-libs@unix:
|
||||||
- librabbitmq.a
|
- librabbitmq.a
|
||||||
|
static-libs@windows:
|
||||||
|
- rabbitmq.4.lib
|
||||||
|
|||||||
@@ -13,3 +13,5 @@ libsodium:
|
|||||||
- libsodium
|
- libsodium
|
||||||
static-libs@unix:
|
static-libs@unix:
|
||||||
- libsodium.a
|
- libsodium.a
|
||||||
|
static-libs@windows:
|
||||||
|
- libsodium.lib
|
||||||
|
|||||||
@@ -20,3 +20,5 @@ libssh2:
|
|||||||
- libssh2
|
- libssh2
|
||||||
static-libs@unix:
|
static-libs@unix:
|
||||||
- libssh2.a
|
- libssh2.a
|
||||||
|
static-libs@windows:
|
||||||
|
- libssh2.lib
|
||||||
|
|||||||
@@ -14,3 +14,8 @@ libwebp:
|
|||||||
- libwebpdemux
|
- libwebpdemux
|
||||||
- libwebpmux
|
- libwebpmux
|
||||||
- libsharpyuv
|
- libsharpyuv
|
||||||
|
static-libs@windows:
|
||||||
|
- libwebp.lib
|
||||||
|
- libwebpdecoder.lib
|
||||||
|
- libwebpdemux.lib
|
||||||
|
- libsharpyuv.lib
|
||||||
|
|||||||
@@ -12,7 +12,13 @@ libxml2:
|
|||||||
- libiconv
|
- libiconv
|
||||||
- zlib
|
- zlib
|
||||||
- xz
|
- xz
|
||||||
|
depends@windows:
|
||||||
|
- zlib
|
||||||
|
- libiconv-win
|
||||||
headers:
|
headers:
|
||||||
- libxml2
|
- libxml2
|
||||||
pkg-configs:
|
pkg-configs:
|
||||||
- libxml-2.0
|
- libxml-2.0
|
||||||
|
static-libs@windows:
|
||||||
|
- libxml2s.lib
|
||||||
|
- libxml2_a.lib
|
||||||
|
|||||||
@@ -13,3 +13,5 @@ libyaml:
|
|||||||
- yaml.h
|
- yaml.h
|
||||||
static-libs@unix:
|
static-libs@unix:
|
||||||
- libyaml.a
|
- libyaml.a
|
||||||
|
static-libs@windows:
|
||||||
|
- yaml.lib
|
||||||
|
|||||||
@@ -8,9 +8,10 @@ libzip:
|
|||||||
prefer-stable: true
|
prefer-stable: true
|
||||||
metadata:
|
metadata:
|
||||||
license-files: [LICENSE]
|
license-files: [LICENSE]
|
||||||
depends@unix:
|
license: BSD-3-Clause
|
||||||
|
depends:
|
||||||
- zlib
|
- zlib
|
||||||
suggests@unix:
|
suggests:
|
||||||
- bzip2
|
- bzip2
|
||||||
- xz
|
- xz
|
||||||
- zstd
|
- zstd
|
||||||
@@ -20,3 +21,5 @@ libzip:
|
|||||||
- zipconf.h
|
- zipconf.h
|
||||||
static-libs@unix:
|
static-libs@unix:
|
||||||
- libzip.a
|
- libzip.a
|
||||||
|
static-libs@windows:
|
||||||
|
- libzip_a.lib
|
||||||
|
|||||||
@@ -1,12 +1,10 @@
|
|||||||
ncurses:
|
ncurses:
|
||||||
type: library
|
type: library
|
||||||
artifact:
|
artifact: ncurses
|
||||||
source:
|
|
||||||
type: filelist
|
|
||||||
url: 'https://ftp.gnu.org/pub/gnu/ncurses/'
|
|
||||||
regex: '/href="(?<file>ncurses-(?<version>[^"]+)\.tar\.gz)"/'
|
|
||||||
binary: hosted
|
|
||||||
metadata:
|
|
||||||
license-files: [COPYING]
|
|
||||||
static-libs@unix:
|
static-libs@unix:
|
||||||
- libncurses.a
|
- libncurses.a
|
||||||
|
ncursesw:
|
||||||
|
type: library
|
||||||
|
artifact: ncurses
|
||||||
|
static-libs@unix:
|
||||||
|
- libncursesw.a
|
||||||
|
|||||||
@@ -22,3 +22,5 @@ nghttp2:
|
|||||||
- libnghttp2
|
- libnghttp2
|
||||||
static-libs@unix:
|
static-libs@unix:
|
||||||
- libnghttp2.a
|
- libnghttp2.a
|
||||||
|
static-libs@windows:
|
||||||
|
- nghttp2.lib
|
||||||
|
|||||||
@@ -17,3 +17,5 @@ nghttp3:
|
|||||||
- libnghttp3
|
- libnghttp3
|
||||||
static-libs@unix:
|
static-libs@unix:
|
||||||
- libnghttp3.a
|
- libnghttp3.a
|
||||||
|
static-libs@windows:
|
||||||
|
- nghttp3.lib
|
||||||
|
|||||||
@@ -11,9 +11,6 @@ ngtcp2:
|
|||||||
license: MIT
|
license: MIT
|
||||||
depends:
|
depends:
|
||||||
- openssl
|
- openssl
|
||||||
suggests:
|
|
||||||
- nghttp3
|
|
||||||
- brotli
|
|
||||||
headers:
|
headers:
|
||||||
- ngtcp2
|
- ngtcp2
|
||||||
pkg-configs:
|
pkg-configs:
|
||||||
@@ -22,3 +19,5 @@ ngtcp2:
|
|||||||
static-libs@unix:
|
static-libs@unix:
|
||||||
- libngtcp2.a
|
- libngtcp2.a
|
||||||
- libngtcp2_crypto_ossl.a
|
- libngtcp2_crypto_ossl.a
|
||||||
|
static-libs@windows:
|
||||||
|
- ngtcp2.lib
|
||||||
|
|||||||
@@ -13,3 +13,6 @@ onig:
|
|||||||
- oniguruma.h
|
- oniguruma.h
|
||||||
static-libs@unix:
|
static-libs@unix:
|
||||||
- libonig.a
|
- libonig.a
|
||||||
|
static-libs@windows:
|
||||||
|
- onig.lib
|
||||||
|
- onig_a.lib
|
||||||
|
|||||||
@@ -16,8 +16,14 @@ openssl:
|
|||||||
license: OpenSSL
|
license: OpenSSL
|
||||||
depends:
|
depends:
|
||||||
- zlib
|
- zlib
|
||||||
|
depends@windows:
|
||||||
|
- zlib
|
||||||
|
- jom
|
||||||
headers:
|
headers:
|
||||||
- openssl
|
- openssl
|
||||||
static-libs@unix:
|
static-libs@unix:
|
||||||
- libssl.a
|
- libssl.a
|
||||||
- libcrypto.a
|
- libcrypto.a
|
||||||
|
static-libs@windows:
|
||||||
|
- libssl.lib
|
||||||
|
- libcrypto.lib
|
||||||
|
|||||||
@@ -5,19 +5,25 @@ postgresql:
|
|||||||
type: ghtagtar
|
type: ghtagtar
|
||||||
repo: postgres/postgres
|
repo: postgres/postgres
|
||||||
match: REL_18_\d+
|
match: REL_18_\d+
|
||||||
|
binary:
|
||||||
|
windows-x86_64: { type: url, url: 'https://get.enterprisedb.com/postgresql/postgresql-16.8-1-windows-x64-binaries.zip', extract: { lib/libpq.lib: '{build_root_path}/lib/libpq.lib', lib/libpgport.lib: '{build_root_path}/lib/libpgport.lib', lib/libpgcommon.lib: '{build_root_path}/lib/libpgcommon.lib', include/libpq-fe.h: '{build_root_path}/include/libpq-fe.h', include/postgres_ext.h: '{build_root_path}/include/postgres_ext.h', include/pg_config_ext.h: '{build_root_path}/include/pg_config_ext.h', include/libpq/libpq-fs.h: '{build_root_path}/include/libpq/libpq-fs.h' } }
|
||||||
metadata:
|
metadata:
|
||||||
license-files: [COPYRIGHT]
|
license-files: ['@/postgresql.txt']
|
||||||
license: PostgreSQL
|
license: PostgreSQL
|
||||||
depends:
|
depends@unix:
|
||||||
- libiconv
|
- libiconv
|
||||||
- libxml2
|
- libxml2
|
||||||
- openssl
|
- openssl
|
||||||
- zlib
|
- zlib
|
||||||
- libedit
|
- libedit
|
||||||
suggests:
|
suggests@unix:
|
||||||
- icu
|
- icu
|
||||||
- libxslt
|
- libxslt
|
||||||
- ldap
|
- ldap
|
||||||
- zstd
|
- zstd
|
||||||
pkg-configs:
|
pkg-configs:
|
||||||
- libpq
|
- libpq
|
||||||
|
static-libs@windows:
|
||||||
|
- libpq.lib
|
||||||
|
- libpgport.lib
|
||||||
|
- libpgcommon.lib
|
||||||
|
|||||||
12
config/pkg/lib/pthreads4w.yml
Normal file
12
config/pkg/lib/pthreads4w.yml
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
pthreads4w:
|
||||||
|
type: library
|
||||||
|
artifact:
|
||||||
|
source:
|
||||||
|
type: git
|
||||||
|
rev: master
|
||||||
|
url: 'https://git.code.sf.net/p/pthreads4w/code'
|
||||||
|
metadata:
|
||||||
|
license-files: [LICENSE]
|
||||||
|
license: Apache-2.0
|
||||||
|
static-libs@windows:
|
||||||
|
- libpthreadVC3.lib
|
||||||
@@ -10,3 +10,5 @@ qdbm:
|
|||||||
license: 'GPL-2.0-only OR LGPL-2.1-only'
|
license: 'GPL-2.0-only OR LGPL-2.1-only'
|
||||||
static-libs@unix:
|
static-libs@unix:
|
||||||
- libqdbm.a
|
- libqdbm.a
|
||||||
|
static-libs@windows:
|
||||||
|
- qdbm_a.lib
|
||||||
|
|||||||
@@ -10,3 +10,5 @@ sqlite:
|
|||||||
- sqlite3ext.h
|
- sqlite3ext.h
|
||||||
static-libs@unix:
|
static-libs@unix:
|
||||||
- libsqlite3.a
|
- libsqlite3.a
|
||||||
|
static-libs@windows:
|
||||||
|
- libsqlite3_a.lib
|
||||||
|
|||||||
@@ -14,7 +14,13 @@ xz:
|
|||||||
- libiconv
|
- libiconv
|
||||||
headers@unix:
|
headers@unix:
|
||||||
- lzma
|
- lzma
|
||||||
|
headers@windows:
|
||||||
|
- lzma
|
||||||
|
- lzma.h
|
||||||
pkg-configs:
|
pkg-configs:
|
||||||
- liblzma
|
- liblzma
|
||||||
static-libs@unix:
|
static-libs@unix:
|
||||||
- liblzma.a
|
- liblzma.a
|
||||||
|
static-libs@windows:
|
||||||
|
- lzma.lib
|
||||||
|
- liblzma_a.lib
|
||||||
|
|||||||
@@ -14,3 +14,6 @@ zlib:
|
|||||||
- zconf.h
|
- zconf.h
|
||||||
static-libs@unix:
|
static-libs@unix:
|
||||||
- libz.a
|
- libz.a
|
||||||
|
static-libs@windows:
|
||||||
|
- zlibstatic.lib
|
||||||
|
- zlib_a.lib
|
||||||
|
|||||||
@@ -17,3 +17,5 @@ zstd:
|
|||||||
- libzstd
|
- libzstd
|
||||||
static-libs@unix:
|
static-libs@unix:
|
||||||
- libzstd.a
|
- libzstd.a
|
||||||
|
static-libs@windows:
|
||||||
|
- zstd_static.lib
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
curl:
|
curl:
|
||||||
type: library
|
type: target
|
||||||
artifact:
|
artifact:
|
||||||
source:
|
source:
|
||||||
type: ghrel
|
type: ghrel
|
||||||
@@ -12,6 +12,10 @@ curl:
|
|||||||
depends@unix:
|
depends@unix:
|
||||||
- openssl
|
- openssl
|
||||||
- zlib
|
- zlib
|
||||||
|
depends@windows:
|
||||||
|
- zlib
|
||||||
|
- libssh2
|
||||||
|
- nghttp2
|
||||||
suggests@unix:
|
suggests@unix:
|
||||||
- libssh2
|
- libssh2
|
||||||
- brotli
|
- brotli
|
||||||
@@ -23,11 +27,18 @@ curl:
|
|||||||
- ldap
|
- ldap
|
||||||
- idn2
|
- idn2
|
||||||
- krb5
|
- krb5
|
||||||
|
suggests@windows:
|
||||||
|
- brotli
|
||||||
|
- zstd
|
||||||
frameworks:
|
frameworks:
|
||||||
- CoreFoundation
|
- CoreFoundation
|
||||||
- CoreServices
|
- CoreServices
|
||||||
- SystemConfiguration
|
- SystemConfiguration
|
||||||
headers:
|
headers:
|
||||||
- curl
|
- curl
|
||||||
|
static-bins@unix:
|
||||||
|
- curl
|
||||||
static-libs@unix:
|
static-libs@unix:
|
||||||
- libcurl.a
|
- libcurl.a
|
||||||
|
static-libs@windows:
|
||||||
|
- libcurl_a.lib
|
||||||
@@ -2,5 +2,11 @@ go-xcaddy:
|
|||||||
type: target
|
type: target
|
||||||
artifact:
|
artifact:
|
||||||
binary: custom
|
binary: custom
|
||||||
|
env:
|
||||||
|
GOROOT: '{pkg_root_path}/go-xcaddy'
|
||||||
|
GOBIN: '{pkg_root_path}/go-xcaddy/bin'
|
||||||
|
GOPATH: '{pkg_root_path}/go-xcaddy/go'
|
||||||
|
path@unix:
|
||||||
|
- '{pkg_root_path}/go-xcaddy/bin'
|
||||||
static-bins:
|
static-bins:
|
||||||
- xcaddy
|
- xcaddy
|
||||||
|
|||||||
10
config/pkg/target/htop.yml
Normal file
10
config/pkg/target/htop.yml
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
htop:
|
||||||
|
type: target
|
||||||
|
artifact:
|
||||||
|
source:
|
||||||
|
type: ghrel
|
||||||
|
repo: htop-dev/htop
|
||||||
|
match: htop.+\.tar\.xz
|
||||||
|
prefer-stable: true
|
||||||
|
depends:
|
||||||
|
- ncursesw
|
||||||
7
config/pkg/target/jom.yml
Normal file
7
config/pkg/target/jom.yml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
jom:
|
||||||
|
type: target
|
||||||
|
artifact:
|
||||||
|
binary:
|
||||||
|
windows-x86_64: { type: url, url: 'https://download.qt.io/official_releases/jom/jom.zip', extract: '{pkg_root_path}/jom' }
|
||||||
|
path@windows:
|
||||||
|
- '{pkg_root_path}\jom'
|
||||||
8
config/pkg/target/protoc.yml
Normal file
8
config/pkg/target/protoc.yml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
protoc:
|
||||||
|
type: target
|
||||||
|
artifact:
|
||||||
|
binary:
|
||||||
|
linux-x86_64: { type: ghrel, repo: protocolbuffers/protobuf, match: 'protoc-([0-9.]+)-linux-x86_64\.zip', extract: '{pkg_root_path}/protoc' }
|
||||||
|
linux-aarch64: { type: ghrel, repo: protocolbuffers/protobuf, match: 'protoc-([0-9.]+)-linux-aarch_64\.zip', extract: '{pkg_root_path}/protoc' }
|
||||||
|
path:
|
||||||
|
- '{pkg_root_path}/protoc/bin'
|
||||||
6
config/pkg/target/rust.yml
Normal file
6
config/pkg/target/rust.yml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
rust:
|
||||||
|
type: target
|
||||||
|
artifact:
|
||||||
|
binary: custom
|
||||||
|
path:
|
||||||
|
- '{pkg_root_path}/rust/bin'
|
||||||
@@ -641,6 +641,7 @@
|
|||||||
"libjpeg": {
|
"libjpeg": {
|
||||||
"type": "ghtar",
|
"type": "ghtar",
|
||||||
"repo": "libjpeg-turbo/libjpeg-turbo",
|
"repo": "libjpeg-turbo/libjpeg-turbo",
|
||||||
|
"prefer-stable": true,
|
||||||
"license": {
|
"license": {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
"path": "LICENSE.md"
|
"path": "LICENSE.md"
|
||||||
@@ -1054,7 +1055,7 @@
|
|||||||
},
|
},
|
||||||
"protobuf": {
|
"protobuf": {
|
||||||
"type": "url",
|
"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",
|
"path": "php-src/ext/protobuf",
|
||||||
"filename": "protobuf.tgz",
|
"filename": "protobuf.tgz",
|
||||||
"license": {
|
"license": {
|
||||||
|
|||||||
@@ -16,8 +16,10 @@ while also defining the extensions to compile.
|
|||||||
|
|
||||||
1. Fork project.
|
1. Fork project.
|
||||||
2. Go to the Actions of the project and select `CI`.
|
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`)
|
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. After waiting for about a period of time, enter the corresponding task and get `Artifacts`.
|
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.
|
If you enable `debug`, all logs will be output at build time, including compiled logs, for troubleshooting.
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,9 @@ Action 构建指的是直接使用 GitHub Action 进行编译。
|
|||||||
1. Fork 本项目。
|
1. Fork 本项目。
|
||||||
2. 进入项目的 Actions,选择 CI 开头的 Workflow(根据你需要的操作系统选择)。
|
2. 进入项目的 Actions,选择 CI 开头的 Workflow(根据你需要的操作系统选择)。
|
||||||
3. 选择 `Run workflow`,填入你要编译的 PHP 版本、目标类型、扩展列表。(扩展列表使用英文逗号分割,例如 `bcmath,curl,mbstring`)
|
3. 选择 `Run workflow`,填入你要编译的 PHP 版本、目标类型、扩展列表。(扩展列表使用英文逗号分割,例如 `bcmath,curl,mbstring`)
|
||||||
4. 等待大约一段时间后,进入对应的任务中,获取 `Artifacts`。
|
4. 如果需要共享扩展(例如 `xdebug`),请设置 `shared-extensions`(使用英文逗号分割,例如 `xdebug`)。
|
||||||
|
5. 如果需要 FrankenPHP,请启用 `build-frankenphp`,同时也需要启用 `enable-zts`。
|
||||||
|
6. 等待大约一段时间后,进入对应的任务中,获取 `Artifacts`。
|
||||||
|
|
||||||
如果你选择了 `debug`,则会在构建时输出所有日志,包括编译的日志,以供排查错误。
|
如果你选择了 `debug`,则会在构建时输出所有日志,包括编译的日志,以供排查错误。
|
||||||
|
|
||||||
|
|||||||
85
src/Package/Artifact/rust.php
Normal file
85
src/Package/Artifact/rust.php
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Package\Artifact;
|
||||||
|
|
||||||
|
use StaticPHP\Artifact\ArtifactDownloader;
|
||||||
|
use StaticPHP\Artifact\Downloader\DownloadResult;
|
||||||
|
use StaticPHP\Artifact\Downloader\Type\CheckUpdateResult;
|
||||||
|
use StaticPHP\Attribute\Artifact\AfterBinaryExtract;
|
||||||
|
use StaticPHP\Attribute\Artifact\CustomBinary;
|
||||||
|
use StaticPHP\Attribute\Artifact\CustomBinaryCheckUpdate;
|
||||||
|
use StaticPHP\Exception\DownloaderException;
|
||||||
|
use StaticPHP\Runtime\SystemTarget;
|
||||||
|
use StaticPHP\Util\System\LinuxUtil;
|
||||||
|
|
||||||
|
class rust
|
||||||
|
{
|
||||||
|
#[CustomBinary('rust', [
|
||||||
|
'linux-x86_64',
|
||||||
|
'linux-aarch64',
|
||||||
|
])]
|
||||||
|
public function downBinary(ArtifactDownloader $downloader): DownloadResult
|
||||||
|
{
|
||||||
|
// determine distro first
|
||||||
|
$distro = LinuxUtil::isMuslDist() ? 'musl' : 'gnu';
|
||||||
|
$arch = SystemTarget::getTargetArch();
|
||||||
|
|
||||||
|
// get latest rust version from link
|
||||||
|
$toml_config = default_shell()->executeCurl('https://static.rust-lang.org/dist/channel-rust-stable.toml', retries: $downloader->getRetry());
|
||||||
|
// parse toml by regex since we want to avoid adding a toml parser dependency just for this
|
||||||
|
$cnt = preg_match_all('/^version = "([^"]+)"$/m', $toml_config ?: '', $matches);
|
||||||
|
if (!$cnt) {
|
||||||
|
throw new DownloaderException('Failed to parse Rust version from channel config');
|
||||||
|
}
|
||||||
|
$versions = $matches[1];
|
||||||
|
// strip version num \d.\d.\d (some version number is like "x.x.x (abcdefg 1970-01-01)"
|
||||||
|
$versions = array_filter(array_map(fn ($v) => preg_match('/^(\d+\.\d+\.\d+)/', $v, $m) ? $m[1] : null, $versions));
|
||||||
|
usort($versions, 'version_compare');
|
||||||
|
$latest_version = end($versions);
|
||||||
|
if (!$latest_version) {
|
||||||
|
throw new DownloaderException('Could not determine latest Rust version');
|
||||||
|
}
|
||||||
|
|
||||||
|
// merge download link
|
||||||
|
$download_url = "https://static.rust-lang.org/dist/rust-{$latest_version}-{$arch}-unknown-linux-{$distro}.tar.xz";
|
||||||
|
$path = DOWNLOAD_PATH . DIRECTORY_SEPARATOR . basename($download_url);
|
||||||
|
default_shell()->executeCurlDownload($download_url, $path, retries: $downloader->getRetry());
|
||||||
|
return DownloadResult::archive(basename($path), ['url' => $download_url, 'version' => $latest_version], extract: PKG_ROOT_PATH . '/rust-install', verified: false, version: $latest_version);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[CustomBinaryCheckUpdate('rust', [
|
||||||
|
'linux-x86_64',
|
||||||
|
'linux-aarch64',
|
||||||
|
])]
|
||||||
|
public function checkUpdateBinary(?string $old_version, ArtifactDownloader $downloader): CheckUpdateResult
|
||||||
|
{
|
||||||
|
$toml_config = default_shell()->executeCurl('https://static.rust-lang.org/dist/channel-rust-stable.toml', retries: $downloader->getRetry());
|
||||||
|
$cnt = preg_match_all('/^version = "([^"]+)"$/m', $toml_config ?: '', $matches);
|
||||||
|
if (!$cnt) {
|
||||||
|
throw new DownloaderException('Failed to parse Rust version from channel config');
|
||||||
|
}
|
||||||
|
$versions = array_filter(array_map(fn ($v) => preg_match('/^(\d+\.\d+\.\d+)/', $v, $m) ? $m[1] : null, $matches[1]));
|
||||||
|
usort($versions, 'version_compare');
|
||||||
|
$latest_version = end($versions);
|
||||||
|
if (!$latest_version) {
|
||||||
|
throw new DownloaderException('Could not determine latest Rust version');
|
||||||
|
}
|
||||||
|
return new CheckUpdateResult(
|
||||||
|
old: $old_version,
|
||||||
|
new: $latest_version,
|
||||||
|
needUpdate: $old_version === null || $latest_version !== $old_version,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[AfterBinaryExtract('rust', [
|
||||||
|
'linux-x86_64',
|
||||||
|
'linux-aarch64',
|
||||||
|
])]
|
||||||
|
public function postExtractRust(string $target_path): void
|
||||||
|
{
|
||||||
|
$prefix = PKG_ROOT_PATH . '/rust';
|
||||||
|
shell()->exec("cd {$target_path} && ./install.sh --prefix={$prefix}");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -26,6 +26,9 @@ class zig
|
|||||||
$index_json = default_shell()->executeCurl('https://ziglang.org/download/index.json', retries: $downloader->getRetry());
|
$index_json = default_shell()->executeCurl('https://ziglang.org/download/index.json', retries: $downloader->getRetry());
|
||||||
$index_json = json_decode($index_json ?: '', true);
|
$index_json = json_decode($index_json ?: '', true);
|
||||||
$latest_version = null;
|
$latest_version = null;
|
||||||
|
if ($index_json === null) {
|
||||||
|
throw new DownloaderException('Failed to fetch Zig version index');
|
||||||
|
}
|
||||||
foreach ($index_json as $version => $data) {
|
foreach ($index_json as $version => $data) {
|
||||||
if ($version !== 'master') {
|
if ($version !== 'master') {
|
||||||
$latest_version = $version;
|
$latest_version = $version;
|
||||||
|
|||||||
26
src/Package/Extension/curl.php
Normal file
26
src/Package/Extension/curl.php
Normal 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'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
30
src/Package/Extension/gettext.php
Normal file
30
src/Package/Extension/gettext.php
Normal 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\Attribute\PatchDescription;
|
||||||
|
use StaticPHP\Package\PackageInstaller;
|
||||||
|
use StaticPHP\Runtime\SystemTarget;
|
||||||
|
use StaticPHP\Util\FileSystem;
|
||||||
|
|
||||||
|
#[Extension('gettext')]
|
||||||
|
class gettext
|
||||||
|
{
|
||||||
|
#[BeforeStage('php', [php::class, 'buildconfForUnix'], 'ext-gettext')]
|
||||||
|
#[PatchDescription('Patch gettext extension config.m4 to fix library detection on macOS')]
|
||||||
|
public function patchBeforeBuildconf(PackageInstaller $installer): void
|
||||||
|
{
|
||||||
|
spc_skip_unless(SystemTarget::getTargetOS() === 'Darwin', 'gettext extension patch is only needed on macOS');
|
||||||
|
$php_src = $installer->getTargetPackage('php')->getSourceDir();
|
||||||
|
FileSystem::replaceFileStr(
|
||||||
|
"{$php_src}/ext/gettext/config.m4",
|
||||||
|
['AC_CHECK_LIB($GETTEXT_CHECK_IN_LIB', 'AC_CHECK_LIB([$GETTEXT_CHECK_IN_LIB'],
|
||||||
|
['AC_CHECK_LIB(intl', 'AC_CHECK_LIB([intl'] // new php versions use a bracket
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
55
src/Package/Extension/imap.php
Normal file
55
src/Package/Extension/imap.php
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
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\Package\Validate;
|
||||||
|
use StaticPHP\Exception\WrongUsageException;
|
||||||
|
use StaticPHP\Package\PackageBuilder;
|
||||||
|
use StaticPHP\Package\PackageInstaller;
|
||||||
|
use StaticPHP\Package\PhpExtensionPackage;
|
||||||
|
use StaticPHP\Util\FileSystem;
|
||||||
|
|
||||||
|
#[Extension('imap')]
|
||||||
|
class imap extends PhpExtensionPackage
|
||||||
|
{
|
||||||
|
#[Validate]
|
||||||
|
public function validate(PackageBuilder $builder): void
|
||||||
|
{
|
||||||
|
if ($builder->getOption('enable-zts')) {
|
||||||
|
throw new WrongUsageException('ext-imap is not thread safe, do not build it with ZTS builds');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[BeforeStage('php', [php::class, 'buildconfForUnix'], 'ext-imap')]
|
||||||
|
public function patchBeforeBuildconf(PackageInstaller $installer): void
|
||||||
|
{
|
||||||
|
if ($installer->getLibraryPackage('openssl')) {
|
||||||
|
// sometimes imap with openssl does not contain zlib (required by openssl)
|
||||||
|
// we need to add it manually
|
||||||
|
FileSystem::replaceFileStr("{$this->getSourceDir()}/config.m4", 'TST_LIBS="$DLIBS $IMAP_SHARED_LIBADD"', 'TST_LIBS="$DLIBS $IMAP_SHARED_LIBADD -lz"');
|
||||||
|
}
|
||||||
|
// c-client is built with PASSWDTYPE=nul so libcrypt is not referenced.
|
||||||
|
FileSystem::replaceFileStr(
|
||||||
|
"{$this->getSourceDir()}/config.m4",
|
||||||
|
" PHP_CHECK_LIBRARY(crypt, crypt,\n [\n PHP_ADD_LIBRARY(crypt,, IMAP_SHARED_LIBADD)\n AC_DEFINE(HAVE_LIBCRYPT,1,[ ])\n ])",
|
||||||
|
' dnl Skipped: crypt check not needed (c-client built with PASSWDTYPE=nul)'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[CustomPhpConfigureArg('Darwin')]
|
||||||
|
#[CustomPhpConfigureArg('Linux')]
|
||||||
|
public function getUnixConfigureArg(PackageInstaller $installer, PackageBuilder $builder): string
|
||||||
|
{
|
||||||
|
$arg = "--with-imap={$builder->getBuildRootPath()}";
|
||||||
|
if (($ssl = $installer->getLibraryPackage('openssl')) !== null) {
|
||||||
|
$arg .= " --with-imap-ssl={$ssl->getBuildRootPath()}";
|
||||||
|
}
|
||||||
|
return $arg;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,11 +8,19 @@ use StaticPHP\Attribute\Package\BuildFor;
|
|||||||
use StaticPHP\Attribute\Package\Library;
|
use StaticPHP\Attribute\Package\Library;
|
||||||
use StaticPHP\Package\LibraryPackage;
|
use StaticPHP\Package\LibraryPackage;
|
||||||
use StaticPHP\Runtime\Executor\UnixCMakeExecutor;
|
use StaticPHP\Runtime\Executor\UnixCMakeExecutor;
|
||||||
|
use StaticPHP\Runtime\Executor\WindowsCMakeExecutor;
|
||||||
use StaticPHP\Util\FileSystem;
|
use StaticPHP\Util\FileSystem;
|
||||||
|
|
||||||
#[Library('brotli')]
|
#[Library('brotli')]
|
||||||
class brotli
|
class brotli
|
||||||
{
|
{
|
||||||
|
#[BuildFor('Windows')]
|
||||||
|
public function buildWin(LibraryPackage $package): void
|
||||||
|
{
|
||||||
|
WindowsCMakeExecutor::create($package)->build();
|
||||||
|
// FileSystem::copy("{$package->getLibDir()}\\onig.lib", "{$package->getLibDir()}\\onig_a.lib");
|
||||||
|
}
|
||||||
|
|
||||||
#[BuildFor('Linux')]
|
#[BuildFor('Linux')]
|
||||||
#[BuildFor('Darwin')]
|
#[BuildFor('Darwin')]
|
||||||
public function build(LibraryPackage $lib): void
|
public function build(LibraryPackage $lib): void
|
||||||
|
|||||||
@@ -20,6 +20,17 @@ class bzip2
|
|||||||
FileSystem::replaceFileStr($lib->getSourceDir() . '/Makefile', 'CFLAGS=-Wall', 'CFLAGS=-fPIC -Wall');
|
FileSystem::replaceFileStr($lib->getSourceDir() . '/Makefile', 'CFLAGS=-Wall', 'CFLAGS=-fPIC -Wall');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[BuildFor('Windows')]
|
||||||
|
public function buildWin(LibraryPackage $package): void
|
||||||
|
{
|
||||||
|
cmd()->cd($package->getSourceDir())
|
||||||
|
->exec('nmake /nologo /f Makefile.msc CFLAGS="-DWIN32 -MT -Ox -D_FILE_OFFSET_BITS=64 -nologo" clean')
|
||||||
|
->exec('nmake /nologo /f Makefile.msc CFLAGS="-DWIN32 -MT -Ox -D_FILE_OFFSET_BITS=64 -nologo" lib');
|
||||||
|
FileSystem::copy("{$package->getSourceDir()}\\libbz2.lib", "{$package->getLibDir()}\\libbz2.lib");
|
||||||
|
FileSystem::copy("{$package->getSourceDir()}\\libbz2.lib", "{$package->getLibDir()}\\libbz2_a.lib");
|
||||||
|
FileSystem::copy("{$package->getSourceDir()}\\bzlib.h", "{$package->getIncludeDir()}\\bzlib.h");
|
||||||
|
}
|
||||||
|
|
||||||
#[BuildFor('Linux')]
|
#[BuildFor('Linux')]
|
||||||
#[BuildFor('Darwin')]
|
#[BuildFor('Darwin')]
|
||||||
public function build(LibraryPackage $lib, PackageBuilder $builder): void
|
public function build(LibraryPackage $lib, PackageBuilder $builder): void
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ use StaticPHP\Attribute\Package\BuildFor;
|
|||||||
use StaticPHP\Attribute\Package\Library;
|
use StaticPHP\Attribute\Package\Library;
|
||||||
use StaticPHP\Package\LibraryPackage;
|
use StaticPHP\Package\LibraryPackage;
|
||||||
use StaticPHP\Runtime\Executor\UnixCMakeExecutor;
|
use StaticPHP\Runtime\Executor\UnixCMakeExecutor;
|
||||||
|
use StaticPHP\Runtime\Executor\WindowsCMakeExecutor;
|
||||||
use StaticPHP\Util\FileSystem;
|
use StaticPHP\Util\FileSystem;
|
||||||
|
|
||||||
#[Library('freetype')]
|
#[Library('freetype')]
|
||||||
@@ -33,4 +34,18 @@ class freetype
|
|||||||
$lib->patchPkgconfPrefix(['freetype2.pc']);
|
$lib->patchPkgconfPrefix(['freetype2.pc']);
|
||||||
FileSystem::replaceFileStr("{$lib->getBuildRootPath()}/lib/pkgconfig/freetype2.pc", ' -L/lib ', " -L{$lib->getBuildRootPath()}/lib ");
|
FileSystem::replaceFileStr("{$lib->getBuildRootPath()}/lib/pkgconfig/freetype2.pc", ' -L/lib ', " -L{$lib->getBuildRootPath()}/lib ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[BuildFor('Windows')]
|
||||||
|
public function buildWin(LibraryPackage $lib): void
|
||||||
|
{
|
||||||
|
WindowsCMakeExecutor::create($lib)
|
||||||
|
->optionalPackage('libpng', ...cmake_boolean_args('FT_DISABLE_PNG', true))
|
||||||
|
->optionalPackage('bzip2', ...cmake_boolean_args('FT_DISABLE_BZIP2', true))
|
||||||
|
->optionalPackage('brotli', ...cmake_boolean_args('FT_DISABLE_BROTLI', true))
|
||||||
|
->addConfigureArgs('-DFT_DISABLE_HARFBUZZ=ON')
|
||||||
|
->build();
|
||||||
|
|
||||||
|
// freetype.lib to libfreetype_a.lib
|
||||||
|
FileSystem::copy("{$lib->getLibDir()}\\freetype.lib", "{$lib->getLibDir()}\\libfreetype_a.lib");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ use StaticPHP\Attribute\Package\BuildFor;
|
|||||||
use StaticPHP\Attribute\Package\Library;
|
use StaticPHP\Attribute\Package\Library;
|
||||||
use StaticPHP\Package\LibraryPackage;
|
use StaticPHP\Package\LibraryPackage;
|
||||||
use StaticPHP\Runtime\Executor\UnixCMakeExecutor;
|
use StaticPHP\Runtime\Executor\UnixCMakeExecutor;
|
||||||
|
use StaticPHP\Runtime\Executor\WindowsCMakeExecutor;
|
||||||
|
use StaticPHP\Util\FileSystem;
|
||||||
|
|
||||||
#[Library('gmssl')]
|
#[Library('gmssl')]
|
||||||
class gmssl
|
class gmssl
|
||||||
@@ -18,4 +20,35 @@ class gmssl
|
|||||||
{
|
{
|
||||||
UnixCMakeExecutor::create($lib)->build();
|
UnixCMakeExecutor::create($lib)->build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[BuildFor('Windows')]
|
||||||
|
public function buildWin(LibraryPackage $lib): void
|
||||||
|
{
|
||||||
|
$buildDir = "{$lib->getSourceDir()}\\builddir";
|
||||||
|
|
||||||
|
// GmSSL requires NMake Makefiles generator on Windows
|
||||||
|
WindowsCMakeExecutor::create($lib)
|
||||||
|
->setBuildDir($buildDir)
|
||||||
|
->setCustomDefaultArgs(
|
||||||
|
'-G "NMake Makefiles"',
|
||||||
|
'-DWIN32=ON',
|
||||||
|
'-DBUILD_SHARED_LIBS=OFF',
|
||||||
|
'-DCMAKE_BUILD_TYPE=Release',
|
||||||
|
'-DCMAKE_C_FLAGS_RELEASE="/MT /O2 /Ob2 /DNDEBUG"',
|
||||||
|
'-DCMAKE_CXX_FLAGS_RELEASE="/MT /O2 /Ob2 /DNDEBUG"',
|
||||||
|
'-DCMAKE_INSTALL_PREFIX=' . escapeshellarg($lib->getBuildRootPath()),
|
||||||
|
'-B ' . escapeshellarg($buildDir),
|
||||||
|
)
|
||||||
|
->toStep(1)
|
||||||
|
->build();
|
||||||
|
|
||||||
|
// fix cmake_install.cmake install prefix (GmSSL overrides it internally)
|
||||||
|
$installCmake = "{$buildDir}\\cmake_install.cmake";
|
||||||
|
FileSystem::writeFile(
|
||||||
|
$installCmake,
|
||||||
|
'set(CMAKE_INSTALL_PREFIX "' . str_replace('\\', '/', $lib->getBuildRootPath()) . '")' . PHP_EOL . FileSystem::readFile($installCmake)
|
||||||
|
);
|
||||||
|
|
||||||
|
cmd()->cd($buildDir)->exec('nmake install XCFLAGS=/MT');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ use StaticPHP\Attribute\Package\BuildFor;
|
|||||||
use StaticPHP\Attribute\Package\Library;
|
use StaticPHP\Attribute\Package\Library;
|
||||||
use StaticPHP\Package\LibraryPackage;
|
use StaticPHP\Package\LibraryPackage;
|
||||||
use StaticPHP\Runtime\Executor\UnixAutoconfExecutor;
|
use StaticPHP\Runtime\Executor\UnixAutoconfExecutor;
|
||||||
|
use StaticPHP\Util\FileSystem;
|
||||||
|
|
||||||
#[Library('idn2')]
|
#[Library('idn2')]
|
||||||
class idn2
|
class idn2
|
||||||
@@ -29,5 +30,10 @@ class idn2
|
|||||||
->make();
|
->make();
|
||||||
$lib->patchPkgconfPrefix(['libidn2.pc']);
|
$lib->patchPkgconfPrefix(['libidn2.pc']);
|
||||||
$lib->patchLaDependencyPrefix();
|
$lib->patchLaDependencyPrefix();
|
||||||
|
// libunistring is in Libs.private of libidn2.pc, but CMake's pkg_check_modules
|
||||||
|
// does not follow Libs.private for static linking. Promote it to Libs so that
|
||||||
|
// consumers linking static binaries (e.g. the curl exe) can resolve _uc_* / _u32_* symbols.
|
||||||
|
$libidn2_pc = BUILD_ROOT_PATH . '/lib/pkgconfig/libidn2.pc';
|
||||||
|
FileSystem::replaceFileStr($libidn2_pc, 'Libs: -L${libdir} -lidn2', 'Libs: -L${libdir} -lidn2 -lunistring');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,8 +4,6 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Package\Library;
|
namespace Package\Library;
|
||||||
|
|
||||||
use Package\Target\php;
|
|
||||||
use StaticPHP\Attribute\Package\AfterStage;
|
|
||||||
use StaticPHP\Attribute\Package\BuildFor;
|
use StaticPHP\Attribute\Package\BuildFor;
|
||||||
use StaticPHP\Attribute\Package\Library;
|
use StaticPHP\Attribute\Package\Library;
|
||||||
use StaticPHP\Attribute\Package\PatchBeforeBuild;
|
use StaticPHP\Attribute\Package\PatchBeforeBuild;
|
||||||
@@ -19,15 +17,6 @@ use StaticPHP\Util\SourcePatcher;
|
|||||||
#[Library('imap')]
|
#[Library('imap')]
|
||||||
class imap
|
class imap
|
||||||
{
|
{
|
||||||
#[AfterStage('php', [php::class, 'patchUnixEmbedScripts'], 'imap')]
|
|
||||||
#[PatchDescription('Fix missing -lcrypt in php-config libs on glibc systems')]
|
|
||||||
public function afterPatchScripts(): void
|
|
||||||
{
|
|
||||||
if (SystemTarget::getLibc() === 'glibc') {
|
|
||||||
FileSystem::replaceFileRegex(BUILD_BIN_PATH . '/php-config', '/^libs="(.*)"$/m', 'libs="$1 -lcrypt"');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[PatchBeforeBuild]
|
#[PatchBeforeBuild]
|
||||||
#[PatchDescription('Patch imap build system for Linux and macOS compatibility')]
|
#[PatchDescription('Patch imap build system for Linux and macOS compatibility')]
|
||||||
public function patchBeforeBuild(LibraryPackage $lib): void
|
public function patchBeforeBuild(LibraryPackage $lib): void
|
||||||
@@ -66,14 +55,24 @@ class imap
|
|||||||
}
|
}
|
||||||
$libcVer = SystemTarget::getLibcVersion();
|
$libcVer = SystemTarget::getLibcVersion();
|
||||||
$extraLibs = $libcVer && version_compare($libcVer, '2.17', '<=') ? 'EXTRALDFLAGS="-ldl -lrt -lpthread"' : '';
|
$extraLibs = $libcVer && version_compare($libcVer, '2.17', '<=') ? 'EXTRALDFLAGS="-ldl -lrt -lpthread"' : '';
|
||||||
shell()->cd($lib->getSourceDir())
|
try {
|
||||||
->exec('make clean')
|
shell()->cd($lib->getSourceDir())
|
||||||
->exec('touch ip6')
|
->exec('make clean')
|
||||||
->exec('chmod +x tools/an')
|
->exec('touch ip6')
|
||||||
->exec('chmod +x tools/ua')
|
->exec('chmod +x tools/an')
|
||||||
->exec('chmod +x src/osdep/unix/drivers')
|
->exec('chmod +x tools/ua')
|
||||||
->exec('chmod +x src/osdep/unix/mkauths')
|
->exec('chmod +x src/osdep/unix/drivers')
|
||||||
->exec("yes | make slx {$ssl_options} EXTRACFLAGS='-fPIC -Wno-implicit-function-declaration -Wno-incompatible-function-pointer-types' {$extraLibs}");
|
->exec('chmod +x src/osdep/unix/mkauths')
|
||||||
|
// PASSWDTYPE=nul avoids any crypt() symbol reference in c-client.a;
|
||||||
|
// zig-cc 0.15+ uses paths_first strategy and cannot find libcrypt outside of buildroot.
|
||||||
|
->exec("yes | make slx {$ssl_options} PASSWDTYPE=nul EXTRACFLAGS='-fPIC -Wno-implicit-function-declaration -Wno-incompatible-function-pointer-types' {$extraLibs}");
|
||||||
|
} catch (\Throwable $e) {
|
||||||
|
// slx target also builds bundled tools (mtest, etc.) which may fail to link -lcrypt dynamically
|
||||||
|
// (e.g. with zig-cc). We only need c-client.a, so tolerate the failure if it was built.
|
||||||
|
if (!file_exists("{$lib->getSourceDir()}/c-client/c-client.a")) {
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
shell()
|
shell()
|
||||||
->exec("cp -rf {$lib->getSourceDir()}/c-client/c-client.a {$lib->getLibDir()}/libc-client.a")
|
->exec("cp -rf {$lib->getSourceDir()}/c-client/c-client.a {$lib->getLibDir()}/libc-client.a")
|
||||||
@@ -94,16 +93,24 @@ class imap
|
|||||||
$ssl_options = 'SSLTYPE=none';
|
$ssl_options = 'SSLTYPE=none';
|
||||||
}
|
}
|
||||||
$out = shell()->execWithResult('echo "-include $(xcrun --show-sdk-path)/usr/include/poll.h -include $(xcrun --show-sdk-path)/usr/include/time.h -include $(xcrun --show-sdk-path)/usr/include/utime.h"')[1][0];
|
$out = shell()->execWithResult('echo "-include $(xcrun --show-sdk-path)/usr/include/poll.h -include $(xcrun --show-sdk-path)/usr/include/time.h -include $(xcrun --show-sdk-path)/usr/include/utime.h"')[1][0];
|
||||||
shell()->cd($lib->getSourceDir())
|
try {
|
||||||
->exec('make clean')
|
shell()->cd($lib->getSourceDir())
|
||||||
->exec('touch ip6')
|
->exec('make clean')
|
||||||
->exec('chmod +x tools/an')
|
->exec('touch ip6')
|
||||||
->exec('chmod +x tools/ua')
|
->exec('chmod +x tools/an')
|
||||||
->exec('chmod +x src/osdep/unix/drivers')
|
->exec('chmod +x tools/ua')
|
||||||
->exec('chmod +x src/osdep/unix/mkauths')
|
->exec('chmod +x src/osdep/unix/drivers')
|
||||||
->exec(
|
->exec('chmod +x src/osdep/unix/mkauths')
|
||||||
"echo y | make osx {$ssl_options} EXTRACFLAGS='-Wno-implicit-function-declaration -Wno-incompatible-function-pointer-types {$out}'"
|
->exec(
|
||||||
);
|
"echo y | make osx {$ssl_options} EXTRACFLAGS='-Wno-implicit-function-declaration -Wno-incompatible-function-pointer-types {$out}'"
|
||||||
|
);
|
||||||
|
} catch (\Throwable $e) {
|
||||||
|
// osx target also builds bundled tools (mtest, etc.) which may fail to link.
|
||||||
|
// We only need c-client.a, so tolerate the failure if it was built.
|
||||||
|
if (!file_exists("{$lib->getSourceDir()}/c-client/c-client.a")) {
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
shell()
|
shell()
|
||||||
->exec("cp -rf {$lib->getSourceDir()}/c-client/c-client.a {$lib->getLibDir()}/libc-client.a")
|
->exec("cp -rf {$lib->getSourceDir()}/c-client/c-client.a {$lib->getLibDir()}/libc-client.a")
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ use StaticPHP\Package\LibraryPackage;
|
|||||||
use StaticPHP\Package\PackageInstaller;
|
use StaticPHP\Package\PackageInstaller;
|
||||||
use StaticPHP\Runtime\Executor\UnixAutoconfExecutor;
|
use StaticPHP\Runtime\Executor\UnixAutoconfExecutor;
|
||||||
use StaticPHP\Runtime\SystemTarget;
|
use StaticPHP\Runtime\SystemTarget;
|
||||||
|
use StaticPHP\Util\FileSystem;
|
||||||
use StaticPHP\Util\SPCConfigUtil;
|
use StaticPHP\Util\SPCConfigUtil;
|
||||||
|
|
||||||
#[Library('krb5')]
|
#[Library('krb5')]
|
||||||
@@ -59,5 +60,11 @@ class krb5
|
|||||||
'mit-krb5.pc',
|
'mit-krb5.pc',
|
||||||
'gssrpc.pc',
|
'gssrpc.pc',
|
||||||
]);
|
]);
|
||||||
|
// libkrb5support is in Libs.private of mit-krb5.pc, but CMake's pkg_check_modules
|
||||||
|
// does not follow Libs.private for static linking. Promote it to Libs so that
|
||||||
|
// consumers linking static binaries (e.g. the curl exe) can resolve _k5_* symbols.
|
||||||
|
$mit_krb5_pc = BUILD_ROOT_PATH . '/lib/pkgconfig/mit-krb5.pc';
|
||||||
|
FileSystem::replaceFileStr($mit_krb5_pc, 'Libs.private: -lkrb5support', 'Libs.private:');
|
||||||
|
FileSystem::replaceFileStr($mit_krb5_pc, '-lcom_err', '-lcom_err -lkrb5support');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,12 +8,28 @@ use StaticPHP\Attribute\Package\BuildFor;
|
|||||||
use StaticPHP\Attribute\Package\Library;
|
use StaticPHP\Attribute\Package\Library;
|
||||||
use StaticPHP\Package\LibraryPackage;
|
use StaticPHP\Package\LibraryPackage;
|
||||||
use StaticPHP\Runtime\Executor\UnixCMakeExecutor;
|
use StaticPHP\Runtime\Executor\UnixCMakeExecutor;
|
||||||
|
use StaticPHP\Runtime\Executor\WindowsCMakeExecutor;
|
||||||
use StaticPHP\Toolchain\Interface\ToolchainInterface;
|
use StaticPHP\Toolchain\Interface\ToolchainInterface;
|
||||||
use StaticPHP\Toolchain\ZigToolchain;
|
use StaticPHP\Toolchain\ZigToolchain;
|
||||||
|
|
||||||
#[Library('libaom')]
|
#[Library('libaom')]
|
||||||
class libaom extends LibraryPackage
|
class libaom extends LibraryPackage
|
||||||
{
|
{
|
||||||
|
#[BuildFor('Windows')]
|
||||||
|
public function buildWin(): void
|
||||||
|
{
|
||||||
|
WindowsCMakeExecutor::create($this)
|
||||||
|
->setBuildDir("{$this->getSourceDir()}/builddir")
|
||||||
|
->addConfigureArgs(
|
||||||
|
'-DAOM_TARGET_CPU=generic',
|
||||||
|
'-DENABLE_TESTS=OFF',
|
||||||
|
'-DENABLE_EXAMPLES=OFF',
|
||||||
|
'-DENABLE_TOOLS=OFF',
|
||||||
|
'-DENABLE_DOCS=OFF',
|
||||||
|
)
|
||||||
|
->build();
|
||||||
|
}
|
||||||
|
|
||||||
#[BuildFor('Darwin')]
|
#[BuildFor('Darwin')]
|
||||||
#[BuildFor('Linux')]
|
#[BuildFor('Linux')]
|
||||||
public function buildUnix(ToolchainInterface $toolchain): void
|
public function buildUnix(ToolchainInterface $toolchain): void
|
||||||
|
|||||||
@@ -6,12 +6,25 @@ namespace Package\Library;
|
|||||||
|
|
||||||
use StaticPHP\Attribute\Package\BuildFor;
|
use StaticPHP\Attribute\Package\BuildFor;
|
||||||
use StaticPHP\Attribute\Package\Library;
|
use StaticPHP\Attribute\Package\Library;
|
||||||
|
use StaticPHP\Attribute\Package\PatchBeforeBuild;
|
||||||
use StaticPHP\Package\LibraryPackage;
|
use StaticPHP\Package\LibraryPackage;
|
||||||
use StaticPHP\Runtime\Executor\UnixCMakeExecutor;
|
use StaticPHP\Runtime\Executor\UnixCMakeExecutor;
|
||||||
|
use StaticPHP\Runtime\Executor\WindowsCMakeExecutor;
|
||||||
|
use StaticPHP\Runtime\SystemTarget;
|
||||||
|
use StaticPHP\Util\FileSystem;
|
||||||
|
|
||||||
#[Library('libavif')]
|
#[Library('libavif')]
|
||||||
class libavif
|
class libavif
|
||||||
{
|
{
|
||||||
|
#[PatchBeforeBuild]
|
||||||
|
public function patchBeforeBuild(LibraryPackage $lib): void
|
||||||
|
{
|
||||||
|
// workaround for libavif 1.2.0 bug: MSVC does not support empty initializer list
|
||||||
|
if (SystemTarget::getTargetOS() === 'Windows') {
|
||||||
|
FileSystem::replaceFileStr($lib->getSourceDir() . '/src/read.c', 'avifFileType ftyp = {};', 'avifFileType ftyp = { 0 };');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[BuildFor('Darwin')]
|
#[BuildFor('Darwin')]
|
||||||
#[BuildFor('Linux')]
|
#[BuildFor('Linux')]
|
||||||
public function buildUnix(LibraryPackage $lib): void
|
public function buildUnix(LibraryPackage $lib): void
|
||||||
@@ -27,4 +40,17 @@ class libavif
|
|||||||
// patch pkgconfig
|
// patch pkgconfig
|
||||||
$lib->patchPkgconfPrefix(['libavif.pc']);
|
$lib->patchPkgconfPrefix(['libavif.pc']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[BuildFor('Windows')]
|
||||||
|
public function buildWin(LibraryPackage $lib): void
|
||||||
|
{
|
||||||
|
WindowsCMakeExecutor::create($lib)
|
||||||
|
->addConfigureArgs(
|
||||||
|
'-DAVIF_BUILD_APPS=OFF',
|
||||||
|
'-DAVIF_BUILD_TESTS=OFF',
|
||||||
|
'-DAVIF_LIBYUV=OFF',
|
||||||
|
'-DAVIF_ENABLE_GTEST=OFF',
|
||||||
|
)
|
||||||
|
->build();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
47
src/Package/Library/libffi_win.php
Normal file
47
src/Package/Library/libffi_win.php
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
<?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('libffi-win')]
|
||||||
|
class libffi_win
|
||||||
|
{
|
||||||
|
#[Validate]
|
||||||
|
public function validate(): void
|
||||||
|
{
|
||||||
|
$ver = WindowsUtil::findVisualStudio();
|
||||||
|
$vs_ver_dir = match ($ver['major_version']) {
|
||||||
|
'17' => '\win32\vs17_x64',
|
||||||
|
'16' => '\win32\vs16_x64',
|
||||||
|
default => throw new EnvironmentException("Current VS version {$ver['major_version']} is not supported!"),
|
||||||
|
};
|
||||||
|
ApplicationContext::set('libffi_win_vs_ver_dir', $vs_ver_dir);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[BuildFor('Windows')]
|
||||||
|
public function build(LibraryPackage $lib): void
|
||||||
|
{
|
||||||
|
$vs_ver_dir = ApplicationContext::get('libffi_win_vs_ver_dir');
|
||||||
|
cmd()->cd("{$lib->getSourceDir()}{$vs_ver_dir}")
|
||||||
|
->exec('msbuild libffi-msvc.sln /t:Rebuild /p:Configuration=Release /p:Platform=x64');
|
||||||
|
FileSystem::createDir($lib->getLibDir());
|
||||||
|
FileSystem::createDir($lib->getIncludeDir());
|
||||||
|
|
||||||
|
FileSystem::copy("{$lib->getSourceDir()}{$vs_ver_dir}\\x64\\Release\\libffi.lib", "{$lib->getLibDir()}\\libffi.lib");
|
||||||
|
FileSystem::copy("{$lib->getSourceDir()}{$vs_ver_dir}\\x64\\Release\\libffi.pdb", "{$lib->getLibDir()}\\libffi.pdb");
|
||||||
|
FileSystem::copy("{$lib->getSourceDir()}\\include\\ffi.h", "{$lib->getIncludeDir()}\\ffi.h");
|
||||||
|
FileSystem::replaceFileStr("{$lib->getIncludeDir()}\\ffi.h", '#define LIBFFI_H', "#define LIBFFI_H\n#define FFI_BUILDING");
|
||||||
|
FileSystem::copy("{$lib->getSourceDir()}\\src\\x86\\ffitarget.h", "{$lib->getIncludeDir()}\\ffitarget.h");
|
||||||
|
FileSystem::copy("{$lib->getSourceDir()}\\fficonfig.h", "{$lib->getIncludeDir()}\\fficonfig.h");
|
||||||
|
}
|
||||||
|
}
|
||||||
43
src/Package/Library/libiconv_win.php
Normal file
43
src/Package/Library/libiconv_win.php
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
<?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('libiconv-win')]
|
||||||
|
class libiconv_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('vs_ver_dir', $vs_ver_dir);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[BuildFor('Windows')]
|
||||||
|
public function build(LibraryPackage $lib): void
|
||||||
|
{
|
||||||
|
$vs_ver_dir = ApplicationContext::get('vs_ver_dir');
|
||||||
|
cmd()->cd("{$lib->getSourceDir()}{$vs_ver_dir}")
|
||||||
|
->exec('msbuild libiconv.sln /t:Rebuild /p:Configuration=Release /p:Platform=x64');
|
||||||
|
FileSystem::createDir($lib->getLibDir());
|
||||||
|
FileSystem::createDir($lib->getIncludeDir());
|
||||||
|
FileSystem::copy("{$lib->getSourceDir()}{$vs_ver_dir}\\x64\\lib\\libiconv.lib", "{$lib->getLibDir()}\\libiconv.lib");
|
||||||
|
FileSystem::copy("{$lib->getSourceDir()}{$vs_ver_dir}\\x64\\lib\\libiconv_a.lib", "{$lib->getLibDir()}\\libiconv_a.lib");
|
||||||
|
FileSystem::copy("{$lib->getSourceDir()}\\source\\include\\iconv.h", "{$lib->getIncludeDir()}\\iconv.h");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,6 +8,8 @@ use StaticPHP\Attribute\Package\BuildFor;
|
|||||||
use StaticPHP\Attribute\Package\Library;
|
use StaticPHP\Attribute\Package\Library;
|
||||||
use StaticPHP\Package\LibraryPackage;
|
use StaticPHP\Package\LibraryPackage;
|
||||||
use StaticPHP\Runtime\Executor\UnixCMakeExecutor;
|
use StaticPHP\Runtime\Executor\UnixCMakeExecutor;
|
||||||
|
use StaticPHP\Runtime\Executor\WindowsCMakeExecutor;
|
||||||
|
use StaticPHP\Util\FileSystem;
|
||||||
|
|
||||||
#[Library('libjpeg')]
|
#[Library('libjpeg')]
|
||||||
class libjpeg
|
class libjpeg
|
||||||
@@ -25,4 +27,20 @@ class libjpeg
|
|||||||
// patch pkgconfig
|
// patch pkgconfig
|
||||||
$lib->patchPkgconfPrefix(['libjpeg.pc', 'libturbojpeg.pc']);
|
$lib->patchPkgconfPrefix(['libjpeg.pc', 'libturbojpeg.pc']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[BuildFor('Windows')]
|
||||||
|
public function buildWin(LibraryPackage $lib): void
|
||||||
|
{
|
||||||
|
WindowsCMakeExecutor::create($lib)
|
||||||
|
->addConfigureArgs(
|
||||||
|
'-DENABLE_SHARED=OFF',
|
||||||
|
'-DENABLE_STATIC=ON',
|
||||||
|
'-DBUILD_TESTING=OFF',
|
||||||
|
'-DWITH_JAVA=OFF',
|
||||||
|
'-DWITH_CRT_DLL=OFF',
|
||||||
|
)
|
||||||
|
->optionalPackage('zlib', '-DENABLE_ZLIB_COMPRESSION=ON', '-DENABLE_ZLIB_COMPRESSION=OFF')
|
||||||
|
->build();
|
||||||
|
FileSystem::copy("{$lib->getLibDir()}\\jpeg-static.lib", "{$lib->getLibDir()}\\libjpeg_a.lib");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ use StaticPHP\Attribute\Package\BuildFor;
|
|||||||
use StaticPHP\Attribute\Package\Library;
|
use StaticPHP\Attribute\Package\Library;
|
||||||
use StaticPHP\Package\LibraryPackage;
|
use StaticPHP\Package\LibraryPackage;
|
||||||
use StaticPHP\Runtime\Executor\UnixAutoconfExecutor;
|
use StaticPHP\Runtime\Executor\UnixAutoconfExecutor;
|
||||||
|
use StaticPHP\Runtime\Executor\WindowsCMakeExecutor;
|
||||||
|
use StaticPHP\Util\FileSystem;
|
||||||
|
|
||||||
#[Library('libpng')]
|
#[Library('libpng')]
|
||||||
class libpng
|
class libpng
|
||||||
@@ -44,4 +46,21 @@ class libpng
|
|||||||
$lib->patchPkgconfPrefix(['libpng16.pc']);
|
$lib->patchPkgconfPrefix(['libpng16.pc']);
|
||||||
$lib->patchLaDependencyPrefix();
|
$lib->patchLaDependencyPrefix();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[BuildFor('Windows')]
|
||||||
|
public function buildWin(LibraryPackage $lib): void
|
||||||
|
{
|
||||||
|
WindowsCMakeExecutor::create($lib)
|
||||||
|
->addConfigureArgs(
|
||||||
|
'-DSKIP_INSTALL_PROGRAM=ON',
|
||||||
|
'-DSKIP_INSTALL_FILES=ON',
|
||||||
|
'-DPNG_STATIC=ON',
|
||||||
|
'-DPNG_SHARED=OFF',
|
||||||
|
'-DPNG_TESTS=OFF',
|
||||||
|
)
|
||||||
|
->build();
|
||||||
|
|
||||||
|
// libpng16_static.lib to libpng_a.lib
|
||||||
|
FileSystem::copy("{$lib->getLibDir()}\\libpng16_static.lib", "{$lib->getLibDir()}\\libpng_a.lib");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ use StaticPHP\Attribute\Package\BuildFor;
|
|||||||
use StaticPHP\Attribute\Package\Library;
|
use StaticPHP\Attribute\Package\Library;
|
||||||
use StaticPHP\Package\LibraryPackage;
|
use StaticPHP\Package\LibraryPackage;
|
||||||
use StaticPHP\Runtime\Executor\UnixCMakeExecutor;
|
use StaticPHP\Runtime\Executor\UnixCMakeExecutor;
|
||||||
|
use StaticPHP\Runtime\Executor\WindowsCMakeExecutor;
|
||||||
|
|
||||||
#[Library('librabbitmq')]
|
#[Library('librabbitmq')]
|
||||||
class librabbitmq extends LibraryPackage
|
class librabbitmq extends LibraryPackage
|
||||||
@@ -18,4 +19,11 @@ class librabbitmq extends LibraryPackage
|
|||||||
{
|
{
|
||||||
UnixCMakeExecutor::create($this)->addConfigureArgs('-DBUILD_STATIC_LIBS=ON')->build();
|
UnixCMakeExecutor::create($this)->addConfigureArgs('-DBUILD_STATIC_LIBS=ON')->build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[BuildFor('Windows')]
|
||||||
|
public function buildWin(): void
|
||||||
|
{
|
||||||
|
WindowsCMakeExecutor::create($this)->build();
|
||||||
|
rename("{$this->getLibDir()}\\librabbitmq.4.lib", "{$this->getLibDir()}\\rabbitmq.4.lib");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,12 +6,27 @@ namespace Package\Library;
|
|||||||
|
|
||||||
use StaticPHP\Attribute\Package\BuildFor;
|
use StaticPHP\Attribute\Package\BuildFor;
|
||||||
use StaticPHP\Attribute\Package\Library;
|
use StaticPHP\Attribute\Package\Library;
|
||||||
|
use StaticPHP\Attribute\Package\PatchBeforeBuild;
|
||||||
|
use StaticPHP\Attribute\PatchDescription;
|
||||||
|
use StaticPHP\Exception\BuildFailureException;
|
||||||
|
use StaticPHP\Exception\EnvironmentException;
|
||||||
use StaticPHP\Package\LibraryPackage;
|
use StaticPHP\Package\LibraryPackage;
|
||||||
use StaticPHP\Runtime\Executor\UnixAutoconfExecutor;
|
use StaticPHP\Runtime\Executor\UnixAutoconfExecutor;
|
||||||
|
use StaticPHP\Runtime\SystemTarget;
|
||||||
|
use StaticPHP\Util\FileSystem;
|
||||||
|
use StaticPHP\Util\System\WindowsUtil;
|
||||||
|
|
||||||
#[Library('libsodium')]
|
#[Library('libsodium')]
|
||||||
class libsodium
|
class libsodium
|
||||||
{
|
{
|
||||||
|
#[PatchBeforeBuild]
|
||||||
|
#[PatchDescription('Replace SODIUM_STATIC define guard with unconditional #if 1 for MSVC static linking')]
|
||||||
|
public function patchBeforeBuild(LibraryPackage $lib): void
|
||||||
|
{
|
||||||
|
spc_skip_if(SystemTarget::getTargetOS() !== 'Windows', 'This patch is only for Windows builds.');
|
||||||
|
FileSystem::replaceFileStr($lib->getSourceDir() . '\src\libsodium\include\sodium\export.h', '#ifdef SODIUM_STATIC', '#if 1');
|
||||||
|
}
|
||||||
|
|
||||||
#[BuildFor('Linux')]
|
#[BuildFor('Linux')]
|
||||||
#[BuildFor('Darwin')]
|
#[BuildFor('Darwin')]
|
||||||
public function build(LibraryPackage $lib): void
|
public function build(LibraryPackage $lib): void
|
||||||
@@ -21,4 +36,39 @@ class libsodium
|
|||||||
// Patch pkg-config file
|
// Patch pkg-config file
|
||||||
$lib->patchPkgconfPrefix(['libsodium.pc'], PKGCONF_PATCH_PREFIX);
|
$lib->patchPkgconfPrefix(['libsodium.pc'], PKGCONF_PATCH_PREFIX);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[BuildFor('Windows')]
|
||||||
|
public function buildWin(LibraryPackage $lib): void
|
||||||
|
{
|
||||||
|
$ver = WindowsUtil::findVisualStudio();
|
||||||
|
$vs_ver_dir = match ($ver['major_version']) {
|
||||||
|
'17' => '\vs2022',
|
||||||
|
'16' => '\vs2019',
|
||||||
|
default => throw new EnvironmentException("Current VS version {$ver['major_version']} is not supported yet!"),
|
||||||
|
};
|
||||||
|
|
||||||
|
cmd()->cd("{$lib->getSourceDir()}\\builds\\msvc{$vs_ver_dir}")
|
||||||
|
->exec('msbuild libsodium.sln /t:Rebuild /p:Configuration=StaticRelease /p:Platform=x64 /p:PreprocessorDefinitions="SODIUM_STATIC=1"');
|
||||||
|
FileSystem::createDir($lib->getLibDir());
|
||||||
|
FileSystem::createDir($lib->getIncludeDir());
|
||||||
|
|
||||||
|
// copy include
|
||||||
|
FileSystem::copyDir("{$lib->getSourceDir()}\\src\\libsodium\\include\\sodium", "{$lib->getIncludeDir()}\\sodium");
|
||||||
|
FileSystem::copy("{$lib->getSourceDir()}\\src\\libsodium\\include\\sodium.h", "{$lib->getIncludeDir()}\\sodium.h");
|
||||||
|
// copy lib
|
||||||
|
$ls = FileSystem::scanDirFiles("{$lib->getSourceDir()}\\bin");
|
||||||
|
$find = false;
|
||||||
|
foreach ($ls as $file) {
|
||||||
|
if (str_ends_with($file, 'libsodium.lib')) {
|
||||||
|
FileSystem::copy($file, "{$lib->getLibDir()}\\libsodium.lib");
|
||||||
|
$find = true;
|
||||||
|
}
|
||||||
|
if (str_ends_with($file, 'libsodium.pdb')) {
|
||||||
|
FileSystem::copy($file, "{$lib->getLibDir()}\\libsodium.pdb");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!$find) {
|
||||||
|
throw new BuildFailureException("Build libsodium success, but cannot find libsodium.lib in {$lib->getSourceDir()}\\bin .");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,10 +8,22 @@ use StaticPHP\Attribute\Package\BuildFor;
|
|||||||
use StaticPHP\Attribute\Package\Library;
|
use StaticPHP\Attribute\Package\Library;
|
||||||
use StaticPHP\Package\LibraryPackage;
|
use StaticPHP\Package\LibraryPackage;
|
||||||
use StaticPHP\Runtime\Executor\UnixCMakeExecutor;
|
use StaticPHP\Runtime\Executor\UnixCMakeExecutor;
|
||||||
|
use StaticPHP\Runtime\Executor\WindowsCMakeExecutor;
|
||||||
|
|
||||||
#[Library('libssh2')]
|
#[Library('libssh2')]
|
||||||
class libssh2
|
class libssh2
|
||||||
{
|
{
|
||||||
|
#[BuildFor('Windows')]
|
||||||
|
public function buildWin(LibraryPackage $lib): void
|
||||||
|
{
|
||||||
|
WindowsCMakeExecutor::create($lib)
|
||||||
|
->addConfigureArgs(
|
||||||
|
'-DENABLE_ZLIB_COMPRESSION=ON',
|
||||||
|
'-DBUILD_TESTING=OFF'
|
||||||
|
)
|
||||||
|
->build();
|
||||||
|
}
|
||||||
|
|
||||||
#[BuildFor('Linux')]
|
#[BuildFor('Linux')]
|
||||||
#[BuildFor('Darwin')]
|
#[BuildFor('Darwin')]
|
||||||
public function build(LibraryPackage $lib): void
|
public function build(LibraryPackage $lib): void
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ use StaticPHP\Attribute\Package\BuildFor;
|
|||||||
use StaticPHP\Attribute\Package\Library;
|
use StaticPHP\Attribute\Package\Library;
|
||||||
use StaticPHP\Package\LibraryPackage;
|
use StaticPHP\Package\LibraryPackage;
|
||||||
use StaticPHP\Runtime\Executor\UnixCMakeExecutor;
|
use StaticPHP\Runtime\Executor\UnixCMakeExecutor;
|
||||||
|
use StaticPHP\Runtime\Executor\WindowsCMakeExecutor;
|
||||||
|
|
||||||
#[Library('libwebp')]
|
#[Library('libwebp')]
|
||||||
class libwebp extends LibraryPackage
|
class libwebp extends LibraryPackage
|
||||||
@@ -41,4 +42,23 @@ int main() { return _mm256_cvtsi256_si32(_mm256_setzero_si256()); }';
|
|||||||
$this->patchPkgconfPrefix(patch_option: PKGCONF_PATCH_PREFIX | PKGCONF_PATCH_LIBDIR);
|
$this->patchPkgconfPrefix(patch_option: PKGCONF_PATCH_PREFIX | PKGCONF_PATCH_LIBDIR);
|
||||||
$this->patchPkgconfPrefix(['libsharpyuv.pc'], PKGCONF_PATCH_CUSTOM, ['/^includedir=.*$/m', 'includedir=${prefix}/include/webp']);
|
$this->patchPkgconfPrefix(['libsharpyuv.pc'], PKGCONF_PATCH_CUSTOM, ['/^includedir=.*$/m', 'includedir=${prefix}/include/webp']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[BuildFor('Windows')]
|
||||||
|
public function buildWin(): void
|
||||||
|
{
|
||||||
|
WindowsCMakeExecutor::create($this)
|
||||||
|
->addConfigureArgs(
|
||||||
|
'-DWEBP_BUILD_EXTRAS=OFF',
|
||||||
|
'-DWEBP_BUILD_ANIM_UTILS=OFF',
|
||||||
|
'-DWEBP_BUILD_CWEBP=OFF',
|
||||||
|
'-DWEBP_BUILD_DWEBP=OFF',
|
||||||
|
'-DWEBP_BUILD_GIF2WEBP=OFF',
|
||||||
|
'-DWEBP_BUILD_IMG2WEBP=OFF',
|
||||||
|
'-DWEBP_BUILD_VWEBP=OFF',
|
||||||
|
'-DWEBP_BUILD_WEBPINFO=OFF',
|
||||||
|
'-DWEBP_BUILD_WEBPMUX=OFF',
|
||||||
|
'-DWEBP_BUILD_FUZZTEST=OFF',
|
||||||
|
)
|
||||||
|
->build();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,12 +7,33 @@ namespace Package\Library;
|
|||||||
use StaticPHP\Attribute\Package\BuildFor;
|
use StaticPHP\Attribute\Package\BuildFor;
|
||||||
use StaticPHP\Attribute\Package\Library;
|
use StaticPHP\Attribute\Package\Library;
|
||||||
use StaticPHP\Package\LibraryPackage;
|
use StaticPHP\Package\LibraryPackage;
|
||||||
|
use StaticPHP\Package\PackageInstaller;
|
||||||
use StaticPHP\Runtime\Executor\UnixCMakeExecutor;
|
use StaticPHP\Runtime\Executor\UnixCMakeExecutor;
|
||||||
|
use StaticPHP\Runtime\Executor\WindowsCMakeExecutor;
|
||||||
use StaticPHP\Util\FileSystem;
|
use StaticPHP\Util\FileSystem;
|
||||||
|
|
||||||
#[Library('libxml2')]
|
#[Library('libxml2')]
|
||||||
class libxml2
|
class libxml2
|
||||||
{
|
{
|
||||||
|
#[BuildFor('Windows')]
|
||||||
|
public function buildForWindows(LibraryPackage $lib, PackageInstaller $installer): void
|
||||||
|
{
|
||||||
|
$iconv_win = $installer->getLibraryPackage('libiconv-win');
|
||||||
|
WindowsCMakeExecutor::create($lib)
|
||||||
|
->addConfigureArgs(
|
||||||
|
'-DLIBXML2_WITH_ICONV=ON',
|
||||||
|
"-DIconv_LIBRARY={$iconv_win->getLibDir()}",
|
||||||
|
"-DIconv_INCLUDE_DIR={$iconv_win->getIncludeDir()}",
|
||||||
|
'-DLIBXML2_WITH_ZLIB=ON',
|
||||||
|
'-DLIBXML2_WITH_PYTHON=OFF',
|
||||||
|
'-DLIBXML2_WITH_LZMA=OFF',
|
||||||
|
'-DLIBXML2_WITH_PROGRAMS=OFF',
|
||||||
|
'-DLIBXML2_WITH_TESTS=OFF',
|
||||||
|
)
|
||||||
|
->build();
|
||||||
|
FileSystem::copy("{$lib->getLibDir()}\\libxml2s.lib", "{$lib->getLibDir()}\\libxml2_a.lib");
|
||||||
|
}
|
||||||
|
|
||||||
#[BuildFor('Linux')]
|
#[BuildFor('Linux')]
|
||||||
public function buildForLinux(LibraryPackage $lib): void
|
public function buildForLinux(LibraryPackage $lib): void
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,16 +6,44 @@ namespace Package\Library;
|
|||||||
|
|
||||||
use StaticPHP\Attribute\Package\BuildFor;
|
use StaticPHP\Attribute\Package\BuildFor;
|
||||||
use StaticPHP\Attribute\Package\Library;
|
use StaticPHP\Attribute\Package\Library;
|
||||||
|
use StaticPHP\Attribute\Package\PatchBeforeBuild;
|
||||||
|
use StaticPHP\Attribute\PatchDescription;
|
||||||
use StaticPHP\Package\LibraryPackage;
|
use StaticPHP\Package\LibraryPackage;
|
||||||
use StaticPHP\Runtime\Executor\UnixAutoconfExecutor;
|
use StaticPHP\Runtime\Executor\UnixAutoconfExecutor;
|
||||||
|
use StaticPHP\Runtime\Executor\WindowsCMakeExecutor;
|
||||||
|
use StaticPHP\Runtime\SystemTarget;
|
||||||
|
use StaticPHP\Util\FileSystem;
|
||||||
|
|
||||||
#[Library('libyaml')]
|
#[Library('libyaml')]
|
||||||
class libyaml
|
class libyaml
|
||||||
{
|
{
|
||||||
|
#[PatchBeforeBuild]
|
||||||
|
#[PatchDescription('Copy missing cmake helper files required for MSVC build (not included in libyaml git source)')]
|
||||||
|
public function patchBeforeBuild(LibraryPackage $lib): void
|
||||||
|
{
|
||||||
|
spc_skip_if(SystemTarget::getTargetOS() !== 'Windows', 'This patch is only for Windows builds.');
|
||||||
|
// check missing files: cmake\config.h.in and .\YamlConfig.cmake.in
|
||||||
|
if (!file_exists($lib->getSourceDir() . '\cmake\config.h.in')) {
|
||||||
|
FileSystem::createDir($lib->getSourceDir() . '\cmake');
|
||||||
|
FileSystem::copy(ROOT_DIR . '/src/globals/extra/libyaml_config.h.in', $lib->getSourceDir() . '\cmake\config.h.in');
|
||||||
|
}
|
||||||
|
if (!file_exists($lib->getSourceDir() . '\YamlConfig.cmake.in')) {
|
||||||
|
FileSystem::copy(ROOT_DIR . '/src/globals/extra/libyaml_yamlConfig.cmake.in', $lib->getSourceDir() . '\YamlConfig.cmake.in');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[BuildFor('Darwin')]
|
#[BuildFor('Darwin')]
|
||||||
#[BuildFor('Linux')]
|
#[BuildFor('Linux')]
|
||||||
public function buildUnix(LibraryPackage $lib): void
|
public function buildUnix(LibraryPackage $lib): void
|
||||||
{
|
{
|
||||||
UnixAutoconfExecutor::create($lib)->configure()->make();
|
UnixAutoconfExecutor::create($lib)->configure()->make();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[BuildFor('Windows')]
|
||||||
|
public function buildWin(LibraryPackage $lib): void
|
||||||
|
{
|
||||||
|
WindowsCMakeExecutor::create($lib)
|
||||||
|
->addConfigureArgs('-DBUILD_TESTING=OFF')
|
||||||
|
->build();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ use StaticPHP\Attribute\Package\BuildFor;
|
|||||||
use StaticPHP\Attribute\Package\Library;
|
use StaticPHP\Attribute\Package\Library;
|
||||||
use StaticPHP\Package\LibraryPackage;
|
use StaticPHP\Package\LibraryPackage;
|
||||||
use StaticPHP\Runtime\Executor\UnixCMakeExecutor;
|
use StaticPHP\Runtime\Executor\UnixCMakeExecutor;
|
||||||
|
use StaticPHP\Runtime\Executor\WindowsCMakeExecutor;
|
||||||
|
use StaticPHP\Util\FileSystem;
|
||||||
|
|
||||||
#[Library('libzip')]
|
#[Library('libzip')]
|
||||||
class libzip
|
class libzip
|
||||||
@@ -33,4 +35,28 @@ class libzip
|
|||||||
->build();
|
->build();
|
||||||
$lib->patchPkgconfPrefix(['libzip.pc'], PKGCONF_PATCH_PREFIX);
|
$lib->patchPkgconfPrefix(['libzip.pc'], PKGCONF_PATCH_PREFIX);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[BuildFor('Windows')]
|
||||||
|
public function buildWin(LibraryPackage $lib): void
|
||||||
|
{
|
||||||
|
WindowsCMakeExecutor::create($lib)
|
||||||
|
->optionalPackage('bzip2', ...cmake_boolean_args('ENABLE_BZIP2'))
|
||||||
|
->optionalPackage('xz', ...cmake_boolean_args('ENABLE_LZMA'))
|
||||||
|
->optionalPackage('openssl', ...cmake_boolean_args('ENABLE_OPENSSL'))
|
||||||
|
->optionalPackage('zstd', ...cmake_boolean_args('ENABLE_ZSTD'))
|
||||||
|
->addConfigureArgs(
|
||||||
|
'-DENABLE_GNUTLS=OFF',
|
||||||
|
'-DENABLE_MBEDTLS=OFF',
|
||||||
|
'-DBUILD_DOC=OFF',
|
||||||
|
'-DBUILD_EXAMPLES=OFF',
|
||||||
|
'-DBUILD_REGRESS=OFF',
|
||||||
|
'-DBUILD_TOOLS=OFF',
|
||||||
|
'-DBUILD_OSSFUZZ=OFF',
|
||||||
|
)
|
||||||
|
->build();
|
||||||
|
FileSystem::copy(
|
||||||
|
$lib->getBuildRootPath() . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'zip.lib',
|
||||||
|
$lib->getBuildRootPath() . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'libzip_a.lib'
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ use StaticPHP\Util\DirDiff;
|
|||||||
use StaticPHP\Util\FileSystem;
|
use StaticPHP\Util\FileSystem;
|
||||||
|
|
||||||
#[Library('ncurses')]
|
#[Library('ncurses')]
|
||||||
|
#[Library('ncursesw')]
|
||||||
class ncurses
|
class ncurses
|
||||||
{
|
{
|
||||||
#[BuildFor('Darwin')]
|
#[BuildFor('Darwin')]
|
||||||
@@ -21,37 +22,48 @@ class ncurses
|
|||||||
{
|
{
|
||||||
$dirdiff = new DirDiff(BUILD_BIN_PATH);
|
$dirdiff = new DirDiff(BUILD_BIN_PATH);
|
||||||
|
|
||||||
UnixAutoconfExecutor::create($package)
|
$ac = UnixAutoconfExecutor::create($package)
|
||||||
->appendEnv([
|
->appendEnv([
|
||||||
'LDFLAGS' => $toolchain->isStatic() ? '-static' : '',
|
'LDFLAGS' => $toolchain->isStatic() ? '-static' : '',
|
||||||
])
|
]);
|
||||||
->configure(
|
$wide = $package->getName() === 'ncurses' ? ['--disable-widec'] : [];
|
||||||
'--enable-overwrite',
|
// Include standard system terminfo paths as fallback so binaries linking this ncurses
|
||||||
'--with-curses-h',
|
// (e.g. htop) can find terminfo on any target system without needing TERMINFO_DIRS set.
|
||||||
'--enable-pc-files',
|
$terminfo_dirs = implode(':', [
|
||||||
'--enable-echo',
|
"{$package->getBuildRootPath()}/share/terminfo",
|
||||||
'--disable-widec',
|
'/etc/terminfo',
|
||||||
'--with-normal',
|
'/lib/terminfo',
|
||||||
'--with-ticlib',
|
'/usr/share/terminfo',
|
||||||
'--without-tests',
|
]);
|
||||||
'--without-dlsym',
|
$ac->configure(
|
||||||
'--without-debug',
|
'--enable-overwrite',
|
||||||
'--enable-symlinks',
|
'--with-curses-h',
|
||||||
"--bindir={$package->getBinDir()}",
|
'--enable-pc-files',
|
||||||
"--includedir={$package->getIncludeDir()}",
|
'--enable-echo',
|
||||||
"--libdir={$package->getLibDir()}",
|
'--with-normal',
|
||||||
"--prefix={$package->getBuildRootPath()}",
|
'--with-ticlib',
|
||||||
)
|
'--without-tests',
|
||||||
|
'--without-dlsym',
|
||||||
|
'--without-debug',
|
||||||
|
'--enable-symlinks',
|
||||||
|
"--with-terminfo-dirs={$terminfo_dirs}",
|
||||||
|
"--bindir={$package->getBinDir()}",
|
||||||
|
"--includedir={$package->getIncludeDir()}",
|
||||||
|
"--libdir={$package->getLibDir()}",
|
||||||
|
"--prefix={$package->getBuildRootPath()}",
|
||||||
|
...$wide,
|
||||||
|
)
|
||||||
->make();
|
->make();
|
||||||
$new_files = $dirdiff->getIncrementFiles(true);
|
$new_files = $dirdiff->getIncrementFiles(true);
|
||||||
foreach ($new_files as $file) {
|
foreach ($new_files as $file) {
|
||||||
@unlink(BUILD_BIN_PATH . '/' . $file);
|
@unlink(BUILD_BIN_PATH . '/' . $file);
|
||||||
}
|
}
|
||||||
|
|
||||||
shell()->cd(BUILD_ROOT_PATH)->exec('rm -rf share/terminfo');
|
// shell()->cd(BUILD_ROOT_PATH)->exec('rm -rf share/terminfo');
|
||||||
shell()->cd(BUILD_ROOT_PATH)->exec('rm -rf lib/terminfo');
|
// shell()->cd(BUILD_ROOT_PATH)->exec('rm -rf lib/terminfo');
|
||||||
|
|
||||||
$pkgconf_list = ['form.pc', 'menu.pc', 'ncurses++.pc', 'ncurses.pc', 'panel.pc', 'tic.pc'];
|
$suffix = $package->getName() === 'ncursesw' ? 'w' : '';
|
||||||
|
$pkgconf_list = ["form{$suffix}.pc", "menu{$suffix}.pc", "ncurses++{$suffix}.pc", "ncurses{$suffix}.pc", "panel{$suffix}.pc", "tic{$suffix}.pc"];
|
||||||
$package->patchPkgconfPrefix($pkgconf_list);
|
$package->patchPkgconfPrefix($pkgconf_list);
|
||||||
|
|
||||||
foreach ($pkgconf_list as $pkgconf) {
|
foreach ($pkgconf_list as $pkgconf) {
|
||||||
|
|||||||
@@ -8,10 +8,29 @@ use StaticPHP\Attribute\Package\BuildFor;
|
|||||||
use StaticPHP\Attribute\Package\Library;
|
use StaticPHP\Attribute\Package\Library;
|
||||||
use StaticPHP\Package\LibraryPackage;
|
use StaticPHP\Package\LibraryPackage;
|
||||||
use StaticPHP\Runtime\Executor\UnixAutoconfExecutor;
|
use StaticPHP\Runtime\Executor\UnixAutoconfExecutor;
|
||||||
|
use StaticPHP\Runtime\Executor\WindowsCMakeExecutor;
|
||||||
|
use StaticPHP\Util\FileSystem;
|
||||||
|
|
||||||
#[Library('nghttp2')]
|
#[Library('nghttp2')]
|
||||||
class nghttp2
|
class nghttp2
|
||||||
{
|
{
|
||||||
|
#[BuildFor('Windows')]
|
||||||
|
public function buildWin(LibraryPackage $lib): void
|
||||||
|
{
|
||||||
|
WindowsCMakeExecutor::create($lib)
|
||||||
|
->addConfigureArgs(
|
||||||
|
'-DENABLE_SHARED_LIB=OFF',
|
||||||
|
'-DENABLE_STATIC_LIB=ON',
|
||||||
|
'-DENABLE_STATIC_CRT=ON',
|
||||||
|
'-DENABLE_LIB_ONLY=ON',
|
||||||
|
'-DENABLE_DOC=OFF',
|
||||||
|
'-DBUILD_TESTING=OFF',
|
||||||
|
)
|
||||||
|
->build();
|
||||||
|
|
||||||
|
FileSystem::replaceFileStr($lib->getIncludeDir() . '\nghttp2\nghttp2.h', '#ifdef NGHTTP2_STATICLIB', '#if 1');
|
||||||
|
}
|
||||||
|
|
||||||
#[BuildFor('Linux')]
|
#[BuildFor('Linux')]
|
||||||
#[BuildFor('Darwin')]
|
#[BuildFor('Darwin')]
|
||||||
public function build(LibraryPackage $lib): void
|
public function build(LibraryPackage $lib): void
|
||||||
|
|||||||
@@ -8,10 +8,26 @@ use StaticPHP\Attribute\Package\BuildFor;
|
|||||||
use StaticPHP\Attribute\Package\Library;
|
use StaticPHP\Attribute\Package\Library;
|
||||||
use StaticPHP\Package\LibraryPackage;
|
use StaticPHP\Package\LibraryPackage;
|
||||||
use StaticPHP\Runtime\Executor\UnixAutoconfExecutor;
|
use StaticPHP\Runtime\Executor\UnixAutoconfExecutor;
|
||||||
|
use StaticPHP\Runtime\Executor\WindowsCMakeExecutor;
|
||||||
|
|
||||||
#[Library('nghttp3')]
|
#[Library('nghttp3')]
|
||||||
class nghttp3
|
class nghttp3
|
||||||
{
|
{
|
||||||
|
#[BuildFor('Windows')]
|
||||||
|
public function buildWin(LibraryPackage $lib): void
|
||||||
|
{
|
||||||
|
WindowsCMakeExecutor::create($lib)
|
||||||
|
->addConfigureArgs(
|
||||||
|
'-DENABLE_SHARED_LIB=OFF',
|
||||||
|
'-DENABLE_STATIC_LIB=ON',
|
||||||
|
'-DBUILD_STATIC_LIBS=ON',
|
||||||
|
'-DBUILD_SHARED_LIBS=OFF',
|
||||||
|
'-DENABLE_STATIC_CRT=ON',
|
||||||
|
'-DENABLE_LIB_ONLY=ON',
|
||||||
|
)
|
||||||
|
->build();
|
||||||
|
}
|
||||||
|
|
||||||
#[BuildFor('Linux')]
|
#[BuildFor('Linux')]
|
||||||
#[BuildFor('Darwin')]
|
#[BuildFor('Darwin')]
|
||||||
public function build(LibraryPackage $lib): void
|
public function build(LibraryPackage $lib): void
|
||||||
|
|||||||
@@ -8,10 +8,27 @@ use StaticPHP\Attribute\Package\BuildFor;
|
|||||||
use StaticPHP\Attribute\Package\Library;
|
use StaticPHP\Attribute\Package\Library;
|
||||||
use StaticPHP\Package\LibraryPackage;
|
use StaticPHP\Package\LibraryPackage;
|
||||||
use StaticPHP\Runtime\Executor\UnixAutoconfExecutor;
|
use StaticPHP\Runtime\Executor\UnixAutoconfExecutor;
|
||||||
|
use StaticPHP\Runtime\Executor\WindowsCMakeExecutor;
|
||||||
|
|
||||||
#[Library('ngtcp2')]
|
#[Library('ngtcp2')]
|
||||||
class ngtcp2
|
class ngtcp2
|
||||||
{
|
{
|
||||||
|
#[BuildFor('Windows')]
|
||||||
|
public function buildWin(LibraryPackage $lib): void
|
||||||
|
{
|
||||||
|
WindowsCMakeExecutor::create($lib)
|
||||||
|
->addConfigureArgs(
|
||||||
|
'-DENABLE_SHARED_LIB=OFF',
|
||||||
|
'-DENABLE_STATIC_LIB=ON',
|
||||||
|
'-DBUILD_STATIC_LIBS=ON',
|
||||||
|
'-DBUILD_SHARED_LIBS=OFF',
|
||||||
|
'-DENABLE_STATIC_CRT=ON',
|
||||||
|
'-DENABLE_LIB_ONLY=ON',
|
||||||
|
'-DENABLE_OPENSSL=ON',
|
||||||
|
)
|
||||||
|
->build();
|
||||||
|
}
|
||||||
|
|
||||||
#[BuildFor('Linux')]
|
#[BuildFor('Linux')]
|
||||||
#[BuildFor('Darwin')]
|
#[BuildFor('Darwin')]
|
||||||
public function build(LibraryPackage $lib): void
|
public function build(LibraryPackage $lib): void
|
||||||
@@ -26,18 +43,6 @@ class ngtcp2
|
|||||||
]),
|
]),
|
||||||
'--with-openssl=no'
|
'--with-openssl=no'
|
||||||
)
|
)
|
||||||
->optionalPackage('nghttp3', ...ac_with_args('libnghttp3', true))
|
|
||||||
->optionalPackage(
|
|
||||||
'brotli',
|
|
||||||
fn (LibraryPackage $brotli) => implode(' ', [
|
|
||||||
'--with-brotlidec=yes',
|
|
||||||
"LIBBROTLIDEC_CFLAGS=\"-I{$brotli->getIncludeDir()}\"",
|
|
||||||
"LIBBROTLIDEC_LIBS=\"{$brotli->getStaticLibFiles()}\"",
|
|
||||||
'--with-libbrotlienc=yes',
|
|
||||||
"LIBBROTLIENC_CFLAGS=\"-I{$brotli->getIncludeDir()}\"",
|
|
||||||
"LIBBROTLIENC_LIBS=\"{$brotli->getStaticLibFiles()}\"",
|
|
||||||
])
|
|
||||||
)
|
|
||||||
->appendEnv(['PKG_CONFIG' => '$PKG_CONFIG --static'])
|
->appendEnv(['PKG_CONFIG' => '$PKG_CONFIG --static'])
|
||||||
->configure('--enable-lib-only')
|
->configure('--enable-lib-only')
|
||||||
->make();
|
->make();
|
||||||
|
|||||||
@@ -6,13 +6,72 @@ namespace Package\Library;
|
|||||||
|
|
||||||
use StaticPHP\Attribute\Package\BuildFor;
|
use StaticPHP\Attribute\Package\BuildFor;
|
||||||
use StaticPHP\Attribute\Package\Library;
|
use StaticPHP\Attribute\Package\Library;
|
||||||
|
use StaticPHP\Attribute\Package\Validate;
|
||||||
|
use StaticPHP\DI\ApplicationContext;
|
||||||
|
use StaticPHP\Exception\EnvironmentException;
|
||||||
use StaticPHP\Package\LibraryPackage;
|
use StaticPHP\Package\LibraryPackage;
|
||||||
|
use StaticPHP\Package\PackageBuilder;
|
||||||
|
use StaticPHP\Runtime\SystemTarget;
|
||||||
use StaticPHP\Util\FileSystem;
|
use StaticPHP\Util\FileSystem;
|
||||||
use StaticPHP\Util\System\LinuxUtil;
|
use StaticPHP\Util\System\LinuxUtil;
|
||||||
|
use StaticPHP\Util\System\WindowsUtil;
|
||||||
|
|
||||||
#[Library('openssl')]
|
#[Library('openssl')]
|
||||||
class openssl
|
class openssl
|
||||||
{
|
{
|
||||||
|
#[Validate]
|
||||||
|
public function validate(): void
|
||||||
|
{
|
||||||
|
if (SystemTarget::getTargetOS() === 'Windows') {
|
||||||
|
global $argv;
|
||||||
|
$perl_path_native = PKG_ROOT_PATH . '\strawberry-perl-' . arch2gnu(php_uname('m')) . '-win\perl\bin\perl.exe';
|
||||||
|
$perl = file_exists($perl_path_native) ? ($perl_path_native) : WindowsUtil::findCommand('perl.exe');
|
||||||
|
if ($perl === null) {
|
||||||
|
throw new EnvironmentException(
|
||||||
|
'You need to install perl first!',
|
||||||
|
"Please run \"{$argv[0]} doctor\" to fix the environment.",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
ApplicationContext::set('perl', $perl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[BuildFor('Windows')]
|
||||||
|
public function buildWin(LibraryPackage $lib, PackageBuilder $builder): void
|
||||||
|
{
|
||||||
|
$perl = ApplicationContext::get('perl');
|
||||||
|
$cmd = cmd()->cd($lib->getSourceDir())
|
||||||
|
->exec(
|
||||||
|
"{$perl} Configure zlib VC-WIN64A " .
|
||||||
|
'no-shared ' .
|
||||||
|
'--prefix=' . quote($lib->getBuildRootPath()) . ' ' .
|
||||||
|
'--with-zlib-lib=' . quote($lib->getLibDir()) . ' ' .
|
||||||
|
'--with-zlib-include=' . quote($lib->getIncludeDir()) . ' ' .
|
||||||
|
'--release ' .
|
||||||
|
'no-legacy ' .
|
||||||
|
'no-tests ' .
|
||||||
|
'/FS'
|
||||||
|
);
|
||||||
|
|
||||||
|
// patch zlib
|
||||||
|
FileSystem::replaceFileStr("{$lib->getSourceDir()}\\Makefile", 'ZLIB1', 'zlibstatic.lib');
|
||||||
|
// patch debug: https://stackoverflow.com/questions/18486243/how-do-i-build-openssl-statically-linked-against-windows-runtime
|
||||||
|
FileSystem::replaceFileStr("{$lib->getSourceDir()}\\Makefile", '/debug', '/incremental:no /opt:icf /dynamicbase /nxcompat /ltcg /nodefaultlib:msvcrt');
|
||||||
|
|
||||||
|
// build
|
||||||
|
$cmd->exec("jom.exe /j{$builder->concurrency} install_dev CNF_LDFLAGS=\"/NODEFAULTLIB:kernel32.lib /NODEFAULTLIB:msvcrt /NODEFAULTLIB:msvcrtd /DEFAULTLIB:libcmt /LIBPATH:{$lib->getLibDir()} zlibstatic.lib\"");
|
||||||
|
|
||||||
|
// copy necessary c files
|
||||||
|
FileSystem::copy("{$lib->getSourceDir()}\\ms\\applink.c", "{$lib->getIncludeDir()}\\openssl\\applink.c");
|
||||||
|
|
||||||
|
// patch cmake outputs
|
||||||
|
FileSystem::replaceFileRegex(
|
||||||
|
"{$lib->getLibDir()}\\cmake\\OpenSSL\\OpenSSLConfig.cmake",
|
||||||
|
'/set\(OPENSSL_LIBCRYPTO_DEPENDENCIES .*\)/m',
|
||||||
|
'set(OPENSSL_LIBCRYPTO_DEPENDENCIES "${OPENSSL_LIBRARY_DIR}" ws2_32.lib gdi32.lib advapi32.lib crypt32.lib user32.lib)'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#[BuildFor('Darwin')]
|
#[BuildFor('Darwin')]
|
||||||
public function buildForDarwin(LibraryPackage $pkg): void
|
public function buildForDarwin(LibraryPackage $pkg): void
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -73,6 +73,11 @@ class postgresql extends LibraryPackage
|
|||||||
|
|
||||||
FileSystem::resetDir("{$this->getSourceDir()}/build");
|
FileSystem::resetDir("{$this->getSourceDir()}/build");
|
||||||
|
|
||||||
|
if ($installer->isPackageResolved('ldap')) {
|
||||||
|
$ldap_libs = clean_spaces(implode(' ', PkgConfigUtil::getLibsArray('ldap')));
|
||||||
|
FileSystem::replaceFileStr("{$this->getSourceDir()}/configure", '-lldap', $ldap_libs);
|
||||||
|
}
|
||||||
|
|
||||||
// PHP source relies on the non-private encoding functions in libpgcommon.a
|
// PHP source relies on the non-private encoding functions in libpgcommon.a
|
||||||
FileSystem::replaceFileStr(
|
FileSystem::replaceFileStr(
|
||||||
"{$this->getSourceDir()}/src/common/Makefile",
|
"{$this->getSourceDir()}/src/common/Makefile",
|
||||||
|
|||||||
34
src/Package/Library/pthreads4w.php
Normal file
34
src/Package/Library/pthreads4w.php
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Package\Library;
|
||||||
|
|
||||||
|
use StaticPHP\Attribute\Package\BuildFor;
|
||||||
|
use StaticPHP\Attribute\Package\Library;
|
||||||
|
use StaticPHP\Package\LibraryPackage;
|
||||||
|
use StaticPHP\Util\FileSystem;
|
||||||
|
|
||||||
|
#[Library('pthreads4w')]
|
||||||
|
class pthreads4w
|
||||||
|
{
|
||||||
|
#[BuildFor('Windows')]
|
||||||
|
public function buildWin(LibraryPackage $lib): void
|
||||||
|
{
|
||||||
|
cmd()->cd($lib->getSourceDir())
|
||||||
|
->exec(
|
||||||
|
'nmake /E /nologo /f Makefile ' .
|
||||||
|
'DESTROOT=' . $lib->getBuildRootPath() . ' ' .
|
||||||
|
'XCFLAGS="/MT" ' . // no dll
|
||||||
|
'EHFLAGS="/I. /DHAVE_CONFIG_H /Os /Ob2 /D__PTW32_STATIC_LIB /D__PTW32_BUILD_INLINED" ' .
|
||||||
|
'pthreadVC3.inlined_static_stamp'
|
||||||
|
);
|
||||||
|
FileSystem::createDir($lib->getLibDir());
|
||||||
|
FileSystem::createDir($lib->getIncludeDir());
|
||||||
|
FileSystem::copy("{$lib->getSourceDir()}\\libpthreadVC3.lib", "{$lib->getLibDir()}\\libpthreadVC3.lib");
|
||||||
|
FileSystem::copy("{$lib->getSourceDir()}\\_ptw32.h", "{$lib->getIncludeDir()}\\_ptw32.h");
|
||||||
|
FileSystem::copy("{$lib->getSourceDir()}\\pthread.h", "{$lib->getIncludeDir()}\\pthread.h");
|
||||||
|
FileSystem::copy("{$lib->getSourceDir()}\\sched.h", "{$lib->getIncludeDir()}\\sched.h");
|
||||||
|
FileSystem::copy("{$lib->getSourceDir()}\\semaphore.h", "{$lib->getIncludeDir()}\\semaphore.h");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -23,4 +23,15 @@ class qdbm
|
|||||||
$ac->make(SystemTarget::getTargetOS() === 'Darwin' ? 'mac' : '');
|
$ac->make(SystemTarget::getTargetOS() === 'Darwin' ? 'mac' : '');
|
||||||
$lib->patchPkgconfPrefix(['qdbm.pc']);
|
$lib->patchPkgconfPrefix(['qdbm.pc']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[BuildFor('Windows')]
|
||||||
|
public function buildWin(LibraryPackage $lib): void
|
||||||
|
{
|
||||||
|
cmd()->cd($lib->getSourceDir())
|
||||||
|
->exec('nmake /f VCMakefile');
|
||||||
|
FileSystem::createDir($lib->getLibDir());
|
||||||
|
FileSystem::createDir($lib->getIncludeDir());
|
||||||
|
FileSystem::copy("{$lib->getSourceDir()}\\qdbm_a.lib", "{$lib->getLibDir()}\\qdbm_a.lib");
|
||||||
|
FileSystem::copy("{$lib->getSourceDir()}\\depot.h", "{$lib->getIncludeDir()}\\depot.h");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,8 +6,11 @@ namespace Package\Library;
|
|||||||
|
|
||||||
use StaticPHP\Attribute\Package\BuildFor;
|
use StaticPHP\Attribute\Package\BuildFor;
|
||||||
use StaticPHP\Attribute\Package\Library;
|
use StaticPHP\Attribute\Package\Library;
|
||||||
|
use StaticPHP\Attribute\Package\PatchBeforeBuild;
|
||||||
use StaticPHP\Package\LibraryPackage;
|
use StaticPHP\Package\LibraryPackage;
|
||||||
use StaticPHP\Runtime\Executor\UnixAutoconfExecutor;
|
use StaticPHP\Runtime\Executor\UnixAutoconfExecutor;
|
||||||
|
use StaticPHP\Runtime\SystemTarget;
|
||||||
|
use StaticPHP\Util\FileSystem;
|
||||||
|
|
||||||
#[Library('sqlite')]
|
#[Library('sqlite')]
|
||||||
class sqlite
|
class sqlite
|
||||||
@@ -19,4 +22,18 @@ class sqlite
|
|||||||
UnixAutoconfExecutor::create($lib)->configure()->make();
|
UnixAutoconfExecutor::create($lib)->configure()->make();
|
||||||
$lib->patchPkgconfPrefix(['sqlite3.pc']);
|
$lib->patchPkgconfPrefix(['sqlite3.pc']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[PatchBeforeBuild]
|
||||||
|
public function patchBeforeBuild(LibraryPackage $lib): void
|
||||||
|
{
|
||||||
|
spc_skip_if(SystemTarget::getTargetOS() !== 'Windows', 'This patch is only for Windows builds.');
|
||||||
|
FileSystem::copy(ROOT_DIR . '/src/globals/extra/Makefile-sqlite', "{$lib->getSourceDir()}\\Makefile");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[BuildFor('Windows')]
|
||||||
|
public function buildWin(LibraryPackage $lib): void
|
||||||
|
{
|
||||||
|
cmd()->cd($lib->getSourceDir())
|
||||||
|
->exec("nmake PREFIX={$lib->getBuildRootPath()} install-static");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ use StaticPHP\Attribute\Package\BuildFor;
|
|||||||
use StaticPHP\Attribute\Package\Library;
|
use StaticPHP\Attribute\Package\Library;
|
||||||
use StaticPHP\Package\LibraryPackage;
|
use StaticPHP\Package\LibraryPackage;
|
||||||
use StaticPHP\Runtime\Executor\UnixAutoconfExecutor;
|
use StaticPHP\Runtime\Executor\UnixAutoconfExecutor;
|
||||||
|
use StaticPHP\Runtime\Executor\WindowsCMakeExecutor;
|
||||||
|
use StaticPHP\Util\FileSystem;
|
||||||
|
|
||||||
#[Library('xz')]
|
#[Library('xz')]
|
||||||
class xz
|
class xz
|
||||||
@@ -27,4 +29,14 @@ class xz
|
|||||||
$lib->patchPkgconfPrefix(['liblzma.pc']);
|
$lib->patchPkgconfPrefix(['liblzma.pc']);
|
||||||
$lib->patchLaDependencyPrefix();
|
$lib->patchLaDependencyPrefix();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[BuildFor('Windows')]
|
||||||
|
public function buildWin(LibraryPackage $lib): void
|
||||||
|
{
|
||||||
|
WindowsCMakeExecutor::create($lib)->build();
|
||||||
|
// copy lzma.lib to liblzma_a.lib
|
||||||
|
FileSystem::copy("{$lib->getLibDir()}\\lzma.lib", "{$lib->getLibDir()}\\liblzma_a.lib");
|
||||||
|
// patch lzma.h: make static API always available on Windows
|
||||||
|
FileSystem::replaceFileStr("{$lib->getIncludeDir()}\\lzma.h", 'defined(LZMA_API_STATIC)', 'defined(_WIN32)');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ use StaticPHP\Attribute\Package\BuildFor;
|
|||||||
use StaticPHP\Attribute\Package\Library;
|
use StaticPHP\Attribute\Package\Library;
|
||||||
use StaticPHP\Package\LibraryPackage;
|
use StaticPHP\Package\LibraryPackage;
|
||||||
use StaticPHP\Runtime\Executor\UnixAutoconfExecutor;
|
use StaticPHP\Runtime\Executor\UnixAutoconfExecutor;
|
||||||
|
use StaticPHP\Runtime\Executor\WindowsCMakeExecutor;
|
||||||
|
use StaticPHP\Util\FileSystem;
|
||||||
|
|
||||||
#[Library('zlib')]
|
#[Library('zlib')]
|
||||||
class zlib
|
class zlib
|
||||||
@@ -21,4 +23,29 @@ class zlib
|
|||||||
// Patch pkg-config file
|
// Patch pkg-config file
|
||||||
$lib->patchPkgconfPrefix(['zlib.pc'], PKGCONF_PATCH_PREFIX);
|
$lib->patchPkgconfPrefix(['zlib.pc'], PKGCONF_PATCH_PREFIX);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[BuildFor('Windows')]
|
||||||
|
public function buildWin(LibraryPackage $lib): void
|
||||||
|
{
|
||||||
|
WindowsCMakeExecutor::create($lib)->build();
|
||||||
|
$detect_list = [
|
||||||
|
'zlibstatic.lib',
|
||||||
|
'zs.lib',
|
||||||
|
'libzs.lib',
|
||||||
|
'libz.lib',
|
||||||
|
];
|
||||||
|
foreach ($detect_list as $item) {
|
||||||
|
if (file_exists("{$lib->getLibDir()}\\{$item}")) {
|
||||||
|
FileSystem::copy("{$lib->getLibDir()}\\{$item}", "{$lib->getLibDir()}\\zlib_a.lib");
|
||||||
|
FileSystem::copy("{$lib->getLibDir()}\\{$item}", "{$lib->getLibDir()}\\zlibstatic.lib");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
FileSystem::removeFileIfExists("{$lib->getBinDir()}\\zlib.dll");
|
||||||
|
FileSystem::removeFileIfExists("{$lib->getLibDir()}\\zlib.lib");
|
||||||
|
FileSystem::removeFileIfExists("{$lib->getLibDir()}\\libz.dll");
|
||||||
|
FileSystem::removeFileIfExists("{$lib->getLibDir()}\\libz.lib");
|
||||||
|
FileSystem::removeFileIfExists("{$lib->getLibDir()}\\z.lib");
|
||||||
|
FileSystem::removeFileIfExists("{$lib->getLibDir()}\\z.dll");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,10 +8,24 @@ use StaticPHP\Attribute\Package\BuildFor;
|
|||||||
use StaticPHP\Attribute\Package\Library;
|
use StaticPHP\Attribute\Package\Library;
|
||||||
use StaticPHP\Package\LibraryPackage;
|
use StaticPHP\Package\LibraryPackage;
|
||||||
use StaticPHP\Runtime\Executor\UnixCMakeExecutor;
|
use StaticPHP\Runtime\Executor\UnixCMakeExecutor;
|
||||||
|
use StaticPHP\Runtime\Executor\WindowsCMakeExecutor;
|
||||||
|
|
||||||
#[Library('zstd')]
|
#[Library('zstd')]
|
||||||
class zstd
|
class zstd
|
||||||
{
|
{
|
||||||
|
#[BuildFor('Windows')]
|
||||||
|
public function buildWin(LibraryPackage $package): void
|
||||||
|
{
|
||||||
|
WindowsCMakeExecutor::create($package)
|
||||||
|
->setWorkingDir("{$package->getSourceDir()}/build/cmake")
|
||||||
|
->setBuildDir("{$package->getSourceDir()}/build/cmake/build")
|
||||||
|
->addConfigureArgs(
|
||||||
|
'-DZSTD_BUILD_STATIC=ON',
|
||||||
|
'-DZSTD_BUILD_SHARED=OFF',
|
||||||
|
)
|
||||||
|
->build();
|
||||||
|
}
|
||||||
|
|
||||||
#[BuildFor('Linux')]
|
#[BuildFor('Linux')]
|
||||||
#[BuildFor('Darwin')]
|
#[BuildFor('Darwin')]
|
||||||
public function build(LibraryPackage $lib): void
|
public function build(LibraryPackage $lib): void
|
||||||
|
|||||||
@@ -2,25 +2,28 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
namespace Package\Library;
|
namespace Package\Target;
|
||||||
|
|
||||||
use StaticPHP\Attribute\Package\BuildFor;
|
use StaticPHP\Attribute\Package\BuildFor;
|
||||||
use StaticPHP\Attribute\Package\Library;
|
|
||||||
use StaticPHP\Attribute\Package\PatchBeforeBuild;
|
use StaticPHP\Attribute\Package\PatchBeforeBuild;
|
||||||
|
use StaticPHP\Attribute\Package\Target;
|
||||||
use StaticPHP\Attribute\PatchDescription;
|
use StaticPHP\Attribute\PatchDescription;
|
||||||
use StaticPHP\Package\LibraryPackage;
|
use StaticPHP\Package\LibraryPackage;
|
||||||
use StaticPHP\Runtime\Executor\UnixCMakeExecutor;
|
use StaticPHP\Runtime\Executor\UnixCMakeExecutor;
|
||||||
|
use StaticPHP\Runtime\Executor\WindowsCMakeExecutor;
|
||||||
use StaticPHP\Runtime\SystemTarget;
|
use StaticPHP\Runtime\SystemTarget;
|
||||||
use StaticPHP\Util\FileSystem;
|
use StaticPHP\Util\FileSystem;
|
||||||
|
|
||||||
#[Library('curl')]
|
#[Target('curl')]
|
||||||
class curl
|
class curl
|
||||||
{
|
{
|
||||||
#[PatchBeforeBuild]
|
#[PatchBeforeBuild]
|
||||||
#[PatchDescription('Remove CMAKE_C_IMPLICIT_LINK_LIBRARIES and fix macOS framework detection')]
|
#[PatchDescription('Remove CMAKE_C_IMPLICIT_LINK_LIBRARIES and fix macOS framework detection')]
|
||||||
public function patchBeforeBuild(LibraryPackage $lib): bool
|
public function patchBeforeBuild(LibraryPackage $lib): bool
|
||||||
{
|
{
|
||||||
shell()->cd($lib->getSourceDir())->exec('sed -i.save s@\${CMAKE_C_IMPLICIT_LINK_LIBRARIES}@@ ./CMakeLists.txt');
|
if (SystemTarget::getTargetOS() !== 'Windows') {
|
||||||
|
shell()->cd($lib->getSourceDir())->exec('sed -i.save s@\${CMAKE_C_IMPLICIT_LINK_LIBRARIES}@@ ./CMakeLists.txt');
|
||||||
|
}
|
||||||
if (SystemTarget::getTargetOS() === 'Darwin') {
|
if (SystemTarget::getTargetOS() === 'Darwin') {
|
||||||
FileSystem::replaceFileRegex("{$lib->getSourceDir()}/CMakeLists.txt", '/NOT COREFOUNDATION_FRAMEWORK/m', 'FALSE');
|
FileSystem::replaceFileRegex("{$lib->getSourceDir()}/CMakeLists.txt", '/NOT COREFOUNDATION_FRAMEWORK/m', 'FALSE');
|
||||||
FileSystem::replaceFileRegex("{$lib->getSourceDir()}/CMakeLists.txt", '/NOT SYSTEMCONFIGURATION_FRAMEWORK/m', 'FALSE');
|
FileSystem::replaceFileRegex("{$lib->getSourceDir()}/CMakeLists.txt", '/NOT SYSTEMCONFIGURATION_FRAMEWORK/m', 'FALSE');
|
||||||
@@ -29,6 +32,34 @@ class curl
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[BuildFor('Windows')]
|
||||||
|
public function buildWin(LibraryPackage $lib): void
|
||||||
|
{
|
||||||
|
WindowsCMakeExecutor::create($lib)
|
||||||
|
->optionalPackage('zstd', ...cmake_boolean_args('CURL_ZSTD'))
|
||||||
|
->optionalPackage('brotli', ...cmake_boolean_args('CURL_BROTLI'))
|
||||||
|
->addConfigureArgs(
|
||||||
|
'-DBUILD_CURL_EXE=OFF',
|
||||||
|
'-DZSTD_LIBRARY=zstd_static.lib',
|
||||||
|
'-DBUILD_TESTING=OFF',
|
||||||
|
'-DBUILD_EXAMPLES=OFF',
|
||||||
|
'-DUSE_LIBIDN2=OFF',
|
||||||
|
'-DCURL_USE_LIBPSL=OFF',
|
||||||
|
'-DUSE_WINDOWS_SSPI=ON',
|
||||||
|
'-DCURL_USE_SCHANNEL=ON',
|
||||||
|
'-DCURL_USE_OPENSSL=OFF',
|
||||||
|
'-DCURL_ENABLE_SSL=ON',
|
||||||
|
'-DUSE_NGHTTP2=ON',
|
||||||
|
'-DSHARE_LIB_OBJECT=OFF',
|
||||||
|
'-DCURL_USE_LIBSSH2=ON',
|
||||||
|
'-DENABLE_IPV6=ON',
|
||||||
|
)
|
||||||
|
->build();
|
||||||
|
// move libcurl.lib to libcurl_a.lib
|
||||||
|
rename("{$lib->getLibDir()}\\libcurl.lib", "{$lib->getLibDir()}\\libcurl_a.lib");
|
||||||
|
FileSystem::replaceFileStr("{$lib->getIncludeDir()}\\curl\\curl.h", '#ifdef CURL_STATICLIB', '#if 1');
|
||||||
|
}
|
||||||
|
|
||||||
#[BuildFor('Linux')]
|
#[BuildFor('Linux')]
|
||||||
#[BuildFor('Darwin')]
|
#[BuildFor('Darwin')]
|
||||||
public function build(LibraryPackage $lib): void
|
public function build(LibraryPackage $lib): void
|
||||||
@@ -48,20 +79,25 @@ class curl
|
|||||||
->optionalPackage('idn2', ...cmake_boolean_args('CURL_USE_IDN2'))
|
->optionalPackage('idn2', ...cmake_boolean_args('CURL_USE_IDN2'))
|
||||||
->optionalPackage('libcares', '-DENABLE_ARES=ON')
|
->optionalPackage('libcares', '-DENABLE_ARES=ON')
|
||||||
->addConfigureArgs(
|
->addConfigureArgs(
|
||||||
'-DBUILD_CURL_EXE=OFF',
|
'-DBUILD_CURL_EXE=ON',
|
||||||
'-DBUILD_LIBCURL_DOCS=OFF',
|
'-DBUILD_LIBCURL_DOCS=OFF',
|
||||||
|
'-DCURL_USE_PKGCONFIG=ON',
|
||||||
)
|
)
|
||||||
->build();
|
->build();
|
||||||
|
|
||||||
// patch pkgconf
|
// patch pkgconf
|
||||||
$lib->patchPkgconfPrefix(['libcurl.pc']);
|
$lib->patchPkgconfPrefix(['libcurl.pc']);
|
||||||
// curl's CMake embeds krb5 link flags directly without following Requires.private chain,
|
// Ensure -lkrb5support is present in libcurl.pc for downstream consumers.
|
||||||
// so -lkrb5support (from mit-krb5.pc Libs.private) is missing from libcurl.pc.
|
// krb5.php already promotes it to Libs in mit-krb5.pc before the build, so
|
||||||
|
// CMake should have embedded it; this is a safety fallback if it was missed.
|
||||||
$pc_path = "{$lib->getLibDir()}/pkgconfig/libcurl.pc";
|
$pc_path = "{$lib->getLibDir()}/pkgconfig/libcurl.pc";
|
||||||
if (str_contains(FileSystem::readFile($pc_path), '-lgssapi_krb5')) {
|
$pc_content = FileSystem::readFile($pc_path);
|
||||||
FileSystem::replaceFileRegex($pc_path, '/-lcom_err$/m', '-lcom_err -lkrb5support');
|
if (str_contains($pc_content, '-lgssapi_krb5') && !str_contains($pc_content, '-lkrb5support')) {
|
||||||
|
FileSystem::replaceFileRegex($pc_path, '/-lcom_err\b/', '-lcom_err -lkrb5support');
|
||||||
}
|
}
|
||||||
shell()->cd("{$lib->getLibDir()}/cmake/CURL/")
|
shell()->cd("{$lib->getLibDir()}/cmake/CURL/")
|
||||||
->exec("sed -ie 's|\"/lib/libcurl.a\"|\"{$lib->getLibDir()}/libcurl.a\"|g' CURLTargets-release.cmake");
|
->exec("sed -ie 's|\"/lib/libcurl.a\"|\"{$lib->getLibDir()}/libcurl.a\"|g' CURLTargets-release.cmake");
|
||||||
|
|
||||||
|
$lib->setOutput('Static curl executable path', BUILD_BIN_PATH . '/curl');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace Package\Target;
|
|
||||||
|
|
||||||
use StaticPHP\Attribute\Package\BeforeStage;
|
|
||||||
use StaticPHP\Attribute\Package\InitPackage;
|
|
||||||
use StaticPHP\Attribute\Package\Target;
|
|
||||||
use StaticPHP\Util\GlobalEnvManager;
|
|
||||||
|
|
||||||
#[Target('go-xcaddy')]
|
|
||||||
class go_xcaddy
|
|
||||||
{
|
|
||||||
#[InitPackage]
|
|
||||||
#[BeforeStage('frankenphp', 'build', 'go-xcaddy')]
|
|
||||||
public function init(): void
|
|
||||||
{
|
|
||||||
if (is_dir(PKG_ROOT_PATH . '/go-xcaddy/bin')) {
|
|
||||||
GlobalEnvManager::addPathIfNotExists(PKG_ROOT_PATH . '/go-xcaddy/bin');
|
|
||||||
GlobalEnvManager::putenv('GOROOT=' . PKG_ROOT_PATH . '/go-xcaddy');
|
|
||||||
GlobalEnvManager::putenv('GOBIN=' . PKG_ROOT_PATH . '/go-xcaddy/bin');
|
|
||||||
GlobalEnvManager::putenv('GOPATH=' . PKG_ROOT_PATH . '/go-xcaddy/go');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
29
src/Package/Target/htop.php
Normal file
29
src/Package/Target/htop.php
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Package\Target;
|
||||||
|
|
||||||
|
use StaticPHP\Attribute\Package\BuildFor;
|
||||||
|
use StaticPHP\Attribute\Package\Target;
|
||||||
|
use StaticPHP\Package\TargetPackage;
|
||||||
|
use StaticPHP\Runtime\Executor\UnixAutoconfExecutor;
|
||||||
|
use StaticPHP\Toolchain\Interface\ToolchainInterface;
|
||||||
|
|
||||||
|
#[Target('htop')]
|
||||||
|
class htop extends TargetPackage
|
||||||
|
{
|
||||||
|
#[BuildFor('Darwin')]
|
||||||
|
#[BuildFor('Linux')]
|
||||||
|
public function build(ToolchainInterface $toolchain): void
|
||||||
|
{
|
||||||
|
// htop's --enable-static adds -static to CFLAGS/LDFLAGS globally (not just for .a libraries),
|
||||||
|
// which causes zig-cc to fail on glibc targets. Only enable it for truly static (musl) builds.
|
||||||
|
UnixAutoconfExecutor::create($this)
|
||||||
|
->removeConfigureArgs('--disable-shared', '--enable-static')
|
||||||
|
->exec('./autogen.sh')
|
||||||
|
->addConfigureArgs($toolchain->isStatic() ? '--enable-static' : '--disable-static')
|
||||||
|
->configure()
|
||||||
|
->make(with_clean: false);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -12,6 +12,7 @@ use StaticPHP\Attribute\Package\BeforeStage;
|
|||||||
use StaticPHP\Attribute\Package\Info;
|
use StaticPHP\Attribute\Package\Info;
|
||||||
use StaticPHP\Attribute\Package\InitPackage;
|
use StaticPHP\Attribute\Package\InitPackage;
|
||||||
use StaticPHP\Attribute\Package\ResolveBuild;
|
use StaticPHP\Attribute\Package\ResolveBuild;
|
||||||
|
use StaticPHP\Attribute\Package\Stage;
|
||||||
use StaticPHP\Attribute\Package\Target;
|
use StaticPHP\Attribute\Package\Target;
|
||||||
use StaticPHP\Attribute\Package\Validate;
|
use StaticPHP\Attribute\Package\Validate;
|
||||||
use StaticPHP\Config\PackageConfig;
|
use StaticPHP\Config\PackageConfig;
|
||||||
@@ -29,6 +30,7 @@ use StaticPHP\Toolchain\Interface\ToolchainInterface;
|
|||||||
use StaticPHP\Toolchain\ToolchainManager;
|
use StaticPHP\Toolchain\ToolchainManager;
|
||||||
use StaticPHP\Util\DependencyResolver;
|
use StaticPHP\Util\DependencyResolver;
|
||||||
use StaticPHP\Util\FileSystem;
|
use StaticPHP\Util\FileSystem;
|
||||||
|
use StaticPHP\Util\InteractiveTerm;
|
||||||
use StaticPHP\Util\SourcePatcher;
|
use StaticPHP\Util\SourcePatcher;
|
||||||
use StaticPHP\Util\V2CompatLayer;
|
use StaticPHP\Util\V2CompatLayer;
|
||||||
use Symfony\Component\Console\Input\InputArgument;
|
use Symfony\Component\Console\Input\InputArgument;
|
||||||
@@ -339,6 +341,35 @@ class php extends TargetPackage
|
|||||||
FileSystem::removeDir(BUILD_MODULES_PATH);
|
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
|
private function makeStaticExtensionString(PackageInstaller $installer): string
|
||||||
{
|
{
|
||||||
$arg = [];
|
$arg = [];
|
||||||
|
|||||||
@@ -469,27 +469,6 @@ trait unix
|
|||||||
$package->runStage([$this, 'unixBuildSharedExt']);
|
$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
|
* Patch phpize and php-config if needed
|
||||||
*/
|
*/
|
||||||
@@ -662,7 +641,7 @@ trait unix
|
|||||||
/**
|
/**
|
||||||
* Generate micro extension test php code.
|
* 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";
|
$php = "<?php\n\necho '[micro-test-start]' . PHP_EOL;\n";
|
||||||
foreach ($installer->getResolvedPackages(PhpExtensionPackage::class) as $ext) {
|
foreach ($installer->getResolvedPackages(PhpExtensionPackage::class) as $ext) {
|
||||||
|
|||||||
@@ -8,10 +8,15 @@ use StaticPHP\Attribute\Package\BeforeStage;
|
|||||||
use StaticPHP\Attribute\Package\BuildFor;
|
use StaticPHP\Attribute\Package\BuildFor;
|
||||||
use StaticPHP\Attribute\Package\Stage;
|
use StaticPHP\Attribute\Package\Stage;
|
||||||
use StaticPHP\Attribute\PatchDescription;
|
use StaticPHP\Attribute\PatchDescription;
|
||||||
|
use StaticPHP\Config\PackageConfig;
|
||||||
use StaticPHP\Exception\PatchException;
|
use StaticPHP\Exception\PatchException;
|
||||||
use StaticPHP\Exception\SPCInternalException;
|
use StaticPHP\Exception\SPCInternalException;
|
||||||
|
use StaticPHP\Exception\ValidationException;
|
||||||
|
use StaticPHP\Exception\WrongUsageException;
|
||||||
|
use StaticPHP\Package\LibraryPackage;
|
||||||
use StaticPHP\Package\PackageBuilder;
|
use StaticPHP\Package\PackageBuilder;
|
||||||
use StaticPHP\Package\PackageInstaller;
|
use StaticPHP\Package\PackageInstaller;
|
||||||
|
use StaticPHP\Package\PhpExtensionPackage;
|
||||||
use StaticPHP\Package\TargetPackage;
|
use StaticPHP\Package\TargetPackage;
|
||||||
use StaticPHP\Util\FileSystem;
|
use StaticPHP\Util\FileSystem;
|
||||||
use StaticPHP\Util\InteractiveTerm;
|
use StaticPHP\Util\InteractiveTerm;
|
||||||
@@ -52,9 +57,11 @@ trait windows
|
|||||||
$cli = $installer->isPackageResolved('php-cli');
|
$cli = $installer->isPackageResolved('php-cli');
|
||||||
$cgi = $installer->isPackageResolved('php-cgi');
|
$cgi = $installer->isPackageResolved('php-cgi');
|
||||||
$micro = $installer->isPackageResolved('php-micro');
|
$micro = $installer->isPackageResolved('php-micro');
|
||||||
|
$embed = $installer->isPackageResolved('php-embed');
|
||||||
$args[] = $cli ? '--enable-cli=yes' : '--enable-cli=no';
|
$args[] = $cli ? '--enable-cli=yes' : '--enable-cli=no';
|
||||||
$args[] = $cgi ? '--enable-cgi=yes' : '--enable-cgi=no';
|
$args[] = $cgi ? '--enable-cgi=yes' : '--enable-cgi=no';
|
||||||
$args[] = $micro ? '--enable-micro=yes' : '--enable-micro=no';
|
$args[] = $micro ? '--enable-micro=yes' : '--enable-micro=no';
|
||||||
|
$args[] = $embed ? '--enable-embed=yes' : '--enable-embed=no';
|
||||||
|
|
||||||
// zts
|
// zts
|
||||||
$args[] = $package->getBuildOption('enable-zts', false) ? '--enable-zts=yes' : '--enable-zts=no';
|
$args[] = $package->getBuildOption('enable-zts', false) ? '--enable-zts=yes' : '--enable-zts=no';
|
||||||
@@ -98,18 +105,31 @@ trait windows
|
|||||||
throw new PatchException('Windows Makefile patching for php.exe target', 'Cannot patch windows CLI Makefile, Makefile does not contain "$(BUILD_DIR)\php.exe:" line');
|
throw new PatchException('Windows Makefile patching for php.exe target', 'Cannot patch windows CLI Makefile, Makefile does not contain "$(BUILD_DIR)\php.exe:" line');
|
||||||
}
|
}
|
||||||
$lines[$line_num] = '$(BUILD_DIR)\php.exe: generated_files $(DEPS_CLI) $(PHP_GLOBAL_OBJS) $(CLI_GLOBAL_OBJS) $(STATIC_EXT_OBJS) $(ASM_OBJS) $(BUILD_DIR)\php.exe.res $(BUILD_DIR)\php.exe.manifest';
|
$lines[$line_num] = '$(BUILD_DIR)\php.exe: generated_files $(DEPS_CLI) $(PHP_GLOBAL_OBJS) $(CLI_GLOBAL_OBJS) $(STATIC_EXT_OBJS) $(ASM_OBJS) $(BUILD_DIR)\php.exe.res $(BUILD_DIR)\php.exe.manifest';
|
||||||
$lines[$line_num + 1] = "\t" . '"$(LINK)" /nologo $(PHP_GLOBAL_OBJS_RESP) $(CLI_GLOBAL_OBJS_RESP) $(STATIC_EXT_OBJS_RESP) $(STATIC_EXT_LIBS) $(ASM_OBJS) $(LIBS) $(LIBS_CLI) $(BUILD_DIR)\php.exe.res /out:$(BUILD_DIR)\php.exe $(LDFLAGS) $(LDFLAGS_CLI) /ltcg /nodefaultlib:msvcrt /nodefaultlib:msvcrtd /ignore:4286';
|
$lines[$line_num + 1] = "\t" . '"$(LINK)” /nologo $(PHP_GLOBAL_OBJS_RESP) $(CLI_GLOBAL_OBJS_RESP) $(STATIC_EXT_OBJS_RESP) $(STATIC_EXT_LIBS) $(ASM_OBJS) $(LIBS) $(LIBS_CLI) $(BUILD_DIR)\php.exe.res /out:$(BUILD_DIR)\php.exe $(LDFLAGS) $(LDFLAGS_CLI) /ltcg /nodefaultlib:msvcrt /nodefaultlib:msvcrtd /ignore:4286';
|
||||||
FileSystem::writeFile("{$package->getSourceDir()}\\Makefile", implode("\r\n", $lines));
|
FileSystem::writeFile("{$package->getSourceDir()}\\Makefile", implode("\r\n", $lines));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[Stage]
|
#[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'));
|
InteractiveTerm::setMessage('Building php: ' . ConsoleColor::yellow('php.exe'));
|
||||||
|
|
||||||
// extra lib
|
// Collect static-libs@windows from all resolved library packages.
|
||||||
$extra_libs = getenv('SPC_EXTRA_LIBS') ?: '';
|
// 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
|
// 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
|
// We need to modify CFLAGS to replace /Ox with /Zi and add /DEBUG to LDFLAGS
|
||||||
$debug_overrides = '';
|
$debug_overrides = '';
|
||||||
@@ -131,6 +151,68 @@ trait windows
|
|||||||
$this->deployWindowsBinary($builder, $package, 'php-cli');
|
$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]
|
#[Stage]
|
||||||
public function makeForWindows(TargetPackage $package, PackageInstaller $installer): void
|
public function makeForWindows(TargetPackage $package, PackageInstaller $installer): void
|
||||||
{
|
{
|
||||||
@@ -147,6 +229,193 @@ trait windows
|
|||||||
if ($installer->isPackageResolved('php-micro')) {
|
if ($installer->isPackageResolved('php-micro')) {
|
||||||
$package->runStage([$this, 'makeMicroForWindows']);
|
$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')]
|
#[BuildFor('Windows')]
|
||||||
@@ -215,6 +484,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
|
protected function deployWindowsBinary(PackageBuilder $builder, TargetPackage $package, string $sapi): void
|
||||||
{
|
{
|
||||||
$rel_type = 'Release'; // TODO: Debug build support
|
$rel_type = 'Release'; // TODO: Debug build support
|
||||||
@@ -231,9 +689,95 @@ trait windows
|
|||||||
|
|
||||||
$builder->deployBinary($src_file, $dst_file);
|
$builder->deployBinary($src_file, $dst_file);
|
||||||
|
|
||||||
// make debug info file path
|
// copy .pdb debug info file
|
||||||
if ($builder->getOption('no-strip', false) && file_exists("{$src[0]}\\{$src[2]}")) {
|
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]}");
|
FileSystem::copy("{$src[0]}\\{$src[2]}", "{$debug_dir}\\{$src[2]}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// with-upx-pack for cli, cgi and micro
|
||||||
|
if ($builder->getOption('with-upx-pack', false)) {
|
||||||
|
if (in_array($sapi, ['php-cli', 'php-cgi', 'php-micro'], true)) {
|
||||||
|
cmd()->exec(getenv('UPX_EXEC') . ' --best ' . escapeshellarg($dst_file));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ use Symfony\Component\Console\Application;
|
|||||||
*/
|
*/
|
||||||
final class ConsoleApplication extends Application
|
final class ConsoleApplication extends Application
|
||||||
{
|
{
|
||||||
public const string VERSION = '2.8.3';
|
public const string VERSION = '2.8.4';
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -96,7 +96,8 @@ class Extension
|
|||||||
fn ($x) => $x->getStaticLibFiles(),
|
fn ($x) => $x->getStaticLibFiles(),
|
||||||
$this->getLibraryDependencies(recursive: true)
|
$this->getLibraryDependencies(recursive: true)
|
||||||
);
|
);
|
||||||
return implode(' ', $ret);
|
$libs = implode(' ', $ret);
|
||||||
|
return deduplicate_flags($libs);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -365,6 +365,27 @@ abstract class LibraryBase
|
|||||||
|
|
||||||
protected function isLibraryInstalled(): bool
|
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) {
|
foreach (Config::getLib(static::NAME, 'static-libs', []) as $name) {
|
||||||
if (!file_exists(BUILD_LIB_PATH . "/{$name}")) {
|
if (!file_exists(BUILD_LIB_PATH . "/{$name}")) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ use SPC\store\FileSystem;
|
|||||||
use SPC\util\CustomExt;
|
use SPC\util\CustomExt;
|
||||||
use SPC\util\GlobalEnvManager;
|
use SPC\util\GlobalEnvManager;
|
||||||
use SPC\util\SPCConfigUtil;
|
use SPC\util\SPCConfigUtil;
|
||||||
use SPC\util\SPCTarget;
|
|
||||||
|
|
||||||
#[CustomExt('grpc')]
|
#[CustomExt('grpc')]
|
||||||
class grpc extends Extension
|
class grpc extends Extension
|
||||||
@@ -21,18 +20,50 @@ class grpc extends Extension
|
|||||||
if ($this->builder instanceof WindowsBuilder) {
|
if ($this->builder instanceof WindowsBuilder) {
|
||||||
throw new ValidationException('grpc extension does not support windows yet');
|
throw new ValidationException('grpc extension does not support windows yet');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fix deprecated PHP API usage in call.c
|
||||||
FileSystem::replaceFileStr(
|
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_exception_get_default(TSRMLS_C),',
|
||||||
'zend_ce_exception,',
|
'zend_ce_exception,',
|
||||||
);
|
);
|
||||||
if (SPCTarget::getTargetOS() === 'Darwin') {
|
|
||||||
FileSystem::replaceFileRegex(
|
$config_m4 = <<<'M4'
|
||||||
$this->source_dir . '/config.m4',
|
PHP_ARG_ENABLE(grpc, [whether to enable grpc support], [AS_HELP_STRING([--enable-grpc], [Enable grpc support])])
|
||||||
'/GRPC_LIBDIR=.*$/m',
|
|
||||||
'GRPC_LIBDIR=' . BUILD_LIB_PATH . "\n" . 'LDFLAGS="$LDFLAGS -framework CoreFoundation"'
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -48,7 +79,6 @@ class grpc extends Extension
|
|||||||
public function patchBeforeMake(): bool
|
public function patchBeforeMake(): bool
|
||||||
{
|
{
|
||||||
parent::patchBeforeMake();
|
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');
|
GlobalEnvManager::putenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS=' . getenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS') . ' -Wno-strict-prototypes');
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,19 +50,16 @@ class swoole extends Extension
|
|||||||
|
|
||||||
// commonly used feature: coroutine-time
|
// commonly used feature: coroutine-time
|
||||||
$arg .= ' --enable-swoole-coro-time --with-pic';
|
$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';
|
$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
|
// additional features that only require libraries
|
||||||
$arg .= $this->builder->getLib('libcares') ? ' --enable-cares' : '';
|
$arg .= $this->builder->getLib('libcares') ? ' --enable-cares' : '';
|
||||||
$arg .= $this->builder->getLib('brotli') ? (' --enable-brotli --with-brotli-dir=' . BUILD_ROOT_PATH) : '';
|
$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('nghttp2') ? (' --with-nghttp2-dir=' . BUILD_ROOT_PATH) : '';
|
||||||
$arg .= $this->builder->getLib('zstd') ? ' --enable-zstd' : '';
|
$arg .= $this->builder->getLib('zstd') ? ' --enable-zstd' : '';
|
||||||
$arg .= $this->builder->getLib('liburing') ? ' --enable-iouring' : '';
|
$arg .= $this->builder->getLib('liburing') ? ' --enable-iouring --enable-uring-socket' : '';
|
||||||
$arg .= $this->builder->getExt('sockets') ? ' --enable-sockets' : '';
|
$arg .= $this->builder->getExt('sockets') ? ' --enable-sockets' : '';
|
||||||
|
|
||||||
// enable additional features that require the pdo extension, but conflict with pdo_* extensions
|
// 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'));
|
$config = (new SPCConfigUtil($this->builder))->getLibraryConfig($this->builder->getLib('unixodbc'));
|
||||||
$arg .= ' --with-swoole-odbc=unixODBC,' . BUILD_ROOT_PATH . ' SWOOLE_ODBC_LIBS="' . $config['libs'] . '"';
|
$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') {
|
if ($this->getExtVersion() >= '6.1.0') {
|
||||||
$arg .= ' --enable-swoole-stdext';
|
$arg .= ' --enable-swoole-stdext';
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ class LinuxBuilder extends UnixBuilderBase
|
|||||||
throw new WrongUsageException(
|
throw new WrongUsageException(
|
||||||
"You're building against musl libc statically (the default on Linux), but you're trying to build shared extensions.\n" .
|
"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" .
|
'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...');
|
logger()->info('Building shared extensions...');
|
||||||
|
|||||||
@@ -72,6 +72,10 @@ trait UnixSystemUtilTrait
|
|||||||
if (!is_file($symbol_file)) {
|
if (!is_file($symbol_file)) {
|
||||||
throw new SPCInternalException("The symbol file {$symbol_file} does not exist, please check if nm command is available.");
|
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
|
// macOS/zig
|
||||||
if (SPCTarget::getTargetOS() !== 'Linux' || ToolchainManager::getToolchainClass() === ZigToolchain::class) {
|
if (SPCTarget::getTargetOS() !== 'Linux' || ToolchainManager::getToolchainClass() === ZigToolchain::class) {
|
||||||
return "-Wl,-exported_symbols_list,{$symbol_file}";
|
return "-Wl,-exported_symbols_list,{$symbol_file}";
|
||||||
|
|||||||
@@ -457,6 +457,7 @@ abstract class UnixBuilderBase extends BuilderBase
|
|||||||
'XCADDY_GO_BUILD_FLAGS' => '-buildmode=pie ' .
|
'XCADDY_GO_BUILD_FLAGS' => '-buildmode=pie ' .
|
||||||
'-ldflags \"-linkmode=external ' . $extLdFlags . ' ' .
|
'-ldflags \"-linkmode=external ' . $extLdFlags . ' ' .
|
||||||
'-X \'github.com/caddyserver/caddy/v2/modules/caddyhttp.ServerHeader=FrankenPHP Caddy\' ' .
|
'-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 ' .
|
'-X \'github.com/caddyserver/caddy/v2.CustomVersion=FrankenPHP ' .
|
||||||
"v{$frankenPhpVersion} PHP {$libphpVersion} Caddy'\\\" " .
|
"v{$frankenPhpVersion} PHP {$libphpVersion} Caddy'\\\" " .
|
||||||
"-tags={$muslTags}nobadger,nomysql,nopgx{$nobrotli}{$nowatcher}",
|
"-tags={$muslTags}nobadger,nomysql,nopgx{$nobrotli}{$nowatcher}",
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user