mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-13 20:05:35 +08:00
add memcached for macOS
This commit is contained in:
@@ -53,6 +53,19 @@
|
|||||||
"sockets"
|
"sockets"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"memcached": {
|
||||||
|
"type": "external",
|
||||||
|
"source": "memcached",
|
||||||
|
"arg-type": "custom",
|
||||||
|
"cpp-extension": true,
|
||||||
|
"lib-depends": [
|
||||||
|
"libmemcached"
|
||||||
|
],
|
||||||
|
"ext-depends": [
|
||||||
|
"session",
|
||||||
|
"zlib"
|
||||||
|
]
|
||||||
|
},
|
||||||
"exif": {
|
"exif": {
|
||||||
"type": "builtin"
|
"type": "builtin"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -462,6 +462,13 @@
|
|||||||
"zconf.h"
|
"zconf.h"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"libmemcached": {
|
||||||
|
"source": "libmemcached",
|
||||||
|
"static-libs-unix": [
|
||||||
|
"libmemcached.a",
|
||||||
|
"libmemcachedutil.a"
|
||||||
|
]
|
||||||
|
},
|
||||||
"zstd": {
|
"zstd": {
|
||||||
"source": "zstd",
|
"source": "zstd",
|
||||||
"static-libs-unix": [
|
"static-libs-unix": [
|
||||||
|
|||||||
@@ -16,6 +16,25 @@
|
|||||||
"path": "LICENSE"
|
"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": {
|
"brotli": {
|
||||||
"type": "ghtar",
|
"type": "ghtar",
|
||||||
"repo": "google/brotli",
|
"repo": "google/brotli",
|
||||||
|
|||||||
18
src/SPC/builder/extension/memcached.php
Normal file
18
src/SPC/builder/extension/memcached.php
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace SPC\builder\extension;
|
||||||
|
|
||||||
|
use SPC\builder\Extension;
|
||||||
|
use SPC\util\CustomExt;
|
||||||
|
|
||||||
|
#[CustomExt('memcached')]
|
||||||
|
class memcached extends Extension
|
||||||
|
{
|
||||||
|
public function getUnixConfigureArg(): string
|
||||||
|
{
|
||||||
|
$rootdir = BUILD_ROOT_PATH;
|
||||||
|
return "--enable-memcached --with-zlib-dir={$rootdir} --with-libmemcached-dir={$rootdir} --disable-memcached-sasl --enable-memcached-json";
|
||||||
|
}
|
||||||
|
}
|
||||||
20
src/SPC/builder/linux/library/libmemcached.php
Normal file
20
src/SPC/builder/linux/library/libmemcached.php
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace SPC\builder\linux\library;
|
||||||
|
|
||||||
|
use SPC\exception\RuntimeException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gmp is a template library class for unix
|
||||||
|
*/
|
||||||
|
class libmemcached extends LinuxLibraryBase
|
||||||
|
{
|
||||||
|
public const NAME = 'libmemcached';
|
||||||
|
|
||||||
|
public function build()
|
||||||
|
{
|
||||||
|
throw new RuntimeException('libmemcached is currently not supported on Linux platform');
|
||||||
|
}
|
||||||
|
}
|
||||||
31
src/SPC/builder/macos/library/libmemcached.php
Normal file
31
src/SPC/builder/macos/library/libmemcached.php
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace SPC\builder\macos\library;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gmp is a template library class for unix
|
||||||
|
*/
|
||||||
|
class libmemcached extends MacOSLibraryBase
|
||||||
|
{
|
||||||
|
public const NAME = 'libmemcached';
|
||||||
|
|
||||||
|
public function build()
|
||||||
|
{
|
||||||
|
$rootdir = BUILD_ROOT_PATH;
|
||||||
|
|
||||||
|
shell()->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');
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user