[go: up one dir, main page]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PHP 8.4 support (testing) #556

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
148 changes: 148 additions & 0 deletions .github/workflows/ext-matrix-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
name: "Extension matrix tests"

on:
workflow_dispatch:
pull_request:
branches: [ "main" ]
paths:
- '.github/workflows/ext-matrix-tests.yml'

jobs:
test:
name: "${{ matrix.extension }} (PHP ${{ matrix.php-version }} on ${{ matrix.operating-system }})"
runs-on: ${{ matrix.operating-system }}
strategy:
fail-fast: false
matrix:
extension:
- amqp
- apcu
- bcmath
- bz2
- calendar
- ctype
- curl
- dba
- dom
- ds
- event
- exif
- filter
- fileinfo
- ftp
- gd
- gettext
- gmp
- iconv
- igbinary
- imagick
- imap
- intl
- ldap
- mbstring,mbregex
- memcache
- mysqli,mysqlnd,pdo_mysql
- opcache
- openssl
- pcntl
- password-argon2
- pcntl
- pdo
- pgsql,pdo_pgsql
- phar
- posix
- rar
- protobuf
- readline
- redis
- session
- shmop
- simdjson
- simplexml,xml
- snappy
- soap
- sockets
- sodium
- sqlite3,pdo_sqlite
- sqlsrv
- ssh2
- swoole
- swoole,swoole-hook-pgsql,swoole-hook-mysql,swoole-hook-sqlite
- swow
- sysvmsg,sysvsem,sysvshm
- tidy
- tokenizer
- uuid
- uv
- xhprof
- xlswriter
- xmlwriter,xmlreader
- xsl
- yac
- yaml
- zip
- zlib
- zstd
php-version:
- "8.4"
operating-system:
- "ubuntu-latest"
#- "macos-13"
#- "debian-arm64-self-hosted"
- "macos-14"

steps:
- name: "Checkout"
uses: "actions/checkout@v4"

- name: OS type
id: os-type
run: |
OS=""
if [ "${{ matrix.operating-system }}" = "ubuntu-latest" ]; then
OS="linux-x86_64"
elif [ "${{ matrix.operating-system }}" = "macos-13" ]; then
OS="macos-x86_64"
elif [ "${{ matrix.operating-system }}" = "debian-arm64-self-hosted" ]; then
OS="linux-aarch64"
elif [ "${{ matrix.operating-system }}" = "macos-14" ]; then
OS="macos-aarch64"
fi
echo "OS=$OS" >> $GITHUB_ENV

- name: "Setup PHP"
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
tools: pecl, composer
extensions: curl, openssl, mbstring
ini-values: memory_limit=-1
env:
phpts: nts

- name: "Install Dependencies"
run: composer update -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist

- id: cache-download
uses: actions/cache@v4
with:
path: downloads
key: php-${{ matrix.php-version }}-dependencies-for-tests

# If there's no dependencies cache, fetch sources
- name: "Download sources"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./bin/spc download --with-php=${{ matrix.php-version }} --for-extensions=${{ matrix.extension }} --debug --ignore-cache-sources=php-src

- name: "Build library: ${{ matrix.library }}"
run: |
SPC_USE_SUDO=yes ./bin/spc doctor --auto-fix
if [ "${{ env.OS }}" = "linux-x86_64" ]; then
./bin/spc install-pkg upx
UPX=--with-upx-pack
elif [ "${{ env.OS }}" = "linux-aarch64" ]; then
./bin/spc install-pkg upx
UPX=--with-upx-pack
fi
./bin/spc build --build-cli --build-micro --build-fpm ${{ matrix.extension }} --debug $UPX --with-suggested-libs --with-suggested-exts
22 changes: 12 additions & 10 deletions README-zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,18 @@ static-php-cli(简称 `spc`)有许多特性:
>
> :x: 不支持

