diff --git a/src/SPC/ConsoleApplication.php b/src/SPC/ConsoleApplication.php index ba43d83c..35330406 100644 --- a/src/SPC/ConsoleApplication.php +++ b/src/SPC/ConsoleApplication.php @@ -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() { diff --git a/src/SPC/builder/windows/WindowsBuilder.php b/src/SPC/builder/windows/WindowsBuilder.php index f2f8fcc4..ff7209d5 100644 --- a/src/SPC/builder/windows/WindowsBuilder.php +++ b/src/SPC/builder/windows/WindowsBuilder.php @@ -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 . diff --git a/src/SPC/command/BuildCliCommand.php b/src/SPC/command/BuildCliCommand.php index 44d16873..5105c43c 100644 --- a/src/SPC/command/BuildCliCommand.php +++ b/src/SPC/command/BuildCliCommand.php @@ -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')) {