mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 04:44:53 +08:00
Merge pull request #782 from crazywhalecc/fix/aarch64-uv-pthread
fix uv missing pthread_atfork in aarch64 centos 7
This commit is contained in:
commit
6c47065686
@ -193,7 +193,7 @@ class Extension
|
|||||||
* If you need to patch some code, overwrite this
|
* If you need to patch some code, overwrite this
|
||||||
* return true if you patched something, false if not
|
* return true if you patched something, false if not
|
||||||
*/
|
*/
|
||||||
public function patchBeforeSharedBuild(): bool
|
public function patchBeforeSharedPhpize(): bool
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -208,6 +208,16 @@ class Extension
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Patch code before shared extension make
|
||||||
|
* If you need to patch some code, overwrite this
|
||||||
|
* return true if you patched something, false if not
|
||||||
|
*/
|
||||||
|
public function patchBeforeSharedMake(): bool
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
* returns a command line string with all required shared extensions to load
|
* returns a command line string with all required shared extensions to load
|
||||||
@ -387,13 +397,17 @@ class Extension
|
|||||||
'LD_LIBRARY_PATH' => BUILD_LIB_PATH,
|
'LD_LIBRARY_PATH' => BUILD_LIB_PATH,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
if ($this->patchBeforeSharedPhpize()) {
|
||||||
|
logger()->info("Extension [{$this->getName()}] patched before shared phpize");
|
||||||
|
}
|
||||||
|
|
||||||
// prepare configure args
|
// prepare configure args
|
||||||
shell()->cd($this->source_dir)
|
shell()->cd($this->source_dir)
|
||||||
->setEnv($env)
|
->setEnv($env)
|
||||||
->exec(BUILD_BIN_PATH . '/phpize');
|
->exec(BUILD_BIN_PATH . '/phpize');
|
||||||
|
|
||||||
if ($this->patchBeforeSharedConfigure()) {
|
if ($this->patchBeforeSharedConfigure()) {
|
||||||
logger()->info('ext [ . ' . $this->getName() . '] patching before shared configure');
|
logger()->info("Extension [{$this->getName()}] patched before shared configure");
|
||||||
}
|
}
|
||||||
|
|
||||||
shell()->cd($this->source_dir)
|
shell()->cd($this->source_dir)
|
||||||
@ -411,6 +425,10 @@ class Extension
|
|||||||
'$1 ' . $staticLibString
|
'$1 ' . $staticLibString
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if ($this->patchBeforeSharedMake()) {
|
||||||
|
logger()->info("Extension [{$this->getName()}] patched before shared make");
|
||||||
|
}
|
||||||
|
|
||||||
shell()->cd($this->source_dir)
|
shell()->cd($this->source_dir)
|
||||||
->setEnv($env)
|
->setEnv($env)
|
||||||
->exec('make clean')
|
->exec('make clean')
|
||||||
|
|||||||
@ -22,7 +22,7 @@ class intl extends Extension
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function patchBeforeSharedBuild(): bool
|
public function patchBeforeSharedPhpize(): bool
|
||||||
{
|
{
|
||||||
return $this->patchBeforeBuildconf();
|
return $this->patchBeforeBuildconf();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||||||
namespace SPC\builder\extension;
|
namespace SPC\builder\extension;
|
||||||
|
|
||||||
use SPC\builder\Extension;
|
use SPC\builder\Extension;
|
||||||
|
use SPC\store\FileSystem;
|
||||||
use SPC\util\CustomExt;
|
use SPC\util\CustomExt;
|
||||||
|
|
||||||
#[CustomExt('uv')]
|
#[CustomExt('uv')]
|
||||||
@ -16,4 +17,13 @@ class uv extends Extension
|
|||||||
throw new \RuntimeException('The latest uv extension requires PHP 8.0 or later');
|
throw new \RuntimeException('The latest uv extension requires PHP 8.0 or later');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function patchBeforeSharedMake(): bool
|
||||||
|
{
|
||||||
|
if (PHP_OS_FAMILY !== 'Linux' || arch2gnu(php_uname('m')) !== 'aarch64') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
FileSystem::replaceFileRegex($this->source_dir . '/Makefile', '/^(LDFLAGS =.*)$/m', '$1 -luv -ldl -lrt -pthread');
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -207,8 +207,6 @@ class BuildPHPCommand extends BuildCommand
|
|||||||
// start to build
|
// start to build
|
||||||
$builder->buildPHP($rule);
|
$builder->buildPHP($rule);
|
||||||
|
|
||||||
SourcePatcher::patchBeforeSharedBuild($builder);
|
|
||||||
|
|
||||||
// build dynamic extensions if needed
|
// build dynamic extensions if needed
|
||||||
if (!empty($shared_extensions)) {
|
if (!empty($shared_extensions)) {
|
||||||
logger()->info('Building shared extensions ...');
|
logger()->info('Building shared extensions ...');
|
||||||
|
|||||||
@ -61,8 +61,7 @@ class LinuxToolCheckList
|
|||||||
|
|
||||||
$required = match ($distro['dist']) {
|
$required = match ($distro['dist']) {
|
||||||
'alpine' => self::TOOLS_ALPINE,
|
'alpine' => self::TOOLS_ALPINE,
|
||||||
'redhat' => self::TOOLS_RHEL,
|
'redhat', 'centos' => self::TOOLS_RHEL,
|
||||||
'centos' => array_merge(self::TOOLS_RHEL, ['perl-IPC-Cmd']),
|
|
||||||
'arch' => self::TOOLS_ARCH,
|
'arch' => self::TOOLS_ARCH,
|
||||||
default => self::TOOLS_DEBIAN,
|
default => self::TOOLS_DEBIAN,
|
||||||
};
|
};
|
||||||
|
|||||||
@ -46,12 +46,12 @@ class SourcePatcher
|
|||||||
{
|
{
|
||||||
foreach ($builder->getExts() as $ext) {
|
foreach ($builder->getExts() as $ext) {
|
||||||
if ($ext->patchBeforeBuildconf() === true) {
|
if ($ext->patchBeforeBuildconf() === true) {
|
||||||
logger()->info('Extension [' . $ext->getName() . '] patched before buildconf');
|
logger()->info("Extension [{$ext->getName()}] patched before buildconf");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach ($builder->getLibs() as $lib) {
|
foreach ($builder->getLibs() as $lib) {
|
||||||
if ($lib->patchBeforeBuildconf() === true) {
|
if ($lib->patchBeforeBuildconf() === true) {
|
||||||
logger()->info('Library [' . $lib->getName() . '] patched before buildconf');
|
logger()->info("Library [{$lib->getName()}]patched before buildconf");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// patch windows php 8.1 bug
|
// patch windows php 8.1 bug
|
||||||
@ -79,15 +79,6 @@ class SourcePatcher
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function patchBeforeSharedBuild(BuilderBase $builder): void
|
|
||||||
{
|
|
||||||
foreach ($builder->getExts() as $ext) {
|
|
||||||
if ($ext->patchBeforeSharedBuild() === true) {
|
|
||||||
logger()->info('Extension [' . $ext->getName() . '] patched before shared build');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Source patcher runner before configure
|
* Source patcher runner before configure
|
||||||
*
|
*
|
||||||
@ -98,12 +89,12 @@ class SourcePatcher
|
|||||||
{
|
{
|
||||||
foreach ($builder->getExts() as $ext) {
|
foreach ($builder->getExts() as $ext) {
|
||||||
if ($ext->patchBeforeConfigure() === true) {
|
if ($ext->patchBeforeConfigure() === true) {
|
||||||
logger()->info('Extension [' . $ext->getName() . '] patched before configure');
|
logger()->info("Extension [{$ext->getName()}] patched before configure");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach ($builder->getLibs() as $lib) {
|
foreach ($builder->getLibs() as $lib) {
|
||||||
if ($lib->patchBeforeConfigure() === true) {
|
if ($lib->patchBeforeConfigure() === true) {
|
||||||
logger()->info('Library [' . $lib->getName() . '] patched before configure');
|
logger()->info("Library [{$lib->getName()}] patched before configure");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// patch capstone
|
// patch capstone
|
||||||
@ -279,12 +270,12 @@ class SourcePatcher
|
|||||||
// call extension patch before make
|
// call extension patch before make
|
||||||
foreach ($builder->getExts(false) as $ext) {
|
foreach ($builder->getExts(false) as $ext) {
|
||||||
if ($ext->patchBeforeMake() === true) {
|
if ($ext->patchBeforeMake() === true) {
|
||||||
logger()->info('Extension [' . $ext->getName() . '] patched before make');
|
logger()->info("Extension [{$ext->getName()}] patched before make");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
foreach ($builder->getLibs() as $lib) {
|
foreach ($builder->getLibs() as $lib) {
|
||||||
if ($lib->patchBeforeMake() === true) {
|
if ($lib->patchBeforeMake() === true) {
|
||||||
logger()->info('Library [' . $lib->getName() . '] patched before make');
|
logger()->info("Library [{$lib->getName()}] patched before make");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,19 +21,19 @@ $test_php_version = [
|
|||||||
|
|
||||||
// test os (macos-13, macos-14, macos-15, ubuntu-latest, windows-latest are available)
|
// test os (macos-13, macos-14, macos-15, ubuntu-latest, windows-latest are available)
|
||||||
$test_os = [
|
$test_os = [
|
||||||
'macos-13',
|
// 'macos-13',
|
||||||
// 'macos-14',
|
// 'macos-14',
|
||||||
'macos-15',
|
// 'macos-15',
|
||||||
// 'ubuntu-latest',
|
// 'ubuntu-latest',
|
||||||
// 'ubuntu-22.04',
|
// 'ubuntu-22.04',
|
||||||
// 'ubuntu-24.04',
|
// 'ubuntu-24.04',
|
||||||
// 'ubuntu-22.04-arm',
|
'ubuntu-22.04-arm',
|
||||||
// 'ubuntu-24.04-arm',
|
// 'ubuntu-24.04-arm',
|
||||||
// 'windows-latest',
|
// 'windows-latest',
|
||||||
];
|
];
|
||||||
|
|
||||||
// whether enable thread safe
|
// whether enable thread safe
|
||||||
$zts = false;
|
$zts = true;
|
||||||
|
|
||||||
$no_strip = false;
|
$no_strip = false;
|
||||||
|
|
||||||
@ -54,13 +54,13 @@ $extensions = match (PHP_OS_FAMILY) {
|
|||||||
|
|
||||||
// If you want to test shared extensions, add them below (comma separated, example `bcmath,openssl`).
|
// If you want to test shared extensions, add them below (comma separated, example `bcmath,openssl`).
|
||||||
$shared_extensions = match (PHP_OS_FAMILY) {
|
$shared_extensions = match (PHP_OS_FAMILY) {
|
||||||
'Linux' => '',
|
'Linux' => 'uv',
|
||||||
'Darwin' => '',
|
'Darwin' => '',
|
||||||
'Windows' => '',
|
'Windows' => '',
|
||||||
};
|
};
|
||||||
|
|
||||||
// If you want to test lib-suggests for all extensions and libraries, set it to true.
|
// If you want to test lib-suggests for all extensions and libraries, set it to true.
|
||||||
$with_suggested_libs = true;
|
$with_suggested_libs = false;
|
||||||
|
|
||||||
// If you want to test extra libs for extensions, add them below (comma separated, example `libwebp,libavif`). Unnecessary, when $with_suggested_libs is true.
|
// If you want to test extra libs for extensions, add them below (comma separated, example `libwebp,libavif`). Unnecessary, when $with_suggested_libs is true.
|
||||||
$with_libs = match (PHP_OS_FAMILY) {
|
$with_libs = match (PHP_OS_FAMILY) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user