@@ -18,6 +18,9 @@ public function getUnixConfigureArg(bool $shared = false): string
1818
1919 public function patchBeforeBuildconf (): bool
2020 {
21+ if (!$ this ->isBuildStatic ()) {
22+ return false ;
23+ }
2124 FileSystem::replaceFileStr (
2225 SOURCE_PATH . '/php-src/ext/memcache/config9.m4 ' ,
2326 'if test -d $abs_srcdir/src ; then ' ,
@@ -44,6 +47,38 @@ public function patchBeforeBuildconf(): bool
4447 return true ;
4548 }
4649
50+ public function patchBeforeSharedConfigure (): bool
51+ {
52+ if (!$ this ->isBuildShared ()) {
53+ return false ;
54+ }
55+ FileSystem::replaceFileStr (
56+ SOURCE_PATH . '/php-src/ext/memcache/config9.m4 ' ,
57+ 'if test -d $abs_srcdir/main ; then ' ,
58+ 'if test -d $abs_srcdir/src ; then ' ,
59+ );
60+ FileSystem::replaceFileStr (
61+ SOURCE_PATH . '/php-src/ext/memcache/config9.m4 ' ,
62+ 'export CPPFLAGS="$CPPFLAGS $INCLUDES -I$abs_srcdir/main" ' ,
63+ 'export CPPFLAGS="$CPPFLAGS $INCLUDES" ' ,
64+ );
65+ // add for in-tree building
66+ FileSystem::replaceFileStr (
67+ SOURCE_PATH . '/php-src/ext/memcache/php_memcache.h ' ,
68+ <<<'EOF'
69+ #ifndef PHP_MEMCACHE_H
70+ #define PHP_MEMCACHE_H
71+
72+ extern zend_module_entry memcache_module_entry;
73+ #define phpext_memcache_ptr &memcache_module_entry
74+
75+ #endif
76+ EOF,
77+ ''
78+ );
79+ return true ;
80+ }
81+
4782 protected function getExtraEnv (): array
4883 {
4984 return ['CFLAGS ' => '-std=c17 ' ];
0 commit comments