| PHP Version | Status | Comment |
|-------------|--------------------|------------------------------|
| 7.2 | :x: | |
| 7.3 | :warning: | phpmicro 和许多扩展不支持 7.3、7.4 版本 |
| 7.4 | :warning: | phpmicro 和许多扩展不支持 7.3、7.4 版本 |
| 8.0 | :heavy_check_mark: | PHP 官方已停止 8.0 的维护 |
| 8.1 | :heavy_check_mark: | PHP 官方仅对 8.1 提供安全更新 |
| 8.2 | :heavy_check_mark: | |
| 8.3 | :heavy_check_mark: | |
| 8.4 | :x: | WIP |
| PHP Version | Status | Comment |
|-------------|--------------------|----------------------------------------------|
| 7.2 | :x: | |
| 7.3 | :x: | phpmicro 和许多扩展不支持 7.3、7.4 版本 |
| 7.4 | :x: | phpmicro 和许多扩展不支持 7.3、7.4 版本 |
| 8.0 | :warning: | PHP 官方已停止 8.0 的维护,我们不再处理 8.0 相关的 backport 支持 |
| 8.1 | :heavy_check_mark: | PHP 官方仅对 8.1 提供安全更新 |
| 8.2 | :heavy_check_mark: | |
| 8.3 | :heavy_check_mark: | |
| 8.4 | :heavy_check_mark: | |

> 这个表格的支持状态是 static-php-cli 对构建对应版本的支持情况,不是 PHP 官方对该版本的支持情况。

### 支持的扩展

Expand Down
23 changes: 13 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,16 +89,19 @@ Currently supported PHP versions for compilation:
>
> :x: not supported

| PHP Version | Status | Comment |
|-------------|--------------------|---------------------------------------------------|
| 7.2 | :x: | |
| 7.3 | :warning: | phpmicro and some extensions not supported on 7.x |
| 7.4 | :warning: | phpmicro and some extensions not supported on 7.x |
| 8.0 | :heavy_check_mark: | PHP official has stopped maintenance of 8.0 |
| 8.1 | :heavy_check_mark: | PHP official has security fixes only |
| 8.2 | :heavy_check_mark: | |
| 8.3 | :heavy_check_mark: | |
| 8.4 | :x: | WIP |
| PHP Version | Status | Comment |
|-------------|--------------------|----------------------------------------------------------------------------------------------------|
| 7.2 | :x: | |
| 7.3 | :x: | phpmicro and some extensions not supported on 7.x |
| 7.4 | :x: | phpmicro and some extensions not supported on 7.x |
| 8.0 | :warning: | PHP official has stopped maintenance of 8.0, we no longer provide backport support for version 8.0 |
| 8.1 | :heavy_check_mark: | PHP official has security fixes only |
| 8.2 | :heavy_check_mark: | |
| 8.3 | :heavy_check_mark: | |
| 8.4 | :heavy_check_mark: | |

> This table shows the support status for static-php-cli in building the corresponding version,
> not the official PHP support status for that version.

### Supported Extensions

Expand Down
2 changes: 1 addition & 1 deletion config/env.ini
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS="${SPC_PHP_DEFAULT_OPTIMIZE_CFLAGS} -fno-ident
; EXTRA_LIBS for `make` php
SPC_CMD_VAR_PHP_MAKE_EXTRA_LIBS=""
; EXTRA_LDFLAGS_PROGRAM for `make` php
SPC_CMD_VAR_PHP_MAKE_EXTRA_LDFLAGS_PROGRAM="-all-static"
SPC_CMD_VAR_PHP_MAKE_EXTRA_LDFLAGS_PROGRAM="-all-static -Wl,-O1 -pie"

