mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-10 02:15:36 +08:00
Add xz
This commit is contained in:
@@ -14,7 +14,13 @@ xz:
|
|||||||
- libiconv
|
- libiconv
|
||||||
headers@unix:
|
headers@unix:
|
||||||
- lzma
|
- lzma
|
||||||
|
headers@windows:
|
||||||
|
- lzma
|
||||||
|
- lzma.h
|
||||||
pkg-configs:
|
pkg-configs:
|
||||||
- liblzma
|
- liblzma
|
||||||
static-libs@unix:
|
static-libs@unix:
|
||||||
- liblzma.a
|
- 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\Attribute\Package\Library;
|
||||||
use StaticPHP\Package\LibraryPackage;
|
use StaticPHP\Package\LibraryPackage;
|
||||||
use StaticPHP\Runtime\Executor\UnixAutoconfExecutor;
|
use StaticPHP\Runtime\Executor\UnixAutoconfExecutor;
|
||||||
|
use StaticPHP\Runtime\Executor\WindowsCMakeExecutor;
|
||||||
|
use StaticPHP\Util\FileSystem;
|
||||||
|
|
||||||
#[Library('xz')]
|
#[Library('xz')]
|
||||||
class xz
|
class xz
|
||||||
@@ -27,4 +29,14 @@ class xz
|
|||||||
$lib->patchPkgconfPrefix(['liblzma.pc']);
|
$lib->patchPkgconfPrefix(['liblzma.pc']);
|
||||||
$lib->patchLaDependencyPrefix();
|
$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