mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-19 13:24:51 +08:00
set php 7.4 patch alternative
This commit is contained in:
parent
fa437644f5
commit
61a76dc0c9
@ -12,6 +12,7 @@ use SPC\exception\RuntimeException;
|
||||
use SPC\store\Config;
|
||||
use SPC\store\Downloader;
|
||||
use SPC\util\Patcher;
|
||||
use SPC\util\Util;
|
||||
use Symfony\Component\Console\Input\InputArgument;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Input\InputOption;
|
||||
@ -214,11 +215,11 @@ class FetchSourceCommand extends BaseCommand
|
||||
private function doPatch(): void
|
||||
{
|
||||
// swow 需要软链接内部的文件夹才能正常编译
|
||||
if (!file_exists(SOURCE_PATH . '/php-src/ext/swow')) {
|
||||
if (!file_exists(SOURCE_PATH . '/php-src/ext/swow') && Util::getPHPVersionID() >= 80000) {
|
||||
Patcher::patchSwow();
|
||||
// patch 一些 PHP 的资源,以便编译
|
||||
Patcher::patchMicroThings();
|
||||
}
|
||||
// patch 一些 PHP 的资源,以便编译
|
||||
Patcher::patchPHPDepFiles();
|
||||
|
||||
// openssl 3 需要 patch 额外的东西
|
||||
if (!$this->input->getOption('with-openssl11') && $this->php_major_ver === '8.0') {
|
||||
|
||||
18
src/SPC/util/Util.php
Normal file
18
src/SPC/util/Util.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\util;
|
||||
|
||||
class Util
|
||||
{
|
||||
/**
|
||||
* Get current PHP version ID (downloaded)
|
||||
*/
|
||||
public static 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]);
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user