mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-17 20:34:51 +08:00
Add ext-maxminddb
This commit is contained in:
parent
fa7de0642a
commit
f414bd289c
13
config/pkg/ext/ext-maxminddb.yml
Normal file
13
config/pkg/ext/ext-maxminddb.yml
Normal file
@ -0,0 +1,13 @@
|
||||
ext-maxminddb:
|
||||
type: php-extension
|
||||
artifact:
|
||||
source:
|
||||
type: pecl
|
||||
name: maxminddb
|
||||
metadata:
|
||||
license-files: [LICENSE]
|
||||
license: Apache-2.0
|
||||
depends:
|
||||
- libmaxminddb
|
||||
php-extension:
|
||||
arg-type: with
|
||||
30
src/Package/Extension/maxminddb.php
Normal file
30
src/Package/Extension/maxminddb.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?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\Util\FileSystem;
|
||||
|
||||
#[Extension('maxminddb')]
|
||||
class maxminddb extends PhpExtensionPackage
|
||||
{
|
||||
#[BeforeStage('php', [php::class, 'buildconfForUnix'], 'ext-maxminddb')]
|
||||
#[PatchDescription('Patch maxminddb extension for buildconf to support new source structure')]
|
||||
public function patchBeforeBuildconf(): void
|
||||
{
|
||||
if (file_exists("{$this->getSourceDir()}/config.m4")) {
|
||||
return;
|
||||
}
|
||||
// move ext/maxminddb/ext/* to ext/maxminddb/
|
||||
$files = FileSystem::scanDirFiles("{$this->getSourceDir()}/ext", false, true);
|
||||
foreach ($files as $file) {
|
||||
rename("{$this->getSourceDir()}/ext/{$file}", "{$this->getSourceDir()}/{$file}");
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user