Compare commits

...

13 Commits
2.4.0 ... 2.4.1

Author SHA1 Message Date
crazywhalecc
bc7dba6125 Fix parallel config.m4 2024-12-05 18:51:57 +08:00
crazywhalecc
3ce24da15c Fix patch point tests 2024-12-05 18:51:57 +08:00
crazywhalecc
3659e20b0d Fix patch point tests 2024-12-05 18:51:57 +08:00
crazywhalecc
a90a57ffab Add extension configure tests 2024-12-05 18:51:57 +08:00
crazywhalecc
45bdb6a66b Add extension configure tests 2024-12-05 18:51:57 +08:00
crazywhalecc
64258e3513 Fix pgsql linux builds with PHP 8.4 2024-12-05 18:30:19 +08:00
crazywhalecc
fe72b800c6 Add pgsql tests 2024-12-05 13:48:27 +08:00
crazywhalecc
39bc44322e cs-fix 2024-12-05 13:48:27 +08:00
crazywhalecc
1a0e6ee717 cs-fix, add tests 2024-12-05 13:48:27 +08:00
crazywhalecc
cc088b6382 Let grpc use openssl 2024-12-05 13:48:27 +08:00
crazywhalecc
b9f709c23d Change ext.json for pgsql 2024-12-05 13:48:27 +08:00
crazywhalecc
05b602d38c Fix pgsql with PHP 8.4 embed missing libs bug 2024-12-05 13:48:27 +08:00
Simon Hamp
a8a071de1a Add missing step 2024-12-01 16:11:05 +08:00
28 changed files with 102 additions and 23 deletions

28
composer.lock generated
View File

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

View File

@@ -524,7 +524,7 @@
}, },
"notes": true, "notes": true,
"type": "builtin", "type": "builtin",
"arg-type": "with-prefix", "arg-type": "custom",
"lib-depends": [ "lib-depends": [
"postgresql" "postgresql"
] ]

View File

@@ -147,7 +147,8 @@
"libcares.a" "libcares.a"
], ],
"lib-depends": [ "lib-depends": [
"zlib" "zlib",
"openssl"
], ],
"frameworks": [ "frameworks": [
"CoreFoundation" "CoreFoundation"

View File

@@ -36,9 +36,13 @@
} }
}, },
"bzip2": { "bzip2": {
"type": "filelist", "alt": {
"url": "https://sourceware.org/pub/bzip2/", "type": "filelist",
"regex": "/href=\"(?<file>bzip2-(?<version>[^\"]+)\\.tar\\.gz)\"/", "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",
"provide-pre-built": true, "provide-pre-built": true,
"license": { "license": {
"type": "text", "type": "text",

View File

@@ -74,6 +74,12 @@ bin/setup-runtime -action add-path
bin/setup-runtime -action remove-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) ### Install other Tools (automatic)
For `php-sdk-binary-tools`, `strawberry-perl`, and `nasm`, For `php-sdk-binary-tools`, `strawberry-perl`, and `nasm`,

View File

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

View File

@@ -6,6 +6,7 @@ namespace SPC\builder;
use SPC\exception\ExceptionHandler; use SPC\exception\ExceptionHandler;
use SPC\exception\FileSystemException; use SPC\exception\FileSystemException;
use SPC\exception\InterruptException;
use SPC\exception\RuntimeException; use SPC\exception\RuntimeException;
use SPC\exception\WrongUsageException; use SPC\exception\WrongUsageException;
use SPC\store\Config; use SPC\store\Config;
@@ -407,6 +408,13 @@ abstract class BuilderBase
} }
logger()->debug('Running additional patch script: ' . $patch); logger()->debug('Running additional patch script: ' . $patch);
require $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) { } catch (\Throwable $e) {
logger()->critical('Patch script ' . $patch . ' failed to run.'); logger()->critical('Patch script ' . $patch . ' failed to run.');
if ($this->getOption('debug')) { if ($this->getOption('debug')) {
@@ -414,6 +422,7 @@ abstract class BuilderBase
} else { } else {
logger()->critical('Please check with --debug option to see more details.'); logger()->critical('Please check with --debug option to see more details.');
} }
throw $e;
} }
} }
} }

View File

@@ -6,6 +6,7 @@ namespace SPC\builder\extension;
use SPC\builder\Extension; use SPC\builder\Extension;
use SPC\exception\WrongUsageException; use SPC\exception\WrongUsageException;
use SPC\store\FileSystem;
use SPC\util\CustomExt; use SPC\util\CustomExt;
#[CustomExt('parallel')] #[CustomExt('parallel')]
@@ -17,4 +18,10 @@ class parallel extends Extension
throw new WrongUsageException('ext-parallel must be built with ZTS builds. Use "--enable-zts" option!'); 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,6 +6,8 @@ namespace SPC\builder\extension;
use SPC\builder\Extension; use SPC\builder\Extension;
use SPC\exception\FileSystemException; use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\exception\WrongUsageException;
use SPC\store\FileSystem; use SPC\store\FileSystem;
use SPC\util\CustomExt; use SPC\util\CustomExt;
@@ -14,9 +16,19 @@ class pgsql extends Extension
{ {
/** /**
* @throws FileSystemException * @throws FileSystemException
* @throws RuntimeException
* @throws WrongUsageException
*/ */
public function patchBeforeConfigure(): bool 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( FileSystem::replaceFileRegex(
SOURCE_PATH . '/php-src/configure', SOURCE_PATH . '/php-src/configure',
'/-lpq/', '/-lpq/',
@@ -24,4 +36,16 @@ class pgsql extends Extension
); );
return true; 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,4 +1,5 @@
<?php <?php
/** /**
* Copyright (c) 2022 Yun Dou <dixyes@gmail.com> * Copyright (c) 2022 Yun Dou <dixyes@gmail.com>
* *

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -11,7 +11,7 @@ trait grpc
protected function build(): void protected function build(): void
{ {
shell()->cd($this->source_dir) shell()->cd($this->source_dir)
->exec('EXTRA_DEFINES=GRPC_POSIX_FORK_ALLOW_PTHREAD_ATFORK CXXFLAGS="-L' . BUILD_LIB_PATH . ' -I' . BUILD_INCLUDE_PATH . '" make static -j' . $this->builder->concurrency); ->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/libgrpc.a', BUILD_LIB_PATH . '/libgrpc.a');
copy($this->source_dir . '/libs/opt/libboringssl.a', BUILD_LIB_PATH . '/libboringssl.a'); copy($this->source_dir . '/libs/opt/libboringssl.a', BUILD_LIB_PATH . '/libboringssl.a');
if (!file_exists(BUILD_LIB_PATH . '/libcares.a')) { if (!file_exists(BUILD_LIB_PATH . '/libcares.a')) {

View File

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

View File

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

View File

@@ -26,7 +26,7 @@ $test_os = [
]; ];
// whether enable thread safe // whether enable thread safe
$zts = false; $zts = true;
$no_strip = false; $no_strip = false;
@@ -38,7 +38,7 @@ $prefer_pre_built = false;
// If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`). // If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`).
$extensions = match (PHP_OS_FAMILY) { $extensions = match (PHP_OS_FAMILY) {
'Linux', 'Darwin' => 'grpc', 'Linux', 'Darwin' => 'parallel',
'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', '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',
}; };

View File

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