From 9c8b4d627c14e953796fbed991979051ee138ef0 Mon Sep 17 00:00:00 2001 From: henderkes Date: Sun, 19 Oct 2025 09:08:50 +0200 Subject: [PATCH 1/6] also install-modules of course... --- src/SPC/builder/linux/LinuxBuilder.php | 2 +- src/SPC/builder/macos/MacOSBuilder.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/SPC/builder/linux/LinuxBuilder.php b/src/SPC/builder/linux/LinuxBuilder.php index 41b1545d..bb40125a 100644 --- a/src/SPC/builder/linux/LinuxBuilder.php +++ b/src/SPC/builder/linux/LinuxBuilder.php @@ -288,7 +288,7 @@ class LinuxBuilder extends UnixBuilderBase 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-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; diff --git a/src/SPC/builder/macos/MacOSBuilder.php b/src/SPC/builder/macos/MacOSBuilder.php index d144457e..119aa3b7 100644 --- a/src/SPC/builder/macos/MacOSBuilder.php +++ b/src/SPC/builder/macos/MacOSBuilder.php @@ -267,7 +267,7 @@ class MacOSBuilder extends UnixBuilderBase $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-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'; From 8ab09898f0f5ccb125e9f4810dbd23cdfa671fa8 Mon Sep 17 00:00:00 2001 From: henderkes Date: Sun, 19 Oct 2025 10:41:14 +0200 Subject: [PATCH 2/6] conditional install-modules --- config/ext.json | 5 +++++ src/SPC/builder/linux/LinuxBuilder.php | 8 +++++++- src/SPC/builder/macos/MacOSBuilder.php | 8 +++++++- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/config/ext.json b/config/ext.json index 59ff4352..51924abf 100644 --- a/config/ext.json +++ b/config/ext.json @@ -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" ] diff --git a/src/SPC/builder/linux/LinuxBuilder.php b/src/SPC/builder/linux/LinuxBuilder.php index bb40125a..3995c3a8 100644 --- a/src/SPC/builder/linux/LinuxBuilder.php +++ b/src/SPC/builder/linux/LinuxBuilder.php @@ -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; diff --git a/src/SPC/builder/macos/MacOSBuilder.php b/src/SPC/builder/macos/MacOSBuilder.php index 119aa3b7..bcfaf6cf 100644 --- a/src/SPC/builder/macos/MacOSBuilder.php +++ b/src/SPC/builder/macos/MacOSBuilder.php @@ -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'; From 4cdefeab81e07c93c5919bcef1532b554acafb96 Mon Sep 17 00:00:00 2001 From: Marc Date: Sun, 19 Oct 2025 11:03:39 +0200 Subject: [PATCH 3/6] test with modules to build linux should use install-modules now, macOS should not (zip is not built with php) --- src/globals/test-extensions.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/globals/test-extensions.php b/src/globals/test-extensions.php index 99e4e31b..03e0c324 100644 --- a/src/globals/test-extensions.php +++ b/src/globals/test-extensions.php @@ -55,8 +55,8 @@ $extensions = match (PHP_OS_FAMILY) { // If you want to test shared extensions, add them below (comma separated, example `bcmath,openssl`). $shared_extensions = match (PHP_OS_FAMILY) { - 'Linux' => '', - 'Darwin' => '', + 'Linux' => 'mysqli', + 'Darwin' => 'zip', 'Windows' => '', }; From 310335813fa6ad627fec66490d270164c5f5d106 Mon Sep 17 00:00:00 2001 From: henderkes Date: Mon, 20 Oct 2025 21:23:54 +0200 Subject: [PATCH 4/6] use libedit for postgreqsql --- config/lib.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/lib.json b/config/lib.json index 81335539..6eefb33d 100644 --- a/config/lib.json +++ b/config/lib.json @@ -781,7 +781,7 @@ "libxml2", "openssl", "zlib", - "readline" + "libedit" ], "lib-suggests": [ "icu", From 32efeb970c927c605dd78e646ff5091033076f8a Mon Sep 17 00:00:00 2001 From: henderkes Date: Mon, 20 Oct 2025 23:00:23 +0200 Subject: [PATCH 5/6] don't build ossfuzzer for zip --- src/SPC/builder/unix/library/libzip.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/SPC/builder/unix/library/libzip.php b/src/SPC/builder/unix/library/libzip.php index 931bfcc3..ad0befea 100644 --- a/src/SPC/builder/unix/library/libzip.php +++ b/src/SPC/builder/unix/library/libzip.php @@ -22,6 +22,7 @@ trait libzip '-DBUILD_EXAMPLES=OFF', '-DBUILD_REGRESS=OFF', '-DBUILD_TOOLS=OFF', + '-DBUILD_OSSFUZZ=OFF', ) ->build(); $this->patchPkgconfPrefix(['libzip.pc'], PKGCONF_PATCH_PREFIX); From bba390dbcc8718f48f6cd559e20e6d4571fa91e8 Mon Sep 17 00:00:00 2001 From: henderkes Date: Mon, 20 Oct 2025 23:04:33 +0200 Subject: [PATCH 6/6] add runtime libs to unixshell (debian 11 is stupid and doesn't add them automatically) --- src/SPC/util/shell/UnixShell.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/SPC/util/shell/UnixShell.php b/src/SPC/util/shell/UnixShell.php index 75a0be3d..b8d038b0 100644 --- a/src/SPC/util/shell/UnixShell.php +++ b/src/SPC/util/shell/UnixShell.php @@ -8,6 +8,7 @@ use SPC\builder\freebsd\library\BSDLibraryBase; use SPC\builder\linux\library\LinuxLibraryBase; use SPC\builder\macos\library\MacOSLibraryBase; use SPC\exception\SPCInternalException; +use SPC\util\SPCTarget; use ZM\Logger\ConsoleColor; /** @@ -48,7 +49,7 @@ class UnixShell extends Shell 'CFLAGS' => $library->getLibExtraCFlags(), 'CXXFLAGS' => $library->getLibExtraCXXFlags(), 'LDFLAGS' => $library->getLibExtraLdFlags(), - 'LIBS' => $library->getLibExtraLibs(), + 'LIBS' => $library->getLibExtraLibs() . SPCTarget::getRuntimeLibs(), ]); return $this; }