mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 04:44:53 +08:00
also use libstdc++.a for grpc?
This commit is contained in:
parent
83696e92b7
commit
81430e6853
@ -222,7 +222,8 @@ class Extension
|
||||
{
|
||||
$config = (new SPCConfigUtil($this->builder))->config([$this->getName()], array_map(fn ($l) => $l->getName(), $this->builder->getLibs()));
|
||||
[$staticLibs, $sharedLibs] = $this->splitLibsIntoStaticAndShared($config['libs']);
|
||||
$lstdcpp = str_contains($sharedLibs, '-lstdc++') ? '-lstdc++' : '';
|
||||
$lstdcpp = str_contains($sharedLibs, '-l:libstdc++.a') ? '-l:libstdc++.a' : null;
|
||||
$lstdcpp ??= str_contains($sharedLibs, '-lstdc++') ? '-lstdc++' : '';
|
||||
|
||||
$makefileContent = file_get_contents($this->source_dir . '/Makefile');
|
||||
if (preg_match('/^(.*_SHARED_LIBADD\s*=\s*)(.*)$/m', $makefileContent, $matches)) {
|
||||
|
||||
@ -60,7 +60,17 @@ class grpc extends Extension
|
||||
protected function getSharedExtensionEnv(): array
|
||||
{
|
||||
$env = parent::getSharedExtensionEnv();
|
||||
$env['CPPFLAGS'] = $env['CXXFLAGS'];
|
||||
$env['CPPFLAGS'] = $env['CXXFLAGS'] . ' -Wno-attributes';
|
||||
return $env;
|
||||
}
|
||||
|
||||
protected function splitLibsIntoStaticAndShared(string $allLibs): array
|
||||
{
|
||||
[$static, $shared] = parent::splitLibsIntoStaticAndShared($allLibs);
|
||||
if (str_contains(getenv('PATH'), 'rh/devtoolset') || str_contains(getenv('PATH'), 'rh/gcc-toolset')) {
|
||||
$static .= ' -l:libstdc++.a';
|
||||
$shared = str_replace('-lstdc++', '', $shared);
|
||||
}
|
||||
return [clean_spaces($static), clean_spaces($shared)];
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user