add fastlz, libmemcached for linux

This commit is contained in:
DubbleClick 2025-06-12 10:46:26 +07:00
parent bfba598ef4
commit 089b94d753
10 changed files with 101 additions and 32 deletions

View File

@ -330,6 +330,16 @@
"openssl" "openssl"
] ]
}, },
"libxml": {
"support": {
"BSD": "wip"
},
"type": "builtin",
"arg-type": "none",
"target": [
"static"
]
},
"lz4": { "lz4": {
"support": { "support": {
"Windows": "wip", "Windows": "wip",
@ -342,16 +352,6 @@
"liblz4" "liblz4"
] ]
}, },
"libxml": {
"support": {
"BSD": "wip"
},
"type": "builtin",
"arg-type": "none",
"target": [
"static"
]
},
"mbregex": { "mbregex": {
"type": "builtin", "type": "builtin",
"arg-type": "custom", "arg-type": "custom",
@ -396,8 +396,7 @@
"memcached": { "memcached": {
"support": { "support": {
"Windows": "wip", "Windows": "wip",
"BSD": "wip", "BSD": "wip"
"Linux": "no"
}, },
"type": "external", "type": "external",
"source": "memcached", "source": "memcached",
@ -406,6 +405,10 @@
"lib-depends": [ "lib-depends": [
"libmemcached" "libmemcached"
], ],
"lib-depends-unix": [
"libmemcached",
"fastlz"
],
"ext-depends": [ "ext-depends": [
"session", "session",
"zlib" "zlib"
@ -1083,6 +1086,9 @@
"type": "external", "type": "external",
"source": "yac", "source": "yac",
"arg-type-unix": "custom", "arg-type-unix": "custom",
"lib-depends-unix": [
"fastlz"
],
"ext-depends-unix": [ "ext-depends-unix": [
"igbinary" "igbinary"
] ]

View File

@ -101,6 +101,15 @@
"SystemConfiguration" "SystemConfiguration"
] ]
}, },
"fastlz": {
"source": "fastlz",
"static-libs-unix": [
"libfastlz.a"
],
"headers": [
"fastlz/fastlz.h"
]
},
"freetype": { "freetype": {
"source": "freetype", "source": "freetype",
"static-libs-unix": [ "static-libs-unix": [
@ -389,7 +398,9 @@
"source": "libmemcached", "source": "libmemcached",
"static-libs-unix": [ "static-libs-unix": [
"libmemcached.a", "libmemcached.a",
"libmemcachedutil.a" "libmemcachedprotocol.a",
"libmemcachedutil.a",
"libhashkit.a"
] ]
}, },
"libpng": { "libpng": {

View File

@ -272,6 +272,15 @@
"path": "LICENSE" "path": "LICENSE"
} }
}, },
"fastlz": {
"type": "git",
"url": "https://github.com/ariya/FastLZ.git",
"rev": "master",
"license": {
"type": "file",
"path": "LICENSE.MIT"
}
},
"freetype": { "freetype": {
"type": "git", "type": "git",
"rev": "VER-2-13-2", "rev": "VER-2-13-2",
@ -528,12 +537,12 @@
} }
}, },
"libmemcached": { "libmemcached": {
"type": "git", "type": "ghtagtar",
"url": "https://github.com/static-php/libmemcached-macos.git", "repo": "awesomized/libmemcached",
"rev": "master", "match": "1.\\d.\\d",
"license": { "license": {
"type": "file", "type": "file",
"path": "COPYING" "path": "LICENSE"
} }
}, },
"libpng": { "libpng": {

View File

@ -12,8 +12,11 @@ class memcached extends Extension
{ {
public function getUnixConfigureArg(bool $shared = false): string public function getUnixConfigureArg(bool $shared = false): string
{ {
$rootdir = BUILD_ROOT_PATH; return '--enable-memcached' . ($shared ? '=shared' : '') . ' ' .
$zlib_dir = $this->builder->getPHPVersionID() >= 80400 ? '' : "--with-zlib-dir={$rootdir}"; '--with-zlib-dir=' . BUILD_ROOT_PATH . ' ' .
return '--enable-memcached' . ($shared ? '=shared' : '') . " {$zlib_dir} --with-libmemcached-dir={$rootdir} --disable-memcached-sasl --enable-memcached-json"; '--with-libmemcached-dir=' . BUILD_ROOT_PATH . ' ' .
'--disable-memcached-sasl ' .
'--enable-memcached-json ' .
'--with-system-fastlz';
} }
} }

View File

@ -21,6 +21,6 @@ class yac extends Extension
public function getUnixConfigureArg(bool $shared = false): string public function getUnixConfigureArg(bool $shared = false): string
{ {
return '--enable-yac --enable-igbinary --enable-json'; return '--enable-yac ' . ($shared ? '=shared' : '') . ' --enable-igbinary --enable-json --with-system-fastlz';
} }
} }

View File

@ -0,0 +1,12 @@
<?php
declare(strict_types=1);
namespace SPC\builder\linux\library;
class fastlz extends LinuxLibraryBase
{
use \SPC\builder\unix\library\fastlz;
public const NAME = 'fastlz';
}

View File

@ -4,17 +4,14 @@ declare(strict_types=1);
namespace SPC\builder\linux\library; namespace SPC\builder\linux\library;
use SPC\exception\RuntimeException; use SPC\util\executor\UnixCMakeExecutor;
/**
* gmp is a template library class for unix
*/
class libmemcached extends LinuxLibraryBase class libmemcached extends LinuxLibraryBase
{ {
public const NAME = 'libmemcached'; public const NAME = 'libmemcached';
public function build() public function build(): void
{ {
throw new RuntimeException('libmemcached is currently not supported on Linux platform'); UnixCMakeExecutor::create($this)->build();
} }
} }

View File

@ -0,0 +1,12 @@
<?php
declare(strict_types=1);
namespace SPC\builder\macos\library;
class fastlz extends MacOSLibraryBase
{
use \SPC\builder\unix\library\fastlz;
public const NAME = 'fastlz';
}

View File

@ -4,17 +4,14 @@ declare(strict_types=1);
namespace SPC\builder\macos\library; namespace SPC\builder\macos\library;
use SPC\util\executor\UnixAutoconfExecutor; use SPC\util\executor\UnixCMakeExecutor;
/**
* gmp is a template library class for unix
*/
class libmemcached extends MacOSLibraryBase class libmemcached extends MacOSLibraryBase
{ {
public const NAME = 'libmemcached'; public const NAME = 'libmemcached';
public function build(): void public function build(): void
{ {
UnixAutoconfExecutor::create($this)->configure('--disable-sasl')->exec("sed -ie 's/-Werror//g' ./Makefile")->make(); UnixCMakeExecutor::create($this)->build();
} }
} }

View File

@ -0,0 +1,22 @@
<?php
declare(strict_types=1);
namespace SPC\builder\unix\library;
trait fastlz
{
protected function build(): void
{
shell()->cd($this->source_dir)->initializeEnv($this)
->exec((getenv('CC') ?? 'cc') . ' -c -O3 -fPIC fastlz.c -o fastlz.o')
->exec((getenv('AR') ?? 'ar') . ' rcs libfastlz.a fastlz.o');
if (!copy($this->source_dir . '/fastlz.h', BUILD_INCLUDE_PATH . '/fastlz.h')) {
throw new \RuntimeException('Failed to copy fastlz.h');
}
if (!copy($this->source_dir . '/libfastlz.a', BUILD_LIB_PATH . '/libfastlz.a')) {
throw new \RuntimeException('Failed to copy libfastlz.a');
}
}
}