mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 04:44:53 +08:00
patch before make for uv
This commit is contained in:
parent
625ee2703d
commit
7d45415990
@ -208,6 +208,16 @@ class Extension
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Patch code before shared extension make
|
||||
* If you need to patch some code, overwrite this
|
||||
* return true if you patched something, false if not
|
||||
*/
|
||||
public function patchBeforeSharedMake(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* returns a command line string with all required shared extensions to load
|
||||
@ -408,6 +418,10 @@ class Extension
|
||||
'$1 ' . $staticLibString
|
||||
);
|
||||
|
||||
if ($this->patchBeforeSharedMake()) {
|
||||
logger()->info('ext [ . ' . $this->getName() . '] patching before shared make');
|
||||
}
|
||||
|
||||
shell()->cd($this->source_dir)
|
||||
->setEnv($env)
|
||||
->exec('make clean')
|
||||
|
||||
@ -5,6 +5,8 @@ declare(strict_types=1);
|
||||
namespace SPC\builder\extension;
|
||||
|
||||
use SPC\builder\Extension;
|
||||
use SPC\builder\linux\SystemUtil;
|
||||
use SPC\store\FileSystem;
|
||||
use SPC\util\CustomExt;
|
||||
|
||||
#[CustomExt('uv')]
|
||||
@ -17,10 +19,12 @@ class uv extends Extension
|
||||
}
|
||||
}
|
||||
|
||||
public function getStaticAndSharedLibs(): array
|
||||
public function patchBeforeSharedMake(): bool
|
||||
{
|
||||
[$static, $shared] = parent::getStaticAndSharedLibs();
|
||||
$shared .= ' -lpthread';
|
||||
return [$static, $shared];
|
||||
if (SystemUtil::getLibcVersionIfExists() >= '2.17') {
|
||||
return false;
|
||||
}
|
||||
FileSystem::replaceFileRegex($this->source_dir . '/Makefile', '/^(LDFLAGS =.*)$/', '$1 -luv -ldl -lrt -pthread');
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user