mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-17 22:05:35 +08:00
Compare commits
2 Commits
fix/postgr
...
ef3d4c22c0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ef3d4c22c0 | ||
|
|
9a37534fd3 |
@@ -1171,6 +1171,27 @@
|
|||||||
"xz"
|
"xz"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"zip-shared": {
|
||||||
|
"support": {
|
||||||
|
"BSD": "wip"
|
||||||
|
},
|
||||||
|
"type": "external",
|
||||||
|
"source": "ext-zip",
|
||||||
|
"arg-type": "enable",
|
||||||
|
"lib-depends-unix": [
|
||||||
|
"libzip"
|
||||||
|
],
|
||||||
|
"ext-depends-windows": [
|
||||||
|
"zlib",
|
||||||
|
"bz2"
|
||||||
|
],
|
||||||
|
"lib-depends-windows": [
|
||||||
|
"libzip",
|
||||||
|
"zlib",
|
||||||
|
"bzip2",
|
||||||
|
"xz"
|
||||||
|
]
|
||||||
|
},
|
||||||
"zlib": {
|
"zlib": {
|
||||||
"type": "builtin",
|
"type": "builtin",
|
||||||
"arg-type": "custom",
|
"arg-type": "custom",
|
||||||
|
|||||||
@@ -263,6 +263,16 @@
|
|||||||
"path": "LICENSE"
|
"path": "LICENSE"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"ext-zip": {
|
||||||
|
"type": "url",
|
||||||
|
"url": "https://pecl.php.net/get/zip",
|
||||||
|
"path": "php-src/ext/zip-shared",
|
||||||
|
"filename": "ext-zip.tgz",
|
||||||
|
"license": {
|
||||||
|
"type": "file",
|
||||||
|
"path": "LICENSE"
|
||||||
|
}
|
||||||
|
},
|
||||||
"ext-zstd": {
|
"ext-zstd": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"path": "php-src/ext/zstd",
|
"path": "php-src/ext/zstd",
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ class Extension
|
|||||||
{
|
{
|
||||||
$escapedPath = str_replace("'", '', escapeshellarg(BUILD_ROOT_PATH)) !== BUILD_ROOT_PATH || str_contains(BUILD_ROOT_PATH, ' ') ? escapeshellarg(BUILD_ROOT_PATH) : BUILD_ROOT_PATH;
|
$escapedPath = str_replace("'", '', escapeshellarg(BUILD_ROOT_PATH)) !== BUILD_ROOT_PATH || str_contains(BUILD_ROOT_PATH, ' ') ? escapeshellarg(BUILD_ROOT_PATH) : BUILD_ROOT_PATH;
|
||||||
$_name = str_replace('_', '-', $this->name);
|
$_name = str_replace('_', '-', $this->name);
|
||||||
return match ($arg_type = Config::getExt($this->name, 'arg-type', 'enable')) {
|
$arg = match ($arg_type = Config::getExt($this->name, 'arg-type', 'enable')) {
|
||||||
'enable' => '--enable-' . $_name . ($shared ? '=shared' : '') . ' ',
|
'enable' => '--enable-' . $_name . ($shared ? '=shared' : '') . ' ',
|
||||||
'enable-path' => '--enable-' . $_name . '=' . ($shared ? 'shared,' : '') . $escapedPath . ' ',
|
'enable-path' => '--enable-' . $_name . '=' . ($shared ? 'shared,' : '') . $escapedPath . ' ',
|
||||||
'with' => '--with-' . $_name . ($shared ? '=shared' : '') . ' ',
|
'with' => '--with-' . $_name . ($shared ? '=shared' : '') . ' ',
|
||||||
@@ -89,6 +89,7 @@ class Extension
|
|||||||
'none', 'custom' => '',
|
'none', 'custom' => '',
|
||||||
default => throw new WrongUsageException("argType does not accept {$arg_type}, use [enable/with/with-path] ."),
|
default => throw new WrongUsageException("argType does not accept {$arg_type}, use [enable/with/with-path] ."),
|
||||||
};
|
};
|
||||||
|
return str_replace('-shared', '', $arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -130,7 +131,7 @@ class Extension
|
|||||||
|
|
||||||
public function getName(): string
|
public function getName(): string
|
||||||
{
|
{
|
||||||
return $this->name;
|
return str_replace('-shared', '', $this->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -138,7 +139,7 @@ class Extension
|
|||||||
*/
|
*/
|
||||||
public function getDistName(): string
|
public function getDistName(): string
|
||||||
{
|
{
|
||||||
return $this->name;
|
return str_replace('-shared', '', $this->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getWindowsConfigureArg(bool $shared = false): string
|
public function getWindowsConfigureArg(bool $shared = false): string
|
||||||
|
|||||||
@@ -56,6 +56,12 @@ class BuildPHPCommand extends BuildCommand
|
|||||||
$libraries = array_map('trim', array_filter(explode(',', $this->getOption('with-libs'))));
|
$libraries = array_map('trim', array_filter(explode(',', $this->getOption('with-libs'))));
|
||||||
// transform string to array
|
// transform string to array
|
||||||
$shared_extensions = array_map('trim', array_filter(explode(',', $this->getOption('build-shared'))));
|
$shared_extensions = array_map('trim', array_filter(explode(',', $this->getOption('build-shared'))));
|
||||||
|
foreach ($shared_extensions as &$ext) {
|
||||||
|
if (array_key_exists($ext . '-shared', Config::getExts())) {
|
||||||
|
$ext .= '-shared';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
unset($ext);
|
||||||
// transform string to array
|
// transform string to array
|
||||||
$static_extensions = $this->parseExtensionList($this->getArgument('extensions'));
|
$static_extensions = $this->parseExtensionList($this->getArgument('extensions'));
|
||||||
|
|
||||||
@@ -205,7 +211,7 @@ class BuildPHPCommand extends BuildCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
// add static-php-cli.version to main.c, in order to debug php failure more easily
|
// add static-php-cli.version to main.c, in order to debug php failure more easily
|
||||||
SourcePatcher::patchSPCVersionToPHP($this->getApplication()->getVersion());
|
SourcePatcher::patchSPCVersionToPHP($this->getApplication()?->getVersion());
|
||||||
|
|
||||||
// clean old modules that may conflict with the new php build
|
// clean old modules that may conflict with the new php build
|
||||||
FileSystem::removeDir(BUILD_MODULES_PATH);
|
FileSystem::removeDir(BUILD_MODULES_PATH);
|
||||||
@@ -244,6 +250,7 @@ class BuildPHPCommand extends BuildCommand
|
|||||||
}
|
}
|
||||||
if (!empty($shared_extensions)) {
|
if (!empty($shared_extensions)) {
|
||||||
foreach ($shared_extensions as $ext) {
|
foreach ($shared_extensions as $ext) {
|
||||||
|
$ext = str_replace('-shared', '', $ext);
|
||||||
$path = FileSystem::convertPath("{$build_root_path}/modules/{$ext}.so");
|
$path = FileSystem::convertPath("{$build_root_path}/modules/{$ext}.so");
|
||||||
if (file_exists(BUILD_MODULES_PATH . "/{$ext}.so")) {
|
if (file_exists(BUILD_MODULES_PATH . "/{$ext}.so")) {
|
||||||
logger()->info("Shared extension [{$ext}] path{$fixed}: {$path}");
|
logger()->info("Shared extension [{$ext}] path{$fixed}: {$path}");
|
||||||
|
|||||||
@@ -295,6 +295,11 @@ class DownloadCommand extends BaseCommand
|
|||||||
*/
|
*/
|
||||||
private function calculateSourcesByExt(array $extensions, bool $include_suggests = true): array
|
private function calculateSourcesByExt(array $extensions, bool $include_suggests = true): array
|
||||||
{
|
{
|
||||||
|
foreach ($extensions as $ext) {
|
||||||
|
if (array_key_exists($ext . '-shared', Config::getExts())) {
|
||||||
|
$extensions[] = $ext . '-shared';
|
||||||
|
}
|
||||||
|
}
|
||||||
[$extensions, $libraries] = $include_suggests ? DependencyUtil::getExtsAndLibs($extensions, [], true, true) : DependencyUtil::getExtsAndLibs($extensions);
|
[$extensions, $libraries] = $include_suggests ? DependencyUtil::getExtsAndLibs($extensions, [], true, true) : DependencyUtil::getExtsAndLibs($extensions);
|
||||||
$sources = [];
|
$sources = [];
|
||||||
foreach ($extensions as $extension) {
|
foreach ($extensions as $extension) {
|
||||||
|
|||||||
@@ -27,6 +27,11 @@ class SourceManager
|
|||||||
}
|
}
|
||||||
// ext check source exist
|
// ext check source exist
|
||||||
if (is_array($exts)) {
|
if (is_array($exts)) {
|
||||||
|
foreach ($exts as $ext) {
|
||||||
|
if (in_array($ext . '-shared', Config::getExts())) {
|
||||||
|
$exts[] = $ext . '-shared';
|
||||||
|
}
|
||||||
|
}
|
||||||
foreach ($exts as $ext) {
|
foreach ($exts as $ext) {
|
||||||
// get source name for ext
|
// get source name for ext
|
||||||
if (Config::getExt($ext, 'type') !== 'external') {
|
if (Config::getExt($ext, 'type') !== 'external') {
|
||||||
|
|||||||
@@ -50,7 +50,13 @@ class LicenseDumper
|
|||||||
logger()->warning('Target dump directory is not empty, be aware!');
|
logger()->warning('Target dump directory is not empty, be aware!');
|
||||||
}
|
}
|
||||||
FileSystem::createDir($target_dir);
|
FileSystem::createDir($target_dir);
|
||||||
|
$exts = $this->exts;
|
||||||
foreach ($this->exts as $ext) {
|
foreach ($this->exts as $ext) {
|
||||||
|
if (array_key_exists($ext . '-shared', Config::getExts())) {
|
||||||
|
$exts[] = $ext . '-shared';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach ($exts as $ext) {
|
||||||
if (Config::getExt($ext, 'type') !== 'external') {
|
if (Config::getExt($ext, 'type') !== 'external') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user