mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-12 11:25:35 +08:00
remove redundant LinuxLibraryBase tryBuild
This commit is contained in:
@@ -8,9 +8,6 @@ use SPC\builder\BuilderBase;
|
|||||||
use SPC\builder\LibraryBase;
|
use SPC\builder\LibraryBase;
|
||||||
use SPC\builder\linux\LinuxBuilder;
|
use SPC\builder\linux\LinuxBuilder;
|
||||||
use SPC\builder\traits\UnixLibraryTrait;
|
use SPC\builder\traits\UnixLibraryTrait;
|
||||||
use SPC\exception\FileSystemException;
|
|
||||||
use SPC\exception\RuntimeException;
|
|
||||||
use SPC\exception\WrongUsageException;
|
|
||||||
|
|
||||||
abstract class LinuxLibraryBase extends LibraryBase
|
abstract class LinuxLibraryBase extends LibraryBase
|
||||||
{
|
{
|
||||||
@@ -37,44 +34,6 @@ abstract class LinuxLibraryBase extends LibraryBase
|
|||||||
return $this->builder;
|
return $this->builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @throws RuntimeException
|
|
||||||
* @throws FileSystemException
|
|
||||||
* @throws WrongUsageException
|
|
||||||
*/
|
|
||||||
public function tryBuild(bool $force_build = false): int
|
|
||||||
{
|
|
||||||
// 传入 true,表明直接编译
|
|
||||||
if ($force_build) {
|
|
||||||
logger()->info('Building required library [' . static::NAME . ']');
|
|
||||||
$this->patchBeforeBuild();
|
|
||||||
$this->build();
|
|
||||||
return BUILD_STATUS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 看看这些库是不是存在,如果不存在,则调用编译并返回结果状态
|
|
||||||
foreach ($this->getStaticLibs() as $name) {
|
|
||||||
if (!file_exists(BUILD_LIB_PATH . "/{$name}")) {
|
|
||||||
$this->tryBuild(true);
|
|
||||||
return BUILD_STATUS_OK;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 头文件同理
|
|
||||||
foreach ($this->getHeaders() as $name) {
|
|
||||||
if (!file_exists(BUILD_INCLUDE_PATH . "/{$name}")) {
|
|
||||||
$this->tryBuild(true);
|
|
||||||
return BUILD_STATUS_OK;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// pkg-config 做特殊处理,如果是 pkg-config 就检查有没有 pkg-config 二进制
|
|
||||||
if (static::NAME === 'pkg-config' && !file_exists(BUILD_ROOT_PATH . '/bin/pkg-config')) {
|
|
||||||
$this->tryBuild(true);
|
|
||||||
return BUILD_STATUS_OK;
|
|
||||||
}
|
|
||||||
// 到这里说明所有的文件都存在,就跳过编译
|
|
||||||
return BUILD_STATUS_ALREADY;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function makeFakePkgconfs(): void
|
protected function makeFakePkgconfs(): void
|
||||||
{
|
{
|
||||||
$workspace = BUILD_ROOT_PATH;
|
$workspace = BUILD_ROOT_PATH;
|
||||||
|
|||||||
Reference in New Issue
Block a user