diff --git a/README-en.md b/README-en.md index efe1833c..ee7783a0 100755 --- a/README-en.md +++ b/README-en.md @@ -46,7 +46,7 @@ chmod +x spc - [X] macOS support - [X] Exception handler - [ ] Windows support -- [ ] PHP 7.4 support +- [X] PHP 7.4 support ## Supported Extensions (WIP) diff --git a/README.md b/README.md index 8d0ff05f..8b446662 100755 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ chmod +x spc - [X] macOS 支持 - [ ] Windows 支持 - [ ] Linux 支持 -- [ ] PHP 7.4 支持 +- [X] PHP 7.4 支持 ## 支持的扩展情况(WIP) diff --git a/ext-support.md b/ext-support.md index 1a543aad..6b1ea97a 100644 --- a/ext-support.md +++ b/ext-support.md @@ -66,4 +66,4 @@ ## Bugs -See #32. \ No newline at end of file +See [#32](https://github.com/crazywhalecc/static-php-cli/issues/32). diff --git a/src/SPC/builder/macos/MacOSBuilder.php b/src/SPC/builder/macos/MacOSBuilder.php index e87d2c3a..1ba3fb8c 100644 --- a/src/SPC/builder/macos/MacOSBuilder.php +++ b/src/SPC/builder/macos/MacOSBuilder.php @@ -219,6 +219,9 @@ class MacOSBuilder extends BuilderBase */ public function buildMicro(string $extra_libs): void { + if ($this->getPHPVersionID() < 80000) { + throw new RuntimeException('phpmicro only support PHP >= 8.0!'); + } if ($this->getExt('phar')) { $this->phar_patched = true; try { @@ -260,4 +263,11 @@ class MacOSBuilder extends BuilderBase 'strip sapi/cli/php' ); } + + public function getPHPVersionID(): int + { + $file = file_get_contents(SOURCE_PATH . '/php-src/main/php_version.h'); + preg_match('/PHP_VERSION_ID (\d+)/', $file, $match); + return intval($match[1]); + } } diff --git a/src/SPC/command/BuildCliCommand.php b/src/SPC/command/BuildCliCommand.php index 4a0af726..85836e8f 100644 --- a/src/SPC/command/BuildCliCommand.php +++ b/src/SPC/command/BuildCliCommand.php @@ -77,8 +77,8 @@ class BuildCliCommand extends BuildCommand if ($input->getOption('debug')) { ExceptionHandler::getInstance()->handle($e); } else { - logger()->emergency('Build failed, please check terminal output, or build with --debug option to see more details.'); - logger()->emergency($e->getMessage()); + logger()->critical('Build failed, please check terminal output, or build with --debug option to see more details.'); + logger()->critical($e->getMessage()); } return 1; }