Compare commits

..

18 Commits

Author SHA1 Message Date
crazywhalecc
237fc535b4 Fix FileSystem remove soft link directory 2024-11-06 16:45:45 +08:00
crazywhalecc
8da3f35815 Fix gettext sanity check 2024-11-06 16:29:17 +08:00
crazywhalecc
dc3f3dfcaa Do not cache PHP 2024-11-05 12:58:09 +08:00
crazywhalecc
23daeeb311 Add extension matrix tests 2024-11-05 12:54:53 +08:00
crazywhalecc
e9466dca68 Use similar optimize flags for compiling PHP (bump major ver) 2024-11-05 11:18:36 +08:00
crazywhalecc
664a8122ad Add 8.1-8.3 test 2024-11-03 13:56:48 +08:00
crazywhalecc
13523bcdbc Fix imagick build for PHP 8.4 2024-11-03 13:56:36 +08:00
crazywhalecc
6de66056a5 Remove --with-zlib-dir that has been removed in 8.4 2024-11-03 13:56:02 +08:00
crazywhalecc
aa457dfe5c Update README 2024-11-03 12:38:49 +08:00
crazywhalecc
4a22d2a613 Fix sodium build, remove build patches 2024-11-03 12:37:57 +08:00
crazywhalecc
3f871fde13 Change swoole source to git master instead of pecl (6.0 has not been released) 2024-11-03 12:37:40 +08:00
crazywhalecc
e196442387 Change default download php version to 8.3 2024-11-03 12:37:00 +08:00
crazywhalecc
dc57e5e5c4 Remove 8.1-8.3 tests 2024-11-03 01:35:29 +08:00
crazywhalecc
6670b56da5 Fix display PHP version when using archive 2024-11-03 01:17:30 +08:00
crazywhalecc
307e984b5d Fix imap library build in macOS Sequoia 2024-11-03 01:15:49 +08:00
crazywhalecc
0e131f2dba 8.4 download imap separately, compatible with 8.1-8.3 2024-11-02 21:47:39 +08:00
crazywhalecc
6ed25ed740 Add 8.4 support for switch-php-version command 2024-11-02 21:44:55 +08:00
crazywhalecc
220c4dab42 Add PHP 8.4 support (testing) 2024-10-25 16:38:02 +08:00
49 changed files with 75 additions and 308 deletions

View File

@@ -12,10 +12,9 @@ on:
version:
required: true
description: php version to compile
default: '8.3'
default: '8.2'
type: choice
options:
- '8.4'
- '8.3'
- '8.2'
- '8.1'

View File

@@ -6,10 +6,9 @@ on:
version:
required: true
description: php version to compile
default: '8.3'
default: '8.2'
type: choice
options:
- '8.4'
- '8.3'
- '8.2'
- '8.1'

View File

@@ -6,10 +6,9 @@ on:
version:
required: true
description: php version to compile
default: '8.3'
default: '8.2'
type: choice
options:
- '8.4'
- '8.3'
- '8.2'
- '8.1'

View File

@@ -6,10 +6,9 @@ on:
version:
required: true
description: php version to compile
default: '8.3'
default: '8.2'
type: choice
options:
- '8.4'
- '8.3'
- '8.2'
- '8.1'

View File

@@ -9,7 +9,6 @@ on:
default: '8.2'
type: choice
options:
- '8.4'
- '8.3'
- '8.2'
- '8.1'

View File

@@ -82,7 +82,6 @@ jobs:
- php: '8.1'
- php: '8.2'
- php: '8.3'
- php: '8.4'
steps:
- name: "Checkout"

28
composer.lock generated
View File

