diff --git a/config/ext.json b/config/ext.json index 16920649..e7321203 100644 --- a/config/ext.json +++ b/config/ext.json @@ -163,6 +163,17 @@ "onig" ] }, + "memcache": { + "type": "external", + "source": "ext-memcache", + "arg-type": "custom", + "lib-depends": [ + "zlib" + ], + "ext-depends": [ + "session" + ] + }, "mongodb": { "type": "external", "source": "mongodb", @@ -220,13 +231,6 @@ "postgresql" ] }, - "pgsql": { - "type": "builtin", - "arg-type": "with-prefix", - "lib-depends": [ - "postgresql" - ] - }, "pdo_sqlite": { "type": "builtin", "arg-type": "with", @@ -238,6 +242,13 @@ "sqlite" ] }, + "pgsql": { + "type": "builtin", + "arg-type": "with-prefix", + "lib-depends": [ + "postgresql" + ] + }, "phar": { "type": "builtin", "ext-depends": [ diff --git a/config/source.json b/config/source.json index 8410e5bd..41f96367 100644 --- a/config/source.json +++ b/config/source.json @@ -61,6 +61,16 @@ "path": "LICENSE" } }, + "ext-memcache": { + "type": "url", + "url": "https://pecl.php.net/get/memcache", + "path": "php-src/ext/memcache", + "filename": "memcache.tgz", + "license": { + "type": "file", + "path": "LICENSE" + } + }, "ext-ssh2": { "type": "url", "url": "https://pecl.php.net/get/ssh2", diff --git a/src/SPC/builder/extension/memcache.php b/src/SPC/builder/extension/memcache.php new file mode 100644 index 00000000..2d2e2c94 --- /dev/null +++ b/src/SPC/builder/extension/memcache.php @@ -0,0 +1,17 @@ +getExt('pdo_sqlite')) { - // FileSystem::replaceFile() - // } + if ($builder->getExt('memcache')) { + FileSystem::replaceFile( + SOURCE_PATH . '/php-src/ext/memcache/config9.m4', + REPLACE_FILE_STR, + 'if test -d $abs_srcdir/src ; then', + 'if test -d $abs_srcdir/main ; then' + ); + FileSystem::replaceFile( + SOURCE_PATH . '/php-src/ext/memcache/config9.m4', + REPLACE_FILE_STR, + 'export CPPFLAGS="$CPPFLAGS $INCLUDES"', + 'export CPPFLAGS="$CPPFLAGS $INCLUDES -I$abs_srcdir/main"' + ); + // add for in-tree building + file_put_contents( + 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 + ); + } } public static function patchSwow(): bool