Skip to content

Commit f414bd2

Browse files
committed
Add ext-maxminddb
1 parent fa7de06 commit f414bd2

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

config/pkg/ext/ext-maxminddb.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
ext-maxminddb:
2+
type: php-extension
3+
artifact:
4+
source:
5+
type: pecl
6+
name: maxminddb
7+
metadata:
8+
license-files: [LICENSE]
9+
license: Apache-2.0
10+
depends:
11+
- libmaxminddb
12+
php-extension:
13+
arg-type: with
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
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\Util\FileSystem;
13+
14+
#[Extension('maxminddb')]
15+
class maxminddb extends PhpExtensionPackage
16+
{
17+
#[BeforeStage('php', [php::class, 'buildconfForUnix'], 'ext-maxminddb')]
18+
#[PatchDescription('Patch maxminddb extension for buildconf to support new source structure')]
19+
public function patchBeforeBuildconf(): void
20+
{
21+
if (file_exists("{$this->getSourceDir()}/config.m4")) {
22+
return;
23+
}
24+
// move ext/maxminddb/ext/* to ext/maxminddb/
25+
$files = FileSystem::scanDirFiles("{$this->getSourceDir()}/ext", false, true);
26+
foreach ($files as $file) {
27+
rename("{$this->getSourceDir()}/ext/{$file}", "{$this->getSourceDir()}/{$file}");
28+
}
29+
}
30+
}

0 commit comments

Comments
 (0)