[macos]
; compiler environments
Expand Down
3 changes: 2 additions & 1 deletion config/ext.json
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,8 @@
"BSD": "wip"
},
"notes": true,
"type": "builtin",
"type": "external",
"source": "ext-imap",
"arg-type": "custom",
"lib-depends": [
"imap"
Expand Down
25 changes: 21 additions & 4 deletions config/source.json
Original file line number Diff line number Diff line change
Expand Up @@ -249,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",
Expand Down Expand Up @@ -513,7 +525,7 @@
"micro": {
"type": "git",
"path": "php-src/sapi/micro",
"rev": "master",
"rev": "84beta",
"url": "https://github.com/static-php/phpmicro",
"license": {
"type": "file",
Expand Down Expand Up @@ -726,13 +738,18 @@
}
},
"swoole": {
"type": "ghtar",
"path": "php-src/ext/swoole",
"repo": "swoole/swoole-src",
"prefer-stable": true,
"type": "git",
"rev": "master",
"url": "https://github.com/swoole/swoole-src.git",
"license": {
"type": "file",
"path": "LICENSE"
},
"alt": {
"type": "ghtar",
"repo": "swoole/swoole-src",
"prefer-stable": true
}
},
"swow": {
Expand Down
2 changes: 1 addition & 1 deletion src/SPC/ConsoleApplication.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
*/
final class ConsoleApplication extends Application
{
public const VERSION = '2.3.6';
public const VERSION = '2.4.0';

public function __construct()
{
Expand Down
2 changes: 1 addition & 1 deletion src/SPC/builder/BuilderBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ public function getPHPVersionFromArchive(?string $file = null): false|string
return false;
}
}
if (preg_match('/php-(\d+\.\d+\.\d+)/', $file, $match)) {
if (preg_match('/php-(\d+\.\d+\.\d+(?:RC\d+)?)\.tar\.(?:gz|bz2|xz)/', $file, $match)) {
return $match[1];
}
return false;
Expand Down
35 changes: 0 additions & 35 deletions src/SPC/builder/extension/sodium.php

This file was deleted.

3 changes: 3 additions & 0 deletions src/SPC/builder/extension/zlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ class zlib extends Extension
{
public function getUnixConfigureArg(): string
{
if ($this->builder->getPHPVersionID() >= 80400) {
return '--with-zlib';
}
return '--with-zlib --with-zlib-dir="' . BUILD_ROOT_PATH . '"';
}
}
2 changes: 1 addition & 1 deletion src/SPC/builder/macos/library/imap.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ protected function build(): void
->exec('chmod +x src/osdep/unix/drivers')
->exec('chmod +x src/osdep/unix/mkauths')
->exec(
"yes | make osx {$ssl_options} EXTRACFLAGS='-Wimplicit-function-declaration -Wno-incompatible-function-pointer-types {$out}'"
"echo y | make osx {$ssl_options} EXTRACFLAGS='-Wno-implicit-function-declaration -Wno-incompatible-function-pointer-types {$out}'"
);
try {
shell()
Expand Down
2 changes: 1 addition & 1 deletion src/SPC/command/DownloadCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function configure(): void
$this->addArgument('sources', InputArgument::REQUIRED, 'The sources will be compiled, comma separated');
$this->addOption('shallow-clone', null, null, 'Clone shallow');
$this->addOption('with-openssl11', null, null, 'Use openssl 1.1');
$this->addOption('with-php', null, InputOption::VALUE_REQUIRED, 'version in major.minor format (default 8.2)', '8.2');
$this->addOption('with-php', null, InputOption::VALUE_REQUIRED, 'version in major.minor format (default 8.3)', '8.3');
$this->addOption('clean', null, null, 'Clean old download cache and source before fetch');
$this->addOption('all', 'A', null, 'Fetch all sources that static-php-cli needed');
$this->addOption('custom-url', 'U', InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Specify custom source download url, e.g "php-src:https://downloads.php.net/~eric/php-8.3.0beta1.tar.gz"');
Expand Down
6 changes: 3 additions & 3 deletions src/SPC/command/SwitchPhpVersionCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ public function configure()
$this->addArgument(
'php-major-version',
InputArgument::REQUIRED,
'PHP major version (supported: 7.4, 8.0, 8.1, 8.2, 8.3)',
'PHP major version (supported: 7.4, 8.0, 8.1, 8.2, 8.3, 8.4)',
null,
fn () => ['7.4', '8.0', '8.1', '8.2', '8.3']
fn () => ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
);
$this->no_motd = true;

Expand All @@ -31,7 +31,7 @@ public function configure()
public function handle(): int
{
$php_ver = $this->input->getArgument('php-major-version');
if (!in_array($php_ver, ['7.4', '8.0', '8.1', '8.2', '8.3'])) {
if (!in_array($php_ver, ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4'])) {
// match x.y.z
preg_match('/^\d+\.\d+\.\d+$/', $php_ver, $matches);
if (!$matches) {
Expand Down
3 changes: 3 additions & 0 deletions src/SPC/store/FileSystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,9 @@ public static function removeDir(string $dir): bool
}
}
}
if (is_link($dir)) {
return unlink($dir);
}
return rmdir($dir);
}

Expand Down
Loading
Loading