2023-09-03 15:49:15 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
namespace SPC\builder\extension;
|
|
|
|
|
|
|
|
|
|
use SPC\builder\Extension;
|
2023-09-03 18:59:00 +02:00
|
|
|
use SPC\builder\macos\MacOSBuilder;
|
|
|
|
|
use SPC\exception\FileSystemException;
|
|
|
|
|
use SPC\store\FileSystem;
|
2023-09-03 15:49:15 +02:00
|
|
|
use SPC\util\CustomExt;
|
|
|
|
|
|
|
|
|
|
#[CustomExt('snappy')]
|
|
|
|
|
class snappy extends Extension
|
|
|
|
|
{
|
2023-09-03 18:59:00 +02:00
|
|
|
/**
|
|
|
|
|
* @throws FileSystemException
|
|
|
|
|
*/
|
|
|
|
|
public function patchBeforeConfigure(): bool
|
|
|
|
|
{
|
|
|
|
|
FileSystem::replaceFileRegex(
|
|
|
|
|
SOURCE_PATH . '/php-src/configure',
|
|
|
|
|
'/-lsnappy/',
|
|
|
|
|
$this->getLibFilesString() . $this->builder instanceof MacOSBuilder ? ' -lc++' : ' -lstdc++'
|
|
|
|
|
);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-03 15:49:15 +02:00
|
|
|
public function getUnixConfigureArg(): string
|
|
|
|
|
{
|
|
|
|
|
return '--enable-snappy --with-snappy-includedir="' . BUILD_ROOT_PATH . '"';
|
|
|
|
|
}
|
|
|
|
|
}
|