mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-13 20:05:35 +08:00
Compare commits
10 Commits
2.7.11
...
f7ca621efe
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f7ca621efe | ||
|
|
6b5200002e | ||
|
|
53f7cdefe0 | ||
|
|
e1a14bbb9f | ||
|
|
9e051c8c80 | ||
|
|
e677be74d7 | ||
|
|
037d224fd7 | ||
|
|
ce44e00bd4 | ||
|
|
0247458853 | ||
|
|
656a58c3fa |
428
composer.lock
generated
428
composer.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -142,8 +142,6 @@ SPC_CMD_PREFIX_PHP_CONFIGURE="./configure --prefix= --with-valgrind=no --enable-
|
|||||||
SPC_CMD_VAR_PHP_EMBED_TYPE="static"
|
SPC_CMD_VAR_PHP_EMBED_TYPE="static"
|
||||||
; EXTRA_CFLAGS for `configure` and `make` php
|
; EXTRA_CFLAGS for `configure` and `make` php
|
||||||
SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS="-g -fstack-protector-strong -fpic -fpie -Werror=unknown-warning-option ${SPC_DEFAULT_C_FLAGS}"
|
SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS="-g -fstack-protector-strong -fpic -fpie -Werror=unknown-warning-option ${SPC_DEFAULT_C_FLAGS}"
|
||||||
; minimum compatible macOS version (LLVM vars, availability not guaranteed)
|
|
||||||
MACOSX_DEPLOYMENT_TARGET=12.0
|
|
||||||
|
|
||||||
[freebsd]
|
[freebsd]
|
||||||
; compiler environments
|
; compiler environments
|
||||||
|
|||||||
@@ -385,6 +385,9 @@ class Extension
|
|||||||
logger()->info('Shared extension [' . $this->getName() . '] was already built, skipping (' . $this->getName() . '.so)');
|
logger()->info('Shared extension [' . $this->getName() . '] was already built, skipping (' . $this->getName() . '.so)');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if ((string) Config::getExt($this->getName(), 'type') === 'addon') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
logger()->info('Building extension [' . $this->getName() . '] as shared extension (' . $this->getName() . '.so)');
|
logger()->info('Building extension [' . $this->getName() . '] as shared extension (' . $this->getName() . '.so)');
|
||||||
foreach ($this->dependencies as $dependency) {
|
foreach ($this->dependencies as $dependency) {
|
||||||
if (!$dependency instanceof Extension) {
|
if (!$dependency instanceof Extension) {
|
||||||
|
|||||||
@@ -184,18 +184,18 @@ abstract class LibraryBase
|
|||||||
|
|
||||||
// extract first if not exists
|
// extract first if not exists
|
||||||
if (!is_dir($this->source_dir)) {
|
if (!is_dir($this->source_dir)) {
|
||||||
$this->getBuilder()->emitPatchPoint('before-library[ ' . static::NAME . ']-extract');
|
$this->getBuilder()->emitPatchPoint('before-library[' . static::NAME . ']-extract');
|
||||||
SourceManager::initSource(libs: [static::NAME], source_only: true);
|
SourceManager::initSource(libs: [static::NAME], source_only: true);
|
||||||
$this->getBuilder()->emitPatchPoint('after-library[ ' . static::NAME . ']-extract');
|
$this->getBuilder()->emitPatchPoint('after-library[' . static::NAME . ']-extract');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->patched && $this->patchBeforeBuild()) {
|
if (!$this->patched && $this->patchBeforeBuild()) {
|
||||||
file_put_contents($this->source_dir . '/.spc.patched', 'PATCHED!!!');
|
file_put_contents($this->source_dir . '/.spc.patched', 'PATCHED!!!');
|
||||||
}
|
}
|
||||||
$this->getBuilder()->emitPatchPoint('before-library[ ' . static::NAME . ']-build');
|
$this->getBuilder()->emitPatchPoint('before-library[' . static::NAME . ']-build');
|
||||||
$this->build();
|
$this->build();
|
||||||
$this->installLicense();
|
$this->installLicense();
|
||||||
$this->getBuilder()->emitPatchPoint('after-library[ ' . static::NAME . ']-build');
|
$this->getBuilder()->emitPatchPoint('after-library[' . static::NAME . ']-build');
|
||||||
return LIB_STATUS_OK;
|
return LIB_STATUS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -346,19 +346,19 @@ abstract class LibraryBase
|
|||||||
*/
|
*/
|
||||||
protected function installLicense(): void
|
protected function installLicense(): void
|
||||||
{
|
{
|
||||||
FileSystem::createDir(BUILD_ROOT_PATH . '/source-licenses/' . $this->getName());
|
|
||||||
$source = Config::getLib($this->getName(), 'source');
|
$source = Config::getLib($this->getName(), 'source');
|
||||||
|
FileSystem::createDir(BUILD_ROOT_PATH . "/source-licenses/{$source}");
|
||||||
$license_files = Config::getSource($source)['license'] ?? [];
|
$license_files = Config::getSource($source)['license'] ?? [];
|
||||||
if (is_assoc_array($license_files)) {
|
if (is_assoc_array($license_files)) {
|
||||||
$license_files = [$license_files];
|
$license_files = [$license_files];
|
||||||
}
|
}
|
||||||
foreach ($license_files as $index => $license) {
|
foreach ($license_files as $index => $license) {
|
||||||
if ($license['type'] === 'text') {
|
if ($license['type'] === 'text') {
|
||||||
FileSystem::writeFile(BUILD_ROOT_PATH . '/source-licenses/' . $this->getName() . "/{$index}.txt", $license['text']);
|
FileSystem::writeFile(BUILD_ROOT_PATH . "/source-licenses/{$source}/{$index}.txt", $license['text']);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ($license['type'] === 'file') {
|
if ($license['type'] === 'file') {
|
||||||
copy($this->source_dir . '/' . $license['path'], BUILD_ROOT_PATH . '/source-licenses/' . $this->getName() . "/{$index}.txt");
|
copy($this->source_dir . '/' . $license['path'], BUILD_ROOT_PATH . "/source-licenses/{$source}/{$index}.txt");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ class swoole extends Extension
|
|||||||
public function patchBeforeMake(): bool
|
public function patchBeforeMake(): bool
|
||||||
{
|
{
|
||||||
$patched = parent::patchBeforeMake();
|
$patched = parent::patchBeforeMake();
|
||||||
|
FileSystem::replaceFileStr($this->source_dir . '/ext-src/php_swoole_private.h', 'PHP_VERSION_ID > 80500', 'PHP_VERSION_ID >= 80600');
|
||||||
if ($this->builder instanceof MacOSBuilder) {
|
if ($this->builder instanceof MacOSBuilder) {
|
||||||
// Fix swoole with event extension <util.h> conflict bug
|
// Fix swoole with event extension <util.h> conflict bug
|
||||||
$util_path = shell()->execWithResult('xcrun --show-sdk-path', false)[1][0] . '/usr/include/util.h';
|
$util_path = shell()->execWithResult('xcrun --show-sdk-path', false)[1][0] . '/usr/include/util.h';
|
||||||
|
|||||||
@@ -10,9 +10,10 @@ trait libwebp
|
|||||||
{
|
{
|
||||||
protected function build(): void
|
protected function build(): void
|
||||||
{
|
{
|
||||||
$code = 'int main() { return _mm256_cvtsi256_si32(_mm256_setzero_si256()); }';
|
$code = '#include <immintrin.h>
|
||||||
|
int main() { return _mm256_cvtsi256_si32(_mm256_setzero_si256()); }';
|
||||||
$cc = getenv('CC') ?: 'gcc';
|
$cc = getenv('CC') ?: 'gcc';
|
||||||
[$ret] = shell()->execWithResult("echo '{$code}' | {$cc} -x c -mavx2 -o /dev/null - 2>&1");
|
[$ret] = shell()->execWithResult("printf '%s' '{$code}' | {$cc} -x c -mavx2 -o /dev/null - 2>&1");
|
||||||
$disableAvx2 = $ret !== 0 && GNU_ARCH === 'x86_64' && PHP_OS_FAMILY === 'Linux';
|
$disableAvx2 = $ret !== 0 && GNU_ARCH === 'x86_64' && PHP_OS_FAMILY === 'Linux';
|
||||||
|
|
||||||
UnixCMakeExecutor::create($this)
|
UnixCMakeExecutor::create($this)
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ class curl extends WindowsLibraryBase
|
|||||||
'-DCMAKE_BUILD_TYPE=Release ' .
|
'-DCMAKE_BUILD_TYPE=Release ' .
|
||||||
'-DBUILD_SHARED_LIBS=OFF ' .
|
'-DBUILD_SHARED_LIBS=OFF ' .
|
||||||
'-DBUILD_STATIC_LIBS=ON ' .
|
'-DBUILD_STATIC_LIBS=ON ' .
|
||||||
|
'-DCURL_STATICLIB=ON ' .
|
||||||
'-DCMAKE_INSTALL_PREFIX=' . BUILD_ROOT_PATH . ' ' .
|
'-DCMAKE_INSTALL_PREFIX=' . BUILD_ROOT_PATH . ' ' .
|
||||||
'-DBUILD_CURL_EXE=OFF ' . // disable curl.exe
|
'-DBUILD_CURL_EXE=OFF ' . // disable curl.exe
|
||||||
'-DBUILD_TESTING=OFF ' . // disable tests
|
'-DBUILD_TESTING=OFF ' . // disable tests
|
||||||
@@ -41,9 +42,9 @@ class curl extends WindowsLibraryBase
|
|||||||
'-DCURL_USE_OPENSSL=OFF ' . // disable openssl due to certificate issue
|
'-DCURL_USE_OPENSSL=OFF ' . // disable openssl due to certificate issue
|
||||||
'-DCURL_ENABLE_SSL=ON ' .
|
'-DCURL_ENABLE_SSL=ON ' .
|
||||||
'-DUSE_NGHTTP2=ON ' . // enable nghttp2
|
'-DUSE_NGHTTP2=ON ' . // enable nghttp2
|
||||||
'-DSHARE_LIB_OBJECT=OFF ' . // disable shared lib object
|
|
||||||
'-DCURL_USE_LIBSSH2=ON ' . // enable libssh2
|
'-DCURL_USE_LIBSSH2=ON ' . // enable libssh2
|
||||||
'-DENABLE_IPV6=ON ' . // enable ipv6
|
'-DENABLE_IPV6=ON ' . // enable ipv6
|
||||||
|
'-DNGHTTP2_CFLAGS="/DNGHTTP2_STATICLIB" ' .
|
||||||
$alt
|
$alt
|
||||||
)
|
)
|
||||||
->execWithWrapper(
|
->execWithWrapper(
|
||||||
@@ -52,7 +53,5 @@ class curl extends WindowsLibraryBase
|
|||||||
);
|
);
|
||||||
// move libcurl.lib to libcurl_a.lib
|
// move libcurl.lib to libcurl_a.lib
|
||||||
rename(BUILD_LIB_PATH . '\libcurl.lib', BUILD_LIB_PATH . '\libcurl_a.lib');
|
rename(BUILD_LIB_PATH . '\libcurl.lib', BUILD_LIB_PATH . '\libcurl_a.lib');
|
||||||
|
|
||||||
FileSystem::replaceFileStr(BUILD_INCLUDE_PATH . '\curl\curl.h', '#ifdef CURL_STATICLIB', '#if 1');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,16 +29,11 @@ class nghttp2 extends WindowsLibraryBase
|
|||||||
'-DBUILD_SHARED_LIBS=OFF ' .
|
'-DBUILD_SHARED_LIBS=OFF ' .
|
||||||
'-DENABLE_STATIC_CRT=ON ' .
|
'-DENABLE_STATIC_CRT=ON ' .
|
||||||
'-DENABLE_LIB_ONLY=ON ' .
|
'-DENABLE_LIB_ONLY=ON ' .
|
||||||
'-DCMAKE_INSTALL_PREFIX=' . BUILD_ROOT_PATH . ' ' .
|
'-DCMAKE_INSTALL_PREFIX=' . BUILD_ROOT_PATH . ' '
|
||||||
'-DENABLE_STATIC_CRT=ON ' .
|
|
||||||
'-DENABLE_DOC=OFF ' .
|
|
||||||
'-DBUILD_TESTING=OFF '
|
|
||||||
)
|
)
|
||||||
->execWithWrapper(
|
->execWithWrapper(
|
||||||
$this->builder->makeSimpleWrapper('cmake'),
|
$this->builder->makeSimpleWrapper('cmake'),
|
||||||
"--build build --config Release --target install -j{$this->builder->concurrency}"
|
"--build build --config Release --target install -j{$this->builder->concurrency}"
|
||||||
);
|
);
|
||||||
|
|
||||||
FileSystem::replaceFileStr(BUILD_INCLUDE_PATH . '\nghttp2\nghttp2.h', '#ifdef NGHTTP2_STATICLIB', '#if 1');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -108,6 +108,9 @@ class Downloader
|
|||||||
if (($rel['prerelease'] ?? false) === true && ($source['prefer-stable'] ?? false)) {
|
if (($rel['prerelease'] ?? false) === true && ($source['prefer-stable'] ?? false)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (($rel['draft'] ?? false) === true && (($source['prefer-stable'] ?? false) || !$rel['tarball_url'])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (!($source['match'] ?? null)) {
|
if (!($source['match'] ?? null)) {
|
||||||
$url = $rel['tarball_url'] ?? null;
|
$url = $rel['tarball_url'] ?? null;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -408,13 +408,13 @@ class FileSystem
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$sub_file = self::convertPath($dir . '/' . $v);
|
$sub_file = self::convertPath($dir . '/' . $v);
|
||||||
if (is_dir($sub_file)) {
|
if (is_link($sub_file) || is_file($sub_file)) {
|
||||||
# 如果是 目录 且 递推 , 则递推添加下级文件
|
if (!unlink($sub_file)) {
|
||||||
if (!self::removeDir($sub_file)) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} elseif (is_link($sub_file) || is_file($sub_file)) {
|
} elseif (is_dir($sub_file)) {
|
||||||
if (!unlink($sub_file)) {
|
# 如果是 目录 且 递推 , 则递推添加下级文件
|
||||||
|
if (!self::removeDir($sub_file)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,15 +23,15 @@ $test_php_version = [
|
|||||||
|
|
||||||
// test os (macos-15-intel, macos-15, ubuntu-latest, windows-latest are available)
|
// test os (macos-15-intel, macos-15, ubuntu-latest, windows-latest are available)
|
||||||
$test_os = [
|
$test_os = [
|
||||||
// 'macos-15-intel', // bin/spc for x86_64
|
'macos-15-intel', // bin/spc for x86_64
|
||||||
// 'macos-15', // bin/spc for arm64
|
'macos-15', // bin/spc for arm64
|
||||||
// 'ubuntu-latest', // bin/spc-alpine-docker for x86_64
|
'ubuntu-latest', // bin/spc-alpine-docker for x86_64
|
||||||
// 'ubuntu-22.04', // bin/spc-gnu-docker for x86_64
|
'ubuntu-22.04', // bin/spc-gnu-docker for x86_64
|
||||||
// 'ubuntu-24.04', // bin/spc 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
|
// 'ubuntu-24.04-arm', // bin/spc for arm64
|
||||||
// 'windows-2022', // .\bin\spc.ps1
|
// 'windows-2022', // .\bin\spc.ps1
|
||||||
'windows-2025',
|
// 'windows-2025',
|
||||||
];
|
];
|
||||||
|
|
||||||
// whether enable thread safe
|
// whether enable thread safe
|
||||||
@@ -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`).
|
// 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' => 'curl',
|
'Linux', 'Darwin' => 'swoole,imagick',
|
||||||
'Windows' => 'bcmath',
|
'Windows' => 'bcmath',
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -67,7 +67,7 @@ $with_suggested_libs = false;
|
|||||||
// If you want to test extra libs for extensions, add them below (comma separated, example `libwebp,libavif`). Unnecessary, when $with_suggested_libs is 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) {
|
$with_libs = match (PHP_OS_FAMILY) {
|
||||||
'Linux', 'Darwin' => 'libwebp',
|
'Linux', 'Darwin' => 'libwebp',
|
||||||
'Windows' => 'nghttp2',
|
'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