Skip to content

Commit 8ab0989

Browse files
committed
conditional install-modules
1 parent 9c8b4d6 commit 8ab0989

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

config/ext.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,7 @@
341341
"ext-depends": [
342342
"xml"
343343
],
344+
"build-with-php": true,
344345
"target": [
345346
"static"
346347
]
@@ -461,13 +462,15 @@
461462
"mysqli": {
462463
"type": "builtin",
463464
"arg-type": "with",
465+
"build-with-php": true,
464466
"ext-depends": [
465467
"mysqlnd"
466468
]
467469
},
468470
"mysqlnd": {
469471
"type": "builtin",
470472
"arg-type-windows": "with",
473+
"build-with-php": true,
471474
"lib-depends": [
472475
"zlib"
473476
]
@@ -797,6 +800,7 @@
797800
"type": "builtin",
798801
"arg-type": "with-path",
799802
"arg-type-windows": "with",
803+
"build-with-php": true,
800804
"lib-depends": [
801805
"sqlite"
802806
]
@@ -1177,6 +1181,7 @@
11771181
"lib-depends": [
11781182
"zlib"
11791183
],
1184+
"build-with-php": true,
11801185
"target": [
11811186
"static"
11821187
]

src/SPC/builder/linux/LinuxBuilder.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use SPC\builder\unix\UnixBuilderBase;
88
use SPC\exception\PatchException;
99
use SPC\exception\WrongUsageException;
10+
use SPC\store\Config;
1011
use SPC\store\FileSystem;
1112
use SPC\store\SourcePatcher;
1213
use SPC\util\GlobalEnvManager;
@@ -283,12 +284,17 @@ protected function buildFpm(): void
283284
*/
284285
protected function buildEmbed(): void
285286
{
287+
$sharedExts = array_filter($this->exts, static fn ($ext) => $ext->isBuildShared());
288+
$sharedExts = array_filter($sharedExts, static function ($ext) {
289+
return Config::getExt($ext->getName(), 'build-with-php') === true;
290+
});
291+
$install_modules = $sharedExts ? 'install-modules' : '';
286292
$vars = SystemUtil::makeEnvVarString($this->getMakeExtraVars());
287293
$concurrency = getenv('SPC_CONCURRENCY') ? '-j' . getenv('SPC_CONCURRENCY') : '';
288294
shell()->cd(SOURCE_PATH . '/php-src')
289295
->exec('sed -i "s|//lib|/lib|g" Makefile')
290296
->exec('sed -i "s|^EXTENSION_DIR = .*|EXTENSION_DIR = /' . basename(BUILD_MODULES_PATH) . '|" Makefile')
291-
->exec("make {$concurrency} INSTALL_ROOT=" . BUILD_ROOT_PATH . " {$vars} install-sapi install-modules install-build install-headers install-programs");
297+
->exec("make {$concurrency} INSTALL_ROOT=" . BUILD_ROOT_PATH . " {$vars} install-sapi {$install_modules} install-build install-headers install-programs");
292298

293299
$ldflags = getenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_LDFLAGS') ?: '';
294300
$libDir = BUILD_LIB_PATH;

src/SPC/builder/macos/MacOSBuilder.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use SPC\builder\macos\library\MacOSLibraryBase;
88
use SPC\builder\unix\UnixBuilderBase;
99
use SPC\exception\WrongUsageException;
10+
use SPC\store\Config;
1011
use SPC\store\FileSystem;
1112
use SPC\store\SourcePatcher;
1213
use SPC\util\GlobalEnvManager;
@@ -264,10 +265,15 @@ protected function buildFpm(): void
264265
*/
265266
protected function buildEmbed(): void
266267
{
268+
$sharedExts = array_filter($this->exts, static fn ($ext) => $ext->isBuildShared());
269+
$sharedExts = array_filter($sharedExts, static function ($ext) {
270+
return Config::getExt($ext->getName(), 'build-with-php') === true;
271+
});
272+
$install_modules = $sharedExts ? 'install-modules' : '';
267273
$vars = SystemUtil::makeEnvVarString($this->getMakeExtraVars());
268274
$concurrency = getenv('SPC_CONCURRENCY') ? '-j' . getenv('SPC_CONCURRENCY') : '';
269275
shell()->cd(SOURCE_PATH . '/php-src')
270-
->exec("make {$concurrency} INSTALL_ROOT=" . BUILD_ROOT_PATH . " {$vars} install-sapi install-modules install-build install-headers install-programs");
276+
->exec("make {$concurrency} INSTALL_ROOT=" . BUILD_ROOT_PATH . " {$vars} install-sapi {$install_modules} install-build install-headers install-programs");
271277

272278
if (getenv('SPC_CMD_VAR_PHP_EMBED_TYPE') === 'static') {
273279
$AR = getenv('AR') ?: 'ar';

0 commit comments

Comments
 (0)