mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-12 19:35:35 +08:00
Compare commits
14 Commits
2.2.4
...
eb00e0012f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eb00e0012f | ||
|
|
f645c8869a | ||
|
|
351e391221 | ||
|
|
1d78a231db | ||
|
|
9463cf94ca | ||
|
|
ba127f4e00 | ||
|
|
d4da18e869 | ||
|
|
334a3bdf5d | ||
|
|
a1f632e8c9 | ||
|
|
3445a2cd58 | ||
|
|
3100911802 | ||
|
|
a6236eb98c | ||
|
|
c22488ec57 | ||
|
|
0857a19c3c |
@@ -21,11 +21,9 @@
|
|||||||
"type": "builtin"
|
"type": "builtin"
|
||||||
},
|
},
|
||||||
"bz2": {
|
"bz2": {
|
||||||
"support": {
|
|
||||||
"Windows": "wip"
|
|
||||||
},
|
|
||||||
"type": "builtin",
|
"type": "builtin",
|
||||||
"arg-type": "with-prefix",
|
"arg-type-unix": "with-prefix",
|
||||||
|
"arg-type-windows": "with",
|
||||||
"lib-depends": [
|
"lib-depends": [
|
||||||
"bzip2"
|
"bzip2"
|
||||||
]
|
]
|
||||||
@@ -473,7 +471,6 @@
|
|||||||
},
|
},
|
||||||
"pdo_sqlsrv": {
|
"pdo_sqlsrv": {
|
||||||
"support": {
|
"support": {
|
||||||
"Windows": "wip",
|
|
||||||
"BSD": "wip"
|
"BSD": "wip"
|
||||||
},
|
},
|
||||||
"type": "external",
|
"type": "external",
|
||||||
@@ -519,7 +516,6 @@
|
|||||||
},
|
},
|
||||||
"rar": {
|
"rar": {
|
||||||
"support": {
|
"support": {
|
||||||
"Windows": "wip",
|
|
||||||
"BSD": "wip",
|
"BSD": "wip",
|
||||||
"Darwin": "partial"
|
"Darwin": "partial"
|
||||||
},
|
},
|
||||||
@@ -636,12 +632,11 @@
|
|||||||
},
|
},
|
||||||
"sqlsrv": {
|
"sqlsrv": {
|
||||||
"support": {
|
"support": {
|
||||||
"Windows": "wip",
|
|
||||||
"BSD": "wip"
|
"BSD": "wip"
|
||||||
},
|
},
|
||||||
"type": "external",
|
"type": "external",
|
||||||
"source": "sqlsrv",
|
"source": "sqlsrv",
|
||||||
"lib-depends": [
|
"lib-depends-unix": [
|
||||||
"unixodbc"
|
"unixodbc"
|
||||||
],
|
],
|
||||||
"ext-depends-linux": [
|
"ext-depends-linux": [
|
||||||
@@ -738,7 +733,6 @@
|
|||||||
},
|
},
|
||||||
"swow": {
|
"swow": {
|
||||||
"support": {
|
"support": {
|
||||||
"Windows": "wip",
|
|
||||||
"BSD": "wip"
|
"BSD": "wip"
|
||||||
},
|
},
|
||||||
"notes": true,
|
"notes": true,
|
||||||
@@ -925,26 +919,35 @@
|
|||||||
},
|
},
|
||||||
"yaml": {
|
"yaml": {
|
||||||
"support": {
|
"support": {
|
||||||
"Windows": "wip",
|
|
||||||
"BSD": "wip"
|
"BSD": "wip"
|
||||||
},
|
},
|
||||||
"type": "external",
|
"type": "external",
|
||||||
"source": "yaml",
|
"source": "yaml",
|
||||||
"arg-type": "with-prefix",
|
"arg-type-unix": "with-prefix",
|
||||||
|
"arg-type-windows": "with",
|
||||||
"lib-depends": [
|
"lib-depends": [
|
||||||
"libyaml"
|
"libyaml"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"zip": {
|
"zip": {
|
||||||
"support": {
|
"support": {
|
||||||
"Windows": "wip",
|
|
||||||
"BSD": "wip"
|
"BSD": "wip"
|
||||||
},
|
},
|
||||||
"type": "builtin",
|
"type": "builtin",
|
||||||
"arg-type": "with-prefix",
|
"arg-type": "with-prefix",
|
||||||
"arg-type-windows": "enable",
|
"arg-type-windows": "enable",
|
||||||
"lib-depends": [
|
"lib-depends-unix": [
|
||||||
"libzip"
|
"libzip"
|
||||||
|
],
|
||||||
|
"ext-depends-windows": [
|
||||||
|
"zlib",
|
||||||
|
"bz2"
|
||||||
|
],
|
||||||
|
"lib-depends-windows": [
|
||||||
|
"libzip",
|
||||||
|
"zlib",
|
||||||
|
"bzip2",
|
||||||
|
"xz"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"zlib": {
|
"zlib": {
|
||||||
|
|||||||
@@ -21,10 +21,8 @@
|
|||||||
"libbz2.a"
|
"libbz2.a"
|
||||||
],
|
],
|
||||||
"static-libs-windows": [
|
"static-libs-windows": [
|
||||||
[
|
"libbz2.lib",
|
||||||
"libbz2.lib",
|
"libbz2_a.lib"
|
||||||
"libbz2_a.lib"
|
|
||||||
]
|
|
||||||
],
|
],
|
||||||
"headers": [
|
"headers": [
|
||||||
"bzlib.h"
|
"bzlib.h"
|
||||||
@@ -448,23 +446,30 @@
|
|||||||
"libzip.a"
|
"libzip.a"
|
||||||
],
|
],
|
||||||
"static-libs-windows": [
|
"static-libs-windows": [
|
||||||
[
|
"zip.lib",
|
||||||
"zip.lib",
|
"libzip_a.lib"
|
||||||
"libzip_a.lib"
|
|
||||||
]
|
|
||||||
],
|
],
|
||||||
"headers": [
|
"headers": [
|
||||||
"zip.h",
|
"zip.h",
|
||||||
"zipconf.h"
|
"zipconf.h"
|
||||||
],
|
],
|
||||||
"lib-depends": [
|
"lib-depends-unix": [
|
||||||
"zlib"
|
"zlib"
|
||||||
],
|
],
|
||||||
"lib-suggests": [
|
"lib-suggests-unix": [
|
||||||
"bzip2",
|
"bzip2",
|
||||||
"xz",
|
"xz",
|
||||||
"zstd",
|
"zstd",
|
||||||
"openssl"
|
"openssl"
|
||||||
|
],
|
||||||
|
"lib-depends-windows": [
|
||||||
|
"zlib",
|
||||||
|
"bzip2",
|
||||||
|
"xz"
|
||||||
|
],
|
||||||
|
"lib-suggests-windows": [
|
||||||
|
"zstd",
|
||||||
|
"openssl"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"ncurses": {
|
"ncurses": {
|
||||||
@@ -625,10 +630,8 @@
|
|||||||
"liblzma.a"
|
"liblzma.a"
|
||||||
],
|
],
|
||||||
"static-libs-windows": [
|
"static-libs-windows": [
|
||||||
[
|
"liblzma.lib",
|
||||||
"liblzma.lib",
|
"liblzma_a.lib"
|
||||||
"liblzma_a.lib"
|
|
||||||
]
|
|
||||||
],
|
],
|
||||||
"headers-unix": [
|
"headers-unix": [
|
||||||
"lzma"
|
"lzma"
|
||||||
@@ -637,7 +640,7 @@
|
|||||||
"lzma",
|
"lzma",
|
||||||
"lzma.h"
|
"lzma.h"
|
||||||
],
|
],
|
||||||
"lib-depends": [
|
"lib-depends-unix": [
|
||||||
"libiconv"
|
"libiconv"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
5
config/pre-built.json
Normal file
5
config/pre-built.json
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"repo": "static-php/static-php-cli-hosted",
|
||||||
|
"match-pattern": "{name}-{arch}-{os}.tgz",
|
||||||
|
"pack-config": {}
|
||||||
|
}
|
||||||
@@ -47,6 +47,7 @@
|
|||||||
"type": "ghrel",
|
"type": "ghrel",
|
||||||
"repo": "curl/curl",
|
"repo": "curl/curl",
|
||||||
"match": "curl.+\\.tar\\.xz",
|
"match": "curl.+\\.tar\\.xz",
|
||||||
|
"prefer-stable": true,
|
||||||
"license": {
|
"license": {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
"path": "COPYING"
|
"path": "COPYING"
|
||||||
@@ -194,6 +195,7 @@
|
|||||||
"type": "ghrel",
|
"type": "ghrel",
|
||||||
"repo": "unicode-org/icu",
|
"repo": "unicode-org/icu",
|
||||||
"match": "icu4c.+-src\\.tgz",
|
"match": "icu4c.+-src\\.tgz",
|
||||||
|
"prefer-stable": true,
|
||||||
"license": {
|
"license": {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
"path": "LICENSE"
|
"path": "LICENSE"
|
||||||
@@ -266,6 +268,7 @@
|
|||||||
"type": "ghrel",
|
"type": "ghrel",
|
||||||
"repo": "c-ares/c-ares",
|
"repo": "c-ares/c-ares",
|
||||||
"match": "c-ares-.+\\.tar\\.gz",
|
"match": "c-ares-.+\\.tar\\.gz",
|
||||||
|
"prefer-stable": true,
|
||||||
"alt": {
|
"alt": {
|
||||||
"type": "filelist",
|
"type": "filelist",
|
||||||
"url": "https://c-ares.org/download/",
|
"url": "https://c-ares.org/download/",
|
||||||
@@ -280,6 +283,7 @@
|
|||||||
"type": "ghrel",
|
"type": "ghrel",
|
||||||
"repo": "libevent/libevent",
|
"repo": "libevent/libevent",
|
||||||
"match": "libevent.+\\.tar\\.gz",
|
"match": "libevent.+\\.tar\\.gz",
|
||||||
|
"prefer-stable": true,
|
||||||
"license": {
|
"license": {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
"path": "LICENSE"
|
"path": "LICENSE"
|
||||||
@@ -289,6 +293,7 @@
|
|||||||
"type": "ghrel",
|
"type": "ghrel",
|
||||||
"repo": "libffi/libffi",
|
"repo": "libffi/libffi",
|
||||||
"match": "libffi.+\\.tar\\.gz",
|
"match": "libffi.+\\.tar\\.gz",
|
||||||
|
"prefer-stable": true,
|
||||||
"license": {
|
"license": {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
"path": "LICENSE"
|
"path": "LICENSE"
|
||||||
@@ -333,6 +338,7 @@
|
|||||||
"type": "ghrel",
|
"type": "ghrel",
|
||||||
"repo": "lz4/lz4",
|
"repo": "lz4/lz4",
|
||||||
"match": "lz4-.+\\.tar\\.gz",
|
"match": "lz4-.+\\.tar\\.gz",
|
||||||
|
"prefer-stable": true,
|
||||||
"license": {
|
"license": {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
"path": "LICENSE"
|
"path": "LICENSE"
|
||||||
@@ -369,6 +375,7 @@
|
|||||||
"type": "ghrel",
|
"type": "ghrel",
|
||||||
"repo": "jedisct1/libsodium",
|
"repo": "jedisct1/libsodium",
|
||||||
"match": "libsodium-\\d+(\\.\\d+)*\\.tar\\.gz",
|
"match": "libsodium-\\d+(\\.\\d+)*\\.tar\\.gz",
|
||||||
|
"prefer-stable": true,
|
||||||
"license": {
|
"license": {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
"path": "LICENSE"
|
"path": "LICENSE"
|
||||||
@@ -378,6 +385,7 @@
|
|||||||
"type": "ghrel",
|
"type": "ghrel",
|
||||||
"repo": "libssh2/libssh2",
|
"repo": "libssh2/libssh2",
|
||||||
"match": "libssh2.+\\.tar\\.gz",
|
"match": "libssh2.+\\.tar\\.gz",
|
||||||
|
"prefer-stable": true,
|
||||||
"license": {
|
"license": {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
"path": "COPYING"
|
"path": "COPYING"
|
||||||
@@ -444,6 +452,7 @@
|
|||||||
"type": "ghrel",
|
"type": "ghrel",
|
||||||
"repo": "yaml/libyaml",
|
"repo": "yaml/libyaml",
|
||||||
"match": "yaml-.+\\.tar\\.gz",
|
"match": "yaml-.+\\.tar\\.gz",
|
||||||
|
"prefer-stable": true,
|
||||||
"license": {
|
"license": {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
"path": "License"
|
"path": "License"
|
||||||
@@ -453,6 +462,7 @@
|
|||||||
"type": "ghrel",
|
"type": "ghrel",
|
||||||
"repo": "nih-at/libzip",
|
"repo": "nih-at/libzip",
|
||||||
"match": "libzip.+\\.tar\\.xz",
|
"match": "libzip.+\\.tar\\.xz",
|
||||||
|
"prefer-stable": true,
|
||||||
"license": {
|
"license": {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
"path": "LICENSE"
|
"path": "LICENSE"
|
||||||
@@ -483,6 +493,7 @@
|
|||||||
"repo": "mongodb/mongo-php-driver",
|
"repo": "mongodb/mongo-php-driver",
|
||||||
"path": "php-src/ext/mongodb",
|
"path": "php-src/ext/mongodb",
|
||||||
"match": "mongodb.+\\.tgz",
|
"match": "mongodb.+\\.tgz",
|
||||||
|
"prefer-stable": true,
|
||||||
"license": {
|
"license": {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
"path": "LICENSE"
|
"path": "LICENSE"
|
||||||
@@ -501,6 +512,7 @@
|
|||||||
"type": "ghrel",
|
"type": "ghrel",
|
||||||
"repo": "nghttp2/nghttp2",
|
"repo": "nghttp2/nghttp2",
|
||||||
"match": "nghttp2.+\\.tar\\.xz",
|
"match": "nghttp2.+\\.tar\\.xz",
|
||||||
|
"prefer-stable": true,
|
||||||
"license": {
|
"license": {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
"path": "COPYING"
|
"path": "COPYING"
|
||||||
@@ -510,6 +522,7 @@
|
|||||||
"type": "ghrel",
|
"type": "ghrel",
|
||||||
"repo": "kkos/oniguruma",
|
"repo": "kkos/oniguruma",
|
||||||
"match": "onig-.+\\.tar\\.gz",
|
"match": "onig-.+\\.tar\\.gz",
|
||||||
|
"prefer-stable": true,
|
||||||
"license": {
|
"license": {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
"path": "COPYING"
|
"path": "COPYING"
|
||||||
@@ -649,6 +662,7 @@
|
|||||||
"type": "ghtar",
|
"type": "ghtar",
|
||||||
"path": "php-src/ext/swoole",
|
"path": "php-src/ext/swoole",
|
||||||
"repo": "swoole/swoole-src",
|
"repo": "swoole/swoole-src",
|
||||||
|
"prefer-stable": true,
|
||||||
"license": {
|
"license": {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
"path": "LICENSE"
|
"path": "LICENSE"
|
||||||
@@ -734,6 +748,7 @@
|
|||||||
"type": "ghrel",
|
"type": "ghrel",
|
||||||
"repo": "madler/zlib",
|
"repo": "madler/zlib",
|
||||||
"match": "zlib.+\\.tar\\.gz",
|
"match": "zlib.+\\.tar\\.gz",
|
||||||
|
"prefer-stable": true,
|
||||||
"license": {
|
"license": {
|
||||||
"type": "text",
|
"type": "text",
|
||||||
"text": "(C) 1995-2022 Jean-loup Gailly and Mark Adler\n\nThis software is provided 'as-is', without any express or implied\nwarranty. In no event will the authors be held liable for any damages\narising from the use of this software.\n\nPermission is granted to anyone to use this software for any purpose,\nincluding commercial applications, and to alter it and redistribute it\nfreely, subject to the following restrictions:\n\n1. The origin of this software must not be misrepresented; you must not\n claim that you wrote the original software. If you use this software\n in a product, an acknowledgment in the product documentation would be\n appreciated but is not required.\n2. Altered source versions must be plainly marked as such, and must not be\n misrepresented as being the original software.\n3. This notice may not be removed or altered from any source distribution.\n\nJean-loup Gailly Mark Adler\njloup@gzip.org madler@alumni.caltech.edu"
|
"text": "(C) 1995-2022 Jean-loup Gailly and Mark Adler\n\nThis software is provided 'as-is', without any express or implied\nwarranty. In no event will the authors be held liable for any damages\narising from the use of this software.\n\nPermission is granted to anyone to use this software for any purpose,\nincluding commercial applications, and to alter it and redistribute it\nfreely, subject to the following restrictions:\n\n1. The origin of this software must not be misrepresented; you must not\n claim that you wrote the original software. If you use this software\n in a product, an acknowledgment in the product documentation would be\n appreciated but is not required.\n2. Altered source versions must be plainly marked as such, and must not be\n misrepresented as being the original software.\n3. This notice may not be removed or altered from any source distribution.\n\nJean-loup Gailly Mark Adler\njloup@gzip.org madler@alumni.caltech.edu"
|
||||||
@@ -743,6 +758,7 @@
|
|||||||
"type": "ghrel",
|
"type": "ghrel",
|
||||||
"repo": "facebook/zstd",
|
"repo": "facebook/zstd",
|
||||||
"match": "zstd.+\\.tar\\.gz",
|
"match": "zstd.+\\.tar\\.gz",
|
||||||
|
"prefer-stable": true,
|
||||||
"license": {
|
"license": {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
"path": "LICENSE"
|
"path": "LICENSE"
|
||||||
|
|||||||
@@ -8,7 +8,9 @@ use SPC\command\BuildCliCommand;
|
|||||||
use SPC\command\BuildLibsCommand;
|
use SPC\command\BuildLibsCommand;
|
||||||
use SPC\command\DeleteDownloadCommand;
|
use SPC\command\DeleteDownloadCommand;
|
||||||
use SPC\command\dev\AllExtCommand;
|
use SPC\command\dev\AllExtCommand;
|
||||||
|
use SPC\command\dev\ExtVerCommand;
|
||||||
use SPC\command\dev\GenerateExtDocCommand;
|
use SPC\command\dev\GenerateExtDocCommand;
|
||||||
|
use SPC\command\dev\LibVerCommand;
|
||||||
use SPC\command\dev\PhpVerCommand;
|
use SPC\command\dev\PhpVerCommand;
|
||||||
use SPC\command\dev\SortConfigCommand;
|
use SPC\command\dev\SortConfigCommand;
|
||||||
use SPC\command\DoctorCommand;
|
use SPC\command\DoctorCommand;
|
||||||
@@ -25,7 +27,7 @@ use Symfony\Component\Console\Application;
|
|||||||
*/
|
*/
|
||||||
final class ConsoleApplication extends Application
|
final class ConsoleApplication extends Application
|
||||||
{
|
{
|
||||||
public const VERSION = '2.2.4';
|
public const VERSION = '2.3.0';
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
@@ -48,6 +50,8 @@ final class ConsoleApplication extends Application
|
|||||||
// Dev commands
|
// Dev commands
|
||||||
new AllExtCommand(),
|
new AllExtCommand(),
|
||||||
new PhpVerCommand(),
|
new PhpVerCommand(),
|
||||||
|
new LibVerCommand(),
|
||||||
|
new ExtVerCommand(),
|
||||||
new SortConfigCommand(),
|
new SortConfigCommand(),
|
||||||
new GenerateExtDocCommand(),
|
new GenerateExtDocCommand(),
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ abstract class BuilderBase
|
|||||||
* @throws WrongUsageException
|
* @throws WrongUsageException
|
||||||
* @internal
|
* @internal
|
||||||
*/
|
*/
|
||||||
public function proveExts(array $extensions): void
|
public function proveExts(array $extensions, bool $skip_check_deps = false): void
|
||||||
{
|
{
|
||||||
CustomExt::loadCustomExt();
|
CustomExt::loadCustomExt();
|
||||||
$this->emitPatchPoint('before-php-extract');
|
$this->emitPatchPoint('before-php-extract');
|
||||||
@@ -181,6 +181,10 @@ abstract class BuilderBase
|
|||||||
$this->addExt($ext);
|
$this->addExt($ext);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($skip_check_deps) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($this->exts as $ext) {
|
foreach ($this->exts as $ext) {
|
||||||
$ext->checkDependency();
|
$ext->checkDependency();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ class BuilderProvider
|
|||||||
*/
|
*/
|
||||||
public static function makeBuilderByInput(InputInterface $input): BuilderBase
|
public static function makeBuilderByInput(InputInterface $input): BuilderBase
|
||||||
{
|
{
|
||||||
ini_set('memory_limit', '2G');
|
ini_set('memory_limit', '4G');
|
||||||
|
|
||||||
self::$builder = match (PHP_OS_FAMILY) {
|
self::$builder = match (PHP_OS_FAMILY) {
|
||||||
'Windows' => new WindowsBuilder($input->getOptions()),
|
'Windows' => new WindowsBuilder($input->getOptions()),
|
||||||
|
|||||||
@@ -228,6 +228,16 @@ class Extension
|
|||||||
// do nothing, just throw wrong usage exception if not valid
|
// do nothing, just throw wrong usage exception if not valid
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get current extension version
|
||||||
|
*
|
||||||
|
* @return null|string Version string or null
|
||||||
|
*/
|
||||||
|
public function getExtVersion(): ?string
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws RuntimeException
|
* @throws RuntimeException
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -182,6 +182,16 @@ abstract class LibraryBase
|
|||||||
// do nothing, just throw wrong usage exception if not valid
|
// do nothing, just throw wrong usage exception if not valid
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get current lib version
|
||||||
|
*
|
||||||
|
* @return null|string Version string or null
|
||||||
|
*/
|
||||||
|
public function getLibVersion(): ?string
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get current builder object.
|
* Get current builder object.
|
||||||
*/
|
*/
|
||||||
|
|||||||
36
src/SPC/builder/extension/sqlsrv.php
Normal file
36
src/SPC/builder/extension/sqlsrv.php
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace SPC\builder\extension;
|
||||||
|
|
||||||
|
use SPC\builder\Extension;
|
||||||
|
use SPC\store\FileSystem;
|
||||||
|
use SPC\util\CustomExt;
|
||||||
|
|
||||||
|
#[CustomExt('sqlsrv')]
|
||||||
|
class sqlsrv extends Extension
|
||||||
|
{
|
||||||
|
private bool $pdo_sqlsrv_patched = false;
|
||||||
|
|
||||||
|
public function patchBeforeBuildconf(): bool
|
||||||
|
{
|
||||||
|
if (PHP_OS_FAMILY === 'Windows' && $this->builder->getExt('pdo_sqlsrv') === null) {
|
||||||
|
// support sqlsrv without pdo_sqlsrv
|
||||||
|
FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/ext/sqlsrv/config.w32', 'PHP_PDO_SQLSRV', '"no"');
|
||||||
|
$this->pdo_sqlsrv_patched = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function patchBeforeConfigure(): bool
|
||||||
|
{
|
||||||
|
if ($this->pdo_sqlsrv_patched) {
|
||||||
|
// revert pdo_sqlsrv patch
|
||||||
|
FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/ext/sqlsrv/config.w32', '"no" == "no"', 'PHP_PDO_SQLSRV == "no"');
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,6 +10,18 @@ use SPC\util\CustomExt;
|
|||||||
#[CustomExt('swoole')]
|
#[CustomExt('swoole')]
|
||||||
class swoole extends Extension
|
class swoole extends Extension
|
||||||
{
|
{
|
||||||
|
public function getExtVersion(): ?string
|
||||||
|
{
|
||||||
|
// Get version from source directory
|
||||||
|
$file = SOURCE_PATH . '/php-src/ext/swoole/include/swoole_version.h';
|
||||||
|
// Match #define SWOOLE_VERSION "5.1.3"
|
||||||
|
$pattern = '/#define SWOOLE_VERSION "(.+)"/';
|
||||||
|
if (preg_match($pattern, file_get_contents($file), $matches)) {
|
||||||
|
return $matches[1];
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public function getUnixConfigureArg(): string
|
public function getUnixConfigureArg(): string
|
||||||
{
|
{
|
||||||
// enable swoole
|
// enable swoole
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class swow extends Extension
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getUnixConfigureArg(): string
|
public function getConfigureArg(): string
|
||||||
{
|
{
|
||||||
$arg = '--enable-swow';
|
$arg = '--enable-swow';
|
||||||
$arg .= $this->builder->getLib('openssl') ? ' --enable-swow-ssl' : ' --disable-swow-ssl';
|
$arg .= $this->builder->getLib('openssl') ? ' --enable-swow-ssl' : ' --disable-swow-ssl';
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ class MacOSBuilder extends UnixBuilderBase
|
|||||||
$this->arch_c_flags = getenv('SPC_DEFAULT_C_FLAGS');
|
$this->arch_c_flags = getenv('SPC_DEFAULT_C_FLAGS');
|
||||||
$this->arch_cxx_flags = getenv('SPC_DEFAULT_CXX_FLAGS');
|
$this->arch_cxx_flags = getenv('SPC_DEFAULT_CXX_FLAGS');
|
||||||
// cmake toolchain
|
// cmake toolchain
|
||||||
$this->cmake_toolchain_file = SystemUtil::makeCmakeToolchainFile('Darwin', $this->getOption('arch'), $this->arch_c_flags);
|
$this->cmake_toolchain_file = SystemUtil::makeCmakeToolchainFile('Darwin', $this->getOption('arch', php_uname('m')), $this->arch_c_flags);
|
||||||
|
|
||||||
// create pkgconfig and include dir (some libs cannot create them automatically)
|
// create pkgconfig and include dir (some libs cannot create them automatically)
|
||||||
f_mkdir(BUILD_LIB_PATH . '/pkgconfig', recursive: true);
|
f_mkdir(BUILD_LIB_PATH . '/pkgconfig', recursive: true);
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ class SystemUtil
|
|||||||
*/
|
*/
|
||||||
public static function getCpuCount(): int
|
public static function getCpuCount(): int
|
||||||
{
|
{
|
||||||
[$ret, $output] = shell()->execWithResult('sysctl -n hw.ncpu');
|
[$ret, $output] = shell()->execWithResult('sysctl -n hw.ncpu', false);
|
||||||
if ($ret !== 0) {
|
if ($ret !== 0) {
|
||||||
throw new RuntimeException('Failed to get cpu count');
|
throw new RuntimeException('Failed to get cpu count');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,51 +10,27 @@ use SPC\store\FileSystem;
|
|||||||
|
|
||||||
trait libyaml
|
trait libyaml
|
||||||
{
|
{
|
||||||
|
public function getLibVersion(): ?string
|
||||||
|
{
|
||||||
|
// Match version from CMakeLists.txt:
|
||||||
|
// Format: set (YAML_VERSION_MAJOR 0)
|
||||||
|
// set (YAML_VERSION_MINOR 2)
|
||||||
|
// set (YAML_VERSION_PATCH 5)
|
||||||
|
$content = FileSystem::readFile($this->source_dir . '/CMakeLists.txt');
|
||||||
|
if (preg_match('/set \(YAML_VERSION_MAJOR (\d+)\)/', $content, $major)
|
||||||
|
&& preg_match('/set \(YAML_VERSION_MINOR (\d+)\)/', $content, $minor)
|
||||||
|
&& preg_match('/set \(YAML_VERSION_PATCH (\d+)\)/', $content, $patch)) {
|
||||||
|
return "{$major[1]}.{$minor[1]}.{$patch[1]}";
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws RuntimeException
|
* @throws RuntimeException
|
||||||
* @throws FileSystemException
|
* @throws FileSystemException
|
||||||
*/
|
*/
|
||||||
protected function build(): void
|
protected function build(): void
|
||||||
{
|
{
|
||||||
// prepare cmake/config.h.in
|
|
||||||
if (!is_file(SOURCE_PATH . '/libyaml/cmake/config.h.in')) {
|
|
||||||
f_mkdir(SOURCE_PATH . '/libyaml/cmake');
|
|
||||||
file_put_contents(
|
|
||||||
SOURCE_PATH . '/libyaml/cmake/config.h.in',
|
|
||||||
<<<'EOF'
|
|
||||||
#define YAML_VERSION_MAJOR @YAML_VERSION_MAJOR@
|
|
||||||
#define YAML_VERSION_MINOR @YAML_VERSION_MINOR@
|
|
||||||
#define YAML_VERSION_PATCH @YAML_VERSION_PATCH@
|
|
||||||
#define YAML_VERSION_STRING "@YAML_VERSION_STRING@"
|
|
||||||
EOF
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// prepare yamlConfig.cmake.in
|
|
||||||
if (!is_file(SOURCE_PATH . '/libyaml/yamlConfig.cmake.in')) {
|
|
||||||
file_put_contents(
|
|
||||||
SOURCE_PATH . '/libyaml/yamlConfig.cmake.in',
|
|
||||||
<<<'EOF'
|
|
||||||
# Config file for the yaml library.
|
|
||||||
#
|
|
||||||
# It defines the following variables:
|
|
||||||
# yaml_LIBRARIES - libraries to link against
|
|
||||||
|
|
||||||
@PACKAGE_INIT@
|
|
||||||
|
|
||||||
set_and_check(yaml_TARGETS "@PACKAGE_CONFIG_DIR_CONFIG@/yamlTargets.cmake")
|
|
||||||
|
|
||||||
if(NOT yaml_TARGETS_IMPORTED)
|
|
||||||
set(yaml_TARGETS_IMPORTED 1)
|
|
||||||
include(${yaml_TARGETS})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(yaml_LIBRARIES yaml)
|
|
||||||
|
|
||||||
EOF
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
[$lib, $include, $destdir] = SEPARATED_PATH;
|
[$lib, $include, $destdir] = SEPARATED_PATH;
|
||||||
|
|
||||||
FileSystem::resetDir($this->source_dir . '/build');
|
FileSystem::resetDir($this->source_dir . '/build');
|
||||||
|
|||||||
21
src/SPC/builder/windows/library/bzip2.php
Normal file
21
src/SPC/builder/windows/library/bzip2.php
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace SPC\builder\windows\library;
|
||||||
|
|
||||||
|
class bzip2 extends WindowsLibraryBase
|
||||||
|
{
|
||||||
|
public const NAME = 'bzip2';
|
||||||
|
|
||||||
|
protected function build(): void
|
||||||
|
{
|
||||||
|
$nmake = $this->builder->makeSimpleWrapper('nmake /nologo /f Makefile.msc CFLAGS="-DWIN32 -MT -Ox -D_FILE_OFFSET_BITS=64 -nologo"');
|
||||||
|
cmd()->cd($this->source_dir)
|
||||||
|
->execWithWrapper($nmake, 'clean')
|
||||||
|
->execWithWrapper($nmake, 'lib');
|
||||||
|
copy($this->source_dir . '\libbz2.lib', BUILD_LIB_PATH . '\libbz2.lib');
|
||||||
|
copy($this->source_dir . '\libbz2.lib', BUILD_LIB_PATH . '\libbz2_a.lib');
|
||||||
|
copy($this->source_dir . '\bzlib.h', BUILD_INCLUDE_PATH . '\bzlib.h');
|
||||||
|
}
|
||||||
|
}
|
||||||
44
src/SPC/builder/windows/library/libyaml.php
Normal file
44
src/SPC/builder/windows/library/libyaml.php
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace SPC\builder\windows\library;
|
||||||
|
|
||||||
|
use SPC\store\FileSystem;
|
||||||
|
|
||||||
|
class libyaml extends WindowsLibraryBase
|
||||||
|
{
|
||||||
|
public const NAME = 'libyaml';
|
||||||
|
|
||||||
|
protected function build(): void
|
||||||
|
{
|
||||||
|
// reset cmake
|
||||||
|
FileSystem::resetDir($this->source_dir . '\build');
|
||||||
|
|
||||||
|
// check missing files: cmake\config.h.in and .\YamlConfig.cmake.in
|
||||||
|
if (!file_exists($this->source_dir . '\cmake\config.h.in')) {
|
||||||
|
FileSystem::createDir($this->source_dir . '\cmake');
|
||||||
|
copy(ROOT_DIR . '\src\globals\extra\libyaml_config.h.in', $this->source_dir . '\cmake\config.h.in');
|
||||||
|
}
|
||||||
|
if (!file_exists($this->source_dir . '\YamlConfig.cmake.in')) {
|
||||||
|
copy(ROOT_DIR . '\src\globals\extra\libyaml_YamlConfig.cmake.in', $this->source_dir . '\YamlConfig.cmake.in');
|
||||||
|
}
|
||||||
|
|
||||||
|
// start build
|
||||||
|
cmd()->cd($this->source_dir)
|
||||||
|
->execWithWrapper(
|
||||||
|
$this->builder->makeSimpleWrapper('cmake'),
|
||||||
|
'-B build ' .
|
||||||
|
'-A x64 ' .
|
||||||
|
"-DCMAKE_TOOLCHAIN_FILE={$this->builder->cmake_toolchain_file} " .
|
||||||
|
'-DCMAKE_BUILD_TYPE=Release ' .
|
||||||
|
'-DBUILD_SHARED_LIBS=OFF ' .
|
||||||
|
'-DBUILD_TESTING=OFF ' .
|
||||||
|
'-DCMAKE_INSTALL_PREFIX=' . BUILD_ROOT_PATH . ' '
|
||||||
|
)
|
||||||
|
->execWithWrapper(
|
||||||
|
$this->builder->makeSimpleWrapper('cmake'),
|
||||||
|
"--build build --config Release --target install -j{$this->builder->concurrency}"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
46
src/SPC/builder/windows/library/libzip.php
Normal file
46
src/SPC/builder/windows/library/libzip.php
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace SPC\builder\windows\library;
|
||||||
|
|
||||||
|
use SPC\store\FileSystem;
|
||||||
|
|
||||||
|
class libzip extends WindowsLibraryBase
|
||||||
|
{
|
||||||
|
public const NAME = 'libzip';
|
||||||
|
|
||||||
|
protected function build(): void
|
||||||
|
{
|
||||||
|
// reset cmake
|
||||||
|
FileSystem::resetDir($this->source_dir . '\build');
|
||||||
|
|
||||||
|
$openssl = $this->builder->getLib('openssl') ? 'ON' : 'OFF';
|
||||||
|
$zstd = $this->builder->getLib('zstd') ? 'ON' : 'OFF';
|
||||||
|
|
||||||
|
// start build
|
||||||
|
cmd()->cd($this->source_dir)
|
||||||
|
->execWithWrapper(
|
||||||
|
$this->builder->makeSimpleWrapper('cmake'),
|
||||||
|
'-B build ' .
|
||||||
|
'-A x64 ' .
|
||||||
|
"-DCMAKE_TOOLCHAIN_FILE={$this->builder->cmake_toolchain_file} " .
|
||||||
|
'-DCMAKE_BUILD_TYPE=Release ' .
|
||||||
|
'-DBUILD_SHARED_LIBS=OFF ' .
|
||||||
|
'-DENABLE_BZIP2=ON ' .
|
||||||
|
'-DENABLE_LZMA=ON ' .
|
||||||
|
"-DENABLE_ZSTD={$zstd} " .
|
||||||
|
"-DENABLE_OPENSSL={$openssl} " .
|
||||||
|
'-DBUILD_TOOLS=OFF ' .
|
||||||
|
'-DBUILD_DOC=OFF ' .
|
||||||
|
'-DBUILD_EXAMPLES=OFF ' .
|
||||||
|
'-DBUILD_REGRESS=OFF ' .
|
||||||
|
'-DCMAKE_INSTALL_PREFIX=' . BUILD_ROOT_PATH . ' '
|
||||||
|
)
|
||||||
|
->execWithWrapper(
|
||||||
|
$this->builder->makeSimpleWrapper('cmake'),
|
||||||
|
"--build build --config Release --target install -j{$this->builder->concurrency}"
|
||||||
|
);
|
||||||
|
copy(BUILD_LIB_PATH . '\zip.lib', BUILD_LIB_PATH . '\libzip_a.lib');
|
||||||
|
}
|
||||||
|
}
|
||||||
39
src/SPC/builder/windows/library/xz.php
Normal file
39
src/SPC/builder/windows/library/xz.php
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace SPC\builder\windows\library;
|
||||||
|
|
||||||
|
use SPC\store\FileSystem;
|
||||||
|
|
||||||
|
class xz extends WindowsLibraryBase
|
||||||
|
{
|
||||||
|
public const NAME = 'xz';
|
||||||
|
|
||||||
|
protected function build(): void
|
||||||
|
{
|
||||||
|
// reset cmake
|
||||||
|
FileSystem::resetDir($this->source_dir . '\build');
|
||||||
|
|
||||||
|
// start build
|
||||||
|
cmd()->cd($this->source_dir)
|
||||||
|
->execWithWrapper(
|
||||||
|
$this->builder->makeSimpleWrapper('cmake'),
|
||||||
|
'-B build ' .
|
||||||
|
'-A x64 ' .
|
||||||
|
"-DCMAKE_TOOLCHAIN_FILE={$this->builder->cmake_toolchain_file} " .
|
||||||
|
'-DCMAKE_BUILD_TYPE=Release ' .
|
||||||
|
'-DBUILD_SHARED_LIBS=OFF ' .
|
||||||
|
'-DCMAKE_INSTALL_PREFIX=' . BUILD_ROOT_PATH . ' '
|
||||||
|
)
|
||||||
|
->execWithWrapper(
|
||||||
|
$this->builder->makeSimpleWrapper('cmake'),
|
||||||
|
"--build build --config Release --target install -j{$this->builder->concurrency}"
|
||||||
|
);
|
||||||
|
|
||||||
|
// copy liblzma.lib to liblzma_a.lib
|
||||||
|
copy(BUILD_LIB_PATH . '/liblzma.lib', BUILD_LIB_PATH . '/liblzma_a.lib');
|
||||||
|
// patch lzma.h
|
||||||
|
FileSystem::replaceFileStr(BUILD_INCLUDE_PATH . '/lzma.h', 'defined(LZMA_API_STATIC)', 'defined(_WIN32)');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -38,7 +38,7 @@ class DownloadCommand extends BaseCommand
|
|||||||
$this->addOption('for-extensions', 'e', InputOption::VALUE_REQUIRED, 'Fetch by extensions, e.g "openssl,mbstring"');
|
$this->addOption('for-extensions', 'e', InputOption::VALUE_REQUIRED, 'Fetch by extensions, e.g "openssl,mbstring"');
|
||||||
$this->addOption('for-libs', 'l', InputOption::VALUE_REQUIRED, 'Fetch by libraries, e.g "libcares,openssl,onig"');
|
$this->addOption('for-libs', 'l', InputOption::VALUE_REQUIRED, 'Fetch by libraries, e.g "libcares,openssl,onig"');
|
||||||
$this->addOption('without-suggestions', null, null, 'Do not fetch suggested sources when using --for-extensions');
|
$this->addOption('without-suggestions', null, null, 'Do not fetch suggested sources when using --for-extensions');
|
||||||
$this->addOption('ignore-cache-sources', null, InputOption::VALUE_REQUIRED, 'Ignore some source caches, comma separated, e.g "php-src,curl,openssl"', '');
|
$this->addOption('ignore-cache-sources', null, InputOption::VALUE_OPTIONAL, 'Ignore some source caches, comma separated, e.g "php-src,curl,openssl"', '');
|
||||||
$this->addOption('retry', 'R', InputOption::VALUE_REQUIRED, 'Set retry time when downloading failed (default: 0)', '0');
|
$this->addOption('retry', 'R', InputOption::VALUE_REQUIRED, 'Set retry time when downloading failed (default: 0)', '0');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -147,8 +147,12 @@ class DownloadCommand extends BaseCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
$chosen_sources = array_map('trim', array_filter(explode(',', $this->getArgument('sources'))));
|
$chosen_sources = array_map('trim', array_filter(explode(',', $this->getArgument('sources'))));
|
||||||
$force_list = array_map('trim', array_filter(explode(',', $this->getOption('ignore-cache-sources'))));
|
$force_all = empty($this->getOption('ignore-cache-sources'));
|
||||||
|
if (!$force_all) {
|
||||||
|
$force_list = array_map('trim', array_filter(explode(',', $this->getOption('ignore-cache-sources'))));
|
||||||
|
} else {
|
||||||
|
$force_list = [];
|
||||||
|
}
|
||||||
if ($this->getOption('all')) {
|
if ($this->getOption('all')) {
|
||||||
logger()->notice('Downloading with --all option will take more times to download, we recommend you to download with --for-extensions option !');
|
logger()->notice('Downloading with --all option will take more times to download, we recommend you to download with --for-extensions option !');
|
||||||
}
|
}
|
||||||
@@ -182,7 +186,7 @@ class DownloadCommand extends BaseCommand
|
|||||||
Downloader::downloadSource($source, $new_config, true);
|
Downloader::downloadSource($source, $new_config, true);
|
||||||
} else {
|
} else {
|
||||||
logger()->info("Fetching source {$source} [{$ni}/{$cnt}]");
|
logger()->info("Fetching source {$source} [{$ni}/{$cnt}]");
|
||||||
Downloader::downloadSource($source, Config::getSource($source), in_array($source, $force_list));
|
Downloader::downloadSource($source, Config::getSource($source), $force_all || in_array($source, $force_list));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$time = round(microtime(true) - START_TIME, 3);
|
$time = round(microtime(true) - START_TIME, 3);
|
||||||
|
|||||||
51
src/SPC/command/dev/ExtVerCommand.php
Normal file
51
src/SPC/command/dev/ExtVerCommand.php
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace SPC\command\dev;
|
||||||
|
|
||||||
|
use SPC\builder\BuilderProvider;
|
||||||
|
use SPC\command\BaseCommand;
|
||||||
|
use SPC\store\Config;
|
||||||
|
use Symfony\Component\Console\Attribute\AsCommand;
|
||||||
|
use Symfony\Component\Console\Input\InputArgument;
|
||||||
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
|
|
||||||
|
#[AsCommand('dev:ext-version', 'Returns version of extension from source directory', ['dev:ext-ver'])]
|
||||||
|
class ExtVerCommand extends BaseCommand
|
||||||
|
{
|
||||||
|
public function configure()
|
||||||
|
{
|
||||||
|
$this->addArgument('extension', InputArgument::REQUIRED, 'The library name');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function initialize(InputInterface $input, OutputInterface $output): void
|
||||||
|
{
|
||||||
|
$this->no_motd = true;
|
||||||
|
parent::initialize($input, $output);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function handle(): int
|
||||||
|
{
|
||||||
|
// Get lib object
|
||||||
|
$builder = BuilderProvider::makeBuilderByInput($this->input);
|
||||||
|
|
||||||
|
$ext_conf = Config::getExt($this->getArgument('extension'));
|
||||||
|
$builder->proveExts([$this->getArgument('extension')], true);
|
||||||
|
|
||||||
|
// Check whether lib is extracted
|
||||||
|
// if (!is_dir(SOURCE_PATH . '/' . $this->getArgument('library'))) {
|
||||||
|
// $this->output->writeln("<error>Library {$this->getArgument('library')} is not extracted</error>");
|
||||||
|
// return static::FAILURE;
|
||||||
|
// }
|
||||||
|
|
||||||
|
$version = $builder->getExt($this->getArgument('extension'))->getExtVersion();
|
||||||
|
if ($version === null) {
|
||||||
|
$this->output->writeln("<error>Failed to get version of extension {$this->getArgument('extension')}</error>");
|
||||||
|
return static::FAILURE;
|
||||||
|
}
|
||||||
|
$this->output->writeln("<info>{$version}</info>");
|
||||||
|
return static::SUCCESS;
|
||||||
|
}
|
||||||
|
}
|
||||||
60
src/SPC/command/dev/LibVerCommand.php
Normal file
60
src/SPC/command/dev/LibVerCommand.php
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace SPC\command\dev;
|
||||||
|
|
||||||
|
use SPC\builder\BuilderProvider;
|
||||||
|
use SPC\command\BaseCommand;
|
||||||
|
use SPC\exception\WrongUsageException;
|
||||||
|
use SPC\store\Config;
|
||||||
|
use Symfony\Component\Console\Attribute\AsCommand;
|
||||||
|
use Symfony\Component\Console\Input\InputArgument;
|
||||||
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
|
|
||||||
|
#[AsCommand('dev:lib-version', 'Returns version of library from source directory', ['dev:lib-ver'])]
|
||||||
|
class LibVerCommand extends BaseCommand
|
||||||
|
{
|
||||||
|
public function configure()
|
||||||
|
{
|
||||||
|
$this->addArgument('library', InputArgument::REQUIRED, 'The library name');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function initialize(InputInterface $input, OutputInterface $output): void
|
||||||
|
{
|
||||||
|
$this->no_motd = true;
|
||||||
|
parent::initialize($input, $output);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function handle(): int
|
||||||
|
{
|
||||||
|
// Get lib object
|
||||||
|
$builder = BuilderProvider::makeBuilderByInput($this->input);
|
||||||
|
$builder->setLibsOnly();
|
||||||
|
|
||||||
|
// check lib name exist in lib.json
|
||||||
|
try {
|
||||||
|
Config::getLib($this->getArgument('library'));
|
||||||
|
} catch (WrongUsageException $e) {
|
||||||
|
$this->output->writeln("<error>Library {$this->getArgument('library')} is not supported yet</error>");
|
||||||
|
return static::FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
$builder->proveLibs([$this->getArgument('library')]);
|
||||||
|
|
||||||
|
// Check whether lib is extracted
|
||||||
|
if (!is_dir(SOURCE_PATH . '/' . $this->getArgument('library'))) {
|
||||||
|
$this->output->writeln("<error>Library {$this->getArgument('library')} is not extracted</error>");
|
||||||
|
return static::FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
$version = $builder->getLib($this->getArgument('library'))->getLibVersion();
|
||||||
|
if ($version === null) {
|
||||||
|
$this->output->writeln("<error>Failed to get version of library {$this->getArgument('library')}</error>");
|
||||||
|
return static::FAILURE;
|
||||||
|
}
|
||||||
|
$this->output->writeln("<info>{$version}</info>");
|
||||||
|
return static::SUCCESS;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -16,7 +16,7 @@ use SPC\store\source\CustomSourceBase;
|
|||||||
class Downloader
|
class Downloader
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Get latest version from BitBucket tag
|
* Get latest version from BitBucket tag (type = bitbuckettag)
|
||||||
*
|
*
|
||||||
* @param string $name source name
|
* @param string $name source name
|
||||||
* @param array $source source meta info: [repo]
|
* @param array $source source meta info: [repo]
|
||||||
@@ -51,7 +51,7 @@ class Downloader
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get latest version from GitHub tarball
|
* Get latest version from GitHub tarball (type = ghtar / ghtagtar)
|
||||||
*
|
*
|
||||||
* @param string $name source name
|
* @param string $name source name
|
||||||
* @param array $source source meta info: [repo]
|
* @param array $source source meta info: [repo]
|
||||||
@@ -68,7 +68,16 @@ class Downloader
|
|||||||
hooks: [[CurlHook::class, 'setupGithubToken']],
|
hooks: [[CurlHook::class, 'setupGithubToken']],
|
||||||
retry: intval(getenv('SPC_RETRY_TIME') ? getenv('SPC_RETRY_TIME') : 0)
|
retry: intval(getenv('SPC_RETRY_TIME') ? getenv('SPC_RETRY_TIME') : 0)
|
||||||
), true);
|
), true);
|
||||||
$url = $data[0]['tarball_url'];
|
|
||||||
|
if (($source['prefer-stable'] ?? false) === true) {
|
||||||
|
$url = $data[0]['tarball_url'];
|
||||||
|
} else {
|
||||||
|
$id = 0;
|
||||||
|
while ($data[$id]['prerelease'] === true) {
|
||||||
|
++$id;
|
||||||
|
}
|
||||||
|
$url = $data[$id]['tarball_url'] ?? null;
|
||||||
|
}
|
||||||
if (!$url) {
|
if (!$url) {
|
||||||
throw new DownloaderException("failed to find {$name} source");
|
throw new DownloaderException("failed to find {$name} source");
|
||||||
}
|
}
|
||||||
@@ -106,7 +115,7 @@ class Downloader
|
|||||||
), true);
|
), true);
|
||||||
$url = null;
|
$url = null;
|
||||||
foreach ($data as $release) {
|
foreach ($data as $release) {
|
||||||
if ($release['prerelease'] === true) {
|
if (($source['prefer-stable'] ?? false) === true && $release['prerelease'] === true) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
foreach ($release['assets'] as $asset) {
|
foreach ($release['assets'] as $asset) {
|
||||||
|
|||||||
@@ -195,7 +195,7 @@ class FileSystem
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
self::extractArchive($filename, $target);
|
self::extractArchive($filename, $target);
|
||||||
self::emitSourceExtractHook($name);
|
self::emitSourceExtractHook($name, $target);
|
||||||
} catch (RuntimeException $e) {
|
} catch (RuntimeException $e) {
|
||||||
if (PHP_OS_FAMILY === 'Windows') {
|
if (PHP_OS_FAMILY === 'Windows') {
|
||||||
f_passthru('rmdir /s /q ' . $target);
|
f_passthru('rmdir /s /q ' . $target);
|
||||||
@@ -518,10 +518,10 @@ class FileSystem
|
|||||||
return file_put_contents($filename, $file);
|
return file_put_contents($filename, $file);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function emitSourceExtractHook(string $name): void
|
private static function emitSourceExtractHook(string $name, string $target): void
|
||||||
{
|
{
|
||||||
foreach ((self::$_extract_hook[$name] ?? []) as $hook) {
|
foreach ((self::$_extract_hook[$name] ?? []) as $hook) {
|
||||||
if ($hook() === true) {
|
if ($hook($name, $target) === true) {
|
||||||
logger()->info('Patched source [' . $name . '] after extracted');
|
logger()->info('Patched source [' . $name . '] after extracted');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ use SPC\builder\linux\LinuxBuilder;
|
|||||||
use SPC\builder\unix\UnixBuilderBase;
|
use SPC\builder\unix\UnixBuilderBase;
|
||||||
use SPC\exception\FileSystemException;
|
use SPC\exception\FileSystemException;
|
||||||
use SPC\exception\RuntimeException;
|
use SPC\exception\RuntimeException;
|
||||||
|
use SPC\exception\WrongUsageException;
|
||||||
|
|
||||||
class SourcePatcher
|
class SourcePatcher
|
||||||
{
|
{
|
||||||
@@ -20,12 +21,19 @@ class SourcePatcher
|
|||||||
FileSystem::addSourceExtractHook('swoole', [SourcePatcher::class, 'patchSwoole']);
|
FileSystem::addSourceExtractHook('swoole', [SourcePatcher::class, 'patchSwoole']);
|
||||||
FileSystem::addSourceExtractHook('php-src', [SourcePatcher::class, 'patchPhpLibxml212']);
|
FileSystem::addSourceExtractHook('php-src', [SourcePatcher::class, 'patchPhpLibxml212']);
|
||||||
FileSystem::addSourceExtractHook('php-src', [SourcePatcher::class, 'patchGDWin32']);
|
FileSystem::addSourceExtractHook('php-src', [SourcePatcher::class, 'patchGDWin32']);
|
||||||
|
FileSystem::addSourceExtractHook('sqlsrv', [SourcePatcher::class, 'patchSQLSRVWin32']);
|
||||||
|
FileSystem::addSourceExtractHook('pdo_sqlsrv', [SourcePatcher::class, 'patchSQLSRVWin32']);
|
||||||
|
FileSystem::addSourceExtractHook('yaml', [SourcePatcher::class, 'patchYamlWin32']);
|
||||||
|
FileSystem::addSourceExtractHook('libyaml', [SourcePatcher::class, 'patchLibYaml']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Source patcher runner before buildconf
|
* Source patcher runner before buildconf
|
||||||
*
|
*
|
||||||
* @param BuilderBase $builder Builder
|
* @param BuilderBase $builder Builder
|
||||||
|
* @throws FileSystemException
|
||||||
|
* @throws RuntimeException
|
||||||
|
* @throws WrongUsageException
|
||||||
*/
|
*/
|
||||||
public static function patchBeforeBuildconf(BuilderBase $builder): void
|
public static function patchBeforeBuildconf(BuilderBase $builder): void
|
||||||
{
|
{
|
||||||
@@ -77,7 +85,7 @@ class SourcePatcher
|
|||||||
* @throws RuntimeException
|
* @throws RuntimeException
|
||||||
* @throws FileSystemException
|
* @throws FileSystemException
|
||||||
*/
|
*/
|
||||||
public static function patchMicro(?array $list = null, bool $reverse = false): bool
|
public static function patchMicro(): bool
|
||||||
{
|
{
|
||||||
if (!file_exists(SOURCE_PATH . '/php-src/sapi/micro/php_micro.c')) {
|
if (!file_exists(SOURCE_PATH . '/php-src/sapi/micro/php_micro.c')) {
|
||||||
return false;
|
return false;
|
||||||
@@ -112,7 +120,7 @@ class SourcePatcher
|
|||||||
if (PHP_OS_FAMILY === 'Darwin') {
|
if (PHP_OS_FAMILY === 'Darwin') {
|
||||||
$default[] = 'macos_iconv';
|
$default[] = 'macos_iconv';
|
||||||
}
|
}
|
||||||
$patch_list = $list ?? $default;
|
$patch_list = $default;
|
||||||
$patches = [];
|
$patches = [];
|
||||||
$serial = ['80', '81', '82', '83', '84'];
|
$serial = ['80', '81', '82', '83', '84'];
|
||||||
foreach ($patch_list as $patchName) {
|
foreach ($patch_list as $patchName) {
|
||||||
@@ -135,7 +143,7 @@ class SourcePatcher
|
|||||||
|
|
||||||
f_passthru(
|
f_passthru(
|
||||||
'cd ' . SOURCE_PATH . '/php-src && ' .
|
'cd ' . SOURCE_PATH . '/php-src && ' .
|
||||||
(PHP_OS_FAMILY === 'Windows' ? 'type' : 'cat') . ' ' . $patchesStr . ' | patch -p1 ' . ($reverse ? '-R' : '')
|
(PHP_OS_FAMILY === 'Windows' ? 'type' : 'cat') . ' ' . $patchesStr . ' | patch -p1 '
|
||||||
);
|
);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -183,6 +191,9 @@ class SourcePatcher
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws FileSystemException
|
||||||
|
*/
|
||||||
public static function patchSwoole(): bool
|
public static function patchSwoole(): bool
|
||||||
{
|
{
|
||||||
// swoole hook needs pdo/pdo.h
|
// swoole hook needs pdo/pdo.h
|
||||||
@@ -281,6 +292,9 @@ class SourcePatcher
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws FileSystemException
|
||||||
|
*/
|
||||||
public static function patchMicroPhar(int $version_id): void
|
public static function patchMicroPhar(int $version_id): void
|
||||||
{
|
{
|
||||||
FileSystem::backupFile(SOURCE_PATH . '/php-src/ext/phar/phar.c');
|
FileSystem::backupFile(SOURCE_PATH . '/php-src/ext/phar/phar.c');
|
||||||
@@ -306,11 +320,47 @@ class SourcePatcher
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws RuntimeException
|
||||||
|
*/
|
||||||
public static function unpatchMicroPhar(): void
|
public static function unpatchMicroPhar(): void
|
||||||
{
|
{
|
||||||
FileSystem::restoreBackupFile(SOURCE_PATH . '/php-src/ext/phar/phar.c');
|
FileSystem::restoreBackupFile(SOURCE_PATH . '/php-src/ext/phar/phar.c');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fix the compilation issue of sqlsrv and pdo_sqlsrv on Windows (/sdl check is too strict and will cause Zend compilation to fail)
|
||||||
|
*
|
||||||
|
* @throws FileSystemException
|
||||||
|
*/
|
||||||
|
public static function patchSQLSRVWin32(string $source_name): bool
|
||||||
|
{
|
||||||
|
$source_name = preg_replace('/[^a-z_]/', '', $source_name);
|
||||||
|
if (file_exists(SOURCE_PATH . '/php-src/ext/' . $source_name . '/config.w32')) {
|
||||||
|
FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/ext/' . $source_name . '/config.w32', '/sdl', '');
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function patchYamlWin32(): bool
|
||||||
|
{
|
||||||
|
FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/ext/yaml/config.w32', "lib.substr(lib.length - 6, 6) == '_a.lib'", "lib.substr(lib.length - 6, 6) == '_a.lib' || 'yes' == 'yes'");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function patchLibYaml(string $name, string $target): bool
|
||||||
|
{
|
||||||
|
if (!file_exists("{$target}\\cmake\\config.h.in")) {
|
||||||
|
FileSystem::createDir("{$target}\\cmake");
|
||||||
|
copy(ROOT_DIR . '\src\globals\extra\libyaml_config.h.in', "{$target}\\cmake\\config.h.in");
|
||||||
|
}
|
||||||
|
if (!file_exists("{$target}\\YamlConfig.cmake.in")) {
|
||||||
|
copy(ROOT_DIR . '\src\globals\extra\libyaml_YamlConfig.cmake.in', "{$target}\\YamlConfig.cmake.in");
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Patch cli SAPI Makefile for Windows.
|
* Patch cli SAPI Makefile for Windows.
|
||||||
*
|
*
|
||||||
@@ -325,7 +375,7 @@ class SourcePatcher
|
|||||||
$line_num = 0;
|
$line_num = 0;
|
||||||
$found = false;
|
$found = false;
|
||||||
foreach ($lines as $v) {
|
foreach ($lines as $v) {
|
||||||
if (strpos($v, '$(BUILD_DIR)\php.exe:') !== false) {
|
if (str_contains($v, '$(BUILD_DIR)\php.exe:')) {
|
||||||
$found = $line_num;
|
$found = $line_num;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -339,6 +389,9 @@ class SourcePatcher
|
|||||||
FileSystem::writeFile(SOURCE_PATH . '/php-src/Makefile', implode("\r\n", $lines));
|
FileSystem::writeFile(SOURCE_PATH . '/php-src/Makefile', implode("\r\n", $lines));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws RuntimeException
|
||||||
|
*/
|
||||||
public static function patchPhpLibxml212(): bool
|
public static function patchPhpLibxml212(): bool
|
||||||
{
|
{
|
||||||
$file = file_get_contents(SOURCE_PATH . '/php-src/main/php_version.h');
|
$file = file_get_contents(SOURCE_PATH . '/php-src/main/php_version.h');
|
||||||
@@ -360,6 +413,9 @@ class SourcePatcher
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws FileSystemException
|
||||||
|
*/
|
||||||
public static function patchGDWin32(): bool
|
public static function patchGDWin32(): bool
|
||||||
{
|
{
|
||||||
$file = file_get_contents(SOURCE_PATH . '/php-src/main/php_version.h');
|
$file = file_get_contents(SOURCE_PATH . '/php-src/main/php_version.h');
|
||||||
@@ -393,6 +449,9 @@ class SourcePatcher
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws FileSystemException
|
||||||
|
*/
|
||||||
public static function patchMicroWin32(): void
|
public static function patchMicroWin32(): void
|
||||||
{
|
{
|
||||||
// patch micro win32
|
// patch micro win32
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ const SPC_INTERNAL_EXTENSIONS = [
|
|||||||
'core',
|
'core',
|
||||||
'hash',
|
'hash',
|
||||||
'json',
|
'json',
|
||||||
|
'pcre',
|
||||||
'reflection',
|
'reflection',
|
||||||
'spl',
|
'spl',
|
||||||
'standard',
|
'standard',
|
||||||
|
|||||||
10
src/globals/extra/libyaml_YamlConfig.cmake.in
Normal file
10
src/globals/extra/libyaml_YamlConfig.cmake.in
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
@PACKAGE_INIT@
|
||||||
|
|
||||||
|
set_and_check(yaml_TARGETS "@PACKAGE_CONFIG_DIR_CONFIG@/yamlTargets.cmake")
|
||||||
|
|
||||||
|
if(NOT yaml_TARGETS_IMPORTED)
|
||||||
|
set(yaml_TARGETS_IMPORTED 1)
|
||||||
|
include(${yaml_TARGETS})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(yaml_LIBRARIES yaml)
|
||||||
4
src/globals/extra/libyaml_config.h.in
Normal file
4
src/globals/extra/libyaml_config.h.in
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
#define YAML_VERSION_MAJOR @YAML_VERSION_MAJOR@
|
||||||
|
#define YAML_VERSION_MINOR @YAML_VERSION_MINOR@
|
||||||
|
#define YAML_VERSION_PATCH @YAML_VERSION_PATCH@
|
||||||
|
#define YAML_VERSION_STRING "@YAML_VERSION_STRING@"
|
||||||
@@ -20,13 +20,13 @@ $upx = true;
|
|||||||
// If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`).
|
// If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`).
|
||||||
$extensions = match (PHP_OS_FAMILY) {
|
$extensions = match (PHP_OS_FAMILY) {
|
||||||
'Linux', 'Darwin' => 'sockets',
|
'Linux', 'Darwin' => 'sockets',
|
||||||
'Windows' => 'mbstring,pdo_sqlite,mbregex,gd',
|
'Windows' => 'mbstring,pdo_sqlite,mbregex,bz2,sqlsrv,pdo_sqlsrv,yaml,zip,rar,apcu,swow',
|
||||||
};
|
};
|
||||||
|
|
||||||
// If you want to test lib-suggests feature with extension, add them below (comma separated, example `libwebp,libavif`).
|
// If you want to test lib-suggests feature with extension, add them below (comma separated, example `libwebp,libavif`).
|
||||||
$with_libs = match (PHP_OS_FAMILY) {
|
$with_libs = match (PHP_OS_FAMILY) {
|
||||||
'Linux', 'Darwin' => '',
|
'Linux', 'Darwin' => '',
|
||||||
'Windows' => 'libjpeg,libwebp,libavif,freetype',
|
'Windows' => '',
|
||||||
};
|
};
|
||||||
|
|
||||||
// Please change your test base combination. We recommend testing with `common`.
|
// Please change your test base combination. We recommend testing with `common`.
|
||||||
|
|||||||
Reference in New Issue
Block a user