@@ -2529,16 +2529,16 @@
},
{
"name": "friendsofphp/php-cs-fixer",
"version": "v3.65.0",
"version": "v3.64.0",
"source": {
"type": "git",
"url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git",
"reference": "79d4f3e77b250a7d8043d76c6af8f0695e8a469f"
"reference": "58dd9c931c785a79739310aef5178928305ffa67"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/79d4f3e77b250a7d8043d76c6af8f0695e8a469f",
"reference": "79d4f3e77b250a7d8043d76c6af8f0695e8a469f",
"url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/58dd9c931c785a79739310aef5178928305ffa67",
"reference": "58dd9c931c785a79739310aef5178928305ffa67",
"shasum": ""
},
"require": {
@@ -2548,7 +2548,7 @@
"ext-filter": "*",
"ext-json": "*",
"ext-tokenizer": "*",
"fidry/cpu-core-counter": "^1.2",
"fidry/cpu-core-counter": "^1.0",
"php": "^7.4 || ^8.0",
"react/child-process": "^0.6.5",
"react/event-loop": "^1.0",
@@ -2568,18 +2568,18 @@
"symfony/stopwatch": "^5.4 || ^6.0 || ^7.0"
},
"require-dev": {
"facile-it/paraunit": "^1.3.1 || ^2.4",
"infection/infection": "^0.29.8",
"justinrainbow/json-schema": "^5.3 || ^6.0",
"facile-it/paraunit": "^1.3 || ^2.3",
"infection/infection": "^0.29.5",
"justinrainbow/json-schema": "^5.2",
"keradus/cli-executor": "^2.1",
"mikey179/vfsstream": "^1.6.12",
"mikey179/vfsstream": "^1.6.11",
"php-coveralls/php-coveralls": "^2.7",
"php-cs-fixer/accessible-object": "^1.1",
"php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.5",
"php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.5",
"phpunit/phpunit": "^9.6.21 || ^10.5.38 || ^11.4.3",
"symfony/var-dumper": "^5.4.47 || ^6.4.15 || ^7.1.8",
"symfony/yaml": "^5.4.45 || ^6.4.13 || ^7.1.6"
"phpunit/phpunit": "^9.6.19 || ^10.5.21 || ^11.2",
"symfony/var-dumper": "^5.4 || ^6.0 || ^7.0",
"symfony/yaml": "^5.4 || ^6.0 || ^7.0"
},
"suggest": {
"ext-dom": "For handling output formats in XML",
@@ -2620,7 +2620,7 @@
],
"support": {
"issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues",
"source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.65.0"
"source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.64.0"
},
"funding": [
{
@@ -2628,7 +2628,7 @@
"type": "github"
}
],
"time": "2024-11-25T00:39:24+00:00"
"time": "2024-08-30T23:09:38+00:00"
},
{
"name": "humbug/box",

View File

@@ -199,19 +199,6 @@
"gmssl"
]
},
"grpc": {
"support": {
"Windows": "wip",
"BSD": "wip"
},
"type": "external",
"source": "grpc",
"arg-type-unix": "custom",
"cpp-extension": true,
"lib-depends": [
"grpc"
]
},
"iconv": {
"support": {
"BSD": "wip"
@@ -524,7 +511,7 @@
},
"notes": true,
"type": "builtin",
"arg-type": "custom",
"arg-type": "with-prefix",
"lib-depends": [
"postgresql"
]

View File

@@ -139,21 +139,6 @@
"Security"
]
},
"grpc": {
"source": "grpc",
"static-libs-unix": [
"libgrpc.a",
"libboringssl.a",
"libcares.a"
],
"lib-depends": [
"zlib",
"openssl"
],
"frameworks": [
"CoreFoundation"
]
},
"icu": {
"source": "icu",
"cpp-library": true,

View File

@@ -36,13 +36,9 @@
}
},
"bzip2": {
"alt": {
"type": "filelist",
"url": "https://sourceware.org/pub/bzip2/",
"regex": "/href=\"(?<file>bzip2-(?<version>[^\"]+)\\.tar\\.gz)\"/"
},
"type": "url",
"url": "https://dl.static-php.dev/static-php-cli/deps/bzip2/bzip2-1.0.8.tar.gz",
"type": "filelist",
"url": "https://sourceware.org/pub/bzip2/",
"regex": "/href=\"(?<file>bzip2-(?<version>[^\"]+)\\.tar\\.gz)\"/",
"provide-pre-built": true,
"license": {
"type": "text",
@@ -106,18 +102,6 @@
"path": "LICENSE"
}
},
"ext-imap": {
"type": "url",
"url": "https://pecl.php.net/get/imap",
"path": "php-src/ext/imap",
"filename": "imap.tgz",
"license": {
"type": "file",
"path": [
"LICENSE"
]
}
},
"ext-memcache": {
"type": "url",
"url": "https://pecl.php.net/get/memcache",
@@ -227,16 +211,6 @@
"path": "LICENSE"
}
},
"grpc": {
"type": "git",
"rev": "v1.68.x",
"url": "https://github.com/grpc/grpc.git",
"provide-pre-built": true,
"license": {
"type": "file",
"path": "LICENSE"
}
},
"icu": {
"type": "ghrel",
"repo": "unicode-org/icu",
@@ -275,6 +249,18 @@
"path": "LICENSE"
}
},
"ext-imap": {
"type": "url",
"url": "https://pecl.php.net/get/imap",
"path": "php-src/ext/imap",
"filename": "imap.tgz",
"license": {
"type": "file",
"path": [
"LICENSE"
]
}
},
"inotify": {
"type": "url",
"url": "https://pecl.php.net/get/inotify",

View File

@@ -84,11 +84,3 @@ For Linux systems, you can download the [cacert.pem](https://curl.se/docs/caextr
For the certificate locations of different distros, please refer to [Golang docs](https://go.dev/src/crypto/x509/root_linux.go).
> INI configuration `openssl.cafile` cannot be set dynamically using the `ini_set()` function, because `openssl.cafile` is a `PHP_INI_SYSTEM` type configuration and can only be set in the `php.ini` file.
## Why don't we support older versions of PHP?
Because older versions of PHP have many problems, such as security issues, performance issues, and functional issues.
In addition, many older versions of PHP are not compatible with the latest dependency libraries,
which is one of the reasons why older versions of PHP are not supported.
You can use older versions compiled earlier by static-php-cli, such as PHP 8.0, but earlier versions will not be explicitly supported.

View File

@@ -74,12 +74,6 @@ bin/setup-runtime -action add-path
bin/setup-runtime -action remove-path
```
Finally, now that you have PHP and Composer installed, you need to install static-php-cli's Composer dependencies:
```shell
composer install
```
### Install other Tools (automatic)
For `php-sdk-binary-tools`, `strawberry-perl`, and `nasm`,

View File

@@ -46,7 +46,7 @@ This extension contains an implementation of the coroutine environment for `pdo_
## swow
1. Only PHP 8.0 ~ 8.4 is supported.
1. Only PHP version >= 8.0 is supported.
## imap

View File

@@ -36,7 +36,7 @@ Windows currently only supports the x86_64 architecture, and does not support 32
## Supported PHP Version
Currently, static php cli supports PHP versions 8.1 to 8.4, and theoretically supports PHP 8.0 and earlier versions.
Currently, static php cli supports PHP versions 8.0 to 8.3, and theoretically supports PHP 7.4 and earlier versions.
Simply select the earlier version when downloading.
However, due to some extensions and special components that have stopped supporting earlier versions of PHP,
static-php-cli will not explicitly support earlier versions.

View File

@@ -142,9 +142,9 @@ including php-src and the source code of various dependent libraries.
# Download all dependencies
bin/spc download --all
# Download all dependent packages, and specify the main version of PHP to download, optional: 8.1, 8.2, 8.3, 8.4
# Download all dependent packages, and specify the main version of PHP to download, optional: 7.3, 7.4, 8.0, 8.1, 8.2, 8.3
# Also supports specific version of php release: 8.3.10, 8.2.22, etc.
bin/spc download --all --with-php=8.3
bin/spc download --all --with-php=8.2
# Show download progress bar while downloading (curl)
bin/spc download --all --debug
@@ -272,12 +272,12 @@ If you want to build multiple versions of PHP and don't want to build other depe
you can use `switch-php-version` to quickly switch to another version and compile after compiling one version:
```shell
# switch to 8.4
bin/spc switch-php-version 8.4
# switch to 8.3
bin/spc switch-php-version 8.3
# build
bin/spc build bcmath,curl,openssl,ftp,posix,pcntl --build-cli
# switch to 8.1
bin/spc switch-php-version 8.1
# switch to 8.0
bin/spc switch-php-version 8.0
# build
bin/spc build bcmath,curl,openssl,ftp,posix,pcntl --build-cli
```

View File

@@ -70,10 +70,4 @@ PHP 代码的编译器是完全不同的项目,因此不会考虑额外的情
对于 Linux 系统,你可以从 curl 官方网站下载 [cacert.pem](https://curl.se/docs/caextract.html) 文件,也可以使用系统自带的证书文件。
有关不同发行版的证书位置,可参考 [Go 标准库](https://go.dev/src/crypto/x509/root_linux.go)。
> INI 配置 `openssl.cafile` 不可以使用 `ini_set()` 函数动态设置,因为 `openssl.cafile` 是一个 `PHP_INI_SYSTEM` 类型的配置,只能在 `php.ini` 文件中设置。
## 为什么不支持旧版本 PHP
因为旧版本的 PHP 有很多问题,比如安全问题、性能问题、功能问题等。此外,旧版本的 PHP 很多都无法与最新的依赖库兼容,这也是不支持旧版本 PHP 的原因之一。
你可以使用 static-php-cli 早期编译好的旧版本,如 PHP 8.0,但是不会明确支持早期版本。
> INI 配置 `openssl.cafile` 不可以使用 `ini_set()` 函数动态设置,因为 `openssl.cafile` 是一个 `PHP_INI_SYSTEM` 类型的配置,只能在 `php.ini` 文件中设置。

View File

@@ -43,7 +43,7 @@ swoole-hook-sqlite 与 `pdo_sqlite` 扩展冲突。如需使用 Swoole 和 `pdo_
## swow
1. swow 仅支持 PHP 8.0 ~ 8.4 版本。
1. swow 仅支持 PHP >= 8.0 版本。
## imap

View File

@@ -29,6 +29,6 @@ Windows 目前只支持 x86_64 架构,不支持 32 位 x86、不支持 arm64
## PHP 支持版本
目前static-php-cli 对 PHP 8.1 ~ 8.4 版本是支持的,对于 PHP 8.0 及更早版本理论上支持,只需下载时选择早期版本即可。
目前static-php-cli 对 PHP 7.4 ~ 8.3 版本是支持的,对于 PHP 7.4 及更早版本理论上支持,只需下载时选择早期版本即可。
但由于部分扩展和特殊组件已对早期版本的 PHP 停止了支持,所以 static-php-cli 不会明确支持早期版本。
我们推荐你编译尽可能新的 PHP 版本,以获得更好的体验。

View File

@@ -141,8 +141,8 @@ bin/spc download --for-extensions="curl,pcntl,xml,mbstring" --prefer-pre-built
# 下载所有依赖包
bin/spc download --all
# 下载所有依赖包,并指定下载的 PHP 主版本可选8.18.28.38.4也可以使用特定的版本,如 8.3.10。
bin/spc download --all --with-php=8.3
# 下载所有依赖包,并指定下载的 PHP 主版本,可选:7.37.48.08.18.28.3,也可以使用特定的版本,如 8.3.10。
bin/spc download --all --with-php=8.2
# 下载时显示下载进度条curl
bin/spc download --all --debug
@@ -236,12 +236,12 @@ bin/spc build bcmath,curl,openssl,ftp,posix,pcntl --build-cli
如果你想构建多个版本的 PHP且不想每次都重复构建其他依赖库可以使用 `switch-php-version` 在编译好一个版本后快速切换至另一个版本并编译:
```shell
# switch to 8.4
bin/spc switch-php-version 8.4
# switch to 8.3
bin/spc switch-php-version 8.3
# build
bin/spc build bcmath,curl,openssl,ftp,posix,pcntl --build-cli
# switch to 8.1
bin/spc switch-php-version 8.1
# switch to 8.0
bin/spc switch-php-version 8.0
# build
bin/spc build bcmath,curl,openssl,ftp,posix,pcntl --build-cli
```

View File

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

View File

@@ -6,7 +6,6 @@ namespace SPC\builder;
use SPC\exception\ExceptionHandler;
use SPC\exception\FileSystemException;
use SPC\exception\InterruptException;
use SPC\exception\RuntimeException;
use SPC\exception\WrongUsageException;
use SPC\store\Config;
@@ -408,13 +407,6 @@ abstract class BuilderBase
}
logger()->debug('Running additional patch script: ' . $patch);
require $patch;
} catch (InterruptException $e) {
if ($e->getCode() === 0) {
logger()->notice('Patch script ' . $patch . ' interrupted' . ($e->getMessage() ? (': ' . $e->getMessage()) : '.'));
} else {
logger()->error('Patch script ' . $patch . ' interrupted with error code [' . $e->getCode() . ']' . ($e->getMessage() ? (': ' . $e->getMessage()) : '.'));
}
exit($e->getCode());
} catch (\Throwable $e) {
logger()->critical('Patch script ' . $patch . ' failed to run.');
if ($this->getOption('debug')) {
@@ -422,7 +414,6 @@ abstract class BuilderBase
} else {
logger()->critical('Please check with --debug option to see more details.');
}
throw $e;
}
}
}

View File

@@ -1,45 +0,0 @@
<?php
declare(strict_types=1);
namespace SPC\builder\extension;
use SPC\builder\Extension;
use SPC\builder\macos\MacOSBuilder;
use SPC\builder\windows\WindowsBuilder;
use SPC\store\FileSystem;
use SPC\util\CustomExt;
use SPC\util\GlobalEnvManager;
#[CustomExt('grpc')]
class grpc extends Extension
{
public function patchBeforeBuildconf(): bool
{
// soft link to the grpc source code
if ($this->builder instanceof WindowsBuilder) {
// not support windows yet
throw new \RuntimeException('grpc extension does not support windows yet');
}
if (!is_link(SOURCE_PATH . '/php-src/ext/grpc')) {
shell()->exec('ln -s ' . $this->builder->getLib('grpc')->getSourceDir() . '/src/php/ext/grpc ' . SOURCE_PATH . '/php-src/ext/grpc');
$macos = $this->builder instanceof MacOSBuilder ? "\n" . ' LDFLAGS="$LDFLAGS -framework CoreFoundation"' : '';
FileSystem::replaceFileRegex(SOURCE_PATH . '/php-src/ext/grpc/config.m4', '/GRPC_LIBDIR=.*$/m', 'GRPC_LIBDIR=' . BUILD_LIB_PATH . $macos);
FileSystem::replaceFileRegex(SOURCE_PATH . '/php-src/ext/grpc/config.m4', '/SEARCH_PATH=.*$/m', 'SEARCH_PATH="' . BUILD_ROOT_PATH . '"');
return true;
}
return false;
}
public function patchBeforeMake(): bool
{
// add -Wno-strict-prototypes
GlobalEnvManager::putenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS=' . getenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS') . ' -Wno-strict-prototypes');
return true;
}
public function getUnixConfigureArg(): string
{
return '--enable-grpc=' . BUILD_ROOT_PATH . '/grpc GRPC_LIB_SUBDIR=' . BUILD_LIB_PATH;
}
}

View File

@@ -6,7 +6,6 @@ namespace SPC\builder\extension;
use SPC\builder\Extension;
use SPC\exception\WrongUsageException;
use SPC\store\FileSystem;
use SPC\util\CustomExt;
#[CustomExt('parallel')]
@@ -18,10 +17,4 @@ class parallel extends Extension
throw new WrongUsageException('ext-parallel must be built with ZTS builds. Use "--enable-zts" option!');
}
}
public function patchBeforeBuildconf(): bool
{
FileSystem::replaceFileRegex(SOURCE_PATH . '/php-src/ext/parallel/config.m4', '/PHP_VERSION=.*/m', '');
return true;
}
}

View File

@@ -6,8 +6,6 @@ namespace SPC\builder\extension;
use SPC\builder\Extension;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\exception\WrongUsageException;
use SPC\store\FileSystem;
use SPC\util\CustomExt;
@@ -16,19 +14,9 @@ class pgsql extends Extension
{
/**
* @throws FileSystemException
* @throws RuntimeException
* @throws WrongUsageException
*/
public function patchBeforeConfigure(): bool
{
if ($this->builder->getPHPVersionID() >= 80400) {
FileSystem::replaceFileStr(
SOURCE_PATH . '/php-src/configure',
'LIBS="-lpq',
'LIBS="-lpq -lpgport -lpgcommon -lssl -lcrypto -lz -lm'
);
return true;
}
FileSystem::replaceFileRegex(
SOURCE_PATH . '/php-src/configure',
'/-lpq/',
@@ -36,16 +24,4 @@ class pgsql extends Extension
);
return true;
}
/**
* @throws WrongUsageException
* @throws RuntimeException
*/
public function getUnixConfigureArg(): string
{
if ($this->builder->getPHPVersionID() >= 80400) {
return '--with-pgsql=' . BUILD_ROOT_PATH . ' PGSQL_CFLAGS=-I' . BUILD_INCLUDE_PATH . ' PGSQL_LIBS="-L' . BUILD_LIB_PATH . ' -lpq -lpgport -lpgcommon"';
}
return '--with-pgsql=' . BUILD_ROOT_PATH;
}
}

View File

@@ -1,5 +1,4 @@
<?php
/**
* Copyright (c) 2022 Yun Dou <dixyes@gmail.com>
*

View File

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

View File

@@ -1,5 +1,4 @@
<?php
/**
* Copyright (c) 2022 Yun Dou <dixyes@gmail.com>
*

View File

@@ -1,5 +1,4 @@
<?php
/**
* Copyright (c) 2022 Yun Dou <dixyes@gmail.com>
*

View File

@@ -1,5 +1,4 @@
<?php
/**
* Copyright (c) 2022 Yun Dou <dixyes@gmail.com>
*

View File

@@ -1,5 +1,4 @@
<?php
/**
* Copyright (c) 2022 Yun Dou <dixyes@gmail.com>
*

View File

@@ -1,5 +1,4 @@
<?php
/**
* Copyright (c) 2022 Yun Dou <dixyes@gmail.com>
*

View File

@@ -1,5 +1,4 @@
<?php
/**
* Copyright (c) 2022 Yun Dou <dixyes@gmail.com>
*

View File

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

View File

@@ -1,5 +1,4 @@
<?php
/**
* Copyright (c) 2022 Yun Dou <dixyes@gmail.com>
*

View File

@@ -1,5 +1,4 @@
<?php
/**
* Copyright (c) 2022 Yun Dou <dixyes@gmail.com>
*

View File

@@ -1,5 +1,4 @@
<?php
/**
* Copyright (c) 2022 Yun Dou <dixyes@gmail.com>
*

View File

@@ -1,5 +1,4 @@
<?php
/**
* Copyright (c) 2022 Yun Dou <dixyes@gmail.com>
*

View File

@@ -1,5 +1,4 @@
<?php
/**
* Copyright (c) 2022 Yun Dou <dixyes@gmail.com>
*

View File

@@ -1,5 +1,4 @@
<?php
/**
* Copyright (c) 2022 Yun Dou <dixyes@gmail.com>
*

View File

@@ -1,5 +1,4 @@
<?php
/**
* Copyright (c) 2022 Yun Dou <dixyes@gmail.com>
*

View File

@@ -1,24 +0,0 @@
<?php
declare(strict_types=1);
namespace SPC\builder\unix\library;
use SPC\store\FileSystem;
trait grpc
{
protected function build(): void
{
shell()->cd($this->source_dir)
->exec('EXTRA_DEFINES=GRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK EMBED_OPENSSL=false CXXFLAGS="-L' . BUILD_LIB_PATH . ' -I' . BUILD_INCLUDE_PATH . '" make static -j' . $this->builder->concurrency);
copy($this->source_dir . '/libs/opt/libgrpc.a', BUILD_LIB_PATH . '/libgrpc.a');
copy($this->source_dir . '/libs/opt/libboringssl.a', BUILD_LIB_PATH . '/libboringssl.a');
if (!file_exists(BUILD_LIB_PATH . '/libcares.a')) {
copy($this->source_dir . '/libs/opt/libcares.a', BUILD_LIB_PATH . '/libcares.a');
}
FileSystem::copyDir($this->source_dir . '/include/grpc', BUILD_INCLUDE_PATH . '/grpc');
FileSystem::copyDir($this->source_dir . '/include/grpc++', BUILD_INCLUDE_PATH . '/grpc++');
FileSystem::copyDir($this->source_dir . '/include/grpcpp', BUILD_INCLUDE_PATH . '/grpcpp');
}
}

View File

@@ -1,7 +0,0 @@
<?php
declare(strict_types=1);
namespace SPC\exception;
class InterruptException extends \Exception {}

View File

@@ -28,7 +28,7 @@ class Downloader
logger()->debug("finding {$name} source from bitbucket tag");
$data = json_decode(self::curlExec(
url: "https://api.bitbucket.org/2.0/repositories/{$source['repo']}/refs/tags",
retry: self::getRetryTime()
retry: intval(getenv('SPC_RETRY_TIME') ? getenv('SPC_RETRY_TIME') : 0)
), true);
$ver = $data['values'][0]['name'];
if (!$ver) {
@@ -38,7 +38,7 @@ class Downloader
$headers = self::curlExec(
url: $url,
method: 'HEAD',
retry: self::getRetryTime()
retry: intval(getenv('SPC_RETRY_TIME') ? getenv('SPC_RETRY_TIME') : 0)
);
preg_match('/^content-disposition:\s+attachment;\s*filename=("?)(?<filename>.+\.tar\.gz)\1/im', $headers, $matches);
if ($matches) {
@@ -66,7 +66,7 @@ class Downloader
$data = json_decode(self::curlExec(
url: "https://api.github.com/repos/{$source['repo']}/{$type}",
hooks: [[CurlHook::class, 'setupGithubToken']],
retry: self::getRetryTime()
retry: intval(getenv('SPC_RETRY_TIME') ? getenv('SPC_RETRY_TIME') : 0)
), true);
if (($source['prefer-stable'] ?? false) === false) {
@@ -85,7 +85,7 @@ class Downloader
url: $url,
method: 'HEAD',
hooks: [[CurlHook::class, 'setupGithubToken']],
retry: self::getRetryTime()
retry: intval(getenv('SPC_RETRY_TIME') ? getenv('SPC_RETRY_TIME') : 0)
);
preg_match('/^content-disposition:\s+attachment;\s*filename=("?)(?<filename>.+\.tar\.gz)\1/im', $headers, $matches);
if ($matches) {
@@ -108,11 +108,11 @@ class Downloader
*/
public static function getLatestGithubRelease(string $name, array $source, bool $match_result = true): array
{
logger()->debug("finding {$name} from github releases assets");
logger()->debug("finding {$name} from github releases assests");
$data = json_decode(self::curlExec(
url: "https://api.github.com/repos/{$source['repo']}/releases",
hooks: [[CurlHook::class, 'setupGithubToken']],
retry: self::getRetryTime()
retry: intval(getenv('SPC_RETRY_TIME') ? getenv('SPC_RETRY_TIME') : 0)
), true);
$url = null;
foreach ($data as $release) {
@@ -149,7 +149,7 @@ class Downloader
public static function getFromFileList(string $name, array $source): array
{
logger()->debug("finding {$name} source from file list");
$page = self::curlExec($source['url'], retry: self::getRetryTime());
$page = self::curlExec($source['url'], retry: intval(getenv('SPC_RETRY_TIME') ? getenv('SPC_RETRY_TIME') : 0));
preg_match_all($source['regex'], $page, $matches);
if (!$matches) {
throw new DownloaderException("Failed to get {$name} version");
@@ -194,7 +194,7 @@ class Downloader
}
};
self::registerCancelEvent($cancel_func);
self::curlDown(url: $url, path: FileSystem::convertPath(DOWNLOAD_PATH . "/{$filename}"), retry: self::getRetryTime());
self::curlDown(url: $url, path: FileSystem::convertPath(DOWNLOAD_PATH . "/{$filename}"), retry: intval(getenv('SPC_RETRY_TIME') ? getenv('SPC_RETRY_TIME') : 0));
self::unregisterCancelEvent();
logger()->debug("Locking {$filename}");
self::lockSource($name, ['source_type' => 'archive', 'filename' => $filename, 'move_path' => $move_path, 'lock_as' => $lock_as]);
@@ -347,7 +347,7 @@ class Downloader
$pkg['url'],
$pkg['rev'],
$pkg['extract'] ?? null,
self::getRetryTime(),
intval(getenv('SPC_RETRY_TIME') ? getenv('SPC_RETRY_TIME') : 0),
SPC_LOCK_PRE_BUILT
);
break;
@@ -451,7 +451,7 @@ class Downloader
$source['url'],
$source['rev'],
$source['path'] ?? null,
self::getRetryTime(),
intval(getenv('SPC_RETRY_TIME') ? getenv('SPC_RETRY_TIME') : 0),
$lock_as
);
break;
@@ -567,7 +567,7 @@ class Downloader
}
if ($retry > 0) {
logger()->notice('Retrying curl download ...');
self::curlDown($url, $path, $method, $used_headers, retry: $retry - 1);
self::curlDown($url, $path, $method, $used_headers, retry: intval(getenv('SPC_RETRY_TIME') ? getenv('SPC_RETRY_TIME') : 0));
return;
}
throw $e;
@@ -601,9 +601,4 @@ class Downloader
pcntl_signal(2, SIG_IGN);
}
}
private static function getRetryTime(): int
{
return intval(getenv('SPC_RETRY_TIME') ? getenv('SPC_RETRY_TIME') : 0);
}
}

View File

@@ -439,7 +439,7 @@ class SourcePatcher
return true;
}
if ($ver_id < 80200) {
// self::patchFile('spc_fix_libxml2_12_php81.patch', SOURCE_PATH . '/php-src');
self::patchFile('spc_fix_libxml2_12_php81.patch', SOURCE_PATH . '/php-src');
self::patchFile('spc_fix_alpine_build_php80.patch', SOURCE_PATH . '/php-src');
return true;
}

View File

@@ -19,8 +19,12 @@ class PhpSource extends CustomSourceBase
*/
public function fetch(bool $force = false, ?array $config = null, int $lock_as = SPC_LOCK_SOURCE): void
{
$major = defined('SPC_BUILD_PHP_VERSION') ? SPC_BUILD_PHP_VERSION : '8.3';
Downloader::downloadSource('php-src', self::getLatestPHPInfo($major), $force);
$major = defined('SPC_BUILD_PHP_VERSION') ? SPC_BUILD_PHP_VERSION : '8.1';
if ($major === '8.4') {
Downloader::downloadSource('php-src', ['type' => 'url', 'url' => 'https://downloads.php.net/~saki/php-8.4.0RC3.tar.xz'], $force);
} else {
Downloader::downloadSource('php-src', self::getLatestPHPInfo($major), $force);
}
}
/**

View File

@@ -1,5 +0,0 @@
<?php
declare(strict_types=1);
assert(class_exists('Grpc\ChannelCredentials'));

View File

@@ -5,7 +5,6 @@ declare(strict_types=1);
use Psr\Log\LoggerInterface;
use SPC\builder\BuilderBase;
use SPC\builder\BuilderProvider;
use SPC\exception\InterruptException;
use SPC\exception\RuntimeException;
use SPC\exception\WrongUsageException;
use SPC\util\UnixShell;
@@ -126,11 +125,6 @@ function patch_point(): string
return BuilderProvider::getBuilder()->getPatchPoint();
}
function patch_point_interrupt(int $retcode, string $msg = ''): InterruptException
{
return new InterruptException(message: $msg, code: $retcode);
}
// ------- function f_* part -------
// f_ means standard function wrapper

View File

@@ -23,10 +23,12 @@ $test_php_version = [
$test_os = [
'macos-14',
'ubuntu-latest',
'macos-13',
'windows-latest',
];
// whether enable thread safe
$zts = true;
$zts = false;
$no_strip = false;
@@ -38,7 +40,7 @@ $prefer_pre_built = false;
// If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`).
$extensions = match (PHP_OS_FAMILY) {
'Linux', 'Darwin' => 'parallel',
'Linux', 'Darwin' => '',
'Windows' => 'amqp,apcu,bcmath,bz2,calendar,ctype,curl,dba,dom,ds,exif,ffi,fileinfo,filter,ftp,gd,iconv,igbinary,libxml,mbregex,mbstring,mysqli,mysqlnd,opcache,openssl,pdo,pdo_mysql,pdo_sqlite,pdo_sqlsrv,phar,rar,redis,session,shmop,simdjson,simplexml,soap,sockets,sqlite3,sqlsrv,ssh2,swow,sysvshm,tokenizer,xml,xmlreader,xmlwriter,yac,yaml,zip,zlib',
};
@@ -52,7 +54,7 @@ $with_libs = match (PHP_OS_FAMILY) {
// You can use `common`, `bulk`, `minimal` or `none`.
// note: combination is only available for *nix platform. Windows must use `none` combination
$base_combination = match (PHP_OS_FAMILY) {
'Linux', 'Darwin' => 'minimal',
'Linux', 'Darwin' => 'bulk',
'Windows' => 'none',
};

View File

@@ -246,7 +246,6 @@ class BuilderTest extends TestCase
public function testEmitPatchPointNotExists()
{
$this->expectOutputRegex('/failed to run/');
$this->expectException(RuntimeException::class);
$this->builder->setOption('with-added-patch', ['/tmp/patch-point.not_exsssists.php']);
$this->builder->emitPatchPoint('not-exists');
}