Add snappy extension

This commit is contained in:
Joseph Bielawski 2023-09-03 15:49:15 +02:00 committed by Jerry Ma
parent 6de5c1dab0
commit fdc3a7a04b
7 changed files with 120 additions and 3 deletions

View File

@ -325,6 +325,17 @@
"libxml2" "libxml2"
] ]
}, },
"snappy": {
"type": "external",
"source": "ext-snappy",
"arg-type": "custom",
"lib-depends": [
"snappy"
],
"ext-suggest": [
"apcu"
]
},
"snmp": { "snmp": {
"type": "builtin", "type": "builtin",
"arg-type": "with", "arg-type": "with",
@ -490,4 +501,4 @@
"zstd" "zstd"
] ]
} }
} }

View File

@ -510,5 +510,18 @@
"zstd.h", "zstd.h",
"zstd_errors.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"
]
} }
} }

View File

@ -80,6 +80,16 @@
"path": "LICENSE" "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": { "ext-ssh2": {
"type": "url", "type": "url",
"url": "https://pecl.php.net/get/ssh2", "url": "https://pecl.php.net/get/ssh2",
@ -401,6 +411,16 @@
"path": "COPYING" "path": "COPYING"
} }
}, },
"snappy": {
"type": "git",
"repo": "google/snappy",
"rev": "main",
"url": "https://github.com/google/snappy",
"license": {
"type": "file",
"path": "COPYING"
}
},
"sqlite": { "sqlite": {
"type": "url", "type": "url",
"url": "https://www.sqlite.org/2023/sqlite-autoconf-3410100.tar.gz", "url": "https://www.sqlite.org/2023/sqlite-autoconf-3410100.tar.gz",
@ -476,4 +496,4 @@
"path": "LICENSE" "path": "LICENSE"
} }
} }
} }

View 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 . '"';
}
}

View 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';
}

View 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';
}

View 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);
}
}