Skip to content

Commit 890ff47

Browse files
committed
our memcache patch prevents shared building
1 parent 559a290 commit 890ff47

File tree

2 files changed

+36
-2
lines changed

2 files changed

+36
-2
lines changed

config/ext.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,8 +410,7 @@
410410
"ext-depends": [
411411
"zlib",
412412
"session"
413-
],
414-
"build-with-php": true
413+
]
415414
},
416415
"memcached": {
417416
"support": {

src/SPC/builder/extension/memcache.php

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)