From 75b85c26dcfb6d7d90969df5466a00f30956dba9 Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Wed, 26 Jul 2023 00:08:20 +0800 Subject: [PATCH] add memcached for macOS --- config/ext.json | 13 ++++++++ config/lib.json | 7 +++++ config/source.json | 19 ++++++++++++ src/SPC/builder/extension/memcached.php | 18 +++++++++++ .../builder/linux/library/libmemcached.php | 20 ++++++++++++ .../builder/macos/library/libmemcached.php | 31 +++++++++++++++++++ 6 files changed, 108 insertions(+) create mode 100644 src/SPC/builder/extension/memcached.php create mode 100644 src/SPC/builder/linux/library/libmemcached.php create mode 100644 src/SPC/builder/macos/library/libmemcached.php diff --git a/config/ext.json b/config/ext.json index e7321203..fd3a14c5 100644 --- a/config/ext.json +++ b/config/ext.json @@ -53,6 +53,19 @@ "sockets" ] }, + "memcached": { + "type": "external", + "source": "memcached", + "arg-type": "custom", + "cpp-extension": true, + "lib-depends": [ + "libmemcached" + ], + "ext-depends": [ + "session", + "zlib" + ] + }, "exif": { "type": "builtin" }, diff --git a/config/lib.json b/config/lib.json index bc067ce1..41be5156 100644 --- a/config/lib.json +++ b/config/lib.json @@ -462,6 +462,13 @@ "zconf.h" ] }, + "libmemcached": { + "source": "libmemcached", + "static-libs-unix": [ + "libmemcached.a", + "libmemcachedutil.a" + ] + }, "zstd": { "source": "zstd", "static-libs-unix": [ diff --git a/config/source.json b/config/source.json index 41f96367..a9ada593 100644 --- a/config/source.json +++ b/config/source.json @@ -16,6 +16,25 @@ "path": "LICENSE" } }, + "memcached": { + "type": "url", + "url": "https://pecl.php.net/get/memcached", + "path": "php-src/ext/memcached", + "filename": "memcached.tgz", + "license": { + "type": "file", + "path": "LICENSE" + } + }, + "libmemcached": { + "type": "git", + "url": "https://github.com/crazywhalecc/libmemcached-macos.git", + "rev": "master", + "license": { + "type": "file", + "path": "COPYING" + } + }, "brotli": { "type": "ghtar", "repo": "google/brotli", diff --git a/src/SPC/builder/extension/memcached.php b/src/SPC/builder/extension/memcached.php new file mode 100644 index 00000000..49fb228d --- /dev/null +++ b/src/SPC/builder/extension/memcached.php @@ -0,0 +1,18 @@ +cd($this->source_dir) + ->exec('chmod +x configure') + ->exec( + "{$this->builder->configure_env} ./configure " . + '--enable-static --disable-shared ' . + '--disable-sasl ' . + "--prefix={$rootdir}" + ) + ->exec('make clean') + ->exec('sed -ie "s/-Werror//g" ' . $this->source_dir . '/Makefile') + ->exec("make -j{$this->builder->concurrency}") + ->exec('make install'); + } +}