Remove all @throws PHPDoc, it's almost useless for SPC anymore

This commit is contained in:
crazywhalecc
2025-08-06 20:17:26 +08:00
committed by Jerry Ma
parent fa10142f13
commit 0c9a30256e
120 changed files with 169 additions and 1203 deletions

View File

@@ -8,8 +8,6 @@ use SPC\builder\freebsd\BSDBuilder;
use SPC\builder\linux\LinuxBuilder;
use SPC\builder\macos\MacOSBuilder;
use SPC\builder\windows\WindowsBuilder;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\exception\WrongUsageException;
use Symfony\Component\Console\Input\InputInterface;
@@ -20,11 +18,6 @@ class BuilderProvider
{
private static ?BuilderBase $builder = null;
/**
* @throws FileSystemException
* @throws RuntimeException
* @throws WrongUsageException
*/
public static function makeBuilderByInput(InputInterface $input): BuilderBase
{
ini_set('memory_limit', '4G');
@@ -39,9 +32,6 @@ class BuilderProvider
return self::$builder;
}
/**
* @throws WrongUsageException
*/
public static function getBuilder(): BuilderBase
{
if (self::$builder === null) {

View File

@@ -24,11 +24,6 @@ class Extension
protected string $source_dir;
/**
* @throws FileSystemException
* @throws RuntimeException
* @throws WrongUsageException
*/
public function __construct(protected string $name, protected BuilderBase $builder)
{
$ext_type = Config::getExt($this->name, 'type');
@@ -63,9 +58,6 @@ class Extension
/**
* 获取开启该扩展的 PHP 编译添加的参数
*
* @throws FileSystemException
* @throws WrongUsageException
*/
public function getConfigureArg(bool $shared = false): string
{
@@ -80,9 +72,6 @@ class Extension
/**
* 根据 ext 的 arg-type 获取对应开启的参数,一般都是 --enable-xxx 和 --with-xxx
*
* @throws FileSystemException
* @throws WrongUsageException
*/
public function getEnableArg(bool $shared = false): string
{
@@ -112,10 +101,6 @@ class Extension
/**
* 检查下依赖就行了,作用是导入依赖给 Extension 对象,今后可以对库依赖进行选择性处理
*
* @throws RuntimeException
* @throws FileSystemException
* @throws WrongUsageException
*/
public function checkDependency(): static
{
@@ -259,8 +244,6 @@ class Extension
* i.e.; pdo_pgsql would return:
*
* `-d "extension=pgsql" -d "extension=pdo_pgsql"`
* @throws FileSystemException
* @throws WrongUsageException
*/
public function getSharedExtensionLoadString(): string
{
@@ -300,9 +283,6 @@ class Extension
return $ret;
}
/**
* @throws RuntimeException
*/
public function runCliCheckUnix(): void
{
// Run compile check if build target is cli
@@ -333,9 +313,6 @@ class Extension
}
}
/**
* @throws RuntimeException
*/
public function runCliCheckWindows(): void
{
// Run compile check if build target is cli
@@ -368,9 +345,6 @@ class Extension
/**
* Build shared extension
*
* @throws WrongUsageException
* @throws RuntimeException
*/
public function buildShared(): void
{
@@ -406,12 +380,6 @@ class Extension
/**
* Build shared extension for Unix
*
* @throws FileSystemException
* @throws RuntimeException
* @throws WrongUsageException
* @throws \ReflectionException
* @throws \Throwable
*/
public function buildUnixShared(): void
{
@@ -506,9 +474,6 @@ class Extension
return $this->build_static;
}
/**
* @throws RuntimeException
*/
protected function addLibraryDependency(string $name, bool $optional = false): void
{
$depLib = $this->builder->getLib($name);
@@ -522,9 +487,6 @@ class Extension
}
}
/**
* @throws RuntimeException
*/
protected function addExtensionDependency(string $name, bool $optional = false): void
{
$depExt = $this->builder->getExt($name);

View File

@@ -27,9 +27,6 @@ abstract class LibraryBase
protected bool $patched = false;
/**
* @throws RuntimeException
*/
public function __construct(?string $source_dir = null)
{
if (static::NAME === 'unknown') {
@@ -40,10 +37,7 @@ abstract class LibraryBase
/**
* Try to install or build this library.
* @param bool $force If true, force install or build
* @throws FileSystemException
* @throws RuntimeException
* @throws WrongUsageException
* @param bool $force If true, force install or build
*/
public function setup(bool $force = false): int
{
@@ -107,10 +101,6 @@ abstract class LibraryBase
/**
* Calculate dependencies for current library.
*
* @throws RuntimeException
* @throws FileSystemException
* @throws WrongUsageException
*/
public function calcDependency(): void
{
@@ -131,9 +121,6 @@ abstract class LibraryBase
/**
* Get config static libs.
*
* @throws FileSystemException
* @throws WrongUsageException
*/
public function getStaticLibs(): array
{
@@ -142,9 +129,6 @@ abstract class LibraryBase
/**
* Get config headers.
*
* @throws FileSystemException
* @throws WrongUsageException
*/
public function getHeaders(): array
{
@@ -153,19 +137,12 @@ abstract class LibraryBase
/**
* Get binary files.
*
* @throws FileSystemException
* @throws WrongUsageException
*/
public function getBinaryFiles(): array
{
return Config::getLib(static::NAME, 'bin', []);
}
/**
* @throws WrongUsageException
* @throws FileSystemException
*/
public function tryInstall(array $lock, bool $force_install = false): int
{
$install_file = $lock['filename'];
@@ -194,10 +171,6 @@ abstract class LibraryBase
* BUILD_STATUS_OK if build success
* BUILD_STATUS_ALREADY if already built
* BUILD_STATUS_FAILED if build failed
*
* @throws RuntimeException
* @throws FileSystemException
* @throws WrongUsageException
*/
public function tryBuild(bool $force_build = false): int
{
@@ -319,8 +292,6 @@ abstract class LibraryBase
/**
* Build this library.
*
* @throws RuntimeException
*/
abstract protected function build();
@@ -351,8 +322,6 @@ abstract class LibraryBase
/**
* Add lib dependency
*
* @throws RuntimeException
*/
protected function addLibraryDependency(string $name, bool $optional = false): void
{

View File

@@ -6,18 +6,12 @@ namespace SPC\builder\extension;
use SPC\builder\Extension;
use SPC\builder\macos\MacOSBuilder;
use SPC\exception\FileSystemException;
use SPC\exception\WrongUsageException;
use SPC\store\FileSystem;
use SPC\util\CustomExt;
#[CustomExt('bz2')]
class bz2 extends Extension
{
/**
* @throws FileSystemException
* @throws WrongUsageException
*/
public function patchBeforeConfigure(): bool
{
$frameworks = $this->builder instanceof MacOSBuilder ? ' ' . $this->builder->getFrameworks(true) . ' ' : '';

View File

@@ -16,9 +16,6 @@ use SPC\util\CustomExt;
#[CustomExt('curl')]
class curl extends Extension
{
/**
* @throws FileSystemException
*/
public function patchBeforeBuildconf(): bool
{
logger()->info('patching before-configure for curl checks');
@@ -46,10 +43,6 @@ class curl extends Extension
return true;
}
/**
* @throws FileSystemException
* @throws WrongUsageException
*/
public function patchBeforeConfigure(): bool
{
$frameworks = $this->builder instanceof MacOSBuilder ? ' ' . $this->builder->getFrameworks(true) . ' ' : '';

View File

@@ -5,16 +5,12 @@ declare(strict_types=1);
namespace SPC\builder\extension;
use SPC\builder\Extension;
use SPC\exception\RuntimeException;
use SPC\store\FileSystem;
use SPC\util\CustomExt;
#[CustomExt('dom')]
class dom extends Extension
{
/**
* @throws RuntimeException
*/
public function getUnixConfigureArg(bool $shared = false): string
{
$arg = '--enable-dom' . ($shared ? '=shared' : '');

View File

@@ -5,16 +5,12 @@ declare(strict_types=1);
namespace SPC\builder\extension;
use SPC\builder\Extension;
use SPC\exception\FileSystemException;
use SPC\store\FileSystem;
use SPC\util\CustomExt;
#[CustomExt('ev')]
class ev extends Extension
{
/**
* @throws FileSystemException
*/
public function patchBeforeBuildconf(): bool
{
/*

View File

@@ -6,7 +6,6 @@ namespace SPC\builder\extension;
use SPC\builder\Extension;
use SPC\builder\macos\MacOSBuilder;
use SPC\exception\FileSystemException;
use SPC\store\FileSystem;
use SPC\util\CustomExt;
@@ -27,18 +26,12 @@ class event extends Extension
return $arg;
}
/**
* @throws FileSystemException
*/
public function patchBeforeConfigure(): bool
{
FileSystem::replaceFileRegex(SOURCE_PATH . '/php-src/configure', '/-levent_openssl/', $this->getLibFilesString());
return true;
}
/**
* @throws FileSystemException
*/
public function patchBeforeMake(): bool
{
$patched = parent::patchBeforeMake();

View File

@@ -6,17 +6,12 @@ namespace SPC\builder\extension;
use SPC\builder\Extension;
use SPC\builder\macos\MacOSBuilder;
use SPC\exception\FileSystemException;
use SPC\exception\WrongUsageException;
use SPC\store\FileSystem;
use SPC\util\CustomExt;
#[CustomExt('gettext')]
class gettext extends Extension
{
/**
* @throws FileSystemException
*/
public function patchBeforeBuildconf(): bool
{
if ($this->builder instanceof MacOSBuilder) {
@@ -25,10 +20,6 @@ class gettext extends Extension
return true;
}
/**
* @throws WrongUsageException
* @throws FileSystemException
*/
public function patchBeforeConfigure(): bool
{
if ($this->builder instanceof MacOSBuilder) {

View File

@@ -5,16 +5,12 @@ declare(strict_types=1);
namespace SPC\builder\extension;
use SPC\builder\Extension;
use SPC\exception\RuntimeException;
use SPC\store\FileSystem;
use SPC\util\CustomExt;
#[CustomExt('glfw')]
class glfw extends Extension
{
/**
* @throws RuntimeException
*/
public function patchBeforeBuildconf(): bool
{
if (file_exists(SOURCE_PATH . '/php-src/ext/glfw')) {

View File

@@ -24,9 +24,6 @@ class imap extends Extension
return false;
}
/**
* @throws WrongUsageException
*/
public function validate(): void
{
if ($this->builder->getOption('enable-zts')) {

View File

@@ -5,7 +5,6 @@ declare(strict_types=1);
namespace SPC\builder\extension;
use SPC\builder\Extension;
use SPC\exception\FileSystemException;
use SPC\store\FileSystem;
use SPC\util\CustomExt;
@@ -17,9 +16,6 @@ class memcache extends Extension
return '--enable-memcache' . ($shared ? '=shared' : '') . ' --with-zlib-dir=' . BUILD_ROOT_PATH;
}
/**
* @throws FileSystemException
*/
public function patchBeforeBuildconf(): bool
{
FileSystem::replaceFileStr(

View File

@@ -5,7 +5,6 @@ declare(strict_types=1);
namespace SPC\builder\extension;
use SPC\builder\Extension;
use SPC\exception\RuntimeException;
use SPC\exception\WrongUsageException;
use SPC\store\SourcePatcher;
use SPC\util\CustomExt;
@@ -13,10 +12,6 @@ use SPC\util\CustomExt;
#[CustomExt('opcache')]
class opcache extends Extension
{
/**
* @throws WrongUsageException
* @throws RuntimeException
*/
public function validate(): void
{
if ($this->builder->getPHPVersionID() < 80000 && getenv('SPC_SKIP_PHP_VERSION_CHECK') !== 'yes') {

View File

@@ -5,16 +5,12 @@ declare(strict_types=1);
namespace SPC\builder\extension;
use SPC\builder\Extension;
use SPC\exception\FileSystemException;
use SPC\store\FileSystem;
use SPC\util\CustomExt;
#[CustomExt('pdo_sqlite')]
class pdo_sqlite extends Extension
{
/**
* @throws FileSystemException
*/
public function patchBeforeConfigure(): bool
{
FileSystem::replaceFileRegex(

View File

@@ -5,20 +5,12 @@ declare(strict_types=1);
namespace SPC\builder\extension;
use SPC\builder\Extension;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\exception\WrongUsageException;
use SPC\store\FileSystem;
use SPC\util\CustomExt;
#[CustomExt('pgsql')]
class pgsql extends Extension
{
/**
* @throws FileSystemException
* @throws RuntimeException
* @throws WrongUsageException
*/
public function patchBeforeConfigure(): bool
{
FileSystem::replaceFileRegex(
@@ -29,10 +21,6 @@ class pgsql extends Extension
return true;
}
/**
* @throws WrongUsageException
* @throws RuntimeException
*/
public function getUnixConfigureArg(bool $shared = false): string
{
if ($this->builder->getPHPVersionID() >= 80400) {
@@ -46,10 +34,6 @@ class pgsql extends Extension
return '--with-pgsql=' . ($shared ? 'shared,' : '') . BUILD_ROOT_PATH;
}
/**
* @throws WrongUsageException
* @throws RuntimeException
*/
public function getWindowsConfigureArg(bool $shared = false): string
{
if ($this->builder->getPHPVersionID() >= 80400) {

View File

@@ -6,16 +6,12 @@ namespace SPC\builder\extension;
use SPC\builder\Extension;
use SPC\builder\macos\MacOSBuilder;
use SPC\exception\FileSystemException;
use SPC\store\FileSystem;
use SPC\util\CustomExt;
#[CustomExt('rar')]
class rar extends Extension
{
/**
* @throws FileSystemException
*/
public function patchBeforeBuildconf(): bool
{
// workaround for newer Xcode clang (>= 15.0)

View File

@@ -5,16 +5,12 @@ declare(strict_types=1);
namespace SPC\builder\extension;
use SPC\builder\Extension;
use SPC\exception\FileSystemException;
use SPC\store\FileSystem;
use SPC\util\CustomExt;
#[CustomExt('readline')]
class readline extends Extension
{
/**
* @throws FileSystemException
*/
public function patchBeforeConfigure(): bool
{
FileSystem::replaceFileRegex(

View File

@@ -6,16 +6,12 @@ namespace SPC\builder\extension;
use SPC\builder\Extension;
use SPC\builder\macos\MacOSBuilder;
use SPC\exception\FileSystemException;
use SPC\store\FileSystem;
use SPC\util\CustomExt;
#[CustomExt('snappy')]
class snappy extends Extension
{
/**
* @throws FileSystemException
*/
public function patchBeforeConfigure(): bool
{
FileSystem::replaceFileRegex(

View File

@@ -5,16 +5,12 @@ declare(strict_types=1);
namespace SPC\builder\extension;
use SPC\builder\Extension;
use SPC\exception\FileSystemException;
use SPC\store\FileSystem;
use SPC\util\CustomExt;
#[CustomExt('ssh2')]
class ssh2 extends Extension
{
/**
* @throws FileSystemException
*/
public function patchBeforeConfigure(): bool
{
FileSystem::replaceFileRegex(

View File

@@ -26,9 +26,6 @@ class swow extends Extension
return $arg;
}
/**
* @throws RuntimeException
*/
public function patchBeforeBuildconf(): bool
{
if ($this->builder->getPHPVersionID() >= 80000 && !is_link(SOURCE_PATH . '/php-src/ext/swow')) {

View File

@@ -16,9 +16,6 @@ use SPC\util\CustomExt;
#[CustomExt('simplexml')]
class xml extends Extension
{
/**
* @throws RuntimeException
*/
public function getUnixConfigureArg(bool $shared = false): string
{
$arg = match ($this->name) {

View File

@@ -5,8 +5,6 @@ declare(strict_types=1);
namespace SPC\builder\freebsd;
use SPC\builder\unix\UnixBuilderBase;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\exception\WrongUsageException;
use SPC\store\FileSystem;
use SPC\store\SourcePatcher;
@@ -16,11 +14,6 @@ class BSDBuilder extends UnixBuilderBase
/** @var bool Micro patch phar flag */
private bool $phar_patched = false;
/**
* @throws RuntimeException
* @throws WrongUsageException
* @throws FileSystemException
*/
public function __construct(array $options = [])
{
$this->options = $options;
@@ -56,10 +49,7 @@ class BSDBuilder extends UnixBuilderBase
/**
* Just start to build statically linked php binary
*
* @param int $build_target build target
* @throws FileSystemException
* @throws RuntimeException
* @throws WrongUsageException
* @param int $build_target build target
*/
public function buildPHP(int $build_target = BUILD_TARGET_NONE): void
{
@@ -148,9 +138,6 @@ class BSDBuilder extends UnixBuilderBase
/**
* Build cli sapi
*
* @throws RuntimeException
* @throws FileSystemException
*/
protected function buildCli(): void
{
@@ -170,10 +157,6 @@ class BSDBuilder extends UnixBuilderBase
/**
* Build phpmicro sapi
*
* @throws FileSystemException
* @throws RuntimeException
* @throws WrongUsageException
*/
protected function buildMicro(): void
{
@@ -209,9 +192,6 @@ class BSDBuilder extends UnixBuilderBase
/**
* Build fpm sapi
*
* @throws RuntimeException
* @throws FileSystemException
*/
protected function buildFpm(): void
{
@@ -230,8 +210,6 @@ class BSDBuilder extends UnixBuilderBase
/**
* Build embed sapi
*
* @throws RuntimeException
*/
protected function buildEmbed(): void
{

View File

@@ -15,8 +15,6 @@ class SystemUtil
/**
* Get Logic CPU Count for macOS
*
* @throws RuntimeException
*/
public static function getCpuCount(): int
{
@@ -31,9 +29,8 @@ class SystemUtil
/**
* Get Target Arch CFlags
*
* @param string $arch Arch Name
* @return string return Arch CFlags string
* @throws WrongUsageException
* @param string $arch Arch Name
* @return string return Arch CFlags string
*/
public static function getArchCFlags(string $arch): string
{

View File

@@ -22,19 +22,11 @@ declare(strict_types=1);
namespace SPC\builder\freebsd\library;
use SPC\builder\macos\library\MacOSLibraryBase;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\exception\WrongUsageException;
class openssl extends BSDLibraryBase
{
public const NAME = 'openssl';
/**
* @throws FileSystemException
* @throws RuntimeException
* @throws WrongUsageException
*/
protected function build(): void
{
[$lib,,$destdir] = SEPARATED_PATH;

View File

@@ -5,8 +5,7 @@ declare(strict_types=1);
namespace SPC\builder\linux;
use SPC\builder\unix\UnixBuilderBase;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\exception\PatchException;
use SPC\exception\WrongUsageException;
use SPC\store\FileSystem;
use SPC\store\SourcePatcher;
@@ -19,10 +18,6 @@ class LinuxBuilder extends UnixBuilderBase
/** @var bool Micro patch phar flag */
private bool $phar_patched = false;
/**
* @throws FileSystemException
* @throws WrongUsageException
*/
public function __construct(array $options = [])
{
$this->options = $options;
@@ -45,10 +40,7 @@ class LinuxBuilder extends UnixBuilderBase
/**
* Build PHP from source.
*
* @param int $build_target Build target, use `BUILD_TARGET_*` constants
* @throws RuntimeException
* @throws FileSystemException
* @throws WrongUsageException
* @param int $build_target Build target, use `BUILD_TARGET_*` constants
*/
public function buildPHP(int $build_target = BUILD_TARGET_NONE): void
{
@@ -168,9 +160,6 @@ class LinuxBuilder extends UnixBuilderBase
/**
* Build cli sapi
*
* @throws RuntimeException
* @throws FileSystemException
*/
protected function buildCli(): void
{
@@ -193,10 +182,6 @@ class LinuxBuilder extends UnixBuilderBase
/**
* Build phpmicro sapi
*
* @throws FileSystemException
* @throws RuntimeException
* @throws WrongUsageException
*/
protected function buildMicro(): void
{
@@ -231,9 +216,6 @@ class LinuxBuilder extends UnixBuilderBase
/**
* Build fpm sapi
*
* @throws FileSystemException
* @throws RuntimeException
*/
protected function buildFpm(): void
{
@@ -255,8 +237,6 @@ class LinuxBuilder extends UnixBuilderBase
/**
* Build embed sapi
*
* @throws RuntimeException
*/
protected function buildEmbed(): void
{
@@ -346,12 +326,6 @@ class LinuxBuilder extends UnixBuilderBase
/**
* Return extra variables for php make command.
*
* @throws FileSystemException
* @throws RuntimeException
* @throws WrongUsageException
* @throws \ReflectionException
* @throws \Throwable
*/
private function getMakeExtraVars(): array
{
@@ -370,8 +344,6 @@ class LinuxBuilder extends UnixBuilderBase
* Strip micro.sfx for Linux.
* The micro.sfx does not support UPX directly, but we can remove UPX-info segment to adapt.
* This will also make micro.sfx with upx-packed more like a malware fore antivirus :(
*
* @throws RuntimeException
*/
private function processMicroUPX(): void
{

View File

@@ -4,8 +4,6 @@ declare(strict_types=1);
namespace SPC\builder\linux\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\store\FileSystem;
use SPC\util\SPCTarget;
@@ -13,9 +11,6 @@ class imap extends LinuxLibraryBase
{
public const NAME = 'imap';
/**
* @throws FileSystemException
*/
public function patchBeforeBuild(): bool
{
$cc = getenv('CC') ?: 'gcc';

View File

@@ -4,18 +4,12 @@ declare(strict_types=1);
namespace SPC\builder\linux\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\util\executor\UnixAutoconfExecutor;
class libffi extends LinuxLibraryBase
{
public const NAME = 'libffi';
/**
* @throws RuntimeException
* @throws FileSystemException
*/
public function build(): void
{
UnixAutoconfExecutor::create($this)

View File

@@ -21,20 +21,12 @@ declare(strict_types=1);
namespace SPC\builder\linux\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\exception\WrongUsageException;
use SPC\util\executor\UnixAutoconfExecutor;
class libpng extends LinuxLibraryBase
{
public const NAME = 'libpng';
/**
* @throws FileSystemException
* @throws RuntimeException
* @throws WrongUsageException
*/
public function build(): void
{
UnixAutoconfExecutor::create($this)

View File

@@ -21,9 +21,6 @@ declare(strict_types=1);
namespace SPC\builder\linux\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\exception\WrongUsageException;
use SPC\store\FileSystem;
class openssl extends LinuxLibraryBase
@@ -32,11 +29,6 @@ class openssl extends LinuxLibraryBase
public const NAME = 'openssl';
/**
* @throws FileSystemException
* @throws RuntimeException
* @throws WrongUsageException
*/
public function build(): void
{
$extra = '';

View File

@@ -6,8 +6,6 @@ namespace SPC\builder\macos;
use SPC\builder\macos\library\MacOSLibraryBase;
use SPC\builder\unix\UnixBuilderBase;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\exception\WrongUsageException;
use SPC\store\FileSystem;
use SPC\store\SourcePatcher;
@@ -19,11 +17,6 @@ class MacOSBuilder extends UnixBuilderBase
/** @var bool Micro patch phar flag */
private bool $phar_patched = false;
/**
* @throws RuntimeException
* @throws WrongUsageException
* @throws FileSystemException
*/
public function __construct(array $options = [])
{
$this->options = $options;
@@ -48,9 +41,7 @@ class MacOSBuilder extends UnixBuilderBase
/**
* Get dynamically linked macOS frameworks
*
* @param bool $asString If true, return as string
* @throws FileSystemException
* @throws WrongUsageException
* @param bool $asString If true, return as string
*/
public function getFrameworks(bool $asString = false): array|string
{
@@ -83,10 +74,7 @@ class MacOSBuilder extends UnixBuilderBase
/**
* Just start to build statically linked php binary
*
* @param int $build_target build target
* @throws FileSystemException
* @throws RuntimeException
* @throws WrongUsageException
* @param int $build_target build target
*/
public function buildPHP(int $build_target = BUILD_TARGET_NONE): void
{
@@ -190,9 +178,6 @@ class MacOSBuilder extends UnixBuilderBase
/**
* Build cli sapi
*
* @throws RuntimeException
* @throws FileSystemException
*/
protected function buildCli(): void
{
@@ -209,10 +194,6 @@ class MacOSBuilder extends UnixBuilderBase
/**
* Build phpmicro sapi
*
* @throws FileSystemException
* @throws RuntimeException
* @throws WrongUsageException
*/
protected function buildMicro(): void
{
@@ -248,9 +229,6 @@ class MacOSBuilder extends UnixBuilderBase
/**
* Build fpm sapi
*
* @throws RuntimeException
* @throws FileSystemException
*/
protected function buildFpm(): void
{
@@ -266,8 +244,6 @@ class MacOSBuilder extends UnixBuilderBase
/**
* Build embed sapi
*
* @throws RuntimeException
*/
protected function buildEmbed(): void
{

View File

@@ -15,8 +15,6 @@ class SystemUtil
/**
* Get Logic CPU Count for macOS
*
* @throws RuntimeException
*/
public static function getCpuCount(): int
{
@@ -31,9 +29,8 @@ class SystemUtil
/**
* Get Target Arch CFlags
*
* @param string $arch Arch Name
* @return string return Arch CFlags string
* @throws WrongUsageException
* @param string $arch Arch Name
* @return string return Arch CFlags string
*/
public static function getArchCFlags(string $arch): string
{

View File

@@ -8,8 +8,6 @@ use SPC\builder\BuilderBase;
use SPC\builder\LibraryBase;
use SPC\builder\macos\MacOSBuilder;
use SPC\builder\traits\UnixLibraryTrait;
use SPC\exception\FileSystemException;
use SPC\exception\WrongUsageException;
use SPC\store\Config;
abstract class MacOSLibraryBase extends LibraryBase
@@ -28,10 +26,6 @@ abstract class MacOSLibraryBase extends LibraryBase
return $this->builder;
}
/**
* @throws WrongUsageException
* @throws FileSystemException
*/
public function getFrameworks(): array
{
return Config::getLib(static::NAME, 'frameworks', []);

View File

@@ -21,7 +21,6 @@ declare(strict_types=1);
namespace SPC\builder\macos\library;
use SPC\exception\FileSystemException;
use SPC\store\FileSystem;
class curl extends MacOSLibraryBase
@@ -30,9 +29,6 @@ class curl extends MacOSLibraryBase
public const NAME = 'curl';
/**
* @throws FileSystemException
*/
public function patchBeforeBuild(): bool
{
FileSystem::replaceFileRegex(

View File

@@ -4,18 +4,12 @@ declare(strict_types=1);
namespace SPC\builder\macos\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\util\executor\UnixCMakeExecutor;
class glfw extends MacOSLibraryBase
{
public const NAME = 'glfw';
/**
* @throws FileSystemException
* @throws RuntimeException
*/
protected function build(): void
{
UnixCMakeExecutor::create($this)

View File

@@ -4,8 +4,6 @@ declare(strict_types=1);
namespace SPC\builder\macos\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\store\FileSystem;
use SPC\store\SourcePatcher;
@@ -13,10 +11,6 @@ class imap extends MacOSLibraryBase
{
public const NAME = 'imap';
/**
* @throws FileSystemException
* @throws RuntimeException
*/
public function patchBeforeBuild(): bool
{
$cc = getenv('CC') ?: 'clang';
@@ -37,9 +31,6 @@ class imap extends MacOSLibraryBase
return true;
}
/**
* @throws RuntimeException
*/
protected function build(): void
{
if ($this->builder->getLib('openssl')) {

View File

@@ -4,18 +4,12 @@ declare(strict_types=1);
namespace SPC\builder\macos\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\util\executor\UnixAutoconfExecutor;
class libffi extends MacOSLibraryBase
{
public const NAME = 'libffi';
/**
* @throws RuntimeException
* @throws FileSystemException
*/
protected function build(): void
{
$arch = getenv('SPC_ARCH');

View File

@@ -21,20 +21,12 @@ declare(strict_types=1);
namespace SPC\builder\macos\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\exception\WrongUsageException;
use SPC\util\executor\UnixAutoconfExecutor;
class libpng extends MacOSLibraryBase
{
public const NAME = 'libpng';
/**
* @throws FileSystemException
* @throws RuntimeException
* @throws WrongUsageException
*/
protected function build(): void
{
$arch = arch2gnu(php_uname('m'));

View File

@@ -21,9 +21,6 @@ declare(strict_types=1);
namespace SPC\builder\macos\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\exception\WrongUsageException;
use SPC\store\FileSystem;
class openssl extends MacOSLibraryBase
@@ -32,11 +29,6 @@ class openssl extends MacOSLibraryBase
public const NAME = 'openssl';
/**
* @throws FileSystemException
* @throws RuntimeException
* @throws WrongUsageException
*/
protected function build(): void
{
// lib:zlib

View File

@@ -13,11 +13,6 @@ use SPC\util\SPCConfigUtil;
trait UnixLibraryTrait
{
/**
* @throws RuntimeException
* @throws FileSystemException
* @throws WrongUsageException
*/
public function getStaticLibFiles(bool $include_self = true): string
{
$libs = $include_self ? [$this] : [];
@@ -28,11 +23,11 @@ trait UnixLibraryTrait
}
/**
* Patch pkgconfig file prefix
* Patch pkgconfig file prefix, exec_prefix, libdir, includedir for correct build.
*
* @param array $files file list
* @throws FileSystemException
* @throws RuntimeException
* @param array $files File list to patch, if empty, will use pkg-configs from config (e.g. ['zlib.pc', 'openssl.pc'])
* @param int $patch_option Patch options
* @param null|array $custom_replace Custom replace rules, if provided, will be used to replace in the format [regex, replacement]
*/
public function patchPkgconfPrefix(array $files = [], int $patch_option = PKGCONF_PATCH_ALL, ?array $custom_replace = null): void
{

View File

@@ -70,9 +70,7 @@ abstract class UnixBuilderBase extends BuilderBase
}
/**
* Sanity check after build complete
*
* @throws RuntimeException
* Sanity check after build complete.
*/
protected function sanityCheck(int $build_target): void
{
@@ -170,11 +168,9 @@ abstract class UnixBuilderBase extends BuilderBase
}
/**
* 将编译好的二进制文件发布到 buildroot
* Deploy the binary file to the build bin path.
*
* @param int $type 发布类型
* @throws RuntimeException
* @throws FileSystemException
* @param int $type Type integer, one of BUILD_TARGET_CLI, BUILD_TARGET_MICRO, BUILD_TARGET_FPM
*/
protected function deployBinary(int $type): bool
{
@@ -192,8 +188,6 @@ abstract class UnixBuilderBase extends BuilderBase
/**
* Run php clean
*
* @throws RuntimeException
*/
protected function cleanMake(): void
{
@@ -203,7 +197,6 @@ abstract class UnixBuilderBase extends BuilderBase
/**
* Patch phpize and php-config if needed
* @throws FileSystemException
*/
protected function patchPhpScripts(): void
{
@@ -231,10 +224,6 @@ abstract class UnixBuilderBase extends BuilderBase
}
}
/**
* @throws WrongUsageException
* @throws RuntimeException
*/
protected function buildFrankenphp(): void
{
$nobrotli = $this->getLib('brotli') === null ? ',nobrotli' : '';

View File

@@ -4,14 +4,10 @@ declare(strict_types=1);
namespace SPC\builder\unix\library;
use SPC\exception\RuntimeException;
use SPC\util\executor\UnixAutoconfExecutor;
trait attr
{
/**
* @throws RuntimeException
*/
protected function build(): void
{
UnixAutoconfExecutor::create($this)

View File

@@ -4,17 +4,11 @@ declare(strict_types=1);
namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\store\FileSystem;
use SPC\util\executor\UnixCMakeExecutor;
trait brotli
{
/**
* @throws FileSystemException
* @throws RuntimeException
*/
protected function build(): void
{
UnixCMakeExecutor::create($this)

View File

@@ -4,16 +4,10 @@ declare(strict_types=1);
namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\util\executor\UnixCMakeExecutor;
trait curl
{
/**
* @throws RuntimeException
* @throws FileSystemException
*/
protected function build(): void
{
shell()->cd($this->source_dir)->exec('sed -i.save s@\${CMAKE_C_IMPLICIT_LINK_LIBRARIES}@@ ./CMakeLists.txt');

View File

@@ -4,19 +4,11 @@ declare(strict_types=1);
namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\exception\WrongUsageException;
use SPC\store\FileSystem;
use SPC\util\executor\UnixCMakeExecutor;
trait freetype
{
/**
* @throws FileSystemException
* @throws RuntimeException
* @throws WrongUsageException
*/
protected function build(): void
{
$cmake = UnixCMakeExecutor::create($this)

View File

@@ -4,16 +4,10 @@ declare(strict_types=1);
namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\util\executor\UnixAutoconfExecutor;
trait gmp
{
/**
* @throws FileSystemException
* @throws RuntimeException
*/
protected function build(): void
{
UnixAutoconfExecutor::create($this)->configure()->make();

View File

@@ -4,20 +4,12 @@ declare(strict_types=1);
namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\exception\WrongUsageException;
use SPC\store\FileSystem;
use SPC\util\executor\UnixAutoconfExecutor;
use SPC\util\SPCTarget;
trait imagemagick
{
/**
* @throws RuntimeException
* @throws FileSystemException
* @throws WrongUsageException
*/
protected function build(): void
{
$ac = UnixAutoconfExecutor::create($this)

View File

@@ -4,24 +4,16 @@ declare(strict_types=1);
namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\store\FileSystem;
trait jbig
{
/**
* @throws FileSystemException
*/
public function patchBeforeBuild(): bool
{
FileSystem::replaceFileStr($this->source_dir . '/Makefile', 'CFLAGS = -O2 -W -Wno-unused-result', 'CFLAGS = -O2 -W -Wno-unused-result -fPIC');
return true;
}
/**
* @throws RuntimeException
*/
protected function build(): void
{
shell()->cd($this->source_dir)->initializeEnv($this)

View File

@@ -4,16 +4,10 @@ declare(strict_types=1);
namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\util\executor\UnixCMakeExecutor;
trait lerc
{
/**
* @throws FileSystemException
* @throws RuntimeException
*/
protected function build(): void
{
UnixCMakeExecutor::create($this)

View File

@@ -4,16 +4,11 @@ declare(strict_types=1);
namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\store\FileSystem;
use SPC\util\executor\UnixAutoconfExecutor;
trait libacl
{
/**
* @throws FileSystemException
*/
public function patchBeforeMake(): bool
{
$file_path = SOURCE_PATH . '/php-src/Makefile';
@@ -25,9 +20,6 @@ trait libacl
return true;
}
/**
* @throws RuntimeException
*/
protected function build(): void
{
UnixAutoconfExecutor::create($this)

View File

@@ -4,18 +4,10 @@ declare(strict_types=1);
namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\exception\WrongUsageException;
use SPC\util\executor\UnixCMakeExecutor;
trait libavif
{
/**
* @throws FileSystemException
* @throws RuntimeException
* @throws WrongUsageException
*/
protected function build(): void
{
UnixCMakeExecutor::create($this)

View File

@@ -4,7 +4,6 @@ declare(strict_types=1);
namespace SPC\builder\unix\library;
use SPC\exception\RuntimeException;
use SPC\store\FileSystem;
use SPC\util\executor\UnixAutoconfExecutor;
@@ -20,9 +19,6 @@ trait libcares
return false;
}
/**
* @throws RuntimeException
*/
protected function build(): void
{
UnixAutoconfExecutor::create($this)->configure('--disable-tests')->make();

View File

@@ -4,16 +4,10 @@ declare(strict_types=1);
namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\util\executor\UnixCMakeExecutor;
trait libde265
{
/**
* @throws RuntimeException
* @throws FileSystemException
*/
protected function build(): void
{
UnixCMakeExecutor::create($this)

View File

@@ -4,8 +4,6 @@ declare(strict_types=1);
namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\store\FileSystem;
use SPC\util\executor\UnixCMakeExecutor;
@@ -34,10 +32,6 @@ trait libevent
}
}
/**
* @throws RuntimeException
* @throws FileSystemException
*/
protected function build(): void
{
$cmake = UnixCMakeExecutor::create($this)

View File

@@ -4,8 +4,6 @@ declare(strict_types=1);
namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\store\FileSystem;
use SPC\util\executor\UnixCMakeExecutor;
@@ -24,10 +22,6 @@ trait libheif
return false;
}
/**
* @throws RuntimeException
* @throws FileSystemException
*/
protected function build(): void
{
UnixCMakeExecutor::create($this)

View File

@@ -4,18 +4,10 @@ declare(strict_types=1);
namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\exception\WrongUsageException;
use SPC\util\executor\UnixCMakeExecutor;
trait libjpeg
{
/**
* @throws FileSystemException
* @throws RuntimeException
* @throws WrongUsageException
*/
protected function build(): void
{
UnixCMakeExecutor::create($this)

View File

@@ -4,16 +4,10 @@ declare(strict_types=1);
namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\util\executor\UnixCMakeExecutor;
trait librabbitmq
{
/**
* @throws RuntimeException
* @throws FileSystemException
*/
protected function build(): void
{
UnixCMakeExecutor::create($this)->addConfigureArgs('-DBUILD_STATIC_LIBS=ON')->build();

View File

@@ -4,8 +4,6 @@ declare(strict_types=1);
namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\store\FileSystem;
use SPC\util\executor\UnixAutoconfExecutor;
@@ -26,10 +24,6 @@ trait librdkafka
return true;
}
/**
* @throws FileSystemException
* @throws RuntimeException
*/
protected function build(): void
{
UnixAutoconfExecutor::create($this)

View File

@@ -4,16 +4,10 @@ declare(strict_types=1);
namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\util\executor\UnixCMakeExecutor;
trait libssh2
{
/**
* @throws RuntimeException
* @throws FileSystemException
*/
protected function build(): void
{
UnixCMakeExecutor::create($this)

View File

@@ -4,18 +4,12 @@ declare(strict_types=1);
namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\store\FileSystem;
use SPC\util\executor\UnixAutoconfExecutor;
use SPC\util\SPCTarget;
trait libtiff
{
/**
* @throws FileSystemException
* @throws RuntimeException
*/
protected function build(): void
{
$libcpp = SPCTarget::getTargetOS() === 'Linux' ? '-lstdc++' : '-lc++';

View File

@@ -4,15 +4,11 @@ declare(strict_types=1);
namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\store\FileSystem;
use SPC\util\executor\UnixCMakeExecutor;
trait libuuid
{
/**
* @throws FileSystemException
*/
protected function build(): void
{
UnixCMakeExecutor::create($this)->toStep(2)->build();

View File

@@ -4,16 +4,10 @@ declare(strict_types=1);
namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\util\executor\UnixCMakeExecutor;
trait libuv
{
/**
* @throws FileSystemException
* @throws RuntimeException
*/
protected function build(): void
{
UnixCMakeExecutor::create($this)

View File

@@ -4,18 +4,10 @@ declare(strict_types=1);
namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\exception\WrongUsageException;
use SPC\util\executor\UnixCMakeExecutor;
trait libwebp
{
/**
* @throws FileSystemException
* @throws RuntimeException
* @throws WrongUsageException
*/
protected function build(): void
{
UnixCMakeExecutor::create($this)

View File

@@ -5,15 +5,11 @@ declare(strict_types=1);
namespace SPC\builder\unix\library;
use SPC\builder\linux\library\LinuxLibraryBase;
use SPC\exception\FileSystemException;
use SPC\store\FileSystem;
use SPC\util\executor\UnixCMakeExecutor;
trait libxml2
{
/**
* @throws FileSystemException
*/
public function build(): void
{
$cmake = UnixCMakeExecutor::create($this)

View File

@@ -6,18 +6,10 @@ namespace SPC\builder\unix\library;
use SPC\builder\linux\library\LinuxLibraryBase;
use SPC\builder\macos\library\MacOSLibraryBase;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\exception\WrongUsageException;
use SPC\util\executor\UnixAutoconfExecutor;
trait libxslt
{
/**
* @throws FileSystemException
* @throws RuntimeException
* @throws WrongUsageException
*/
protected function build(): void
{
$static_libs = $this instanceof LinuxLibraryBase ? $this->getStaticLibFiles(include_self: false) : '';

View File

@@ -4,16 +4,10 @@ declare(strict_types=1);
namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\util\executor\UnixCMakeExecutor;
trait libzip
{
/**
* @throws RuntimeException
* @throws FileSystemException
*/
protected function build(): void
{
UnixCMakeExecutor::create($this)

View File

@@ -4,18 +4,10 @@ declare(strict_types=1);
namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\exception\WrongUsageException;
use SPC\util\executor\UnixAutoconfExecutor;
trait nghttp2
{
/**
* @throws FileSystemException
* @throws RuntimeException
* @throws WrongUsageException
*/
protected function build(): void
{
UnixAutoconfExecutor::create($this)

View File

@@ -4,16 +4,10 @@ declare(strict_types=1);
namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\util\executor\UnixAutoconfExecutor;
trait nghttp3
{
/**
* @throws FileSystemException
* @throws RuntimeException
*/
protected function build(): void
{
UnixAutoconfExecutor::create($this)->configure('--enable-lib-only')->make();

View File

@@ -6,18 +6,10 @@ namespace SPC\builder\unix\library;
use SPC\builder\linux\library\LinuxLibraryBase;
use SPC\builder\macos\library\MacOSLibraryBase;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\exception\WrongUsageException;
use SPC\util\executor\UnixAutoconfExecutor;
trait ngtcp2
{
/**
* @throws FileSystemException
* @throws RuntimeException
* @throws WrongUsageException
*/
protected function build(): void
{
UnixAutoconfExecutor::create($this)

View File

@@ -4,16 +4,10 @@ declare(strict_types=1);
namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\util\executor\UnixAutoconfExecutor;
trait onig
{
/**
* @throws FileSystemException
* @throws RuntimeException
*/
protected function build(): void
{
UnixAutoconfExecutor::create($this)->configure()->make();

View File

@@ -12,10 +12,6 @@ use SPC\util\SPCTarget;
trait postgresql
{
/**
* @throws RuntimeException
* @throws FileSystemException
*/
protected function build(): void
{
$builddir = BUILD_ROOT_PATH;

View File

@@ -5,17 +5,11 @@ declare(strict_types=1);
namespace SPC\builder\unix\library;
use SPC\builder\macos\library\MacOSLibraryBase;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\store\FileSystem;
use SPC\util\executor\UnixAutoconfExecutor;
trait qdbm
{
/**
* @throws FileSystemException
* @throws RuntimeException
*/
protected function build(): void
{
$ac = UnixAutoconfExecutor::create($this)->configure();

View File

@@ -4,16 +4,10 @@ declare(strict_types=1);
namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\util\executor\UnixAutoconfExecutor;
trait readline
{
/**
* @throws RuntimeException
* @throws FileSystemException
*/
protected function build(): void
{
UnixAutoconfExecutor::create($this)

View File

@@ -4,16 +4,10 @@ declare(strict_types=1);
namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\util\executor\UnixCMakeExecutor;
trait snappy
{
/**
* @throws RuntimeException
* @throws FileSystemException
*/
protected function build(): void
{
UnixCMakeExecutor::create($this)

View File

@@ -4,16 +4,10 @@ declare(strict_types=1);
namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\util\executor\UnixCMakeExecutor;
trait tidy
{
/**
* @throws RuntimeException
* @throws FileSystemException
*/
protected function build(): void
{
$cmake = UnixCMakeExecutor::create($this)

View File

@@ -4,16 +4,10 @@ declare(strict_types=1);
namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\util\executor\UnixAutoconfExecutor;
trait unixodbc
{
/**
* @throws FileSystemException
* @throws RuntimeException
*/
protected function build(): void
{
UnixAutoconfExecutor::create($this)

View File

@@ -4,16 +4,10 @@ declare(strict_types=1);
namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\store\FileSystem;
trait watcher
{
/**
* @throws RuntimeException
* @throws FileSystemException
*/
protected function build(): void
{
$cflags = $this->getLibExtraCXXFlags();

View File

@@ -4,16 +4,10 @@ declare(strict_types=1);
namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\util\executor\UnixAutoconfExecutor;
trait xz
{
/**
* @throws RuntimeException
* @throws FileSystemException
*/
public function build(): void
{
UnixAutoconfExecutor::create($this)

View File

@@ -4,16 +4,10 @@ declare(strict_types=1);
namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\util\executor\UnixAutoconfExecutor;
trait zlib
{
/**
* @throws RuntimeException
* @throws FileSystemException
*/
protected function build(): void
{
UnixAutoconfExecutor::create($this)->exec("./configure --static --prefix={$this->getBuildRootPath()}")->make();

View File

@@ -4,16 +4,10 @@ declare(strict_types=1);
namespace SPC\builder\unix\library;
use SPC\exception\FileSystemException;
use SPC\exception\RuntimeException;
use SPC\util\executor\UnixCMakeExecutor;
trait zstd
{
/**
* @throws RuntimeException
* @throws FileSystemException
*/
protected function build(): void
{
UnixCMakeExecutor::create($this)

View File

@@ -75,9 +75,8 @@ class SystemUtil
/**
* Create CMake toolchain file.
*
* @param null|string $cflags CFLAGS for cmake, default use '/MT /Os /Ob1 /DNDEBUG /D_ACRTIMP= /D_CRTIMP='
* @param null|string $ldflags LDFLAGS for cmake, default use '/nodefaultlib:msvcrt /nodefaultlib:msvcrtd /defaultlib:libcmt'
* @throws FileSystemException
* @param null|string $cflags CFLAGS for cmake, default use '/MT /Os /Ob1 /DNDEBUG /D_ACRTIMP= /D_CRTIMP='
* @param null|string $ldflags LDFLAGS for cmake, default use '/nodefaultlib:msvcrt /nodefaultlib:msvcrtd /defaultlib:libcmt'
*/
public static function makeCmakeToolchainFile(?string $cflags = null, ?string $ldflags = null): string
{

View File

@@ -26,9 +26,6 @@ class WindowsBuilder extends BuilderBase
/** @var bool Micro patch phar flag */
private bool $phar_patched = false;
/**
* @throws FileSystemException
*/
public function __construct(array $options = [])
{
$this->options = $options;
@@ -54,11 +51,6 @@ class WindowsBuilder extends BuilderBase
f_mkdir(BUILD_LIB_PATH, recursive: true);
}
/**
* @throws RuntimeException
* @throws WrongUsageException
* @throws FileSystemException
*/
public function buildPHP(int $build_target = BUILD_TARGET_NONE): void
{
$enableCli = ($build_target & BUILD_TARGET_CLI) === BUILD_TARGET_CLI;
@@ -153,10 +145,6 @@ class WindowsBuilder extends BuilderBase
$this->sanityCheck($build_target);
}
/**
* @throws FileSystemException
* @throws RuntimeException
*/
public function buildCli(): void
{
SourcePatcher::patchWindowsCLITarget();
@@ -182,11 +170,6 @@ class WindowsBuilder extends BuilderBase
*/
}
/**
* @throws FileSystemException
* @throws RuntimeException
* @throws WrongUsageException
*/
public function buildMicro(): void
{
// workaround for fiber (originally from https://github.com/dixyes/lwmbs/blob/master/windows/MicroBuild.php)
@@ -262,10 +245,6 @@ class WindowsBuilder extends BuilderBase
$this->lib_list = $sorted_libraries;
}
/**
* @throws FileSystemException
* @throws RuntimeException
*/
public function cleanMake(): void
{
FileSystem::writeFile(SOURCE_PATH . '\php-src\nmake_clean_wrapper.bat', 'nmake /nologo %*');
@@ -274,8 +253,6 @@ class WindowsBuilder extends BuilderBase
/**
* Run extension and PHP cli and micro check
*
* @throws RuntimeException
*/
public function sanityCheck(mixed $build_target): void
{
@@ -321,11 +298,9 @@ class WindowsBuilder extends BuilderBase
}
/**
* 将编译好的二进制文件发布到 buildroot
* Deploy the binary file to buildroot/bin/
*
* @param int $type 发布类型
* @throws RuntimeException
* @throws FileSystemException
* @param int $type Deploy type
*/
public function deployBinary(int $type): bool
{
@@ -350,34 +325,6 @@ class WindowsBuilder extends BuilderBase
return true;
}
/**
* @throws WrongUsageException
* @throws FileSystemException
*/
public function getAllStaticLibFiles(): array
{
$libs = [];
// reorder libs
foreach ($this->libs as $lib) {
foreach ($lib->getDependencies() as $dep) {
$libs[] = $dep;
}
$libs[] = $lib;
}
$libFiles = [];
$libNames = [];
// merge libs
foreach ($libs as $lib) {
if (!in_array($lib::NAME, $libNames, true)) {
$libNames[] = $lib::NAME;
array_unshift($libFiles, ...$lib->getStaticLibs());
}
}
return $libFiles;
}
/**
* Generate command wrapper prefix for php-sdk internal commands.
*