diff --git a/docs/en/guide/build-on-windows.md b/docs/en/guide/build-on-windows.md index e3cf1c4e..86a212dd 100644 --- a/docs/en/guide/build-on-windows.md +++ b/docs/en/guide/build-on-windows.md @@ -159,7 +159,8 @@ You can try to use the following commands: - `--with-clean`: clean up old make files before compiling PHP - `--enable-zts`: Make compiled PHP thread-safe version (default is NTS version) -- `--with-libs=XXX,YYY`: Compile the specified dependent library before compiling PHP, and activate some extension optional functions +- `--with-libs=XXX,YYY`: Compile the specified dependent library before compiling PHP, and activate some extension optional functions +- `--with-config-file-path=XXX`: Set the path in which to look for php.ini) - `-I xxx=yyy`: Hard compile INI options into PHP before compiling (support multiple options, alias is `--with-hardcoded-ini`) - `--with-micro-fake-cli`: When compiling micro, let micro's `PHP_SAPI` pretend to be `cli` (for compatibility with some programs that check `PHP_SAPI`) - `--disable-opcache-jit`: Disable opcache jit (enabled by default) diff --git a/docs/en/guide/manual-build.md b/docs/en/guide/manual-build.md index 95d08ebd..50f26874 100644 --- a/docs/en/guide/manual-build.md +++ b/docs/en/guide/manual-build.md @@ -290,6 +290,7 @@ You can try to use the following commands: - `--enable-zts`: Make compiled PHP thread-safe version (default is NTS version) - `--no-strip`: Do not run `strip` after compiling the PHP library to trim the binary file to reduce its size (the macOS binary file without trim can use dynamically linked third-party extensions) - `--with-libs=XXX,YYY`: Compile the specified dependent library before compiling PHP, and activate some extended optional functions (such as libavif of the gd library, etc.) +- `--with-config-file-path=XXX`: Set the path in which to look for php.ini) - `-I xxx=yyy`: Hard compile INI options into PHP before compiling (support multiple options, alias is `--with-hardcoded-ini`) - `--with-micro-fake-cli`: When compiling micro, let micro's `PHP_SAPI` pretend to be `cli` (for compatibility with some programs that check `PHP_SAPI`) - `--disable-opcache-jit`: Disable opcache jit (enabled by default) diff --git a/src/SPC/builder/linux/LinuxBuilder.php b/src/SPC/builder/linux/LinuxBuilder.php index 14a1b987..1ce38225 100644 --- a/src/SPC/builder/linux/LinuxBuilder.php +++ b/src/SPC/builder/linux/LinuxBuilder.php @@ -134,6 +134,9 @@ class LinuxBuilder extends UnixBuilderBase } $disable_jit = $this->getOption('disable-opcache-jit', false) ? '--disable-opcache-jit ' : ''; + $config_file_path = $this->getOption('with-config-file-path', false) ? + ( '--with-config-file-path=' . $this->getOption('with-config-file-path') . " " ) : ''; + $enable_cli = ($build_target & BUILD_TARGET_CLI) === BUILD_TARGET_CLI; $enable_fpm = ($build_target & BUILD_TARGET_FPM) === BUILD_TARGET_FPM; $enable_micro = ($build_target & BUILD_TARGET_MICRO) === BUILD_TARGET_MICRO; @@ -163,6 +166,7 @@ class LinuxBuilder extends UnixBuilderBase ($enable_fpm ? '--enable-fpm ' : '--disable-fpm ') . ($enable_embed ? '--enable-embed=static ' : '--disable-embed ') . ($enable_micro ? '--enable-micro=all-static ' : '--disable-micro ') . + $config_file_path . $disable_jit . $json_74 . $zts . diff --git a/src/SPC/builder/windows/WindowsBuilder.php b/src/SPC/builder/windows/WindowsBuilder.php index 1c1646d7..3445d91e 100644 --- a/src/SPC/builder/windows/WindowsBuilder.php +++ b/src/SPC/builder/windows/WindowsBuilder.php @@ -103,6 +103,9 @@ class WindowsBuilder extends BuilderBase $micro_w32 = $this->getOption('enable-micro-win32') ? ' --enable-micro-win32=yes' : ''; + $config_file_path = $this->getOption('with-config-file-path', false) ? + ( '--with-config-file-path=' . $this->getOption('with-config-file-path') . " " ) : ''; + cmd()->cd(SOURCE_PATH . '\php-src') ->exec( "{$this->sdk_prefix} configure.bat --task-args \"" . @@ -114,6 +117,7 @@ class WindowsBuilder extends BuilderBase ($enableCli ? '--enable-cli=yes ' : '--enable-cli=no ') . ($enableMicro ? ('--enable-micro=yes ' . $micro_logo . $micro_w32) : '--enable-micro=no ') . ($enableEmbed ? '--enable-embed=yes ' : '--enable-embed=no ') . + $config_file_path . "{$this->makeExtensionArgs()} " . $zts . '"' diff --git a/src/SPC/command/BuildCliCommand.php b/src/SPC/command/BuildCliCommand.php index 2356e96f..18660603 100644 --- a/src/SPC/command/BuildCliCommand.php +++ b/src/SPC/command/BuildCliCommand.php @@ -32,6 +32,7 @@ class BuildCliCommand extends BuildCommand $this->addOption('no-strip', null, null, 'build without strip, in order to debug and load external extensions'); $this->addOption('enable-zts', null, null, 'enable ZTS support'); $this->addOption('disable-opcache-jit', null, null, 'disable opcache jit'); + $this->addOption('with-config-file-path', null, InputOption::VALUE_REQUIRED, 'Set the path in which to look for php.ini'); $this->addOption('with-hardcoded-ini', 'I', InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Patch PHP source code, inject hardcoded INI'); $this->addOption('with-micro-fake-cli', null, null, 'Let phpmicro\'s PHP_SAPI use "cli" instead of "micro"'); $this->addOption('with-suggested-libs', 'L', null, 'Build with suggested libs for selected exts and libs'); @@ -114,6 +115,9 @@ class BuildCliCommand extends BuildCommand 'Strip Binaries' => $builder->getOption('no-strip') ? 'no' : 'yes', 'Enable ZTS' => $builder->getOption('enable-zts') ? 'yes' : 'no', ]; + if (!empty($this->input->getOption('with-config-file-path'))) { + $indent_texts['Config File Path'] = $this->input->getOption('with-config-file-path'); + } if (!empty($this->input->getOption('with-hardcoded-ini'))) { $indent_texts['Hardcoded INI'] = $this->input->getOption('with-hardcoded-ini'); }