From a329445701eb4e00547511c27e38e1c9e4cb179f Mon Sep 17 00:00:00 2001 From: crazywhalecc Date: Wed, 10 May 2023 02:31:57 +0800 Subject: [PATCH] add ssh2 support --- config/ext.json | 8 ++++++++ config/source.json | 10 ++++++++++ src/SPC/store/SourcePatcher.php | 13 +++++++++++++ 3 files changed, 31 insertions(+) diff --git a/config/ext.json b/config/ext.json index 6e317239..4c6e6062 100644 --- a/config/ext.json +++ b/config/ext.json @@ -302,6 +302,14 @@ "sqlite" ] }, + "ssh2": { + "type": "external", + "source": "ext-ssh2", + "arg-type": "with-prefix", + "lib-depends": [ + "libssh2" + ] + }, "swoole": { "type": "external", "source": "swoole", diff --git a/config/source.json b/config/source.json index 950058d3..f86b51cd 100644 --- a/config/source.json +++ b/config/source.json @@ -61,6 +61,16 @@ "path": "LICENSE" } }, + "ext-ssh2": { + "type": "url", + "url": "http://pecl.php.net/get/ssh2", + "path": "php-src/ext/ssh2", + "filename": "ssh2.tgz", + "license": { + "type": "file", + "path": "LICENSE" + } + }, "ext-zstd": { "type": "git", "path": "php-src/ext/zstd", diff --git a/src/SPC/store/SourcePatcher.php b/src/SPC/store/SourcePatcher.php index e8171efb..aba47b92 100644 --- a/src/SPC/store/SourcePatcher.php +++ b/src/SPC/store/SourcePatcher.php @@ -85,6 +85,9 @@ class SourcePatcher if ($readline = $builder->getExt('readline')) { $patch[] = ['readline patch', '/-lncurses/', $readline->getLibFilesString()]; } + if ($ssh2 = $builder->getExt('ssh2')) { + $patch[] = ['ssh2 patch', '/-lssh2/', $ssh2->getLibFilesString()]; + } $patch[] = ['disable capstone', '/have_capstone="yes"/', 'have_capstone="no"']; foreach ($patch as $item) { logger()->info('Patching configure: ' . $item[0]); @@ -110,6 +113,16 @@ class SourcePatcher } } + public static function patchUnixSsh2(): void + { + FileSystem::replaceFile( + SOURCE_PATH . '/php-src/configure', + REPLACE_FILE_STR, + '-lssh2', + BUILD_LIB_PATH . '/libssh2.a' + ); + } + public static function patchCurlMacOS(): void { FileSystem::replaceFile(