mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-17 20:34:51 +08:00
Add snappy extension
This commit is contained in:
parent
6de5c1dab0
commit
fdc3a7a04b
@ -325,6 +325,17 @@
|
||||
"libxml2"
|
||||
]
|
||||
},
|
||||
"snappy": {
|
||||
"type": "external",
|
||||
"source": "ext-snappy",
|
||||
"arg-type": "custom",
|
||||
"lib-depends": [
|
||||
"snappy"
|
||||
],
|
||||
"ext-suggest": [
|
||||
"apcu"
|
||||
]
|
||||
},
|
||||
"snmp": {
|
||||
"type": "builtin",
|
||||
"arg-type": "with",
|
||||
|
||||
@ -510,5 +510,18 @@
|
||||
"zstd.h",
|
||||
"zstd_errors.h"
|
||||
]
|
||||
},
|
||||
"snappy": {
|
||||
"source": "snappy",
|
||||
"static-libs-unix": [
|
||||
"libsnappy.a"
|
||||
],
|
||||
"headers-unix": [
|
||||
"snappy-c.h",
|
||||
"snappy-sinksource.h",
|
||||
"snappy.h",
|
||||
"snappy-stubs-internal.h",
|
||||
"snappy-stubs-public.h"
|
||||
]
|
||||
}
|
||||
}
|
||||
@ -80,6 +80,16 @@
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"ext-snappy": {
|
||||
"type": "git",
|
||||
"path": "php-src/ext/snappy",
|
||||
"rev": "master",
|
||||
"url": "https://github.com/kjdev/php-ext-snappy",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"ext-ssh2": {
|
||||
"type": "url",
|
||||
"url": "https://pecl.php.net/get/ssh2",
|
||||
@ -401,6 +411,16 @@
|
||||
"path": "COPYING"
|
||||
}
|
||||
},
|
||||
"snappy": {
|
||||
"type": "git",
|
||||
"repo": "google/snappy",
|
||||
"rev": "main",
|
||||
"url": "https://github.com/google/snappy",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "COPYING"
|
||||
}
|
||||
},
|
||||
"sqlite": {
|
||||
"type": "url",
|
||||
"url": "https://www.sqlite.org/2023/sqlite-autoconf-3410100.tar.gz",
|
||||
|
||||
17
src/SPC/builder/extension/snappy.php
Normal file
17
src/SPC/builder/extension/snappy.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\extension;
|
||||
|
||||
use SPC\builder\Extension;
|
||||
use SPC\util\CustomExt;
|
||||
|
||||
#[CustomExt('snappy')]
|
||||
class snappy extends Extension
|
||||
{
|
||||
public function getUnixConfigureArg(): string
|
||||
{
|
||||
return '--enable-snappy --with-snappy-includedir="' . BUILD_ROOT_PATH . '"';
|
||||
}
|
||||
}
|
||||
12
src/SPC/builder/linux/library/snappy.php
Normal file
12
src/SPC/builder/linux/library/snappy.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\linux\library;
|
||||
|
||||
class snappy extends LinuxLibraryBase
|
||||
{
|
||||
use \SPC\builder\unix\library\snappy;
|
||||
|
||||
public const NAME = 'snappy';
|
||||
}
|
||||
12
src/SPC/builder/macos/library/snappy.php
Normal file
12
src/SPC/builder/macos/library/snappy.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\macos\library;
|
||||
|
||||
class snappy extends MacOSLibraryBase
|
||||
{
|
||||
use \SPC\builder\unix\library\snappy;
|
||||
|
||||
public const NAME = 'snappy';
|
||||
}
|
||||
32
src/SPC/builder/unix/library/snappy.php
Normal file
32
src/SPC/builder/unix/library/snappy.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace SPC\builder\unix\library;
|
||||
|
||||
use SPC\exception\FileSystemException;
|
||||
use SPC\exception\RuntimeException;
|
||||
use SPC\store\FileSystem;
|
||||
|
||||
trait snappy
|
||||
{
|
||||
/**
|
||||
* @throws RuntimeException
|
||||
* @throws FileSystemException
|
||||
*/
|
||||
protected function build(): void
|
||||
{
|
||||
FileSystem::resetDir($this->source_dir . '/cmake/build');
|
||||
|
||||
shell()->cd($this->source_dir . '/cmake/build')
|
||||
->exec(
|
||||
"{$this->builder->configure_env} cmake " .
|
||||
"{$this->builder->makeCmakeArgs()} " .
|
||||
'-DSNAPPY_BUILD_TESTS=OFF ' .
|
||||
'-DSNAPPY_BUILD_BENCHMARKS=OFF ' .
|
||||
'../..'
|
||||
)
|
||||
->exec("cmake --build . -j {$this->builder->concurrency}")
|
||||
->exec('make install DESTDIR=' . BUILD_ROOT_PATH);
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user