mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-20 15:25:36 +08:00
hack CXX env var to force C++17
This commit is contained in:
@@ -140,10 +140,10 @@ class LinuxBuilder extends UnixBuilderBase
|
|||||||
$envs_build_php = SystemUtil::makeEnvVarString([
|
$envs_build_php = SystemUtil::makeEnvVarString([
|
||||||
'CFLAGS' => getenv('SPC_CMD_VAR_PHP_CONFIGURE_CFLAGS'),
|
'CFLAGS' => getenv('SPC_CMD_VAR_PHP_CONFIGURE_CFLAGS'),
|
||||||
'CPPFLAGS' => getenv('SPC_CMD_VAR_PHP_CONFIGURE_CPPFLAGS'),
|
'CPPFLAGS' => getenv('SPC_CMD_VAR_PHP_CONFIGURE_CPPFLAGS'),
|
||||||
// -std=c++17 will be able to be removed when https://github.com/php/php-src/pull/14002 will be released
|
|
||||||
'CXXFLAGS' => '-std=c++17 ' . getenv('SPC_CMD_VAR_PHP_CONFIGURE_CXXFLAGS'),
|
|
||||||
'LDFLAGS' => getenv('SPC_CMD_VAR_PHP_CONFIGURE_LDFLAGS'),
|
'LDFLAGS' => getenv('SPC_CMD_VAR_PHP_CONFIGURE_LDFLAGS'),
|
||||||
'LIBS' => getenv('SPC_CMD_VAR_PHP_CONFIGURE_LIBS'),
|
'LIBS' => getenv('SPC_CMD_VAR_PHP_CONFIGURE_LIBS'),
|
||||||
|
// TODO: remove the following line when https://github.com/php/php-src/pull/14002 will be released
|
||||||
|
'CXX' => 'g++ -std=c++17',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// upx pack and strip for micro
|
// upx pack and strip for micro
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ class MacOSBuilder extends UnixBuilderBase
|
|||||||
// add macOS frameworks
|
// add macOS frameworks
|
||||||
$extra_libs .= (empty($extra_libs) ? '' : ' ') . $this->getFrameworks(true);
|
$extra_libs .= (empty($extra_libs) ? '' : ' ') . $this->getFrameworks(true);
|
||||||
// add libc++, some extensions or libraries need it (C++ cannot be linked statically)
|
// add libc++, some extensions or libraries need it (C++ cannot be linked statically)
|
||||||
$extra_libs .= (empty($extra_libs) ? '' : ' ') . ($this->hasCpp() ? '-lc++' : '');
|
$extra_libs .= (empty($extra_libs) ? '' : ' ') . ($this->hasCpp() ? '-lc++ ' : '');
|
||||||
// bloat means force-load all static libraries, even if they are not used
|
// bloat means force-load all static libraries, even if they are not used
|
||||||
if (!$this->getOption('bloat', false)) {
|
if (!$this->getOption('bloat', false)) {
|
||||||
$extra_libs .= (empty($extra_libs) ? '' : ' ') . implode(' ', $this->getAllStaticLibFiles());
|
$extra_libs .= (empty($extra_libs) ? '' : ' ') . implode(' ', $this->getAllStaticLibFiles());
|
||||||
@@ -146,9 +146,9 @@ class MacOSBuilder extends UnixBuilderBase
|
|||||||
$envs_build_php = SystemUtil::makeEnvVarString([
|
$envs_build_php = SystemUtil::makeEnvVarString([
|
||||||
'CFLAGS' => getenv('SPC_CMD_VAR_PHP_CONFIGURE_CFLAGS'),
|
'CFLAGS' => getenv('SPC_CMD_VAR_PHP_CONFIGURE_CFLAGS'),
|
||||||
'CPPFLAGS' => getenv('SPC_CMD_VAR_PHP_CONFIGURE_CPPFLAGS'),
|
'CPPFLAGS' => getenv('SPC_CMD_VAR_PHP_CONFIGURE_CPPFLAGS'),
|
||||||
// -std=c++17 will be able to be removed when https://github.com/php/php-src/pull/14002 will be released
|
|
||||||
'CXXFLAGS' => '-std=c++17 ' . getenv('SPC_CMD_VAR_PHP_CONFIGURE_CXXFLAGS'),
|
|
||||||
'LDFLAGS' => getenv('SPC_CMD_VAR_PHP_CONFIGURE_LDFLAGS'),
|
'LDFLAGS' => getenv('SPC_CMD_VAR_PHP_CONFIGURE_LDFLAGS'),
|
||||||
|
// TODO: remove the following line when https://github.com/php/php-src/pull/14002 will be released
|
||||||
|
'CXX' => 'g++ -std=c++17',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if ($this->getLib('postgresql')) {
|
if ($this->getLib('postgresql')) {
|
||||||
|
|||||||
@@ -11,10 +11,8 @@ class icu extends MacOSLibraryBase
|
|||||||
protected function build(): void
|
protected function build(): void
|
||||||
{
|
{
|
||||||
$root = BUILD_ROOT_PATH;
|
$root = BUILD_ROOT_PATH;
|
||||||
|
|
||||||
$cxxflags = 'CXXFLAGS="-std=c++17"';
|
|
||||||
shell()->cd($this->source_dir . '/source')
|
shell()->cd($this->source_dir . '/source')
|
||||||
->exec("{$cxxflags} ./runConfigureICU MacOSX --enable-static --disable-shared --prefix={$root}")
|
->exec("./runConfigureICU MacOSX --enable-static --disable-shared --prefix={$root}")
|
||||||
->exec('make clean')
|
->exec('make clean')
|
||||||
->exec("make -j{$this->builder->concurrency}")
|
->exec("make -j{$this->builder->concurrency}")
|
||||||
->exec('make install');
|
->exec('make install');
|
||||||
|
|||||||
Reference in New Issue
Block a user