Skip to content

Commit a5351e1

Browse files
authored
Merge pull request #863 from crazywhalecc/brotli-watcher
fix gcc version detection
2 parents bea3bd8 + af90b84 commit a5351e1

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/SPC/builder/unix/UnixBuilderBase.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,8 +282,8 @@ protected function buildFrankenphp(): void
282282
$config = (new SPCConfigUtil($this))->config($this->ext_list, $this->lib_list);
283283
$env = [
284284
'CGO_ENABLED' => '1',
285-
'CGO_CFLAGS' => $config['cflags'],
286-
'CGO_LDFLAGS' => "{$staticFlags} {$config['ldflags']} {$config['libs']} {$lrt}",
285+
'CGO_CFLAGS' => $this->arch_c_flags . ' ' . $config['cflags'],
286+
'CGO_LDFLAGS' => "{$this->arch_ld_flags} {$staticFlags} {$config['ldflags']} {$config['libs']} {$lrt}",
287287
'XCADDY_GO_BUILD_FLAGS' => '-buildmode=pie ' .
288288
'-ldflags \"-linkmode=external ' . $extLdFlags . ' ' . $debugFlags .
289289
'-X \'github.com/caddyserver/caddy/v2.CustomVersion=FrankenPHP ' .

src/SPC/toolchain/ClangNativeToolchain.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function getCompilerInfo(): ?string
4545
$compiler = getenv('CC') ?: 'clang';
4646
$version = shell(false)->execWithResult("{$compiler} --version", false);
4747
$head = pathinfo($compiler, PATHINFO_BASENAME);
48-
if ($version[0] === 0 && preg_match('/clang version (\d+.\d+.\d+)/', $version[1][0], $match)) {
48+
if ($version[0] === 0 && preg_match('/clang version (\d+\.\d+\.\d+)/', $version[1][0], $match)) {
4949
return "{$head} {$match[1]}";
5050
}
5151
return $head;

src/SPC/toolchain/GccNativeToolchain.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function getCompilerInfo(): ?string
4242
$compiler = getenv('CC') ?: 'gcc';
4343
$version = shell(false)->execWithResult("{$compiler} --version", false);
4444
$head = pathinfo($compiler, PATHINFO_BASENAME);
45-
if ($version[0] === 0 && preg_match('/gcc.*(\d+.\d+.\d+)/', $version[1][0], $match)) {
45+
if ($version[0] === 0 && preg_match('/gcc.*?(\d+\.\d+\.\d+)/', $version[1][0], $match)) {
4646
return "{$head} {$match[1]}";
4747
}
4848
return $head;

0 commit comments

Comments
 (0)