Add ext-rar

This commit is contained in:
crazywhalecc 2026-03-12 22:58:59 +08:00
parent 067749ab1b
commit a288533fc3
No known key found for this signature in database
GPG Key ID: 1F4BDD59391F2680
2 changed files with 39 additions and 0 deletions

View File

@ -0,0 +1,12 @@
ext-rar:
type: php-extension
artifact:
source:
type: git
url: 'https://github.com/static-php/php-rar.git'
rev: issue-php82
extract: php-src/ext/rar
metadata:
license-files: [LICENSE]
license: PHP-3.01
lang: cpp

View File

@ -0,0 +1,27 @@
<?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\Package\PhpExtensionPackage;
use StaticPHP\Runtime\SystemTarget;
use StaticPHP\Util\FileSystem;
#[Extension('rar')]
class rar extends PhpExtensionPackage
{
#[BeforeStage('php', [php::class, 'buildconfForUnix'], 'ext-rar')]
#[PatchDescription('rar extension workaround for newer Xcode clang (>= 15.0)')]
public function patchBeforeBuildconf(): void
{
// workaround for newer Xcode clang (>= 15.0)
if (SystemTarget::getTargetOS() === 'Darwin') {
FileSystem::replaceFileStr("{$this->getSourceDir()}/config.m4", '-Wall -fvisibility=hidden', '-Wall -Wno-incompatible-function-pointer-types -fvisibility=hidden');
}
}
}