mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 04:44:53 +08:00
rename --by-extensions to --for-extensions
--without-suggests to --without-suggestions
This commit is contained in:
parent
98f32ae0f0
commit
86ce7e9d25
@ -126,7 +126,7 @@ chmod +x bin/spc
|
||||
# 拉取所有依赖库
|
||||
./bin/spc fetch --all
|
||||
# 只拉取编译指定扩展需要的所有依赖
|
||||
./bin/spc download --by-extensions=openssl,pcntl,mbstring,pdo_sqlite
|
||||
./bin/spc download --for-extensions=openssl,pcntl,mbstring,pdo_sqlite
|
||||
# 构建包含 bcmath,openssl,tokenizer,sqlite3,pdo_sqlite,ftp,curl 扩展的 php-cli 和 micro.sfx
|
||||
./bin/spc build "bcmath,openssl,tokenizer,sqlite3,pdo_sqlite,ftp,curl" --build-cli --build-micro
|
||||
```
|
||||
|
||||
@ -137,7 +137,7 @@ Basic usage for building php and micro with some extensions:
|
||||
# fetch all libraries
|
||||
./bin/spc download --all
|
||||
# only fetch necessary sources by needed extensions
|
||||
./bin/spc download --by-extensions=openssl,pcntl,mbstring,pdo_sqlite
|
||||
./bin/spc download --for-extensions=openssl,pcntl,mbstring,pdo_sqlite
|
||||
# with bcmath,openssl,tokenizer,sqlite3,pdo_sqlite,ftp,curl extension, build both CLI and phpmicro SAPI
|
||||
./bin/spc build bcmath,openssl,tokenizer,sqlite3,pdo_sqlite,ftp,curl --build-cli --build-micro
|
||||
```
|
||||
|
||||
@ -35,8 +35,8 @@ class DownloadCommand extends BaseCommand
|
||||
$this->addOption('all', 'A', null, 'Fetch all sources that static-php-cli needed');
|
||||
$this->addOption('custom-url', 'U', InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Specify custom source download url, e.g "php-src:https://downloads.php.net/~eric/php-8.3.0beta1.tar.gz"');
|
||||
$this->addOption('from-zip', 'Z', InputOption::VALUE_REQUIRED, 'Fetch from zip archive');
|
||||
$this->addOption('by-extensions', 'e', InputOption::VALUE_REQUIRED, 'Fetch by extensions, e.g "openssl,mbstring"');
|
||||
$this->addOption('without-suggests', null, null, 'Do not fetch suggested sources when using --by-extensions');
|
||||
$this->addOption('for-extensions', 'e', InputOption::VALUE_REQUIRED, 'Fetch by extensions, e.g "openssl,mbstring"');
|
||||
$this->addOption('without-suggestions', null, null, 'Do not fetch suggested sources when using --for-extensions');
|
||||
}
|
||||
|
||||
public function initialize(InputInterface $input, OutputInterface $output): void
|
||||
@ -45,7 +45,7 @@ class DownloadCommand extends BaseCommand
|
||||
$input->getOption('all')
|
||||
|| $input->getOption('clean')
|
||||
|| $input->getOption('from-zip')
|
||||
|| $input->getOption('by-extensions')
|
||||
|| $input->getOption('for-extensions')
|
||||
) {
|
||||
$input->setArgument('sources', '');
|
||||
}
|
||||
@ -108,10 +108,10 @@ class DownloadCommand extends BaseCommand
|
||||
Config::$source['openssl']['regex'] = '/href="(?<file>openssl-(?<version>1.[^"]+)\.tar\.gz)\"/';
|
||||
}
|
||||
|
||||
// --by-extensions
|
||||
if ($by_ext = $this->getOption('by-extensions')) {
|
||||
// --for-extensions
|
||||
if ($by_ext = $this->getOption('for-extensions')) {
|
||||
$ext = array_map('trim', array_filter(explode(',', $by_ext)));
|
||||
$sources = $this->calculateSourcesByExt($ext, !$this->getOption('without-suggests'));
|
||||
$sources = $this->calculateSourcesByExt($ext, !$this->getOption('without-suggestions'));
|
||||
array_unshift($sources, 'php-src', 'micro', 'pkg-config');
|
||||
} else {
|
||||
// get source list that will be downloaded
|
||||
|
||||
@ -20,7 +20,7 @@ class DumpLicenseCommand extends BaseCommand
|
||||
{
|
||||
public function configure(): void
|
||||
{
|
||||
$this->addOption('by-extensions', null, InputOption::VALUE_REQUIRED, 'Dump by extensions and related libraries', null);
|
||||
$this->addOption('for-extensions', null, InputOption::VALUE_REQUIRED, 'Dump by extensions and related libraries', null);
|
||||
$this->addOption('without-php', null, InputOption::VALUE_NONE, 'Dump without php-src');
|
||||
$this->addOption('by-libs', null, InputOption::VALUE_REQUIRED, 'Dump by libraries', null);
|
||||
$this->addOption('by-sources', null, InputOption::VALUE_REQUIRED, 'Dump by original sources (source.json)', null);
|
||||
@ -35,9 +35,9 @@ class DumpLicenseCommand extends BaseCommand
|
||||
public function handle(): int
|
||||
{
|
||||
$dumper = new LicenseDumper();
|
||||
if ($this->getOption('by-extensions') !== null) {
|
||||
if ($this->getOption('for-extensions') !== null) {
|
||||
// 从参数中获取要编译的 extensions,并转换为数组
|
||||
$extensions = array_map('trim', array_filter(explode(',', $this->getOption('by-extensions'))));
|
||||
$extensions = array_map('trim', array_filter(explode(',', $this->getOption('for-extensions'))));
|
||||
// 根据提供的扩展列表获取依赖库列表并编译
|
||||
[$extensions, $libraries] = DependencyUtil::getExtLibsByDeps($extensions);
|
||||
$dumper->addExts($extensions);
|
||||
@ -67,7 +67,7 @@ class DumpLicenseCommand extends BaseCommand
|
||||
$this->output->writeln('Dump target dir: ' . $this->getOption('dump-dir'));
|
||||
return static::SUCCESS;
|
||||
}
|
||||
$this->output->writeln('You must use one of "--by-extensions=", "--by-libs=", "--by-sources=" to dump');
|
||||
$this->output->writeln('You must use one of "--for-extensions=", "--by-libs=", "--by-sources=" to dump');
|
||||
return static::FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user