mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-06 08:15:39 +08:00
add ext-gearman
This commit is contained in:
20
src/Package/Extension/gearman.php
Normal file
20
src/Package/Extension/gearman.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Package\Extension;
|
||||
|
||||
use StaticPHP\Attribute\Package\CustomPhpConfigureArg;
|
||||
use StaticPHP\Attribute\Package\Extension;
|
||||
use StaticPHP\Package\PackageInstaller;
|
||||
|
||||
#[Extension('gearman')]
|
||||
class gearman
|
||||
{
|
||||
#[CustomPhpConfigureArg('Linux')]
|
||||
#[CustomPhpConfigureArg('Darwin')]
|
||||
public function getUnixConfigureArg(bool $shared, PackageInstaller $installer): string
|
||||
{
|
||||
return '--with-gearman=' . ($shared ? 'shared,' : '') . $installer->getLibraryPackage('libgearman')->getBuildRootPath();
|
||||
}
|
||||
}
|
||||
@@ -57,7 +57,6 @@ class libevent
|
||||
->addConfigureArgs(
|
||||
'-DEVENT__LIBRARY_TYPE=STATIC',
|
||||
'-DEVENT__DISABLE_BENCHMARK=ON',
|
||||
'-DEVENT__DISABLE_THREAD_SUPPORT=ON',
|
||||
'-DEVENT__DISABLE_TESTS=ON',
|
||||
'-DEVENT__DISABLE_SAMPLES=ON',
|
||||
'-DEVENT__DISABLE_MBEDTLS=ON ',
|
||||
@@ -67,7 +66,7 @@ class libevent
|
||||
}
|
||||
$cmake->build();
|
||||
|
||||
$lib->patchPkgconfPrefix(['libevent.pc', 'libevent_core.pc', 'libevent_extra.pc', 'libevent_openssl.pc']);
|
||||
$lib->patchPkgconfPrefix(['libevent.pc', 'libevent_core.pc', 'libevent_extra.pc', 'libevent_openssl.pc', 'libevent_pthreads.pc']);
|
||||
|
||||
$lib->patchPkgconfPrefix(
|
||||
['libevent_openssl.pc'],
|
||||
|
||||
55
src/Package/Library/libgearman.php
Normal file
55
src/Package/Library/libgearman.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Package\Library;
|
||||
|
||||
use StaticPHP\Attribute\Package\BuildFor;
|
||||
use StaticPHP\Attribute\Package\Library;
|
||||
use StaticPHP\Attribute\Package\PatchBeforeBuild;
|
||||
use StaticPHP\Attribute\PatchDescription;
|
||||
use StaticPHP\Package\LibraryPackage;
|
||||
use StaticPHP\Runtime\Executor\UnixAutoconfExecutor;
|
||||
use StaticPHP\Util\FileSystem;
|
||||
|
||||
#[Library('libgearman')]
|
||||
class libgearman
|
||||
{
|
||||
#[PatchBeforeBuild]
|
||||
#[PatchDescription('Skip the unconditional Boost probe; libgearman itself does not use Boost (only the server/CLI/benchmark targets we skip do)')]
|
||||
public function patchBeforeBuild(LibraryPackage $lib): bool
|
||||
{
|
||||
FileSystem::replaceFileStr(
|
||||
$lib->getSourceDir() . '/configure',
|
||||
'as_fn_error $? "could not find boost" "$LINENO" 5',
|
||||
':',
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
#[BuildFor('Linux')]
|
||||
#[BuildFor('Darwin')]
|
||||
public function build(LibraryPackage $lib): void
|
||||
{
|
||||
UnixAutoconfExecutor::create($lib)
|
||||
->appendEnv([
|
||||
'CFLAGS' => '-Wno-error',
|
||||
'CXXFLAGS' => '-std=c++17 -Wno-error',
|
||||
])
|
||||
->optionalPackage('libmemcached', '--enable-libmemcached', '--disable-libmemcached')
|
||||
->removeConfigureArgs('--enable-pic')
|
||||
->configure(
|
||||
'--disable-libdrizzle',
|
||||
'--disable-libtokyocabinet',
|
||||
'--disable-libpq',
|
||||
'--disable-jobserver',
|
||||
'--without-mysql',
|
||||
)
|
||||
// gearmand is a server+library project; we only need libgearman (client lib)
|
||||
->make(
|
||||
target: 'configmake.h libhashkit-1.0/configure.h libgearman/error_code.hpp libgearman/command.hpp libtest/version.h libgearman/libgearman.la',
|
||||
with_install: 'install-libLTLIBRARIES install-nobase_includeHEADERS install-pkgconfigDATA',
|
||||
);
|
||||
$lib->patchPkgconfPrefix(['gearmand.pc']);
|
||||
}
|
||||
}
|
||||
@@ -757,7 +757,7 @@ trait unix
|
||||
return array_filter([
|
||||
'EXTRA_CFLAGS' => getenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS'),
|
||||
'EXTRA_CXXFLAGS' => getenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_CXXFLAGS'),
|
||||
'EXTRA_LDFLAGS_PROGRAM' => getenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_LDFLAGS') . "{$config['ldflags']} {$static} {$pie}",
|
||||
'EXTRA_LDFLAGS_PROGRAM' => deduplicate_flags(getenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_LDFLAGS') . " {$config['ldflags']} {$static} {$pie}"),
|
||||
'EXTRA_LDFLAGS' => $config['ldflags'],
|
||||
'EXTRA_LIBS' => $libs,
|
||||
]);
|
||||
|
||||
@@ -13,7 +13,7 @@ use StaticPHP\Util\System\LinuxUtil;
|
||||
class LinuxToolCheck
|
||||
{
|
||||
public const TOOLS_ALPINE = [
|
||||
'make', 'bison', 're2c', 'flex',
|
||||
'make', 'bison', 're2c', 'flex', 'gperf',
|
||||
'git', 'autoconf', 'automake', 'gettext-dev',
|
||||
'tar', 'unzip', 'gzip',
|
||||
'bzip2', 'cmake', 'gcc',
|
||||
@@ -22,7 +22,7 @@ class LinuxToolCheck
|
||||
];
|
||||
|
||||
public const TOOLS_DEBIAN = [
|
||||
'make', 'bison', 're2c', 'flex',
|
||||
'make', 'bison', 're2c', 'flex', 'gperf',
|
||||
'git', 'autoconf', 'automake', 'autopoint',
|
||||
'tar', 'unzip', 'gzip', 'gcc', 'g++',
|
||||
'bzip2', 'cmake', 'patch',
|
||||
@@ -30,7 +30,7 @@ class LinuxToolCheck
|
||||
];
|
||||
|
||||
public const TOOLS_RHEL = [
|
||||
'perl', 'make', 'bison', 're2c', 'flex',
|
||||
'perl', 'make', 'bison', 're2c', 'flex', 'gperf',
|
||||
'git', 'autoconf', 'automake',
|
||||
'tar', 'unzip', 'gzip', 'gcc', 'g++',
|
||||
'bzip2', 'cmake', 'patch', 'which',
|
||||
@@ -38,7 +38,7 @@ class LinuxToolCheck
|
||||
];
|
||||
|
||||
public const TOOLS_ARCH = [
|
||||
'base-devel', 'cmake',
|
||||
'base-devel', 'cmake', 'gperf',
|
||||
];
|
||||
|
||||
private const PROVIDED_COMMAND = [
|
||||
|
||||
@@ -18,6 +18,7 @@ class MacOSToolCheck
|
||||
'bison',
|
||||
're2c',
|
||||
'flex',
|
||||
'gperf',
|
||||
'pkg-config',
|
||||
'git',
|
||||
'autoconf',
|
||||
|
||||
Reference in New Issue
Block a user