Files
static-php-cli/src/Package/Library/libssh2.php

43 lines
1.1 KiB
PHP
Raw Normal View History

2026-02-02 15:35:59 +08:00
<?php
declare(strict_types=1);
namespace Package\Library;
use StaticPHP\Attribute\Package\BuildFor;
use StaticPHP\Attribute\Package\Library;
use StaticPHP\Package\LibraryPackage;
use StaticPHP\Runtime\Executor\UnixCMakeExecutor;
2026-03-20 21:48:46 +08:00
use StaticPHP\Runtime\Executor\WindowsCMakeExecutor;
2026-02-02 15:35:59 +08:00
#[Library('libssh2')]
class libssh2
{
2026-03-20 21:48:46 +08:00
#[BuildFor('Windows')]
public function buildWin(LibraryPackage $lib): void
{
WindowsCMakeExecutor::create($lib)
->addConfigureArgs(
'-DCRYPTO_BACKEND=WinCNG',
2026-03-20 21:48:46 +08:00
'-DENABLE_ZLIB_COMPRESSION=ON',
'-DBUILD_TESTING=OFF'
)
->build();
}
2026-02-02 15:35:59 +08:00
#[BuildFor('Linux')]
#[BuildFor('Darwin')]
public function build(LibraryPackage $lib): void
{
UnixCMakeExecutor::create($lib)
->optionalPackage('zlib', ...cmake_boolean_args('ENABLE_ZLIB_COMPRESSION'))
->addConfigureArgs(
'-DBUILD_EXAMPLES=OFF',
'-DBUILD_TESTING=OFF'
)
->build();
$lib->patchPkgconfPrefix(['libssh2.pc']);
}
}