mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-02 22:35:43 +08:00
Compare commits
3 Commits
fix/zlib
...
fix/protob
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cc59b39a02 | ||
|
|
a8e50276d9 | ||
|
|
423b916736 |
@@ -11,6 +11,7 @@
|
||||
"require": {
|
||||
"php": ">= 8.3",
|
||||
"ext-mbstring": "*",
|
||||
"ext-simplexml": "*",
|
||||
"ext-zlib": "*",
|
||||
"laravel/prompts": "^0.1.12",
|
||||
"symfony/console": "^5.4 || ^6 || ^7",
|
||||
|
||||
@@ -494,7 +494,7 @@
|
||||
"static-libs-windows": [
|
||||
"libjpeg_a.lib"
|
||||
],
|
||||
"lib-depends": [
|
||||
"lib-suggests-windows": [
|
||||
"zlib"
|
||||
]
|
||||
},
|
||||
|
||||
@@ -8,30 +8,25 @@
|
||||
"alt": false
|
||||
},
|
||||
"amqp": {
|
||||
"type": "url",
|
||||
"url": "https://pecl.php.net/get/amqp",
|
||||
"type": "pecl",
|
||||
"path": "php-src/ext/amqp",
|
||||
"filename": "amqp.tgz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"apcu": {
|
||||
"type": "url",
|
||||
"url": "https://pecl.php.net/get/APCu",
|
||||
"type": "pecl",
|
||||
"pecl": "APCu",
|
||||
"path": "php-src/ext/apcu",
|
||||
"filename": "apcu.tgz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"ast": {
|
||||
"type": "url",
|
||||
"url": "https://pecl.php.net/get/ast",
|
||||
"type": "pecl",
|
||||
"path": "php-src/ext/ast",
|
||||
"filename": "ast.tgz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
@@ -85,20 +80,16 @@
|
||||
}
|
||||
},
|
||||
"dio": {
|
||||
"type": "url",
|
||||
"url": "https://pecl.php.net/get/dio",
|
||||
"type": "pecl",
|
||||
"path": "php-src/ext/dio",
|
||||
"filename": "dio.tgz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"ev": {
|
||||
"type": "url",
|
||||
"url": "https://pecl.php.net/get/ev",
|
||||
"type": "pecl",
|
||||
"path": "php-src/ext/ev",
|
||||
"filename": "ev.tgz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
@@ -115,10 +106,8 @@
|
||||
}
|
||||
},
|
||||
"ext-ds": {
|
||||
"type": "url",
|
||||
"url": "https://pecl.php.net/get/ds",
|
||||
"type": "pecl",
|
||||
"path": "php-src/ext/ds",
|
||||
"filename": "ds.tgz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
@@ -134,10 +123,8 @@
|
||||
}
|
||||
},
|
||||
"ext-excimer": {
|
||||
"type": "url",
|
||||
"url": "https://pecl.php.net/get/excimer",
|
||||
"type": "pecl",
|
||||
"path": "php-src/ext/excimer",
|
||||
"filename": "excimer.tgz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
@@ -162,10 +149,8 @@
|
||||
}
|
||||
},
|
||||
"ext-grpc": {
|
||||
"type": "url",
|
||||
"url": "https://pecl.php.net/get/grpc",
|
||||
"type": "pecl",
|
||||
"path": "php-src/ext/grpc",
|
||||
"filename": "grpc.tgz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": [
|
||||
@@ -174,20 +159,16 @@
|
||||
}
|
||||
},
|
||||
"ext-imagick": {
|
||||
"type": "url",
|
||||
"url": "https://pecl.php.net/get/imagick",
|
||||
"type": "pecl",
|
||||
"path": "php-src/ext/imagick",
|
||||
"filename": "imagick.tgz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"ext-imap": {
|
||||
"type": "url",
|
||||
"url": "https://pecl.php.net/get/imap",
|
||||
"type": "pecl",
|
||||
"path": "php-src/ext/imap",
|
||||
"filename": "imap.tgz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": [
|
||||
@@ -207,19 +188,15 @@
|
||||
}
|
||||
},
|
||||
"ext-maxminddb": {
|
||||
"type": "url",
|
||||
"url": "https://pecl.php.net/get/maxminddb",
|
||||
"filename": "ext-maxminddb.tgz",
|
||||
"type": "pecl",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"ext-memcache": {
|
||||
"type": "url",
|
||||
"url": "https://pecl.php.net/get/memcache",
|
||||
"type": "pecl",
|
||||
"path": "php-src/ext/memcache",
|
||||
"filename": "memcache.tgz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
@@ -235,10 +212,8 @@
|
||||
}
|
||||
},
|
||||
"ext-simdjson": {
|
||||
"type": "url",
|
||||
"url": "https://pecl.php.net/get/simdjson",
|
||||
"type": "pecl",
|
||||
"path": "php-src/ext/simdjson",
|
||||
"filename": "simdjson.tgz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
@@ -255,40 +230,32 @@
|
||||
}
|
||||
},
|
||||
"ext-ssh2": {
|
||||
"type": "url",
|
||||
"url": "https://pecl.php.net/get/ssh2",
|
||||
"type": "pecl",
|
||||
"path": "php-src/ext/ssh2",
|
||||
"filename": "ssh2.tgz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"ext-trader": {
|
||||
"type": "url",
|
||||
"url": "https://pecl.php.net/get/trader",
|
||||
"type": "pecl",
|
||||
"path": "php-src/ext/trader",
|
||||
"filename": "trader.tgz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"ext-uuid": {
|
||||
"type": "url",
|
||||
"url": "https://pecl.php.net/get/uuid",
|
||||
"type": "pecl",
|
||||
"path": "php-src/ext/uuid",
|
||||
"filename": "uuid.tgz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"ext-uv": {
|
||||
"type": "url",
|
||||
"url": "https://pecl.php.net/get/uv",
|
||||
"type": "pecl",
|
||||
"path": "php-src/ext/uv",
|
||||
"filename": "uv.tgz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
@@ -305,9 +272,7 @@
|
||||
}
|
||||
},
|
||||
"ext-zip": {
|
||||
"type": "url",
|
||||
"url": "https://pecl.php.net/get/zip",
|
||||
"filename": "ext-zip.tgz",
|
||||
"type": "pecl",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
@@ -412,10 +377,8 @@
|
||||
}
|
||||
},
|
||||
"igbinary": {
|
||||
"type": "url",
|
||||
"url": "https://pecl.php.net/get/igbinary",
|
||||
"type": "pecl",
|
||||
"path": "php-src/ext/igbinary",
|
||||
"filename": "igbinary.tgz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "COPYING"
|
||||
@@ -439,10 +402,8 @@
|
||||
}
|
||||
},
|
||||
"inotify": {
|
||||
"type": "url",
|
||||
"url": "https://pecl.php.net/get/inotify",
|
||||
"type": "pecl",
|
||||
"path": "php-src/ext/inotify",
|
||||
"filename": "inotify.tgz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
@@ -641,7 +602,6 @@
|
||||
"libjpeg": {
|
||||
"type": "ghtar",
|
||||
"repo": "libjpeg-turbo/libjpeg-turbo",
|
||||
"prefer-stable": true,
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE.md"
|
||||
@@ -845,10 +805,8 @@
|
||||
}
|
||||
},
|
||||
"memcached": {
|
||||
"type": "url",
|
||||
"url": "https://pecl.php.net/get/memcached",
|
||||
"type": "pecl",
|
||||
"path": "php-src/ext/memcached",
|
||||
"filename": "memcached.tgz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
@@ -886,10 +844,8 @@
|
||||
}
|
||||
},
|
||||
"msgpack": {
|
||||
"type": "url",
|
||||
"url": "https://pecl.php.net/get/msgpack",
|
||||
"type": "pecl",
|
||||
"path": "php-src/ext/msgpack",
|
||||
"filename": "msgpack.tgz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
@@ -989,39 +945,31 @@
|
||||
}
|
||||
},
|
||||
"opentelemetry": {
|
||||
"type": "url",
|
||||
"url": "https://pecl.php.net/get/opentelemetry",
|
||||
"type": "pecl",
|
||||
"path": "php-src/ext/opentelemetry",
|
||||
"filename": "opentelemetry.tgz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"parallel": {
|
||||
"type": "url",
|
||||
"url": "https://pecl.php.net/get/parallel",
|
||||
"type": "pecl",
|
||||
"path": "php-src/ext/parallel",
|
||||
"filename": "parallel.tgz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"pcov": {
|
||||
"type": "url",
|
||||
"url": "https://pecl.php.net/get/pcov",
|
||||
"filename": "pcov.tgz",
|
||||
"type": "pecl",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"pdo_sqlsrv": {
|
||||
"type": "url",
|
||||
"url": "https://pecl.php.net/get/pdo_sqlsrv",
|
||||
"type": "pecl",
|
||||
"path": "php-src/ext/pdo_sqlsrv",
|
||||
"filename": "pdo_sqlsrv.tgz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
@@ -1054,10 +1002,8 @@
|
||||
}
|
||||
},
|
||||
"protobuf": {
|
||||
"type": "url",
|
||||
"url": "https://pecl.php.net/get/protobuf-5.34.1.tgz",
|
||||
"type": "pecl",
|
||||
"path": "php-src/ext/protobuf",
|
||||
"filename": "protobuf.tgz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
@@ -1116,10 +1062,8 @@
|
||||
}
|
||||
},
|
||||
"redis": {
|
||||
"type": "url",
|
||||
"url": "https://pecl.php.net/get/redis",
|
||||
"type": "pecl",
|
||||
"path": "php-src/ext/redis",
|
||||
"filename": "redis.tgz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": [
|
||||
@@ -1156,10 +1100,8 @@
|
||||
}
|
||||
},
|
||||
"sqlsrv": {
|
||||
"type": "url",
|
||||
"url": "https://pecl.php.net/get/sqlsrv",
|
||||
"type": "pecl",
|
||||
"path": "php-src/ext/sqlsrv",
|
||||
"filename": "sqlsrv.tgz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
@@ -1222,20 +1164,16 @@
|
||||
}
|
||||
},
|
||||
"xhprof": {
|
||||
"type": "url",
|
||||
"url": "https://pecl.php.net/get/xhprof",
|
||||
"type": "pecl",
|
||||
"path": "php-src/ext/xhprof-src",
|
||||
"filename": "xhprof.tgz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
}
|
||||
},
|
||||
"xlswriter": {
|
||||
"type": "url",
|
||||
"url": "https://pecl.php.net/get/xlswriter",
|
||||
"type": "pecl",
|
||||
"path": "php-src/ext/xlswriter",
|
||||
"filename": "xlswriter.tgz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
@@ -1253,10 +1191,8 @@
|
||||
}
|
||||
},
|
||||
"yac": {
|
||||
"type": "url",
|
||||
"url": "https://pecl.php.net/get/yac",
|
||||
"type": "pecl",
|
||||
"path": "php-src/ext/yac",
|
||||
"filename": "yac.tgz",
|
||||
"license": {
|
||||
"type": "file",
|
||||
"path": "LICENSE"
|
||||
|
||||
@@ -14,7 +14,6 @@ trait libjpeg
|
||||
->addConfigureArgs(
|
||||
'-DENABLE_STATIC=ON',
|
||||
'-DENABLE_SHARED=OFF',
|
||||
'-DWITH_SYSTEM_ZLIB=ON'
|
||||
)
|
||||
->build();
|
||||
// patch pkgconfig
|
||||
|
||||
@@ -16,6 +16,43 @@ use SPC\util\SPCTarget;
|
||||
*/
|
||||
class Downloader
|
||||
{
|
||||
/**
|
||||
* Get latest stable version from PECL
|
||||
*
|
||||
* @param string $name Source name
|
||||
* @param array $source Source meta info: [pecl?]
|
||||
* @return array<int, string> [url, filename]
|
||||
*/
|
||||
public static function getPECLInfo(string $name, array $source): array
|
||||
{
|
||||
$package = $source['pecl'] ?? (str_starts_with($name, 'ext-') ? substr($name, 4) : $name);
|
||||
$lp = strtolower($package);
|
||||
$api_url = "https://pecl.php.net/rest/r/{$lp}/allreleases.xml";
|
||||
logger()->debug("Fetching {$name} source from PECL: {$api_url}");
|
||||
$xml = self::curlExec(
|
||||
url: $api_url,
|
||||
retries: self::getRetryAttempts()
|
||||
);
|
||||
$dom = new \SimpleXMLElement($xml);
|
||||
$version = null;
|
||||
if ($source['prefer-stable'] ?? false) {
|
||||
foreach ($dom->r as $release) {
|
||||
if ((string) $release->s === 'stable') {
|
||||
$version = (string) $release->v;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
$version ??= isset($dom->r[0]) ? (string) $dom->r[0]->v : null;
|
||||
if ($version === null) {
|
||||
throw new DownloaderException("failed to find any release for {$name} on PECL");
|
||||
}
|
||||
$url = "https://pecl.php.net/get/{$package}-{$version}.tgz";
|
||||
$filename = "{$package}-{$version}.tgz";
|
||||
logger()->info("Found {$name} PECL version: {$version}");
|
||||
return [$url, $filename];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get latest version from PIE config (Packagist)
|
||||
*
|
||||
@@ -612,6 +649,7 @@ class Downloader
|
||||
* @param array{
|
||||
* url?: string,
|
||||
* repo?: string,
|
||||
* pecl?: string,
|
||||
* rev?: string,
|
||||
* path?: string,
|
||||
* filename?: string,
|
||||
@@ -631,6 +669,10 @@ class Downloader
|
||||
{
|
||||
try {
|
||||
switch ($type) {
|
||||
case 'pecl': // PECL (latest stable)
|
||||
[$url, $filename] = self::getPECLInfo($name, $conf);
|
||||
self::downloadFile($name, $url, $filename, $conf['path'] ?? $conf['extract'] ?? null, $download_as);
|
||||
break;
|
||||
case 'pie': // Packagist
|
||||
[$url, $filename] = self::getPIEInfo($name, $conf);
|
||||
self::downloadFile($name, $url, $filename, $conf['path'] ?? $conf['extract'] ?? null, $download_as, hooks: [[CurlHook::class, 'setupGithubToken']]);
|
||||
|
||||
@@ -22,7 +22,9 @@ class ConfigValidator
|
||||
'regex' => 'string', // regex pattern
|
||||
'rev' => 'string', // revision/branch
|
||||
'repo' => 'string', // repository name
|
||||
'pecl' => 'string', // PECL package name
|
||||
'match' => 'string', // match pattern (aaa*bbb)
|
||||
'query' => 'string', // query string for API requests
|
||||
'filename' => 'string', // filename
|
||||
'path' => 'string', // copy path
|
||||
'extract' => 'string', // copy path (alias of path)
|
||||
@@ -73,12 +75,13 @@ class ConfigValidator
|
||||
private const array SOURCE_TYPE_FIELDS = [
|
||||
'filelist' => [['url', 'regex'], []],
|
||||
'git' => [['url', 'rev'], ['path', 'extract', 'submodules']],
|
||||
'ghtagtar' => [['repo'], ['path', 'extract', 'prefer-stable', 'match']],
|
||||
'ghtar' => [['repo'], ['path', 'extract', 'prefer-stable', 'match']],
|
||||
'ghtagtar' => [['repo'], ['path', 'extract', 'prefer-stable', 'match', 'query']],
|
||||
'ghtar' => [['repo'], ['path', 'extract', 'prefer-stable', 'match', 'query']],
|
||||
'ghrel' => [['repo', 'match'], ['path', 'extract', 'prefer-stable']],
|
||||
'url' => [['url'], ['filename', 'path', 'extract']],
|
||||
'bitbuckettag' => [['repo'], ['path', 'extract']],
|
||||
'local' => [['dirname'], ['path', 'extract']],
|
||||
'pecl' => [[], ['pecl', 'path', 'prefer-stable']],
|
||||
'pie' => [['repo'], ['path']],
|
||||
'custom' => [[], ['func']],
|
||||
];
|
||||
|
||||
@@ -13,7 +13,7 @@ declare(strict_types=1);
|
||||
|
||||
// test php version (8.1 ~ 8.4 available, multiple for matrix)
|
||||
$test_php_version = [
|
||||
// '8.1',
|
||||
'8.1',
|
||||
// '8.2',
|
||||
// '8.3',
|
||||
'8.4',
|
||||
@@ -24,11 +24,11 @@ $test_php_version = [
|
||||
// test os (macos-15-intel, macos-15, ubuntu-latest, windows-latest are available)
|
||||
$test_os = [
|
||||
// 'macos-15-intel', // bin/spc for x86_64
|
||||
'macos-15', // bin/spc for arm64
|
||||
'ubuntu-latest', // bin/spc-alpine-docker for x86_64
|
||||
'ubuntu-22.04', // bin/spc-gnu-docker for x86_64
|
||||
// 'macos-15', // bin/spc for arm64
|
||||
// 'ubuntu-latest', // bin/spc-alpine-docker for x86_64
|
||||
// 'ubuntu-22.04', // bin/spc-gnu-docker for x86_64
|
||||
// 'ubuntu-24.04', // bin/spc for x86_64
|
||||
'ubuntu-22.04-arm', // bin/spc-gnu-docker for arm64
|
||||
// 'ubuntu-22.04-arm', // bin/spc-gnu-docker for arm64
|
||||
// 'ubuntu-24.04-arm', // bin/spc for arm64
|
||||
// 'windows-2022', // .\bin\spc.ps1
|
||||
'windows-2025',
|
||||
@@ -42,7 +42,7 @@ $no_strip = false;
|
||||
// compress with upx
|
||||
$upx = false;
|
||||
|
||||
// whether to test frankenphp build, only available for macOS and linux
|
||||
// whether to test frankenphp build, only available for macos and linux
|
||||
$frankenphp = false;
|
||||
|
||||
// prefer downloading pre-built packages to speed up the build process
|
||||
@@ -50,7 +50,7 @@ $prefer_pre_built = false;
|
||||
|
||||
// If you want to test your added extensions and libs, add below (comma separated, example `bcmath,openssl`).
|
||||
$extensions = match (PHP_OS_FAMILY) {
|
||||
'Linux', 'Darwin' => 'zlib',
|
||||
'Linux', 'Darwin' => 'pgsql',
|
||||
'Windows' => 'gd,zlib,mbstring,filter',
|
||||
};
|
||||
|
||||
@@ -66,7 +66,7 @@ $with_suggested_libs = true;
|
||||
|
||||
// If you want to test extra libs for extensions, add them below (comma separated, example `libwebp,libavif`). Unnecessary, when $with_suggested_libs is true.
|
||||
$with_libs = match (PHP_OS_FAMILY) {
|
||||
'Linux', 'Darwin' => 'libjpeg',
|
||||
'Linux', 'Darwin' => '',
|
||||
'Windows' => '',
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user