mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-05 07:45:39 +08:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cd2dc5bce4 | ||
|
|
8650ce4f8f | ||
|
|
9fdfef5057 | ||
|
|
18c5ccfe9d | ||
|
|
d064e1353c |
@@ -142,6 +142,8 @@ 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
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ use Symfony\Component\Console\Application;
|
|||||||
*/
|
*/
|
||||||
final class ConsoleApplication extends Application
|
final class ConsoleApplication extends Application
|
||||||
{
|
{
|
||||||
public const string VERSION = '2.7.10';
|
public const string VERSION = '2.7.11';
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -43,4 +43,9 @@ EOF
|
|||||||
);
|
);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function getExtraEnv(): array
|
||||||
|
{
|
||||||
|
return ['CFLAGS' => '-std=c17'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,12 +5,16 @@ declare(strict_types=1);
|
|||||||
namespace SPC\builder\unix\library;
|
namespace SPC\builder\unix\library;
|
||||||
|
|
||||||
use SPC\util\executor\UnixCMakeExecutor;
|
use SPC\util\executor\UnixCMakeExecutor;
|
||||||
use SPC\util\SPCTarget;
|
|
||||||
|
|
||||||
trait libwebp
|
trait libwebp
|
||||||
{
|
{
|
||||||
protected function build(): void
|
protected function build(): void
|
||||||
{
|
{
|
||||||
|
$code = 'int main() { return _mm256_cvtsi256_si32(_mm256_setzero_si256()); }';
|
||||||
|
$cc = getenv('CC') ?: 'gcc';
|
||||||
|
[$ret] = shell()->execWithResult("echo '{$code}' | {$cc} -x c -mavx2 -o /dev/null - 2>&1");
|
||||||
|
$disableAvx2 = $ret !== 0 && GNU_ARCH === 'x86_64' && PHP_OS_FAMILY === 'Linux';
|
||||||
|
|
||||||
UnixCMakeExecutor::create($this)
|
UnixCMakeExecutor::create($this)
|
||||||
->addConfigureArgs(
|
->addConfigureArgs(
|
||||||
'-DWEBP_BUILD_EXTRAS=OFF',
|
'-DWEBP_BUILD_EXTRAS=OFF',
|
||||||
@@ -23,7 +27,7 @@ trait libwebp
|
|||||||
'-DWEBP_BUILD_WEBPINFO=OFF',
|
'-DWEBP_BUILD_WEBPINFO=OFF',
|
||||||
'-DWEBP_BUILD_WEBPMUX=OFF',
|
'-DWEBP_BUILD_WEBPMUX=OFF',
|
||||||
'-DWEBP_BUILD_FUZZTEST=OFF',
|
'-DWEBP_BUILD_FUZZTEST=OFF',
|
||||||
SPCTarget::getLibcVersion() === '2.31' && GNU_ARCH === 'x86_64' ? '-DWEBP_ENABLE_SIMD=OFF' : '' // fix an edge bug for debian 11 with gcc 10
|
$disableAvx2 ? '-DWEBP_ENABLE_SIMD=OFF' : ''
|
||||||
)
|
)
|
||||||
->build();
|
->build();
|
||||||
// patch pkgconfig
|
// patch pkgconfig
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ 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
|
||||||
@@ -42,9 +41,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(
|
||||||
@@ -53,5 +52,7 @@ 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,11 +29,16 @@ 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');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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.4 available, multiple for matrix)
|
||||||
$test_php_version = [
|
$test_php_version = [
|
||||||
// '8.1',
|
'8.1',
|
||||||
// '8.2',
|
// '8.2',
|
||||||
// '8.3',
|
// '8.3',
|
||||||
'8.4',
|
'8.4',
|
||||||
@@ -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' => 'bcmath,xsl,xml',
|
'Linux', 'Darwin' => 'curl',
|
||||||
'Windows' => 'bcmath',
|
'Windows' => 'bcmath',
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -66,8 +66,8 @@ $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' => '',
|
'Linux', 'Darwin' => 'libwebp',
|
||||||
'Windows' => '',
|
'Windows' => 'nghttp2',
|
||||||
};
|
};
|
||||||
|
|
||||||
// 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