Compare commits

...

29 Commits

Author SHA1 Message Date
crazywhalecc
25a2684e5a add ldap patches (why ext-ldap doesn't use pkg-config to find ldap?) 2024-01-07 12:20:58 +08:00
crazywhalecc
13e0e12181 update patch order 2024-01-07 12:20:58 +08:00
crazywhalecc
81df124b42 update README badge [skip ci] 2024-01-07 12:20:58 +08:00
crazywhalecc
d3d8230a09 add openssl patch 2024-01-07 12:20:58 +08:00
crazywhalecc
d4eb199504 use non-static suffix for brotli 2024-01-07 12:20:58 +08:00
crazywhalecc
6562bc200c fix ldap for macos x86_64 2024-01-07 12:20:58 +08:00
crazywhalecc
0b322f494b test 2024-01-07 12:20:58 +08:00
crazywhalecc
ceed1005cc remove unused download-cache workflow 2024-01-07 12:20:58 +08:00
crazywhalecc
6efcb75224 test ldap 2024-01-07 12:20:58 +08:00
crazywhalecc
a45f2f357d test ldap 2024-01-07 02:28:44 +08:00
crazywhalecc
0c2de9f936 run build test when changing test-extensions.php 2024-01-07 02:22:35 +08:00
crazywhalecc
ac005d1e0f update config to test actions 2024-01-07 02:16:50 +08:00
crazywhalecc
fce0c2f896 update config to test actions 2024-01-07 02:16:17 +08:00
crazywhalecc
a0a0b01cc3 update config to test actions 2024-01-07 02:14:45 +08:00
crazywhalecc
450ec21c90 remove main push test 2024-01-07 02:11:46 +08:00
crazywhalecc
7b2c3ac12d fix if statement for workflow 2024-01-07 02:10:14 +08:00
crazywhalecc
8d4a375400 fix if statement for workflow 2024-01-07 02:03:04 +08:00
crazywhalecc
eda3a9b486 add docs config actions 2024-01-07 01:58:31 +08:00
crazywhalecc
5b581a54aa add docs config actions 2024-01-07 01:57:55 +08:00
crazywhalecc
5549068275 add download cache for tests 2024-01-07 01:24:43 +08:00
crazywhalecc
daf0d2eb32 fix dependency sort 2024-01-07 01:24:43 +08:00
crazywhalecc
bff1a6168f fix imagemagick with curl,brotli errors
symlink breaks imagemagick build
2024-01-07 01:24:43 +08:00
crazywhalecc
54ba41d1b3 fix imap executable permission 2024-01-07 01:24:43 +08:00
crazywhalecc
cb5e13e39a update release-build (Build SPC Binary) workflow 2024-01-07 01:24:43 +08:00
霸气千秋
269e95e0fe fix #307 (#308)
* fix #307 uv 和 swoole 同时启用的时候会提示 uv 找不到

* Update test-extensions.php

* update cs-fixer config for newer version

* revert composer.lock to fit 8.1

---------

Co-authored-by: Jerry Ma <jesse2061@outlook.com>
2024-01-05 19:21:07 +08:00
crazywhalecc
dabdb518ce xz use github 2024-01-03 14:56:39 +08:00
Jerry Ma
eac4763d82 fix libxml2 with icu finding issue (#304)
* fix libxml2 with icu finding issue

* add test
2024-01-03 13:40:48 +08:00
Jerry Ma
fa0ea5443d Update to 2.0.0 2024-01-03 10:36:04 +08:00
好吧,你想说啥
31c71f180b Feature perfect swoole extension config (#297)
* improve swoole static build config

* improve swoole static build config

* improve swoole static build config

* improve swoole static build config

* improve swoole static build config

* add cares config

* update swoole depend  config

* update swoole depend  config

* update cares build   config

* update workflow tests.yaml   config

* fix setup-runtime

* test with clang build

* test with clang build

* update cares build config

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* update cares license

* test build

* test build

* test build

* test build

* test add enable libpq

* test add enable libpq

* test add enable libpq

* test add enable libpq

* test add enable libpq

* test add enable libpq

* test add enable libpq

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* test

* update

* update

* update

* update

* update

* update

* update

* update

* update

* compatible old

* fix code format

* fix code format

* add swoole test case

* add swoole test case

* add phpstan ignore error

* add phpstan ignore error

* add phpstan ignore error

* add phpstan ignore error

* add phpstan ignore error

* update phpstan.neon

* update swoole extension test case

* update swoole test case

* adjust config order and depends

* revert LinuxBuilder

* remove swoole.phpt

* re-adjust swoole args

* update test-extensions and some PHPDoc

* revert: debian and alpine clang doctor install

* revert: MacOSBuilder

* fix: extract hook for archive not working

* revert: build tests

* use addon mode to swoole database hook

* add hook tests

* test minimal

* test minimal

* sort config

---------

Co-authored-by: crazywhalecc <jesse2061@outlook.com>
2024-01-03 10:31:21 +08:00
41 changed files with 706 additions and 341 deletions

View File

@@ -1,40 +0,0 @@
name: archive download sources weekly
on:
workflow_dispatch:
schedule:
- cron: "* 14 * * 5"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
download:
name: cache download sources
runs-on: ubuntu-latest
strategy:
matrix:
php-version: [ "8.0", "8.1", "8.2", "8.3" ]
steps:
- uses: actions/checkout@v3
# Cache composer dependencies
- id: cache-composer-deps
uses: actions/cache@v3
with:
path: vendor
key: composer-dependencies
# If there's no Composer cache, install dependencies
- if: steps.cache-composer-deps.outputs.cache-hit != 'true'
run: composer update --no-dev
# If there's no dependencies cache, fetch sources, with or without debug
- if: steps.cache-download.outputs.cache-hit != 'true'
run: ./bin/spc download --with-php=${{ matrix.php-version }} --all --debug
# Upload downloaded files
- uses: actions/upload-artifact@v3
with:
name: download-files-${{ matrix.php-version }}
path: downloads/

View File

@@ -1,6 +1,8 @@
name: Upload SPC Binary (Release) name: Build SPC Binary
on: on:
push:
branches: [ "main" ]
release: release:
types: types:
- published - published
@@ -8,10 +10,14 @@ on:
jobs: jobs:
build-release-artifacts: build-release-artifacts:
name: "Upload SPC Binary (Release)" name: "Build SPC Binary"
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
matrix: matrix:
php-version:
- "8.1"
micro-version:
- "8.1.26"
operating-system: operating-system:
- "linux-x86_64" - "linux-x86_64"
- "macos-x86_64" - "macos-x86_64"
@@ -21,18 +27,57 @@ jobs:
- name: "Checkout" - name: "Checkout"
uses: "actions/checkout@v4" uses: "actions/checkout@v4"
- name: Reuse static-php-cli-hosted artifacts - if: inputs.debug == true
uses: dawidd6/action-download-artifact@v2 run: echo "SPC_BUILD_DEBUG=--debug" >> $GITHUB_ENV
- name: "Install PHP for official runners"
uses: "shivammathur/setup-php@v2"
with: with:
repo: static-php/static-php-cli-hosted coverage: none
branch: master tools: composer:v2
workflow: build-spc-release.yml php-version: "${{ matrix.php-version }}"
name: "spc-${{ matrix.operating-system }}" ini-values: memory_limit=-1
- name: "Get Composer Cache Directory"
id: composer-cache
run: |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: "Cache Composer dependencies"
uses: "actions/cache@v3"
with:
path: "${{ steps.composer-cache.outputs.dir }}"
key: "php-${{ matrix.php-version }}-locked-composer-${{ hashFiles('**/composer.lock') }}"
restore-keys: |
php-${{ matrix.php-version }}-locked-composer
- name: "Install Locked Dependencies"
run: "composer install --no-interaction --no-progress"
- name: "Build PHAR File"
run: "composer build:phar"
- name: "Download minimal combination"
run: |
curl https://dl.static-php.dev/static-php-cli/minimal/php-${{ matrix.micro-version }}-micro-${{ matrix.operating-system }}.tar.gz -o tmp.tgz
tar -zxvf tmp.tgz
- name: "Generate Executable"
run: |
cat micro.sfx spc.phar > spc
chmod +x spc
- name: "Archive Executable" - name: "Archive Executable"
run: | run: |
tar -czf spc-${{ matrix.operating-system }}.tar.gz spc tar -czf spc-${{ matrix.operating-system }}.tar.gz spc
echo "filename=spc-${{ matrix.operating-system }}.tar.gz" >> $GITHUB_ENV echo "filename=spc-${{ matrix.operating-system }}.tar.gz" >> $GITHUB_ENV
echo "OS=${{ matrix.operating-system }}" >> $GITHUB_ENV
if [ "${{ matrix.operating-system }}" == "linux-x86_64" ]; then
./spc dev:extensions
fi
- name: "Copy file"
run: "mkdir dist/ && cp ${{ env.filename }} dist/ && cp spc dist/spc-$OS"
- name: upload binaries to release - name: upload binaries to release
uses: softprops/action-gh-release@v1 uses: softprops/action-gh-release@v1
@@ -40,6 +85,18 @@ jobs:
with: with:
files: ${{ env.filename }} files: ${{ env.filename }}
- name: "Deploy to Self-Hosted Server"
if: github.repository == 'crazywhalecc/static-php-cli'
uses: easingthemes/ssh-deploy@main
env:
SSH_PRIVATE_KEY: ${{ secrets.DEPLOY_SERVER_SECRET_KEY }}
ARGS: "-rltgoDzvO"
SOURCE: "dist/"
REMOTE_HOST: ${{ secrets.DEPLOY_SERVER_HOST }}
REMOTE_PORT: ${{ secrets.DEPLOY_SERVER_PORT }}
REMOTE_USER: ${{ secrets.DEPLOY_SERVER_USER }}
TARGET: ${{ secrets.DEPLOY_SERVER_TARGET_SPC_NIGHTLY }}
- name: "Upload Artifact" - name: "Upload Artifact"
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
with: with:

View File

@@ -2,7 +2,10 @@ name: Tests
on: on:
push: push:
branches: [ "main" ] branches:
- main
paths:
- 'src/globals/test-extensions.php'
pull_request: pull_request:
branches: [ "main" ] branches: [ "main" ]
@@ -133,6 +136,13 @@ jobs:
restore-keys: | restore-keys: |
${{ runner.os }}-php- ${{ runner.os }}-php-
# Cache downloaded source
- id: cache-download
uses: actions/cache@v3
with:
path: downloads
key: php-${{ matrix.php }}-dependencies
- name: "Install Dependencies" - name: "Install Dependencies"
run: composer update -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist run: composer update -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist

View File

@@ -0,0 +1,43 @@
name: Update Docs Config
on:
push:
branches:
- main
paths:
- 'config/**.json'
jobs:
update-docs-config:
name: "Update Docs Config"
runs-on: ubuntu-latest
if: github.repository == 'crazywhalecc/static-php-cli'
steps:
- name: "Checkout static-php-cli"
uses: actions/checkout@v4
with:
ref: main
path: static-php-cli
- name: "Checkout static-php-cli-docs"
uses: actions/checkout@v4
with:
repository: static-php/static-php-cli-docs
ref: master
token: ${{ secrets.DOCS_REPO_TOKEN }}
path: static-php-cli-docs
- name: "Set up Git"
run: |
git config --global user.email "actions@github.com"
git config --global user.name "GitHub Actions"
- name: "Copy Config Files"
run: cp -r static-php-cli/config/* static-php-cli-docs/docs/.vitepress/config/
- name: "Commit and Push Changes"
run: |
cd static-php-cli-docs
git add -A
git commit -m "Sync config files from main"
git push origin master

View File

@@ -63,6 +63,7 @@ return (new PhpCsFixer\Config())
'phpdoc_summary' => false, 'phpdoc_summary' => false,
'php_unit_test_class_requires_covers' => false, 'php_unit_test_class_requires_covers' => false,
'phpdoc_var_without_name' => false, 'phpdoc_var_without_name' => false,
'fully_qualified_strict_types' => false,
]) ])
->setFinder( ->setFinder(
PhpCsFixer\Finder::create()->in([__DIR__ . '/src', __DIR__ . '/tests/SPC']) PhpCsFixer\Finder::create()->in([__DIR__ . '/src', __DIR__ . '/tests/SPC'])

View File

@@ -14,10 +14,10 @@ Build single static PHP binary, with PHP project together, with popular extensio
> 该 SAPI 源自 [dixyes/phpmicro](https://github.com/dixyes/phpmicro) 的 [Fork 仓库](https://github.com/static-php/phpmicro)。 > 该 SAPI 源自 [dixyes/phpmicro](https://github.com/dixyes/phpmicro) 的 [Fork 仓库](https://github.com/static-php/phpmicro)。
[![Version](https://img.shields.io/badge/Version-2.0--rc8-pink.svg?style=flat-square)]() [![Version](https://img.shields.io/badge/Version-2.0.0-green.svg?style=flat-square)]()
[![License](https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square)]() [![License](https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square)]()
[![](https://img.shields.io/github/actions/workflow/status/static-php/static-php-cli-hosted/build-php-common.yml?branch=refactor&label=Build%20Common%20Extensions&style=flat-square)](https://github.com/static-php/static-php-cli-hosted/actions/workflows/build-php-common.yml) [![](https://img.shields.io/github/actions/workflow/status/crazywhalecc/static-php-cli/tests.yml?branch=main&label=Build%20Test&style=flat-square)](https://github.com/crazywhalecc/static-php-cli/actions/workflows/tests.yml)
[![](https://img.shields.io/badge/Extension%20Counter-65+-yellow.svg?style=flat-square)]() [![](https://img.shields.io/badge/Extension%20Counter-75+-yellow.svg?style=flat-square)]()
[![](https://img.shields.io/github/search/crazywhalecc/static-php-cli/TODO?label=TODO%20Counter&style=flat-square)]() [![](https://img.shields.io/github/search/crazywhalecc/static-php-cli/TODO?label=TODO%20Counter&style=flat-square)]()
> 项目名称是 static-php-cli但其实支持 cli、fpm、micro 和 embed SAPI 😎 > 项目名称是 static-php-cli但其实支持 cli、fpm、micro 和 embed SAPI 😎

View File

@@ -18,11 +18,10 @@ You can also use the micro binary file to combine php binary and php source code
> This SAPI feature is from the [Fork](https://github.com/static-php/phpmicro) of [dixyes/phpmicro](https://github.com/dixyes/phpmicro). > This SAPI feature is from the [Fork](https://github.com/static-php/phpmicro) of [dixyes/phpmicro](https://github.com/dixyes/phpmicro).
[![Version](https://img.shields.io/badge/Version-2.0--rc8-pink.svg?style=flat-square)]() [![Version](https://img.shields.io/badge/Version-2.0.0-green.svg?style=flat-square)]()
[![License](https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square)]() [![License](https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square)]()
[![](https://img.shields.io/github/actions/workflow/status/crazywhalecc/static-php-cli/tests.yml?branch=main&label=Build%20Test&style=flat-square)](https://github.com/crazywhalecc/static-php-cli/actions/workflows/tests.yml) [![](https://img.shields.io/github/actions/workflow/status/crazywhalecc/static-php-cli/tests.yml?branch=main&label=Build%20Test&style=flat-square)](https://github.com/crazywhalecc/static-php-cli/actions/workflows/tests.yml)
[![](https://img.shields.io/badge/Extension%20Counter-75+-yellow.svg?style=flat-square)]([https://static-php.dev/](https://static-php.dev/en/guide/extensions.html))
[![](https://img.shields.io/badge/Extension%20Counter-65+-yellow.svg?style=flat-square)]([https://static-php.dev/](https://static-php.dev/en/guide/extensions.html))
[![](https://img.shields.io/github/search/crazywhalecc/static-php-cli/TODO?label=TODO%20Counter&style=flat-square)]() [![](https://img.shields.io/github/search/crazywhalecc/static-php-cli/TODO?label=TODO%20Counter&style=flat-square)]()
## Documentation ## Documentation

View File

@@ -35,7 +35,6 @@ while [ $# -gt 0 ]; do
case "$1" in case "$1" in
--mirror) --mirror)
mirror="$2" mirror="$2"
shift
;; ;;
--*) --*)
echo "Illegal option $1" echo "Illegal option $1"
@@ -47,7 +46,7 @@ done
case "$mirror" in case "$mirror" in
china) china)
__PHP_RUNTIME_URL__="https://dl.static-php.dev/static-php-cli/bulk/php-8.2.13-cli-${__OS_FIXED__}-${__ARCH__}.tar.gz" __PHP_RUNTIME_URL__="https://dl.static-php.dev/static-php-cli/bulk/php-8.2.13-cli-${__OS_FIXED__}-${__ARCH__}.tar.gz"
__COMPOSER_URL__="https://mirrors.aliyun.com/composer/composer.phar" __COMPOSER_URL__="https://mirrors.tencent.com/composer/composer.phar"
;; ;;
esac esac

170
composer.lock generated
View File

@@ -8,16 +8,16 @@
"packages": [ "packages": [
{ {
"name": "illuminate/collections", "name": "illuminate/collections",
"version": "v10.38.1", "version": "v10.39.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/illuminate/collections.git", "url": "https://github.com/illuminate/collections.git",
"reference": "2677b3962a88640f92dba8a1f4ed38dcaaf13dad" "reference": "63fc240a047788fbc2ebe153de85cb72fce88440"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/illuminate/collections/zipball/2677b3962a88640f92dba8a1f4ed38dcaaf13dad", "url": "https://api.github.com/repos/illuminate/collections/zipball/63fc240a047788fbc2ebe153de85cb72fce88440",
"reference": "2677b3962a88640f92dba8a1f4ed38dcaaf13dad", "reference": "63fc240a047788fbc2ebe153de85cb72fce88440",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -59,11 +59,11 @@
"issues": "https://github.com/laravel/framework/issues", "issues": "https://github.com/laravel/framework/issues",
"source": "https://github.com/laravel/framework" "source": "https://github.com/laravel/framework"
}, },
"time": "2023-12-15T18:25:00+00:00" "time": "2023-12-21T14:17:35+00:00"
}, },
{ {
"name": "illuminate/conditionable", "name": "illuminate/conditionable",
"version": "v10.38.1", "version": "v10.39.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/illuminate/conditionable.git", "url": "https://github.com/illuminate/conditionable.git",
@@ -109,7 +109,7 @@
}, },
{ {
"name": "illuminate/contracts", "name": "illuminate/contracts",
"version": "v10.38.1", "version": "v10.39.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/illuminate/contracts.git", "url": "https://github.com/illuminate/contracts.git",
@@ -157,7 +157,7 @@
}, },
{ {
"name": "illuminate/macroable", "name": "illuminate/macroable",
"version": "v10.38.1", "version": "v10.39.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/illuminate/macroable.git", "url": "https://github.com/illuminate/macroable.git",
@@ -203,16 +203,16 @@
}, },
{ {
"name": "laravel/prompts", "name": "laravel/prompts",
"version": "v0.1.13", "version": "v0.1.14",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/laravel/prompts.git", "url": "https://github.com/laravel/prompts.git",
"reference": "e1379d8ead15edd6cc4369c22274345982edc95a" "reference": "2219fa9c4b944add1e825c3bdb8ecae8bc503bc6"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/laravel/prompts/zipball/e1379d8ead15edd6cc4369c22274345982edc95a", "url": "https://api.github.com/repos/laravel/prompts/zipball/2219fa9c4b944add1e825c3bdb8ecae8bc503bc6",
"reference": "e1379d8ead15edd6cc4369c22274345982edc95a", "reference": "2219fa9c4b944add1e825c3bdb8ecae8bc503bc6",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -228,7 +228,7 @@
"require-dev": { "require-dev": {
"mockery/mockery": "^1.5", "mockery/mockery": "^1.5",
"pestphp/pest": "^2.3", "pestphp/pest": "^2.3",
"phpstan/phpstan": "^1.10", "phpstan/phpstan": "^1.11",
"phpstan/phpstan-mockery": "^1.1" "phpstan/phpstan-mockery": "^1.1"
}, },
"suggest": { "suggest": {
@@ -254,9 +254,9 @@
], ],
"support": { "support": {
"issues": "https://github.com/laravel/prompts/issues", "issues": "https://github.com/laravel/prompts/issues",
"source": "https://github.com/laravel/prompts/tree/v0.1.13" "source": "https://github.com/laravel/prompts/tree/v0.1.14"
}, },
"time": "2023-10-27T13:53:59+00:00" "time": "2023-12-27T04:18:09+00:00"
}, },
{ {
"name": "psr/container", "name": "psr/container",
@@ -414,16 +414,16 @@
}, },
{ {
"name": "symfony/console", "name": "symfony/console",
"version": "v6.4.1", "version": "v6.4.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/console.git", "url": "https://github.com/symfony/console.git",
"reference": "a550a7c99daeedef3f9d23fb82e3531525ff11fd" "reference": "0254811a143e6bc6c8deea08b589a7e68a37f625"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/a550a7c99daeedef3f9d23fb82e3531525ff11fd", "url": "https://api.github.com/repos/symfony/console/zipball/0254811a143e6bc6c8deea08b589a7e68a37f625",
"reference": "a550a7c99daeedef3f9d23fb82e3531525ff11fd", "reference": "0254811a143e6bc6c8deea08b589a7e68a37f625",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -488,7 +488,7 @@
"terminal" "terminal"
], ],
"support": { "support": {
"source": "https://github.com/symfony/console/tree/v6.4.1" "source": "https://github.com/symfony/console/tree/v6.4.2"
}, },
"funding": [ "funding": [
{ {
@@ -504,7 +504,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2023-11-30T10:54:28+00:00" "time": "2023-12-10T16:15:48+00:00"
}, },
{ {
"name": "symfony/deprecation-contracts", "name": "symfony/deprecation-contracts",
@@ -905,21 +905,21 @@
}, },
{ {
"name": "symfony/service-contracts", "name": "symfony/service-contracts",
"version": "v3.4.0", "version": "v3.4.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/service-contracts.git", "url": "https://github.com/symfony/service-contracts.git",
"reference": "b3313c2dbffaf71c8de2934e2ea56ed2291a3838" "reference": "fe07cbc8d837f60caf7018068e350cc5163681a0"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/service-contracts/zipball/b3313c2dbffaf71c8de2934e2ea56ed2291a3838", "url": "https://api.github.com/repos/symfony/service-contracts/zipball/fe07cbc8d837f60caf7018068e350cc5163681a0",
"reference": "b3313c2dbffaf71c8de2934e2ea56ed2291a3838", "reference": "fe07cbc8d837f60caf7018068e350cc5163681a0",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=8.1", "php": ">=8.1",
"psr/container": "^2.0" "psr/container": "^1.1|^2.0"
}, },
"conflict": { "conflict": {
"ext-psr": "<1.1|>=2" "ext-psr": "<1.1|>=2"
@@ -967,7 +967,7 @@
"standards" "standards"
], ],
"support": { "support": {
"source": "https://github.com/symfony/service-contracts/tree/v3.4.0" "source": "https://github.com/symfony/service-contracts/tree/v3.4.1"
}, },
"funding": [ "funding": [
{ {
@@ -983,20 +983,20 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2023-07-30T20:28:31+00:00" "time": "2023-12-26T14:02:43+00:00"
}, },
{ {
"name": "symfony/string", "name": "symfony/string",
"version": "v6.4.0", "version": "v6.4.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/string.git", "url": "https://github.com/symfony/string.git",
"reference": "b45fcf399ea9c3af543a92edf7172ba21174d809" "reference": "7cb80bc10bfcdf6b5492741c0b9357dac66940bc"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/string/zipball/b45fcf399ea9c3af543a92edf7172ba21174d809", "url": "https://api.github.com/repos/symfony/string/zipball/7cb80bc10bfcdf6b5492741c0b9357dac66940bc",
"reference": "b45fcf399ea9c3af543a92edf7172ba21174d809", "reference": "7cb80bc10bfcdf6b5492741c0b9357dac66940bc",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -1053,7 +1053,7 @@
"utf8" "utf8"
], ],
"support": { "support": {
"source": "https://github.com/symfony/string/tree/v6.4.0" "source": "https://github.com/symfony/string/tree/v6.4.2"
}, },
"funding": [ "funding": [
{ {
@@ -1069,7 +1069,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2023-11-28T20:41:49+00:00" "time": "2023-12-10T16:15:48+00:00"
}, },
{ {
"name": "zhamao/logger", "name": "zhamao/logger",
@@ -2377,21 +2377,22 @@
}, },
{ {
"name": "friendsofphp/php-cs-fixer", "name": "friendsofphp/php-cs-fixer",
"version": "v3.41.1", "version": "v3.46.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git",
"reference": "8b6ae8dcbaf23f09680643ab832a4a3a260265f6" "reference": "be6831c9af1740470d2a773119b9273f8ac1c3d2"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/8b6ae8dcbaf23f09680643ab832a4a3a260265f6", "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/be6831c9af1740470d2a773119b9273f8ac1c3d2",
"reference": "8b6ae8dcbaf23f09680643ab832a4a3a260265f6", "reference": "be6831c9af1740470d2a773119b9273f8ac1c3d2",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"composer/semver": "^3.4", "composer/semver": "^3.4",
"composer/xdebug-handler": "^3.0.3", "composer/xdebug-handler": "^3.0.3",
"ext-filter": "*",
"ext-json": "*", "ext-json": "*",
"ext-tokenizer": "*", "ext-tokenizer": "*",
"php": "^7.4 || ^8.0", "php": "^7.4 || ^8.0",
@@ -2416,8 +2417,7 @@
"php-cs-fixer/accessible-object": "^1.1", "php-cs-fixer/accessible-object": "^1.1",
"php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.4", "php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.4",
"php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.4", "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.4",
"phpunit/phpunit": "^9.6", "phpunit/phpunit": "^9.6 || ^10.5.5",
"symfony/phpunit-bridge": "^6.3.8 || ^7.0",
"symfony/yaml": "^5.4 || ^6.0 || ^7.0" "symfony/yaml": "^5.4 || ^6.0 || ^7.0"
}, },
"suggest": { "suggest": {
@@ -2456,7 +2456,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues", "issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues",
"source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.41.1" "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.46.0"
}, },
"funding": [ "funding": [
{ {
@@ -2464,7 +2464,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2023-12-10T19:59:27+00:00" "time": "2024-01-03T21:38:46+00:00"
}, },
{ {
"name": "humbug/box", "name": "humbug/box",
@@ -3534,16 +3534,16 @@
}, },
{ {
"name": "phpstan/phpdoc-parser", "name": "phpstan/phpdoc-parser",
"version": "1.24.5", "version": "1.25.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpstan/phpdoc-parser.git", "url": "https://github.com/phpstan/phpdoc-parser.git",
"reference": "fedf211ff14ec8381c9bf5714e33a7a552dd1acc" "reference": "bd84b629c8de41aa2ae82c067c955e06f1b00240"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/fedf211ff14ec8381c9bf5714e33a7a552dd1acc", "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/bd84b629c8de41aa2ae82c067c955e06f1b00240",
"reference": "fedf211ff14ec8381c9bf5714e33a7a552dd1acc", "reference": "bd84b629c8de41aa2ae82c067c955e06f1b00240",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -3575,22 +3575,22 @@
"description": "PHPDoc parser with support for nullable, intersection and generic types", "description": "PHPDoc parser with support for nullable, intersection and generic types",
"support": { "support": {
"issues": "https://github.com/phpstan/phpdoc-parser/issues", "issues": "https://github.com/phpstan/phpdoc-parser/issues",
"source": "https://github.com/phpstan/phpdoc-parser/tree/1.24.5" "source": "https://github.com/phpstan/phpdoc-parser/tree/1.25.0"
}, },
"time": "2023-12-16T09:33:33+00:00" "time": "2024-01-04T17:06:16+00:00"
}, },
{ {
"name": "phpstan/phpstan", "name": "phpstan/phpstan",
"version": "1.10.50", "version": "1.10.52",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpstan/phpstan.git", "url": "https://github.com/phpstan/phpstan.git",
"reference": "06a98513ac72c03e8366b5a0cb00750b487032e4" "reference": "0cd0c330081d4f1e1d630701fe4f342c3b659685"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/06a98513ac72c03e8366b5a0cb00750b487032e4", "url": "https://api.github.com/repos/phpstan/phpstan/zipball/0cd0c330081d4f1e1d630701fe4f342c3b659685",
"reference": "06a98513ac72c03e8366b5a0cb00750b487032e4", "reference": "0cd0c330081d4f1e1d630701fe4f342c3b659685",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -3639,7 +3639,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2023-12-13T10:59:42+00:00" "time": "2024-01-05T09:51:32+00:00"
}, },
{ {
"name": "phpunit/php-code-coverage", "name": "phpunit/php-code-coverage",
@@ -3964,16 +3964,16 @@
}, },
{ {
"name": "phpunit/phpunit", "name": "phpunit/phpunit",
"version": "10.5.3", "version": "10.5.5",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git", "url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "6fce887c71076a73f32fd3e0774a6833fc5c7f19" "reference": "ed21115d505b4b4f7dc7b5651464e19a2c7f7856"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/6fce887c71076a73f32fd3e0774a6833fc5c7f19", "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/ed21115d505b4b4f7dc7b5651464e19a2c7f7856",
"reference": "6fce887c71076a73f32fd3e0774a6833fc5c7f19", "reference": "ed21115d505b4b4f7dc7b5651464e19a2c7f7856",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -4045,7 +4045,7 @@
"support": { "support": {
"issues": "https://github.com/sebastianbergmann/phpunit/issues", "issues": "https://github.com/sebastianbergmann/phpunit/issues",
"security": "https://github.com/sebastianbergmann/phpunit/security/policy", "security": "https://github.com/sebastianbergmann/phpunit/security/policy",
"source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.3" "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.5"
}, },
"funding": [ "funding": [
{ {
@@ -4061,7 +4061,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2023-12-13T07:25:23+00:00" "time": "2023-12-27T15:13:52+00:00"
}, },
{ {
"name": "psr/event-dispatcher", "name": "psr/event-dispatcher",
@@ -4417,16 +4417,16 @@
}, },
{ {
"name": "sebastian/diff", "name": "sebastian/diff",
"version": "5.0.3", "version": "5.1.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/diff.git", "url": "https://github.com/sebastianbergmann/diff.git",
"reference": "912dc2fbe3e3c1e7873313cc801b100b6c68c87b" "reference": "fbf413a49e54f6b9b17e12d900ac7f6101591b7f"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/912dc2fbe3e3c1e7873313cc801b100b6c68c87b", "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/fbf413a49e54f6b9b17e12d900ac7f6101591b7f",
"reference": "912dc2fbe3e3c1e7873313cc801b100b6c68c87b", "reference": "fbf413a49e54f6b9b17e12d900ac7f6101591b7f",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -4439,7 +4439,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-main": "5.0-dev" "dev-main": "5.1-dev"
} }
}, },
"autoload": { "autoload": {
@@ -4472,7 +4472,7 @@
"support": { "support": {
"issues": "https://github.com/sebastianbergmann/diff/issues", "issues": "https://github.com/sebastianbergmann/diff/issues",
"security": "https://github.com/sebastianbergmann/diff/security/policy", "security": "https://github.com/sebastianbergmann/diff/security/policy",
"source": "https://github.com/sebastianbergmann/diff/tree/5.0.3" "source": "https://github.com/sebastianbergmann/diff/tree/5.1.0"
}, },
"funding": [ "funding": [
{ {
@@ -4480,7 +4480,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2023-05-01T07:48:21+00:00" "time": "2023-12-22T10:55:06+00:00"
}, },
{ {
"name": "sebastian/environment", "name": "sebastian/environment",
@@ -5269,16 +5269,16 @@
}, },
{ {
"name": "symfony/event-dispatcher", "name": "symfony/event-dispatcher",
"version": "v6.4.0", "version": "v6.4.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/event-dispatcher.git", "url": "https://github.com/symfony/event-dispatcher.git",
"reference": "d76d2632cfc2206eecb5ad2b26cd5934082941b6" "reference": "e95216850555cd55e71b857eb9d6c2674124603a"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/d76d2632cfc2206eecb5ad2b26cd5934082941b6", "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/e95216850555cd55e71b857eb9d6c2674124603a",
"reference": "d76d2632cfc2206eecb5ad2b26cd5934082941b6", "reference": "e95216850555cd55e71b857eb9d6c2674124603a",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -5329,7 +5329,7 @@
"description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": { "support": {
"source": "https://github.com/symfony/event-dispatcher/tree/v6.4.0" "source": "https://github.com/symfony/event-dispatcher/tree/v6.4.2"
}, },
"funding": [ "funding": [
{ {
@@ -5345,7 +5345,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2023-07-27T06:52:43+00:00" "time": "2023-12-27T22:16:42+00:00"
}, },
{ {
"name": "symfony/event-dispatcher-contracts", "name": "symfony/event-dispatcher-contracts",
@@ -5619,16 +5619,16 @@
}, },
{ {
"name": "symfony/process", "name": "symfony/process",
"version": "v6.4.0", "version": "v6.4.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/process.git", "url": "https://github.com/symfony/process.git",
"reference": "191703b1566d97a5425dc969e4350d32b8ef17aa" "reference": "c4b1ef0bc80533d87a2e969806172f1c2a980241"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/process/zipball/191703b1566d97a5425dc969e4350d32b8ef17aa", "url": "https://api.github.com/repos/symfony/process/zipball/c4b1ef0bc80533d87a2e969806172f1c2a980241",
"reference": "191703b1566d97a5425dc969e4350d32b8ef17aa", "reference": "c4b1ef0bc80533d87a2e969806172f1c2a980241",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -5660,7 +5660,7 @@
"description": "Executes commands in sub-processes", "description": "Executes commands in sub-processes",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": { "support": {
"source": "https://github.com/symfony/process/tree/v6.4.0" "source": "https://github.com/symfony/process/tree/v6.4.2"
}, },
"funding": [ "funding": [
{ {
@@ -5676,7 +5676,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2023-11-17T21:06:49+00:00" "time": "2023-12-22T16:42:54+00:00"
}, },
{ {
"name": "symfony/stopwatch", "name": "symfony/stopwatch",
@@ -5742,16 +5742,16 @@
}, },
{ {
"name": "symfony/var-dumper", "name": "symfony/var-dumper",
"version": "v6.4.0", "version": "v6.4.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/var-dumper.git", "url": "https://github.com/symfony/var-dumper.git",
"reference": "c40f7d17e91d8b407582ed51a2bbf83c52c367f6" "reference": "68d6573ec98715ddcae5a0a85bee3c1c27a4c33f"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/var-dumper/zipball/c40f7d17e91d8b407582ed51a2bbf83c52c367f6", "url": "https://api.github.com/repos/symfony/var-dumper/zipball/68d6573ec98715ddcae5a0a85bee3c1c27a4c33f",
"reference": "c40f7d17e91d8b407582ed51a2bbf83c52c367f6", "reference": "68d6573ec98715ddcae5a0a85bee3c1c27a4c33f",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -5807,7 +5807,7 @@
"dump" "dump"
], ],
"support": { "support": {
"source": "https://github.com/symfony/var-dumper/tree/v6.4.0" "source": "https://github.com/symfony/var-dumper/tree/v6.4.2"
}, },
"funding": [ "funding": [
{ {
@@ -5823,7 +5823,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2023-11-09T08:28:32+00:00" "time": "2023-12-28T19:16:56+00:00"
}, },
{ {
"name": "thecodingmachine/safe", "name": "thecodingmachine/safe",
@@ -6083,5 +6083,5 @@
"ext-mbstring": "*" "ext-mbstring": "*"
}, },
"platform-dev": [], "platform-dev": [],
"plugin-api-version": "2.6.0" "plugin-api-version": "2.3.0"
} }

View File

@@ -406,10 +406,10 @@
"lib-depends": [ "lib-depends": [
"unixodbc" "unixodbc"
], ],
"cpp-extension": true,
"ext-depends-linux": [ "ext-depends-linux": [
"pcntl" "pcntl"
] ],
"cpp-extension": true
}, },
"ssh2": { "ssh2": {
"type": "external", "type": "external",
@@ -424,17 +424,50 @@
"source": "swoole", "source": "swoole",
"arg-type": "custom", "arg-type": "custom",
"cpp-extension": true, "cpp-extension": true,
"unix-only": true,
"lib-depends": [ "lib-depends": [
"openssl" "libcares",
"brotli",
"nghttp2",
"zlib"
], ],
"ext-depends": [ "ext-depends": [
"openssl" "openssl",
"curl"
], ],
"ext-suggests": [ "ext-suggests": [
"curl", "swoole-hook-pgsql",
"pgsql" "swoole-hook-mysql",
"swoole-hook-sqlite"
]
},
"swoole-hook-mysql": {
"type": "addon",
"arg-type": "custom",
"ext-depends": [
"mysqlnd",
"pdo",
"pdo_mysql"
], ],
"unix-only": true "ext-suggests": [
"mysqli"
]
},
"swoole-hook-pgsql": {
"type": "addon",
"arg-type": "custom",
"ext-depends": [
"pgsql",
"pdo"
]
},
"swoole-hook-sqlite": {
"type": "addon",
"arg-type": "custom",
"ext-depends": [
"sqlite3",
"pdo"
]
}, },
"swow": { "swow": {
"type": "external", "type": "external",
@@ -477,6 +510,9 @@
"arg-type": "with-prefix", "arg-type": "with-prefix",
"lib-depends": [ "lib-depends": [
"libuv" "libuv"
],
"ext-depends": [
"sockets"
] ]
}, },
"xhprof": { "xhprof": {

View File

@@ -2,14 +2,14 @@
"brotli": { "brotli": {
"source": "brotli", "source": "brotli",
"static-libs-unix": [ "static-libs-unix": [
"libbrotlidec-static.a", "libbrotlidec.a",
"libbrotlienc-static.a", "libbrotlienc.a",
"libbrotlicommon-static.a" "libbrotlicommon.a"
], ],
"static-libs-windows": [ "static-libs-windows": [
"brotlicommon-static.lib", "brotlicommon.lib",
"brotlienc-static.lib", "brotlienc.lib",
"brotlidec-static.lib" "brotlidec.lib"
], ],
"headers": [ "headers": [
"brotli" "brotli"
@@ -175,6 +175,18 @@
"libavif.a" "libavif.a"
] ]
}, },
"libcares": {
"source": "libcares",
"static-libs-unix": [
"libcares.a"
],
"headers-unix": [
"ares.h",
"ares_dns.h",
"ares_nameser.h",
"ares_rules.h"
]
},
"libevent": { "libevent": {
"source": "libevent", "source": "libevent",
"static-libs-unix": [ "static-libs-unix": [
@@ -315,16 +327,12 @@
"libxml2" "libxml2"
], ],
"lib-depends": [ "lib-depends": [
"libiconv", "libiconv"
"zlib"
], ],
"lib-suggests": [ "lib-suggests": [
"xz", "xz",
"icu"
],
"lib-suggests-windows": [
"icu", "icu",
"xz" "zlib"
] ]
}, },
"libxslt": { "libxslt": {

View File

@@ -209,6 +209,15 @@
"path": "LICENSE" "path": "LICENSE"
} }
}, },
"libcares": {
"type": "filelist",
"url": "https://c-ares.org/download/",
"regex": "/href=\"\\/download\\/(?<file>c-ares-(?<version>[^\"]+)\\.tar\\.gz)\"/",
"license": {
"type": "file",
"path": "LICENSE.md"
}
},
"libevent": { "libevent": {
"type": "ghrel", "type": "ghrel",
"repo": "libevent/libevent", "repo": "libevent/libevent",
@@ -553,9 +562,9 @@
} }
}, },
"xz": { "xz": {
"type": "filelist", "type": "ghrel",
"url": "https://tukaani.org/xz/", "repo": "tukaani-project/xz",
"regex": "/href=\"(?<file>xz-(?<version>[^\"]+)\\.tar\\.xz)\"/", "match": "xz-.+\\.tar\\.gz",
"license": { "license": {
"type": "file", "type": "file",
"path": "COPYING" "path": "COPYING"

View File

@@ -8,5 +8,10 @@ parameters:
- '#Unsafe usage of new static#' - '#Unsafe usage of new static#'
- '#class Fiber#' - '#class Fiber#'
- '#Attribute class JetBrains\\PhpStorm\\ArrayShape does not exist#' - '#Attribute class JetBrains\\PhpStorm\\ArrayShape does not exist#'
- '#Function Swoole\\Coroutine\\run not found.#'
dynamicConstantNames: dynamicConstantNames:
- PHP_OS_FAMILY - PHP_OS_FAMILY
excludePaths:
analyseAndScan:
- ./src/globals/tests/swoole.php
- ./src/globals/tests/swoole.phpt

View File

@@ -23,7 +23,7 @@ use Symfony\Component\Console\Command\ListCommand;
*/ */
final class ConsoleApplication extends Application final class ConsoleApplication extends Application
{ {
public const VERSION = '2.0.0-rc9'; public const VERSION = '2.0.0';
public function __construct() public function __construct()
{ {

View File

@@ -33,12 +33,12 @@ abstract class BuilderBase
/** /**
* Build libraries * Build libraries
* *
* @param array<string> $libraries Libraries to build * @param array<string> $sorted_libraries Libraries to build (if not empty, must sort first)
* @throws FileSystemException * @throws FileSystemException
* @throws RuntimeException * @throws RuntimeException
* @throws WrongUsageException * @throws WrongUsageException
*/ */
public function buildLibs(array $libraries): void public function buildLibs(array $sorted_libraries): void
{ {
// search all supported libs // search all supported libs
$support_lib_list = []; $support_lib_list = [];
@@ -53,20 +53,18 @@ abstract class BuilderBase
} }
// if no libs specified, compile all supported libs // if no libs specified, compile all supported libs
if ($libraries === [] && $this->isLibsOnly()) { if ($sorted_libraries === [] && $this->isLibsOnly()) {
$libraries = array_keys($support_lib_list); $libraries = array_keys($support_lib_list);
$sorted_libraries = DependencyUtil::getLibsByDeps($libraries);
} }
// pkg-config must be compiled first, whether it is specified or not // pkg-config must be compiled first, whether it is specified or not
if (!in_array('pkg-config', $libraries)) { if (!in_array('pkg-config', $sorted_libraries)) {
array_unshift($libraries, 'pkg-config'); array_unshift($sorted_libraries, 'pkg-config');
} }
// append dependencies
$libraries = DependencyUtil::getLibsByDeps($libraries);
// add lib object for builder // add lib object for builder
foreach ($libraries as $library) { foreach ($sorted_libraries as $library) {
// if some libs are not supported (but in config "lib.json", throw exception) // if some libs are not supported (but in config "lib.json", throw exception)
if (!isset($support_lib_list[$library])) { if (!isset($support_lib_list[$library])) {
throw new WrongUsageException('library [' . $library . '] is in the lib.json list but not supported to compile, but in the future I will support it!'); throw new WrongUsageException('library [' . $library . '] is in the lib.json list but not supported to compile, but in the future I will support it!');
@@ -81,7 +79,7 @@ abstract class BuilderBase
} }
// extract sources // extract sources
SourceExtractor::initSource(libs: $libraries); SourceExtractor::initSource(libs: $sorted_libraries);
// build all libs // build all libs
foreach ($this->libs as $lib) { foreach ($this->libs as $lib) {
@@ -227,7 +225,7 @@ abstract class BuilderBase
foreach ($this->exts as $ext) { foreach ($this->exts as $ext) {
$ret[] = trim($ext->getConfigureArg()); $ret[] = trim($ext->getConfigureArg());
} }
logger()->info('Using configure: ' . implode(' ', $ret)); logger()->debug('Using configure: ' . implode(' ', $ret));
return implode(' ', $ret); return implode(' ', $ret);
} }

View File

@@ -0,0 +1,23 @@
<?php
declare(strict_types=1);
namespace SPC\builder\extension;
use SPC\builder\Extension;
use SPC\store\FileSystem;
use SPC\util\CustomExt;
#[CustomExt('ldap')]
class ldap extends Extension
{
public function patchBeforeConfigure(): bool
{
$output = shell()->execWithResult('$PKG_CONFIG --libs-only-l --static ldap');
if (!empty($output[1][0])) {
$libs = $output[1][0];
FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/configure', '-lldap ', $libs . ' ');
}
return true;
}
}

View File

@@ -12,13 +12,31 @@ class swoole extends Extension
{ {
public function getUnixConfigureArg(): string public function getUnixConfigureArg(): string
{ {
// enable swoole
$arg = '--enable-swoole'; $arg = '--enable-swoole';
// pgsql hook is buggy for static php
$arg .= ' --disable-swoole-pgsql'; // commonly-used feature: coroutine-time, thread-context
$arg .= $this->builder->getLib('openssl') ? ' --enable-openssl' : ' --disable-openssl --without-openssl'; $arg .= ' --enable-swoole-coro-time --enable-thread-context';
$arg .= $this->builder->getLib('brotli') ? (' --enable-brotli --with-brotli-dir=' . BUILD_ROOT_PATH) : ' --disable-brotli';
// swoole curl hook is buggy for php 8.0 // required feature: curl, openssl (but curl hook is buggy for php 8.0)
$arg .= $this->builder->getExt('curl') && $this->builder->getPHPVersionID() >= 80100 ? ' --enable-swoole-curl' : ' --disable-swoole-curl'; $arg .= $this->builder->getPHPVersionID() >= 80100 ? ' --enable-swoole-curl' : ' --disable-swoole-curl';
$arg .= ' --enable-openssl';
// additional feature: c-ares, brotli, nghttp2 (can be disabled, but we enable it by default in config to support full network feature)
$arg .= $this->builder->getLib('libcares') ? ' --enable-cares' : '';
$arg .= $this->builder->getLib('brotli') ? (' --with-brotli-dir=' . BUILD_ROOT_PATH) : '';
$arg .= $this->builder->getLib('nghttp2') ? (' --with-nghttp2-dir=' . BUILD_ROOT_PATH) : '';
// additional feature: swoole-pgsql, it should depend on lib [postgresql], but it will lack of CFLAGS etc.
// so this is a tricky way (enable ext [pgsql,pdo] to add postgresql hook and pdo_pgsql support)
$arg .= $this->builder->getExt('swoole-hook-pgsql') ? '' : ' --disable-swoole-pgsql';
// enable this feature , need remove pdo_sqlite
// more info : https://wenda.swoole.com/detail/109023
$arg .= $this->builder->getExt('swoole-hook-sqlite') ? '' : ' --disable-swoole-sqlite';
// enable this feature , need stop pdo_*
// $arg .= $this->builder->getLib('unixodbc') ? ' --with-swoole-odbc=unixODBC,' : ' ';
return $arg; return $arg;
} }
} }

View File

@@ -0,0 +1,36 @@
<?php
declare(strict_types=1);
namespace SPC\builder\extension;
use SPC\builder\Extension;
use SPC\exception\RuntimeException;
use SPC\util\CustomExt;
#[CustomExt('swoole-hook-mysql')]
class swoole_hook_mysql extends Extension
{
public function getUnixConfigureArg(): string
{
// pdo_mysql doesn't need to be disabled
// enable swoole-hook-mysql will enable mysqli, pdo, pdo_mysql, we don't need to add any additional options
return '';
}
public function runCliCheck(): void
{
// skip if not enable swoole
if ($this->builder->getExt('swoole') === null) {
return;
}
[$ret, $out] = shell()->execWithResult(BUILD_ROOT_PATH . '/bin/php --ri "swoole"', false);
$out = implode('', $out);
if ($ret !== 0) {
throw new RuntimeException('extension ' . $this->getName() . ' failed compile check: php-cli returned ' . $ret);
}
if (!str_contains($out, 'mysqlnd')) {
throw new RuntimeException('swoole mysql hook is not enabled correctly.');
}
}
}

View File

@@ -0,0 +1,40 @@
<?php
declare(strict_types=1);
namespace SPC\builder\extension;
use SPC\builder\Extension;
use SPC\exception\RuntimeException;
use SPC\exception\WrongUsageException;
use SPC\util\CustomExt;
#[CustomExt('swoole-hook-pgsql')]
class swoole_hook_pgsql extends Extension
{
public function getUnixConfigureArg(): string
{
// pdo_pgsql need to be disabled
if ($this->builder->getExt('pdo_pgsql') !== null) {
throw new WrongUsageException('swoole-hook-pgsql provides pdo_pgsql, if you enable pgsql hook for swoole, you must remove pdo_pgsql extension.');
}
// enable swoole pgsql hook
return '--enable-swoole-pgsql';
}
public function runCliCheck(): void
{
// skip if not enable swoole
if ($this->builder->getExt('swoole') === null) {
return;
}
[$ret, $out] = shell()->execWithResult(BUILD_ROOT_PATH . '/bin/php --ri "swoole"', false);
$out = implode('', $out);
if ($ret !== 0) {
throw new RuntimeException('extension ' . $this->getName() . ' failed compile check: php-cli returned ' . $ret);
}
if (!str_contains($out, 'coroutine_pgsql')) {
throw new RuntimeException('swoole pgsql hook is not enabled correctly.');
}
}
}

View File

@@ -0,0 +1,40 @@
<?php
declare(strict_types=1);
namespace SPC\builder\extension;
use SPC\builder\Extension;
use SPC\exception\RuntimeException;
use SPC\exception\WrongUsageException;
use SPC\util\CustomExt;
#[CustomExt('swoole-hook-sqlite')]
class swoole_hook_sqlite extends Extension
{
public function getUnixConfigureArg(): string
{
// pdo_pgsql need to be disabled
if ($this->builder->getExt('pdo_sqlite') !== null) {
throw new WrongUsageException('swoole-hook-sqlite provides pdo_sqlite, if you enable sqlite hook for swoole, you must remove pdo_sqlite extension.');
}
// enable swoole pgsql hook
return '--enable-swoole-sqlite';
}
public function runCliCheck(): void
{
// skip if not enable swoole
if ($this->builder->getExt('swoole') === null) {
return;
}
[$ret, $out] = shell()->execWithResult(BUILD_ROOT_PATH . '/bin/php --ri "swoole"', false);
$out = implode('', $out);
if ($ret !== 0) {
throw new RuntimeException('extension ' . $this->getName() . ' failed compile check: php-cli returned ' . $ret);
}
if (!str_contains($out, 'coroutine_sqlite')) {
throw new RuntimeException('swoole sqlite hook is not enabled correctly.');
}
}
}

View File

@@ -138,16 +138,15 @@ class LinuxBuilder extends BuilderBase
// add libstdc++, some extensions or libraries need it // add libstdc++, some extensions or libraries need it
$extra_libs .= (empty($extra_libs) ? '' : ' ') . ($this->hasCpp() ? '-lstdc++ ' : ''); $extra_libs .= (empty($extra_libs) ? '' : ' ') . ($this->hasCpp() ? '-lstdc++ ' : '');
$this->setOption('extra-libs', $extra_libs); $this->setOption('extra-libs', $extra_libs);
$cflags = $this->arch_c_flags; $cflags = $this->arch_c_flags;
// prepare build php envs // prepare build php envs
$envs_build_php = SystemUtil::makeEnvVarString([ $envs_build_php = SystemUtil::makeEnvVarString([
'CFLAGS' => $cflags, 'CFLAGS' => $cflags,
'CPPFLAGS' => '-I' . BUILD_INCLUDE_PATH, 'CPPFLAGS' => '-I' . BUILD_INCLUDE_PATH,
'LDFLAGS' => '-L' . BUILD_LIB_PATH,
'LIBS' => '-ldl -lpthread', 'LIBS' => '-ldl -lpthread',
]); ]);
SourcePatcher::patchBeforeBuildconf($this); SourcePatcher::patchBeforeBuildconf($this);
shell()->cd(SOURCE_PATH . '/php-src')->exec('./buildconf --force'); shell()->cd(SOURCE_PATH . '/php-src')->exec('./buildconf --force');
@@ -190,8 +189,8 @@ class LinuxBuilder extends BuilderBase
$json_74 . $json_74 .
$zts . $zts .
$maxExecutionTimers . $maxExecutionTimers .
$this->makeExtensionArgs() . ' ' . $this->makeExtensionArgs() .
$envs_build_php ' ' . $envs_build_php . ' '
); );
SourcePatcher::patchBeforeMake($this); SourcePatcher::patchBeforeMake($this);
@@ -323,10 +322,11 @@ class LinuxBuilder extends BuilderBase
$cflags = isset($input['EXTRA_CFLAGS']) && $input['EXTRA_CFLAGS'] ? " {$input['EXTRA_CFLAGS']}" : ''; $cflags = isset($input['EXTRA_CFLAGS']) && $input['EXTRA_CFLAGS'] ? " {$input['EXTRA_CFLAGS']}" : '';
$libs = isset($input['EXTRA_LIBS']) && $input['EXTRA_LIBS'] ? " {$input['EXTRA_LIBS']}" : ''; $libs = isset($input['EXTRA_LIBS']) && $input['EXTRA_LIBS'] ? " {$input['EXTRA_LIBS']}" : '';
$ldflags = isset($input['EXTRA_LDFLAGS_PROGRAM']) && $input['EXTRA_LDFLAGS_PROGRAM'] ? " {$input['EXTRA_LDFLAGS_PROGRAM']}" : ''; $ldflags = isset($input['EXTRA_LDFLAGS_PROGRAM']) && $input['EXTRA_LDFLAGS_PROGRAM'] ? " {$input['EXTRA_LDFLAGS_PROGRAM']}" : '';
$tune_c_flags = implode(' ', array_map(fn ($x) => "-Xcompiler {$x}", $this->tune_c_flags));
return [ return [
'EXTRA_CFLAGS' => "{$optimization} -fno-ident -fPIE " . implode(' ', array_map(fn ($x) => "-Xcompiler {$x}", $this->tune_c_flags)) . $cflags, 'EXTRA_CFLAGS' => "{$optimization} -fno-ident -fPIE {$tune_c_flags}{$cflags}",
'EXTRA_LIBS' => $this->getOption('extra-libs', '') . $libs, 'EXTRA_LIBS' => "{$this->getOption('extra-libs', '')} {$libs}",
'EXTRA_LDFLAGS_PROGRAM' => "{$use_lld} -all-static" . $ldflags, 'EXTRA_LDFLAGS_PROGRAM' => "{$use_lld} -all-static{$ldflags}",
]; ];
} }
} }

View File

@@ -47,6 +47,10 @@ class imap extends LinuxLibraryBase
shell()->cd($this->source_dir) shell()->cd($this->source_dir)
->exec('make clean') ->exec('make clean')
->exec('touch ip6') ->exec('touch ip6')
->exec('chmod +x tools/an')
->exec('chmod +x tools/ua')
->exec('chmod +x src/osdep/unix/drivers')
->exec('chmod +x src/osdep/unix/mkauths')
->exec( ->exec(
"yes | make slx {$ssl_options}" "yes | make slx {$ssl_options}"
); );

View File

@@ -0,0 +1,12 @@
<?php
declare(strict_types=1);
namespace SPC\builder\linux\library;
class libcares extends LinuxLibraryBase
{
use \SPC\builder\unix\library\libcares;
public const NAME = 'libcares';
}

View File

@@ -26,7 +26,9 @@ class libxml2 extends LinuxLibraryBase
shell()->cd($this->source_dir . '/build') shell()->cd($this->source_dir . '/build')
->exec( ->exec(
'cmake ' . 'cmake ' .
"{$this->builder->makeCmakeArgs()} " . '-DCMAKE_BUILD_TYPE=Release ' .
'-DCMAKE_INSTALL_PREFIX=' . BUILD_ROOT_PATH . ' ' .
"-DCMAKE_TOOLCHAIN_FILE={$this->builder->cmake_toolchain_file} " .
'-DBUILD_SHARED_LIBS=OFF ' . '-DBUILD_SHARED_LIBS=OFF ' .
'-DIconv_IS_BUILT_IN=OFF ' . '-DIconv_IS_BUILT_IN=OFF ' .
'-DLIBXML2_WITH_ICONV=ON ' . '-DLIBXML2_WITH_ICONV=ON ' .
@@ -39,7 +41,7 @@ class libxml2 extends LinuxLibraryBase
'..' '..'
) )
->exec("cmake --build . -j {$this->builder->concurrency}") ->exec("cmake --build . -j {$this->builder->concurrency}")
->exec('make install DESTDIR=' . BUILD_ROOT_PATH); ->exec('make install');
FileSystem::replaceFileStr( FileSystem::replaceFileStr(
BUILD_LIB_PATH . '/pkgconfig/libxml-2.0.pc', BUILD_LIB_PATH . '/pkgconfig/libxml-2.0.pc',

View File

@@ -1,72 +1,12 @@
<?php <?php
/**
* Copyright (c) 2022 Yun Dou <dixyes@gmail.com>
*
* lwmbs is licensed under Mulan PSL v2. You can use this
* software according to the terms and conditions of the
* Mulan PSL v2. You may obtain a copy of Mulan PSL v2 at:
*
* http://license.coscl.org.cn/MulanPSL2
*
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS,
* WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
*
* See the Mulan PSL v2 for more details.
*/
declare(strict_types=1); declare(strict_types=1);
namespace SPC\builder\linux\library; namespace SPC\builder\linux\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\exception\WrongUsageException;
class nghttp2 extends LinuxLibraryBase class nghttp2 extends LinuxLibraryBase
{ {
use \SPC\builder\unix\library\nghttp2;
public const NAME = 'nghttp2'; public const NAME = 'nghttp2';
/**
* @throws FileSystemException
* @throws RuntimeException
* @throws WrongUsageException
*/
public function build(): void
{
$args = $this->builder->makeAutoconfArgs(static::NAME, [
'zlib' => null,
'openssl' => null,
'libxml2' => null,
'libev' => null,
'libcares' => null,
'libngtcp2' => null,
'libnghttp3' => null,
'libbpf' => null,
'libevent-openssl' => null,
'jansson' => null,
'jemalloc' => null,
'systemd' => null,
'cunit' => null,
]);
[,,$destdir] = SEPARATED_PATH;
shell()->cd($this->source_dir)
->exec(
'./configure ' .
'--enable-static ' .
'--disable-shared ' .
"--host={$this->builder->getOption('gnu-arch')}-unknown-linux " .
'--enable-lib-only ' .
'--with-boost=no ' .
$args . ' ' .
'--prefix='
)
->exec('make clean')
->exec("make -j{$this->builder->concurrency}")
->exec("make install DESTDIR={$destdir}");
$this->patchPkgconfPrefix(['libnghttp2.pc']);
}
} }

View File

@@ -155,6 +155,21 @@ class MacOSBuilder extends BuilderBase
$enableMicro = ($build_target & BUILD_TARGET_MICRO) === BUILD_TARGET_MICRO; $enableMicro = ($build_target & BUILD_TARGET_MICRO) === BUILD_TARGET_MICRO;
$enableEmbed = ($build_target & BUILD_TARGET_EMBED) === BUILD_TARGET_EMBED; $enableEmbed = ($build_target & BUILD_TARGET_EMBED) === BUILD_TARGET_EMBED;
// prepare build php envs
$envs_build_php = SystemUtil::makeEnvVarString([
'CFLAGS' => " {$this->arch_c_flags} -Werror=unknown-warning-option ",
'CPPFLAGS' => '-I' . BUILD_INCLUDE_PATH,
'LDFLAGS' => '-L' . BUILD_LIB_PATH,
]);
if ($this->getLib('postgresql')) {
shell()
->cd(SOURCE_PATH . '/php-src')
->exec(
'sed -i.backup "s/ac_cv_func_explicit_bzero\" = xyes/ac_cv_func_explicit_bzero\" = x_fake_yes/" ./configure'
);
}
shell()->cd(SOURCE_PATH . '/php-src') shell()->cd(SOURCE_PATH . '/php-src')
->exec( ->exec(
'./configure ' . './configure ' .
@@ -162,8 +177,6 @@ class MacOSBuilder extends BuilderBase
'--with-valgrind=no ' . // Not detect memory leak '--with-valgrind=no ' . // Not detect memory leak
'--enable-shared=no ' . '--enable-shared=no ' .
'--enable-static=yes ' . '--enable-static=yes ' .
"CFLAGS='{$this->arch_c_flags} -Werror=unknown-warning-option' " .
"CPPFLAGS='-I" . BUILD_INCLUDE_PATH . "' " .
'--disable-all ' . '--disable-all ' .
'--disable-cgi ' . '--disable-cgi ' .
'--disable-phpdbg ' . '--disable-phpdbg ' .
@@ -173,7 +186,8 @@ class MacOSBuilder extends BuilderBase
($enableMicro ? '--enable-micro ' : '--disable-micro ') . ($enableMicro ? '--enable-micro ' : '--disable-micro ') .
$json_74 . $json_74 .
$zts . $zts .
$this->makeExtensionArgs() $this->makeExtensionArgs() . ' ' .
$envs_build_php
); );
SourcePatcher::patchBeforeMake($this); SourcePatcher::patchBeforeMake($this);
@@ -213,10 +227,7 @@ class MacOSBuilder extends BuilderBase
*/ */
public function buildCli(): void public function buildCli(): void
{ {
$vars = SystemUtil::makeEnvVarString([ $vars = SystemUtil::makeEnvVarString($this->getBuildVars());
'EXTRA_CFLAGS' => '-g -Os', // with debug information, but optimize for size
'EXTRA_LIBS' => "{$this->getOption('extra-libs')} -lresolv", // link resolv library (macOS needs it)
]);
$shell = shell()->cd(SOURCE_PATH . '/php-src'); $shell = shell()->cd(SOURCE_PATH . '/php-src');
$shell->exec("make -j{$this->concurrency} {$vars} cli"); $shell->exec("make -j{$this->concurrency} {$vars} cli");
@@ -247,9 +258,8 @@ class MacOSBuilder extends BuilderBase
$vars = [ $vars = [
// with debug information, optimize for size, remove identifiers, patch fake cli for micro // with debug information, optimize for size, remove identifiers, patch fake cli for micro
'EXTRA_CFLAGS' => '-g -Os -fno-ident' . $enable_fake_cli, 'EXTRA_CFLAGS' => '-g -Os -fno-ident' . $enable_fake_cli,
// link resolv library (macOS needs it)
'EXTRA_LIBS' => "{$this->getOption('extra-libs')} -lresolv",
]; ];
$vars = $this->getBuildVars($vars);
if (!$this->getOption('no-strip', false)) { if (!$this->getOption('no-strip', false)) {
$vars['STRIP'] = 'dsymutil -f '; $vars['STRIP'] = 'dsymutil -f ';
} }
@@ -272,10 +282,7 @@ class MacOSBuilder extends BuilderBase
*/ */
public function buildFpm(): void public function buildFpm(): void
{ {
$vars = SystemUtil::makeEnvVarString([ $vars = SystemUtil::makeEnvVarString($this->getBuildVars());
'EXTRA_CFLAGS' => '-g -Os', // with debug information, but optimize for size
'EXTRA_LIBS' => "{$this->getOption('extra-libs')} -lresolv", // link resolv library (macOS needs it)
]);
$shell = shell()->cd(SOURCE_PATH . '/php-src'); $shell = shell()->cd(SOURCE_PATH . '/php-src');
$shell->exec("make -j{$this->concurrency} {$vars} fpm"); $shell->exec("make -j{$this->concurrency} {$vars} fpm");
@@ -292,10 +299,7 @@ class MacOSBuilder extends BuilderBase
*/ */
public function buildEmbed(): void public function buildEmbed(): void
{ {
$vars = SystemUtil::makeEnvVarString([ $vars = SystemUtil::makeEnvVarString($this->getBuildVars());
'EXTRA_CFLAGS' => '-g -Os', // with debug information, but optimize for size
'EXTRA_LIBS' => "{$this->getOption('extra-libs')} -lresolv", // link resolv library (macOS needs it)
]);
shell() shell()
->cd(SOURCE_PATH . '/php-src') ->cd(SOURCE_PATH . '/php-src')
@@ -309,4 +313,15 @@ class MacOSBuilder extends BuilderBase
->exec('ar rcs ' . BUILD_ROOT_PATH . '/lib/libphp.a *.o') ->exec('ar rcs ' . BUILD_ROOT_PATH . '/lib/libphp.a *.o')
->exec('rm -Rf ' . BUILD_ROOT_PATH . '/lib/php-o'); ->exec('rm -Rf ' . BUILD_ROOT_PATH . '/lib/php-o');
} }
private function getBuildVars($input = []): array
{
$optimization = $this->getOption('no-strip', false) ? '-g -O0' : '-g0 -Os';
$cflags = isset($input['EXTRA_CFLAGS']) && $input['EXTRA_CFLAGS'] ? " {$input['EXTRA_CFLAGS']}" : '';
$libs = isset($input['EXTRA_LIBS']) && $input['EXTRA_LIBS'] ? " {$input['EXTRA_LIBS']}" : '';
return [
'EXTRA_CFLAGS' => "{$optimization} {$cflags} " . $this->getOption('x-extra-cflags'),
'EXTRA_LIBS' => "{$this->getOption('extra-libs')} -lresolv {$libs} " . $this->getOption('x-extra-libs'),
];
}
} }

View File

@@ -50,6 +50,10 @@ class imap extends MacOSLibraryBase
shell()->cd($this->source_dir) shell()->cd($this->source_dir)
->exec('make clean') ->exec('make clean')
->exec('touch ip6') ->exec('touch ip6')
->exec('chmod +x tools/an')
->exec('chmod +x tools/ua')
->exec('chmod +x src/osdep/unix/drivers')
->exec('chmod +x src/osdep/unix/mkauths')
->exec( ->exec(
"yes | EXTRACFLAGS='-Wimplicit-function-declaration -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' make osx {$ssl_options}" "yes | EXTRACFLAGS='-Wimplicit-function-declaration -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' make osx {$ssl_options}"
); );

View File

@@ -0,0 +1,12 @@
<?php
declare(strict_types=1);
namespace SPC\builder\macos\library;
class libcares extends MacOSLibraryBase
{
use \SPC\builder\unix\library\libcares;
public const NAME = 'libcares';
}

View File

@@ -27,7 +27,9 @@ class libxml2 extends MacOSLibraryBase
->exec( ->exec(
'cmake ' . 'cmake ' .
// '--debug-find ' . // '--debug-find ' .
"{$this->builder->makeCmakeArgs()} " . '-DCMAKE_BUILD_TYPE=Release ' .
'-DCMAKE_INSTALL_PREFIX=' . BUILD_ROOT_PATH . ' ' .
"-DCMAKE_TOOLCHAIN_FILE={$this->builder->cmake_toolchain_file} " .
'-DBUILD_SHARED_LIBS=OFF ' . '-DBUILD_SHARED_LIBS=OFF ' .
'-DLIBXML2_WITH_ICONV=ON ' . '-DLIBXML2_WITH_ICONV=ON ' .
"-DLIBXML2_WITH_ZLIB={$enable_zlib} " . "-DLIBXML2_WITH_ZLIB={$enable_zlib} " .
@@ -39,6 +41,6 @@ class libxml2 extends MacOSLibraryBase
'..' '..'
) )
->exec("cmake --build . -j {$this->builder->concurrency}") ->exec("cmake --build . -j {$this->builder->concurrency}")
->exec('make install DESTDIR=' . BUILD_ROOT_PATH); ->exec('make install');
} }
} }

View File

@@ -20,51 +20,9 @@ declare(strict_types=1);
namespace SPC\builder\macos\library; namespace SPC\builder\macos\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
class nghttp2 extends MacOSLibraryBase class nghttp2 extends MacOSLibraryBase
{ {
use \SPC\builder\unix\library\nghttp2;
public const NAME = 'nghttp2'; public const NAME = 'nghttp2';
/**
* @throws FileSystemException
* @throws RuntimeException
*/
protected function build(): void
{
$args = $this->builder->makeAutoconfArgs(static::NAME, [
'zlib' => null,
'openssl' => null,
'libxml2' => null,
'libev' => null,
'libcares' => null,
'libngtcp2' => null,
'libnghttp3' => null,
'libbpf' => null,
'libevent-openssl' => null,
'jansson' => null,
'jemalloc' => null,
'systemd' => null,
'cunit' => null,
]);
[,,$destdir] = SEPARATED_PATH;
shell()->cd($this->source_dir)
->exec(
'./configure ' .
'--enable-static ' .
'--disable-shared ' .
"--host={$this->builder->getOption('gnu-arch')}-apple-darwin " .
'--enable-lib-only ' .
'--with-boost=no ' .
$args . ' ' .
'--prefix='
)
->exec('make clean')
->exec("make -j{$this->builder->concurrency}")
->exec("make install DESTDIR={$destdir}");
$this->patchPkgconfPrefix(['libnghttp2.pc']);
}
} }

View File

@@ -27,10 +27,7 @@ trait brotli
->exec("cmake --build . -j {$this->builder->concurrency}") ->exec("cmake --build . -j {$this->builder->concurrency}")
->exec('make install DESTDIR=' . BUILD_ROOT_PATH); ->exec('make install DESTDIR=' . BUILD_ROOT_PATH);
$this->patchPkgconfPrefix(['libbrotlicommon.pc', 'libbrotlidec.pc', 'libbrotlienc.pc']); $this->patchPkgconfPrefix(['libbrotlicommon.pc', 'libbrotlidec.pc', 'libbrotlienc.pc']);
shell()->cd(BUILD_ROOT_PATH . '/lib') shell()->cd(BUILD_ROOT_PATH . '/lib')->exec('ln -sf libbrotlicommon.a libbrotli.a');
->exec('ln -s libbrotlicommon.a libbrotlicommon-static.a')
->exec('ln -s libbrotlidec.a libbrotlidec-static.a')
->exec('ln -s libbrotlienc.a libbrotlienc-static.a');
foreach (FileSystem::scanDirFiles(BUILD_ROOT_PATH . '/lib/', false, true) as $filename) { foreach (FileSystem::scanDirFiles(BUILD_ROOT_PATH . '/lib/', false, true) as $filename) {
if (str_starts_with($filename, 'libbrotli') && (str_contains($filename, '.so') || str_ends_with($filename, '.dylib'))) { if (str_starts_with($filename, 'libbrotli') && (str_contains($filename, '.so') || str_ends_with($filename, '.dylib'))) {
unlink(BUILD_ROOT_PATH . '/lib/' . $filename); unlink(BUILD_ROOT_PATH . '/lib/' . $filename);

View File

@@ -4,17 +4,25 @@ declare(strict_types=1);
namespace SPC\builder\unix\library; namespace SPC\builder\unix\library;
use SPC\store\FileSystem;
trait ldap trait ldap
{ {
public function patchBeforeBuild(): bool
{
FileSystem::replaceFileStr($this->source_dir . '/configure', '"-lssl -lcrypto', '"-lssl -lcrypto -lz');
return true;
}
protected function build(): void protected function build(): void
{ {
$alt = ''; $alt = '';
// openssl support // openssl support
$alt .= $this->builder->getLib('openssl') && $this->builder->getExt('zlib') ? '--with-tls=openssl ' : ''; $alt .= $this->builder->getLib('openssl') ? '--with-tls=openssl ' : '';
// gmp support // gmp support
$alt .= $this->builder->getLib('gmp') ? '--with-mp=gmp ' : ''; $alt .= $this->builder->getLib('gmp') ? '--with-mp=gmp ' : '';
// libsodium support // libsodium support
$alt .= $this->builder->getLib('libsodium') ? '--with-argon2=libsodium ' : ''; $alt .= $this->builder->getLib('libsodium') ? '--with-argon2=libsodium ' : '--enable-argon2=no ';
f_putenv('PKG_CONFIG=' . BUILD_ROOT_PATH . '/bin/pkg-config'); f_putenv('PKG_CONFIG=' . BUILD_ROOT_PATH . '/bin/pkg-config');
f_putenv('PKG_CONFIG_PATH=' . BUILD_LIB_PATH . '/pkgconfig'); f_putenv('PKG_CONFIG_PATH=' . BUILD_LIB_PATH . '/pkgconfig');
shell()->cd($this->source_dir) shell()->cd($this->source_dir)
@@ -24,7 +32,6 @@ trait ldap
'--enable-static ' . '--enable-static ' .
'--disable-shared ' . '--disable-shared ' .
'--disable-slapd ' . '--disable-slapd ' .
'--disable-slurpd ' .
'--without-systemd ' . '--without-systemd ' .
'--without-cyrus-sasl ' . '--without-cyrus-sasl ' .
$alt . $alt .

View File

@@ -0,0 +1,21 @@
<?php
declare(strict_types=1);
namespace SPC\builder\unix\library;
use SPC\exception\RuntimeException;
trait libcares
{
/**
* @throws RuntimeException
*/
protected function build(): void
{
shell()->cd($this->source_dir)
->exec('./configure --prefix=' . BUILD_ROOT_PATH . ' --enable-static --disable-shared --disable-tests')
->exec("make -j {$this->builder->concurrency}")
->exec('make install');
}
}

View File

@@ -0,0 +1,53 @@
<?php
declare(strict_types=1);
namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\exception\WrongUsageException;
trait nghttp2
{
/**
* @throws FileSystemException
* @throws RuntimeException
* @throws WrongUsageException
*/
protected function build(): void
{
$args = $this->builder->makeAutoconfArgs(static::NAME, [
'zlib' => null,
'openssl' => null,
'libxml2' => null,
'libev' => null,
'libcares' => null,
'libngtcp2' => null,
'libnghttp3' => null,
'libbpf' => null,
'libevent-openssl' => null,
'jansson' => null,
'jemalloc' => null,
'systemd' => null,
'cunit' => null,
]);
[,,$destdir] = SEPARATED_PATH;
shell()->cd($this->source_dir)
->exec(
'./configure ' .
'--enable-static ' .
'--disable-shared ' .
'--enable-lib-only ' .
'--with-boost=no ' .
$args . ' ' .
'--prefix='
)
->exec('make clean')
->exec("make -j{$this->builder->concurrency}")
->exec("make install DESTDIR={$destdir}");
$this->patchPkgconfPrefix(['libnghttp2.pc']);
}
}

View File

@@ -28,9 +28,6 @@ trait postgresql
'icu' => 'icu-i18n', 'icu' => 'icu-i18n',
]; ];
f_putenv('PKG_CONFIG=' . BUILD_ROOT_PATH . '/bin/pkg-config');
f_putenv('PKG_CONFIG_PATH=' . BUILD_LIB_PATH . '/pkgconfig');
foreach ($optional_packages as $lib => $pkg) { foreach ($optional_packages as $lib => $pkg) {
if ($this->getBuilder()->getLib($lib)) { if ($this->getBuilder()->getLib($lib)) {
$packages .= ' ' . $pkg; $packages .= ' ' . $pkg;

View File

@@ -7,6 +7,7 @@ namespace SPC\command;
use SPC\builder\BuilderProvider; use SPC\builder\BuilderProvider;
use SPC\exception\ExceptionHandler; use SPC\exception\ExceptionHandler;
use SPC\exception\RuntimeException; use SPC\exception\RuntimeException;
use SPC\util\DependencyUtil;
use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputInterface;
@@ -59,6 +60,7 @@ class BuildLibsCommand extends BuildCommand
// 只编译 library 的情况下,标记 // 只编译 library 的情况下,标记
$builder->setLibsOnly(); $builder->setLibsOnly();
// 编译和检查库完整 // 编译和检查库完整
$libraries = DependencyUtil::getLibsByDeps($libraries);
$builder->buildLibs($libraries); $builder->buildLibs($libraries);
$time = round(microtime(true) - START_TIME, 3); $time = round(microtime(true) - START_TIME, 3);

View File

@@ -233,6 +233,7 @@ class FileSystem
throw new FileSystemException("unknown archive format: {$filename}"); throw new FileSystemException("unknown archive format: {$filename}");
} }
} }
self::emitSourceExtractHook($name);
} catch (RuntimeException $e) { } catch (RuntimeException $e) {
if (PHP_OS_FAMILY === 'Windows') { if (PHP_OS_FAMILY === 'Windows') {
f_passthru('rmdir /s /q ' . SOURCE_PATH . "/{$name}"); f_passthru('rmdir /s /q ' . SOURCE_PATH . "/{$name}");

View File

@@ -16,6 +16,7 @@ class SourcePatcher
// FileSystem::addSourceExtractHook('swow', [SourcePatcher::class, 'patchSwow']); // FileSystem::addSourceExtractHook('swow', [SourcePatcher::class, 'patchSwow']);
FileSystem::addSourceExtractHook('micro', [SourcePatcher::class, 'patchMicro']); FileSystem::addSourceExtractHook('micro', [SourcePatcher::class, 'patchMicro']);
FileSystem::addSourceExtractHook('openssl', [SourcePatcher::class, 'patchOpenssl11Darwin']); FileSystem::addSourceExtractHook('openssl', [SourcePatcher::class, 'patchOpenssl11Darwin']);
FileSystem::addSourceExtractHook('swoole', [SourcePatcher::class, 'patchSwoole']);
} }
/** /**
@@ -159,6 +160,17 @@ class SourcePatcher
return false; return false;
} }
public static function patchSwoole(): bool
{
// swoole hook needs pdo/pdo.h
FileSystem::replaceFileStr(
SOURCE_PATH . '/php-src/ext/swoole/config.m4',
'PHP_ADD_INCLUDE([$ext_srcdir])',
"PHP_ADD_INCLUDE( [\$ext_srcdir] )\n PHP_ADD_INCLUDE([\$abs_srcdir/ext])"
);
return true;
}
/** /**
* @throws FileSystemException * @throws FileSystemException
*/ */

View File

@@ -3,6 +3,7 @@
declare(strict_types=1); declare(strict_types=1);
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
use SPC\exception\RuntimeException;
use SPC\exception\WrongUsageException; use SPC\exception\WrongUsageException;
use SPC\util\UnixShell; use SPC\util\UnixShell;
use SPC\util\WindowsCmd; use SPC\util\WindowsCmd;
@@ -69,7 +70,7 @@ function osfamily2dir(): string
/** /**
* Execute the shell command, and the output will be directly printed in the terminal. If there is an error, an exception will be thrown * Execute the shell command, and the output will be directly printed in the terminal. If there is an error, an exception will be thrown
* *
* @throws \SPC\exception\RuntimeException * @throws RuntimeException
*/ */
function f_passthru(string $cmd): ?bool function f_passthru(string $cmd): ?bool
{ {
@@ -87,7 +88,7 @@ function f_passthru(string $cmd): ?bool
} }
$ret = passthru($cmd, $code); $ret = passthru($cmd, $code);
if ($code !== 0) { if ($code !== 0) {
throw new \SPC\exception\RuntimeException('Command run failed with code[' . $code . ']: ' . $cmd, $code); throw new RuntimeException('Command run failed with code[' . $code . ']: ' . $cmd, $code);
} }
return $ret; return $ret;
} }

View File

@@ -2,24 +2,55 @@
declare(strict_types=1); declare(strict_types=1);
# Normal test, contains `common` extension. /**
$extensions = 'bcmath,bz2,calendar,ctype,curl,dom,exif,fileinfo,filter,ftp,gd,gmp,iconv,xml,mbstring,mbregex,mysqlnd,openssl,pcntl,pdo,pdo_mysql,pdo_sqlite,phar,posix,redis,session,simplexml,soap,sockets,sqlite3,tokenizer,xmlwriter,xmlreader,zlib,zip'; * This is GitHub Actions automatic test extension args generator.
* You can edit $extensions, $with_libs and $base_combination.
*/
# Normal test, contains gd extra libraries. // --------------------------------- edit area ---------------------------------
$additional_libs = 'libwebp,libavif,libjpeg,freetype';
# If you want to test additional extensions, add them below. (comma start) // If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`).
$extensions .= ',xhprof'; $extensions = 'ldap';
# If you want to test additional features for extensions, add libs below. (comma start like extensions) // If you want to test lib-suggests feature with extension, add them below (comma separated, example `libwebp,libavif`).
$additional_libs .= ''; $with_libs = '';
// Please change your test base combination. We recommend testing with `common`.
// You can use `common`, `bulk`, `minimal` or `none`.
$base_combination = 'minimal';
// -------------------------- code area, do not modify --------------------------
/**
* get combination for tests, do not modify it if not necessary.
*/
function _getCombination(string $type = 'common'): string
{
return match ($type) {
'common' => 'bcmath,bz2,calendar,ctype,curl,dom,exif,fileinfo,filter,ftp,gd,gmp,iconv,xml,mbstring,mbregex,' .
'mysqlnd,openssl,pcntl,pdo,pdo_mysql,pdo_sqlite,phar,posix,redis,session,simplexml,soap,sockets,' .
'sqlite3,tokenizer,xmlwriter,xmlreader,zlib,zip',
'bulk' => 'apcu,bcmath,bz2,calendar,ctype,curl,dba,dom,event,exif,fileinfo,filter,ftp,gd,gmp,iconv,imagick,imap,' .
'intl,mbregex,mbstring,mysqli,mysqlnd,opcache,openssl,pcntl,pdo,pdo_mysql,pdo_pgsql,pdo_sqlite,pgsql,phar,' .
'posix,protobuf,readline,redis,session,shmop,simplexml,soap,sockets,sodium,sqlite3,swoole,sysvmsg,sysvsem,' .
'sysvshm,tokenizer,xml,xmlreader,xmlwriter,xsl,zip,zlib',
'minimal' => 'pcntl,posix,mbstring,tokenizer,phar',
default => '', // none
};
}
if (!isset($argv[1])) { if (!isset($argv[1])) {
exit("Please use 'extensions', 'cmd' or 'libs' as output type"); exit("Please use 'extensions', 'cmd' or 'libs' as output type");
} }
$trim_value = "\r\n \t,";
$final_extensions = trim(trim($extensions, $trim_value) . ',' . _getCombination($base_combination), $trim_value);
$final_libs = trim($with_libs, $trim_value);
echo match ($argv[1]) { echo match ($argv[1]) {
'extensions' => $extensions, 'extensions' => $final_extensions,
'libs' => $additional_libs, 'libs' => $final_libs,
'cmd' => $extensions . ' --with-libs=' . $additional_libs, 'cmd' => $final_extensions . ($final_libs === '' ? '' : (' --with-libs=' . $final_libs)),
default => '', default => '',
}; };

View File

@@ -0,0 +1,12 @@
<?php
declare(strict_types=1);
assert(function_exists('swoole_cpu_num'));
assert(function_exists('swoole_string'));
assert(class_exists('Swoole\Coroutine'));
assert(class_exists('Swoole\Coroutine\Http2\Client'));
assert(class_exists('Swoole\Coroutine\Redis'));
assert(class_exists('Swoole\Coroutine\WaitGroup'));
assert(class_exists('Swoole\Http2\Request'));
assert(constant('SWOOLE_VERSION'));