mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-07 08:45:40 +08:00
Add openssl lib support
This commit is contained in:
@@ -7,6 +7,7 @@ namespace StaticPHP\Package;
|
||||
use StaticPHP\Config\PackageConfig;
|
||||
use StaticPHP\Exception\PatchException;
|
||||
use StaticPHP\Util\FileSystem;
|
||||
use StaticPHP\Util\SPCConfigUtil;
|
||||
|
||||
/**
|
||||
* Represents a library package with platform-specific build functions.
|
||||
@@ -159,6 +160,16 @@ class LibraryPackage extends Package
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get static library files for current package and its dependencies.
|
||||
*/
|
||||
public function getStaticLibFiles(): string
|
||||
{
|
||||
$config = new SPCConfigUtil(['libs_only_deps' => true, 'absolute_libs' => true]);
|
||||
$res = $config->config([$this->getName()]);
|
||||
return $res['libs'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get extra LIBS for current package.
|
||||
* You need to define the environment variable in the format of {LIBRARY_NAME}_LIBS
|
||||
|
||||
@@ -135,6 +135,22 @@ abstract class Package
|
||||
return isset($this->build_functions[PHP_OS_FAMILY]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the PackageBuilder instance for this package.
|
||||
*/
|
||||
public function getBuilder(): PackageBuilder
|
||||
{
|
||||
return ApplicationContext::get(PackageBuilder::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the PackageInstaller instance for this package.
|
||||
*/
|
||||
public function getInstaller(): PackageInstaller
|
||||
{
|
||||
return ApplicationContext::get(PackageInstaller::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name of the package.
|
||||
*/
|
||||
|
||||
@@ -402,11 +402,64 @@ class PackageInstaller
|
||||
return SPC_STATUS_INSTALLED;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal internally calling only, for users, please use specific getter, such as 'getLibraryPackage', 'getTaretPackage', etc
|
||||
* @param string $package_name Package name
|
||||
*/
|
||||
public function getPackage(string $package_name): ?Package
|
||||
{
|
||||
return $this->packages[$package_name] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a library package by name.
|
||||
*
|
||||
* @param string $package_name Package name
|
||||
* @return null|LibraryPackage The library package instance or null if not found
|
||||
*/
|
||||
public function getLibraryPackage(string $package_name): ?LibraryPackage
|
||||
{
|
||||
$pkg = $this->getPackage($package_name);
|
||||
if ($pkg instanceof LibraryPackage) {
|
||||
return $pkg;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a target package by name.
|
||||
*
|
||||
* @param string $package_name Package name
|
||||
* @return null|TargetPackage The target package instance or null if not found
|
||||
*/
|
||||
public function getTargetPackage(string $package_name): ?TargetPackage
|
||||
{
|
||||
$pkg = $this->getPackage($package_name);
|
||||
if ($pkg instanceof TargetPackage) {
|
||||
return $pkg;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a PHP extension by name.
|
||||
*
|
||||
* @param string $package_or_ext_name Extension name
|
||||
* @return null|PhpExtensionPackage The target package instance or null if not found
|
||||
*/
|
||||
public function getPhpExtensionPackage(string $package_or_ext_name): ?PhpExtensionPackage
|
||||
{
|
||||
$pkg = $this->getPackage($package_or_ext_name);
|
||||
if ($pkg instanceof PhpExtensionPackage) {
|
||||
return $pkg;
|
||||
}
|
||||
$pkg = $this->getPackage("ext-{$package_or_ext_name}");
|
||||
if ($pkg instanceof PhpExtensionPackage) {
|
||||
return $pkg;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate that a package has required artifacts.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user