mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-03 14:55:39 +08:00
Add xz
This commit is contained in:
@@ -14,7 +14,13 @@ xz:
|
||||
- libiconv
|
||||
headers@unix:
|
||||
- lzma
|
||||
headers@windows:
|
||||
- lzma
|
||||
- lzma.h
|
||||
pkg-configs:
|
||||
- liblzma
|
||||
static-libs@unix:
|
||||
- liblzma.a
|
||||
static-libs@windows:
|
||||
- lzma.lib
|
||||
- liblzma_a.lib
|
||||
|
||||
@@ -8,6 +8,8 @@ use StaticPHP\Attribute\Package\BuildFor;
|
||||
use StaticPHP\Attribute\Package\Library;
|
||||
use StaticPHP\Package\LibraryPackage;
|
||||
use StaticPHP\Runtime\Executor\UnixAutoconfExecutor;
|
||||
use StaticPHP\Runtime\Executor\WindowsCMakeExecutor;
|
||||
use StaticPHP\Util\FileSystem;
|
||||
|
||||
#[Library('xz')]
|
||||
class xz
|
||||
@@ -27,4 +29,14 @@ class xz
|
||||
$lib->patchPkgconfPrefix(['liblzma.pc']);
|
||||
$lib->patchLaDependencyPrefix();
|
||||
}
|
||||
|
||||
#[BuildFor('Windows')]
|
||||
public function buildWin(LibraryPackage $lib): void
|
||||
{
|
||||
WindowsCMakeExecutor::create($lib)->build();
|
||||
// copy lzma.lib to liblzma_a.lib
|
||||
FileSystem::copy("{$lib->getLibDir()}\\lzma.lib", "{$lib->getLibDir()}\\liblzma_a.lib");
|
||||
// patch lzma.h: make static API always available on Windows
|
||||
FileSystem::replaceFileStr("{$lib->getIncludeDir()}\\lzma.h", 'defined(LZMA_API_STATIC)', 'defined(_WIN32)');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user