Skip to content

Commit a288533

Browse files
committed
Add ext-rar
1 parent 067749a commit a288533

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

config/pkg/ext/ext-rar.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
ext-rar:
2+
type: php-extension
3+
artifact:
4+
source:
5+
type: git
6+
url: 'https://github.com/static-php/php-rar.git'
7+
rev: issue-php82
8+
extract: php-src/ext/rar
9+
metadata:
10+
license-files: [LICENSE]
11+
license: PHP-3.01
12+
lang: cpp

src/Package/Extension/rar.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Package\Extension;
6+
7+
use Package\Target\php;
8+
use StaticPHP\Attribute\Package\BeforeStage;
9+
use StaticPHP\Attribute\Package\Extension;
10+
use StaticPHP\Attribute\PatchDescription;
11+
use StaticPHP\Package\PhpExtensionPackage;
12+
use StaticPHP\Runtime\SystemTarget;
13+
use StaticPHP\Util\FileSystem;
14+
15+
#[Extension('rar')]
16+
class rar extends PhpExtensionPackage
17+
{
18+
#[BeforeStage('php', [php::class, 'buildconfForUnix'], 'ext-rar')]
19+
#[PatchDescription('rar extension workaround for newer Xcode clang (>= 15.0)')]
20+
public function patchBeforeBuildconf(): void
21+
{
22+
// workaround for newer Xcode clang (>= 15.0)
23+
if (SystemTarget::getTargetOS() === 'Darwin') {
24+
FileSystem::replaceFileStr("{$this->getSourceDir()}/config.m4", '-Wall -fvisibility=hidden', '-Wall -Wno-incompatible-function-pointer-types -fvisibility=hidden');
25+
}
26+
}
27+
}

0 commit comments

Comments
 (0)