mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-06 00:05:42 +08:00
add fastlz, libmemcached for linux
This commit is contained in:
@@ -12,8 +12,11 @@ class memcached extends Extension
|
||||
{
|
||||
public function getUnixConfigureArg(bool $shared = false): string
|
||||
{
|
||||
$rootdir = BUILD_ROOT_PATH;
|
||||
$zlib_dir = $this->builder->getPHPVersionID() >= 80400 ? '' : "--with-zlib-dir={$rootdir}";
|
||||
return '--enable-memcached' . ($shared ? '=shared' : '') . " {$zlib_dir} --with-libmemcached-dir={$rootdir} --disable-memcached-sasl --enable-memcached-json";
|
||||
return '--enable-memcached' . ($shared ? '=shared' : '') . ' ' .
|
||||
'--with-zlib-dir=' . BUILD_ROOT_PATH . ' ' .
|
||||
'--with-libmemcached-dir=' . BUILD_ROOT_PATH . ' ' .
|
||||
'--disable-memcached-sasl ' .
|
||||
'--enable-memcached-json ' .
|
||||
'--with-system-fastlz';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,6 @@ class yac extends Extension
|
||||
|
||||
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';
|
||||
}
|
||||
}
|
||||
|
||||
12
src/SPC/builder/linux/library/fastlz.php
Normal file
12
src/SPC/builder/linux/library/fastlz.php
Normal 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';
|
||||
}
|
||||
@@ -4,17 +4,14 @@ declare(strict_types=1);
|
||||
|
||||
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
|
||||
{
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
12
src/SPC/builder/macos/library/fastlz.php
Normal file
12
src/SPC/builder/macos/library/fastlz.php
Normal 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';
|
||||
}
|
||||
@@ -4,17 +4,14 @@ declare(strict_types=1);
|
||||
|
||||
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
|
||||
{
|
||||
public const NAME = 'libmemcached';
|
||||
|
||||
public function build(): void
|
||||
{
|
||||
UnixAutoconfExecutor::create($this)->configure('--disable-sasl')->exec("sed -ie 's/-Werror//g' ./Makefile")->make();
|
||||
UnixCMakeExecutor::create($this)->build();
|
||||
}
|
||||
}
|
||||
|
||||
22
src/SPC/builder/unix/library/fastlz.php
Normal file
22
src/SPC/builder/unix/library/fastlz.php
Normal 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');
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user