mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 04:44:53 +08:00
Adjust extension definition after review
This commit is contained in:
parent
fdc3a7a04b
commit
0381a1c412
@ -328,6 +328,7 @@
|
|||||||
"snappy": {
|
"snappy": {
|
||||||
"type": "external",
|
"type": "external",
|
||||||
"source": "ext-snappy",
|
"source": "ext-snappy",
|
||||||
|
"cpp-extension": true,
|
||||||
"arg-type": "custom",
|
"arg-type": "custom",
|
||||||
"lib-depends": [
|
"lib-depends": [
|
||||||
"snappy"
|
"snappy"
|
||||||
|
|||||||
@ -522,6 +522,9 @@
|
|||||||
"snappy.h",
|
"snappy.h",
|
||||||
"snappy-stubs-internal.h",
|
"snappy-stubs-internal.h",
|
||||||
"snappy-stubs-public.h"
|
"snappy-stubs-public.h"
|
||||||
|
],
|
||||||
|
"lib-depends": [
|
||||||
|
"zlib"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,11 +5,27 @@ declare(strict_types=1);
|
|||||||
namespace SPC\builder\extension;
|
namespace SPC\builder\extension;
|
||||||
|
|
||||||
use SPC\builder\Extension;
|
use SPC\builder\Extension;
|
||||||
|
use SPC\builder\macos\MacOSBuilder;
|
||||||
|
use SPC\exception\FileSystemException;
|
||||||
|
use SPC\store\FileSystem;
|
||||||
use SPC\util\CustomExt;
|
use SPC\util\CustomExt;
|
||||||
|
|
||||||
#[CustomExt('snappy')]
|
#[CustomExt('snappy')]
|
||||||
class snappy extends Extension
|
class snappy extends Extension
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @throws FileSystemException
|
||||||
|
*/
|
||||||
|
public function patchBeforeConfigure(): bool
|
||||||
|
{
|
||||||
|
FileSystem::replaceFileRegex(
|
||||||
|
SOURCE_PATH . '/php-src/configure',
|
||||||
|
'/-lsnappy/',
|
||||||
|
$this->getLibFilesString() . $this->builder instanceof MacOSBuilder ? ' -lc++' : ' -lstdc++'
|
||||||
|
);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public function getUnixConfigureArg(): string
|
public function getUnixConfigureArg(): string
|
||||||
{
|
{
|
||||||
return '--enable-snappy --with-snappy-includedir="' . BUILD_ROOT_PATH . '"';
|
return '--enable-snappy --with-snappy-includedir="' . BUILD_ROOT_PATH . '"';
|
||||||
|
|||||||
@ -21,12 +21,14 @@ trait snappy
|
|||||||
shell()->cd($this->source_dir . '/cmake/build')
|
shell()->cd($this->source_dir . '/cmake/build')
|
||||||
->exec(
|
->exec(
|
||||||
"{$this->builder->configure_env} cmake " .
|
"{$this->builder->configure_env} cmake " .
|
||||||
"{$this->builder->makeCmakeArgs()} " .
|
"-DCMAKE_TOOLCHAIN_FILE={$this->builder->cmake_toolchain_file} " .
|
||||||
|
'-DCMAKE_BUILD_TYPE=Release ' .
|
||||||
|
'-DCMAKE_INSTALL_PREFIX=' . escapeshellarg(BUILD_ROOT_PATH) . ' ' .
|
||||||
'-DSNAPPY_BUILD_TESTS=OFF ' .
|
'-DSNAPPY_BUILD_TESTS=OFF ' .
|
||||||
'-DSNAPPY_BUILD_BENCHMARKS=OFF ' .
|
'-DSNAPPY_BUILD_BENCHMARKS=OFF ' .
|
||||||
'../..'
|
'../..'
|
||||||
)
|
)
|
||||||
->exec("cmake --build . -j {$this->builder->concurrency}")
|
->exec("cmake --build . -j {$this->builder->concurrency}")
|
||||||
->exec('make install DESTDIR=' . BUILD_ROOT_PATH);
|
->exec('make install');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user