2024-03-04 10:40:23 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
namespace SPC\builder\extension;
|
|
|
|
|
|
|
|
|
|
use SPC\builder\Extension;
|
|
|
|
|
use SPC\store\FileSystem;
|
|
|
|
|
use SPC\util\CustomExt;
|
|
|
|
|
|
|
|
|
|
#[CustomExt('amqp')]
|
|
|
|
|
class amqp extends Extension
|
|
|
|
|
{
|
|
|
|
|
public function patchBeforeMake(): bool
|
|
|
|
|
{
|
|
|
|
|
if (PHP_OS_FAMILY === 'Windows') {
|
|
|
|
|
FileSystem::replaceFileRegex(BUILD_INCLUDE_PATH . '\amqp.h', '/^#warning.*/m', '');
|
|
|
|
|
FileSystem::replaceFileRegex(BUILD_INCLUDE_PATH . '\amqp_framing.h', '/^#warning.*/m', '');
|
|
|
|
|
FileSystem::replaceFileRegex(BUILD_INCLUDE_PATH . '\amqp_ssl_socket.h', '/^#warning.*/m', '');
|
|
|
|
|
FileSystem::replaceFileRegex(BUILD_INCLUDE_PATH . '\amqp_tcp_socket.h', '/^#warning.*/m', '');
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2025-03-27 11:12:19 +07:00
|
|
|
public function getUnixConfigureArg(bool $shared = false): string
|
2024-03-04 10:40:23 +08:00
|
|
|
{
|
2025-06-23 13:12:40 +07:00
|
|
|
return '--with-amqp' . ($shared ? '=shared' : '') . ' --with-librabbitmq-dir=' . BUILD_ROOT_PATH;
|
2024-03-04 10:40:23 +08:00
|
|
|
}
|
|
|
|
|
|
2025-05-21 12:01:00 +07:00
|
|
|
public function getWindowsConfigureArg($shared = false): string
|
2024-03-04 10:40:23 +08:00
|
|
|
{
|
|
|
|
|
return '--with-amqp';
|
|
|
|
|
}
|
|
|
|
|
}
|