mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-20 15:25:36 +08:00
Add ext-maxminddb and libmaxminddb support on Windows
This commit is contained in:
@@ -14,3 +14,5 @@ libmaxminddb:
|
|||||||
- maxminddb_config.h
|
- maxminddb_config.h
|
||||||
static-libs@unix:
|
static-libs@unix:
|
||||||
- libmaxminddb.a
|
- libmaxminddb.a
|
||||||
|
static-libs@windows:
|
||||||
|
- libmaxminddb.lib
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ use StaticPHP\Util\FileSystem;
|
|||||||
class maxminddb extends PhpExtensionPackage
|
class maxminddb extends PhpExtensionPackage
|
||||||
{
|
{
|
||||||
#[BeforeStage('php', [php::class, 'buildconfForUnix'], 'ext-maxminddb')]
|
#[BeforeStage('php', [php::class, 'buildconfForUnix'], 'ext-maxminddb')]
|
||||||
|
#[BeforeStage('php', [php::class, 'buildconfForWindows'], 'ext-maxminddb')]
|
||||||
#[PatchDescription('Patch maxminddb extension for buildconf to support new source structure')]
|
#[PatchDescription('Patch maxminddb extension for buildconf to support new source structure')]
|
||||||
public function patchBeforeBuildconf(): void
|
public function patchBeforeBuildconf(): void
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ use StaticPHP\Attribute\Package\BuildFor;
|
|||||||
use StaticPHP\Attribute\Package\Library;
|
use StaticPHP\Attribute\Package\Library;
|
||||||
use StaticPHP\Package\LibraryPackage;
|
use StaticPHP\Package\LibraryPackage;
|
||||||
use StaticPHP\Runtime\Executor\UnixCMakeExecutor;
|
use StaticPHP\Runtime\Executor\UnixCMakeExecutor;
|
||||||
|
use StaticPHP\Runtime\Executor\WindowsCMakeExecutor;
|
||||||
|
use StaticPHP\Util\FileSystem;
|
||||||
|
|
||||||
#[Library('libmaxminddb')]
|
#[Library('libmaxminddb')]
|
||||||
class libmaxminddb
|
class libmaxminddb
|
||||||
@@ -23,4 +25,18 @@ class libmaxminddb
|
|||||||
)
|
)
|
||||||
->build();
|
->build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[BuildFor('Windows')]
|
||||||
|
public function buildWindows(LibraryPackage $lib): void
|
||||||
|
{
|
||||||
|
WindowsCMakeExecutor::create($lib)
|
||||||
|
->addConfigureArgs(
|
||||||
|
'-DBUILD_TESTING=OFF',
|
||||||
|
'-DMAXMINDDB_BUILD_BINARIES=OFF',
|
||||||
|
)
|
||||||
|
->build();
|
||||||
|
if (!file_exists($lib->getLibDir() . '\libmaxminddb.lib')) {
|
||||||
|
FileSystem::copy("{$lib->getLibDir()}\\maxminddb.lib", "{$lib->getLibDir()}\\libmaxminddb.lib");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user