mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-02 14:25:41 +08:00
Fix gettext multithread segment fault bug (#603)
* Fix gettext included with multithreaded bug * Change --enable-zts to BuildCommand
This commit is contained in:
@@ -10,14 +10,21 @@ trait gettext
|
|||||||
{
|
{
|
||||||
$extra = $this->builder->getLib('ncurses') ? ('--with-libncurses-prefix=' . BUILD_ROOT_PATH . ' ') : '';
|
$extra = $this->builder->getLib('ncurses') ? ('--with-libncurses-prefix=' . BUILD_ROOT_PATH . ' ') : '';
|
||||||
$extra .= $this->builder->getLib('libxml2') ? ('--with-libxml2-prefix=' . BUILD_ROOT_PATH . ' ') : '';
|
$extra .= $this->builder->getLib('libxml2') ? ('--with-libxml2-prefix=' . BUILD_ROOT_PATH . ' ') : '';
|
||||||
|
|
||||||
|
$zts = $this->builder->getOption('enable-zts') ? '--enable-threads=isoc+posix ' : '--disable-threads ';
|
||||||
|
|
||||||
|
$cflags = $this->builder->getOption('enable-zts') ? '-lpthread -D_REENTRANT' : '';
|
||||||
|
$ldflags = $this->builder->getOption('enable-zts') ? '-lpthread' : '';
|
||||||
|
|
||||||
shell()->cd($this->source_dir)
|
shell()->cd($this->source_dir)
|
||||||
->setEnv(['CFLAGS' => $this->getLibExtraCFlags(), 'LDFLAGS' => $this->getLibExtraLdFlags(), 'LIBS' => $this->getLibExtraLibs()])
|
->setEnv(['CFLAGS' => $this->getLibExtraCFlags() ?: $cflags, 'LDFLAGS' => $this->getLibExtraLdFlags() ?: $ldflags, 'LIBS' => $this->getLibExtraLibs()])
|
||||||
->execWithEnv(
|
->execWithEnv(
|
||||||
'./configure ' .
|
'./configure ' .
|
||||||
'--enable-static ' .
|
'--enable-static ' .
|
||||||
'--disable-shared ' .
|
'--disable-shared ' .
|
||||||
'--disable-java ' .
|
'--disable-java ' .
|
||||||
'--disable-c+ ' .
|
'--disable-c+ ' .
|
||||||
|
$zts .
|
||||||
$extra .
|
$extra .
|
||||||
'--with-included-gettext ' .
|
'--with-included-gettext ' .
|
||||||
'--with-libiconv-prefix=' . BUILD_ROOT_PATH . ' ' .
|
'--with-libiconv-prefix=' . BUILD_ROOT_PATH . ' ' .
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ class BuildCliCommand extends BuildCommand
|
|||||||
$this->addOption('build-embed', null, null, 'Build embed SAPI');
|
$this->addOption('build-embed', null, null, 'Build embed SAPI');
|
||||||
$this->addOption('build-all', null, null, 'Build all SAPI');
|
$this->addOption('build-all', null, null, 'Build all SAPI');
|
||||||
$this->addOption('no-strip', null, null, 'build without strip, in order to debug and load external extensions');
|
$this->addOption('no-strip', null, null, 'build without strip, in order to debug and load external extensions');
|
||||||
$this->addOption('enable-zts', null, null, 'enable ZTS support');
|
|
||||||
$this->addOption('disable-opcache-jit', null, null, 'disable opcache jit');
|
$this->addOption('disable-opcache-jit', null, null, 'disable opcache jit');
|
||||||
$this->addOption('with-config-file-path', null, InputOption::VALUE_REQUIRED, 'Set the path in which to look for php.ini', $isWindows ? null : '/usr/local/etc/php');
|
$this->addOption('with-config-file-path', null, InputOption::VALUE_REQUIRED, 'Set the path in which to look for php.ini', $isWindows ? null : '/usr/local/etc/php');
|
||||||
$this->addOption('with-config-file-scan-dir', null, InputOption::VALUE_REQUIRED, 'Set the directory to scan for .ini files after reading php.ini', $isWindows ? null : '/usr/local/etc/php/conf.d');
|
$this->addOption('with-config-file-scan-dir', null, InputOption::VALUE_REQUIRED, 'Set the directory to scan for .ini files after reading php.ini', $isWindows ? null : '/usr/local/etc/php/conf.d');
|
||||||
|
|||||||
@@ -31,5 +31,6 @@ abstract class BuildCommand extends BaseCommand
|
|||||||
$this->addOption('with-clean', null, null, 'fresh build, remove `source` dir before `make`');
|
$this->addOption('with-clean', null, null, 'fresh build, remove `source` dir before `make`');
|
||||||
$this->addOption('bloat', null, null, 'add all libraries into binary');
|
$this->addOption('bloat', null, null, 'add all libraries into binary');
|
||||||
$this->addOption('rebuild', 'r', null, 'Delete old build and rebuild');
|
$this->addOption('rebuild', 'r', null, 'Delete old build and rebuild');
|
||||||
|
$this->addOption('enable-zts', null, null, 'enable ZTS support');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,9 +22,9 @@ $test_php_version = [
|
|||||||
// test os (macos-13, macos-14, ubuntu-latest, windows-latest are available)
|
// test os (macos-13, macos-14, ubuntu-latest, windows-latest are available)
|
||||||
$test_os = [
|
$test_os = [
|
||||||
// 'macos-13',
|
// 'macos-13',
|
||||||
// 'macos-14',
|
'macos-14',
|
||||||
// 'ubuntu-latest',
|
'ubuntu-latest',
|
||||||
'windows-latest',
|
// 'windows-latest',
|
||||||
];
|
];
|
||||||
|
|
||||||
// whether enable thread safe
|
// whether enable thread safe
|
||||||
@@ -40,8 +40,8 @@ $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' => 'curl',
|
'Linux', 'Darwin' => 'gettext',
|
||||||
'Windows' => 'curl',
|
'Windows' => 'gettext',
|
||||||
};
|
};
|
||||||
|
|
||||||
// If you want to test lib-suggests feature with extension, add them below (comma separated, example `libwebp,libavif`).
|
// If you want to test lib-suggests feature with extension, add them below (comma separated, example `libwebp,libavif`).
|
||||||
|
|||||||
Reference in New Issue
Block a user