conditional install-modules

This commit is contained in:
henderkes 2025-10-19 10:41:14 +02:00
parent 9c8b4d627c
commit 8ab09898f0
3 changed files with 19 additions and 2 deletions

View File

@ -341,6 +341,7 @@
"ext-depends": [
"xml"
],
"build-with-php": true,
"target": [
"static"
]
@ -461,6 +462,7 @@
"mysqli": {
"type": "builtin",
"arg-type": "with",
"build-with-php": true,
"ext-depends": [
"mysqlnd"
]
@ -468,6 +470,7 @@
"mysqlnd": {
"type": "builtin",
"arg-type-windows": "with",
"build-with-php": true,
"lib-depends": [
"zlib"
]
@ -797,6 +800,7 @@
"type": "builtin",
"arg-type": "with-path",
"arg-type-windows": "with",
"build-with-php": true,
"lib-depends": [
"sqlite"
]
@ -1177,6 +1181,7 @@
"lib-depends": [
"zlib"
],
"build-with-php": true,
"target": [
"static"
]

View File

@ -7,6 +7,7 @@ namespace SPC\builder\linux;
use SPC\builder\unix\UnixBuilderBase;
use SPC\exception\PatchException;
use SPC\exception\WrongUsageException;
use SPC\store\Config;
use SPC\store\FileSystem;
use SPC\store\SourcePatcher;
use SPC\util\GlobalEnvManager;
@ -283,12 +284,17 @@ class LinuxBuilder extends UnixBuilderBase
*/
protected function buildEmbed(): void
{
$sharedExts = array_filter($this->exts, static fn ($ext) => $ext->isBuildShared());
$sharedExts = array_filter($sharedExts, static function ($ext) {
return Config::getExt($ext->getName(), 'build-with-php') === true;
});
$install_modules = $sharedExts ? 'install-modules' : '';
$vars = SystemUtil::makeEnvVarString($this->getMakeExtraVars());
$concurrency = getenv('SPC_CONCURRENCY') ? '-j' . getenv('SPC_CONCURRENCY') : '';
shell()->cd(SOURCE_PATH . '/php-src')
->exec('sed -i "s|//lib|/lib|g" Makefile')
->exec('sed -i "s|^EXTENSION_DIR = .*|EXTENSION_DIR = /' . basename(BUILD_MODULES_PATH) . '|" Makefile')
->exec("make {$concurrency} INSTALL_ROOT=" . BUILD_ROOT_PATH . " {$vars} install-sapi install-modules install-build install-headers install-programs");
->exec("make {$concurrency} INSTALL_ROOT=" . BUILD_ROOT_PATH . " {$vars} install-sapi {$install_modules} install-build install-headers install-programs");
$ldflags = getenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_LDFLAGS') ?: '';
$libDir = BUILD_LIB_PATH;

View File

@ -7,6 +7,7 @@ namespace SPC\builder\macos;
use SPC\builder\macos\library\MacOSLibraryBase;
use SPC\builder\unix\UnixBuilderBase;
use SPC\exception\WrongUsageException;
use SPC\store\Config;
use SPC\store\FileSystem;
use SPC\store\SourcePatcher;
use SPC\util\GlobalEnvManager;
@ -264,10 +265,15 @@ class MacOSBuilder extends UnixBuilderBase
*/
protected function buildEmbed(): void
{
$sharedExts = array_filter($this->exts, static fn ($ext) => $ext->isBuildShared());
$sharedExts = array_filter($sharedExts, static function ($ext) {
return Config::getExt($ext->getName(), 'build-with-php') === true;
});
$install_modules = $sharedExts ? 'install-modules' : '';
$vars = SystemUtil::makeEnvVarString($this->getMakeExtraVars());
$concurrency = getenv('SPC_CONCURRENCY') ? '-j' . getenv('SPC_CONCURRENCY') : '';
shell()->cd(SOURCE_PATH . '/php-src')
->exec("make {$concurrency} INSTALL_ROOT=" . BUILD_ROOT_PATH . " {$vars} install-sapi install-modules install-build install-headers install-programs");
->exec("make {$concurrency} INSTALL_ROOT=" . BUILD_ROOT_PATH . " {$vars} install-sapi {$install_modules} install-build install-headers install-programs");
if (getenv('SPC_CMD_VAR_PHP_EMBED_TYPE') === 'static') {
$AR = getenv('AR') ?: 'ar';