mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 04:44:53 +08:00
Add extension amqp
This commit is contained in:
parent
d8d9f389ba
commit
95f34fbbc3
18
config/pkg/ext/ext-amqp.yml
Normal file
18
config/pkg/ext/ext-amqp.yml
Normal file
@ -0,0 +1,18 @@
|
||||
ext-amqp:
|
||||
type: php-extension
|
||||
artifact:
|
||||
source:
|
||||
type: url
|
||||
url: 'https://pecl.php.net/get/amqp'
|
||||
extract: php-src/ext/amqp
|
||||
filename: amqp.tgz
|
||||
metadata:
|
||||
license-files: [LICENSE]
|
||||
license: PHP-3.01
|
||||
depends:
|
||||
- librabbitmq
|
||||
depends@windows:
|
||||
- ext-openssl
|
||||
php-extension:
|
||||
arg-type: '--with-amqp@shared_suffix@ --with-librabbitmq-dir=@build_root_path@'
|
||||
arg-type@windows: '--with-amqp'
|
||||
26
src/Package/Extension/amqp.php
Normal file
26
src/Package/Extension/amqp.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Package\Extension;
|
||||
|
||||
use Package\Target\php;
|
||||
use StaticPHP\Attribute\Package\BeforeStage;
|
||||
use StaticPHP\Attribute\Package\Extension;
|
||||
use StaticPHP\Attribute\PatchDescription;
|
||||
use StaticPHP\Util\FileSystem;
|
||||
|
||||
#[Extension('amqp')]
|
||||
class amqp
|
||||
{
|
||||
#[BeforeStage('php', [php::class, 'makeForWindows'], 'ext-amqp')]
|
||||
#[PatchDescription('Remove #warning directives from amqp headers to prevent build failures on Windows')]
|
||||
public function patchBeforeMake(): bool
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user