mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-17 20:34:51 +08:00
Add custom Windows micro logo support (#358)
* add custom windows micro logo option `--with-micro-logo` * bump version 2.1.2
This commit is contained in:
parent
842e0add29
commit
b46655ecfe
@ -25,7 +25,7 @@ use Symfony\Component\Console\Command\ListCommand;
|
||||
*/
|
||||
final class ConsoleApplication extends Application
|
||||
{
|
||||
public const VERSION = '2.1.1';
|
||||
public const VERSION = '2.1.2';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
@ -85,6 +85,14 @@ class WindowsBuilder extends BuilderBase
|
||||
unlink($makefile . '.originfile');
|
||||
}
|
||||
|
||||
if (($logo = $this->getOption('with-micro-logo')) !== null) {
|
||||
// realpath
|
||||
$logo = realpath($logo);
|
||||
$micro_logo = '--enable-micro-logo=' . escapeshellarg($logo) . ' ';
|
||||
} else {
|
||||
$micro_logo = '';
|
||||
}
|
||||
|
||||
cmd()->cd(SOURCE_PATH . '\php-src')
|
||||
->exec(
|
||||
"{$this->sdk_prefix} configure.bat --task-args \"" .
|
||||
@ -94,7 +102,7 @@ class WindowsBuilder extends BuilderBase
|
||||
'--with-extra-includes=' . BUILD_INCLUDE_PATH . ' ' .
|
||||
'--with-extra-libs=' . BUILD_LIB_PATH . ' ' .
|
||||
($enableCli ? '--enable-cli=yes ' : '--enable-cli=no ') .
|
||||
($enableMicro ? '--enable-micro=yes ' : '--enable-micro=no ') .
|
||||
($enableMicro ? ('--enable-micro=yes ' . $micro_logo) : '--enable-micro=no ') .
|
||||
($enableEmbed ? '--enable-embed=yes ' : '--enable-embed=no ') .
|
||||
"{$this->makeExtensionArgs()} " .
|
||||
$zts .
|
||||
|
||||
@ -39,6 +39,10 @@ class BuildCliCommand extends BuildCommand
|
||||
$this->addOption('without-micro-ext-test', null, null, 'Disable phpmicro with extension test code');
|
||||
|
||||
$this->addOption('with-upx-pack', null, null, 'Compress / pack binary using UPX tool (linux/windows only)');
|
||||
|
||||
if (PHP_OS_FAMILY === 'Windows') {
|
||||
$this->addOption('with-micro-logo', null, InputOption::VALUE_REQUIRED, 'Use custom .ico for micro.sfx');
|
||||
}
|
||||
}
|
||||
|
||||
public function handle(): int
|
||||
@ -63,6 +67,14 @@ class BuildCliCommand extends BuildCommand
|
||||
if ($rule === BUILD_TARGET_ALL) {
|
||||
logger()->warning('--build-all option makes `--no-strip` always true, be aware!');
|
||||
}
|
||||
if (($rule & BUILD_TARGET_MICRO) === BUILD_TARGET_MICRO && $this->getOption('with-micro-logo')) {
|
||||
$logo = $this->getOption('with-micro-logo');
|
||||
if (!file_exists($logo)) {
|
||||
logger()->error('Logo file ' . $logo . ' not exist !');
|
||||
return static::FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
// Check upx
|
||||
$suffix = PHP_OS_FAMILY === 'Windows' ? '.exe' : '';
|
||||
if ($this->getOption('with-upx-pack')) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user