From 890ff475f131c809de2b2e3309b85d33f28f5274 Mon Sep 17 00:00:00 2001 From: henderkes Date: Sat, 3 Jan 2026 14:09:16 +0100 Subject: [PATCH] our memcache patch prevents shared building --- config/ext.json | 3 +-- src/SPC/builder/extension/memcache.php | 35 ++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/config/ext.json b/config/ext.json index 62ec4877..419be5a9 100644 --- a/config/ext.json +++ b/config/ext.json @@ -410,8 +410,7 @@ "ext-depends": [ "zlib", "session" - ], - "build-with-php": true + ] }, "memcached": { "support": { diff --git a/src/SPC/builder/extension/memcache.php b/src/SPC/builder/extension/memcache.php index 59c6065d..feba0151 100644 --- a/src/SPC/builder/extension/memcache.php +++ b/src/SPC/builder/extension/memcache.php @@ -18,6 +18,9 @@ class memcache extends Extension public function patchBeforeBuildconf(): bool { + if (!$this->isBuildStatic()) { + return false; + } FileSystem::replaceFileStr( SOURCE_PATH . '/php-src/ext/memcache/config9.m4', 'if test -d $abs_srcdir/src ; then', @@ -44,6 +47,38 @@ EOF return true; } + public function patchBeforeSharedConfigure(): bool + { + if (!$this->isBuildShared()) { + return false; + } + FileSystem::replaceFileStr( + SOURCE_PATH . '/php-src/ext/memcache/config9.m4', + 'if test -d $abs_srcdir/main ; then', + 'if test -d $abs_srcdir/src ; then', + ); + FileSystem::replaceFileStr( + SOURCE_PATH . '/php-src/ext/memcache/config9.m4', + 'export CPPFLAGS="$CPPFLAGS $INCLUDES -I$abs_srcdir/main"', + 'export CPPFLAGS="$CPPFLAGS $INCLUDES"', + ); + // add for in-tree building + FileSystem::replaceFileStr( + SOURCE_PATH . '/php-src/ext/memcache/php_memcache.h', + <<<'EOF' +#ifndef PHP_MEMCACHE_H +#define PHP_MEMCACHE_H + +extern zend_module_entry memcache_module_entry; +#define phpext_memcache_ptr &memcache_module_entry + +#endif +EOF, + '' + ); + return true; + } + protected function getExtraEnv(): array { return ['CFLAGS' => '-std=c17'];