mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-02 14:25:41 +08:00
SPC_DEFAULT_C_FLAGS renamed to SPC_DEFAULT_CFLAGS
This commit is contained in:
@@ -102,8 +102,8 @@ CXX=${SPC_DEFAULT_CXX}
|
||||
AR=${SPC_DEFAULT_AR}
|
||||
LD=${SPC_DEFAULT_LD}
|
||||
; default compiler flags, used in CMake toolchain file, openssl and pkg-config build
|
||||
SPC_DEFAULT_C_FLAGS="-fPIC -O3 -pipe -fno-plt -fno-semantic-interposition -fstack-clash-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -ffunction-sections -fdata-sections"
|
||||
SPC_DEFAULT_CXX_FLAGS="${SPC_DEFAULT_C_FLAGS}"
|
||||
SPC_DEFAULT_CFLAGS="-fPIC -O3 -pipe -fno-plt -fno-semantic-interposition -fstack-clash-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -ffunction-sections -fdata-sections"
|
||||
SPC_DEFAULT_CXX_FLAGS="${SPC_DEFAULT_CFLAGS}"
|
||||
SPC_DEFAULT_LD_FLAGS="-Wl,-z,relro -Wl,--as-needed -Wl,-z,now -Wl,-z,noexecstack -Wl,--gc-sections"
|
||||
; upx executable path
|
||||
UPX_EXEC=${PKG_ROOT_PATH}/bin/upx
|
||||
@@ -120,7 +120,7 @@ SPC_CMD_PREFIX_PHP_CONFIGURE="./configure --prefix= --with-valgrind=no --disable
|
||||
; embed type for php, static (libphp.a) or shared (libphp.so)
|
||||
SPC_CMD_VAR_PHP_EMBED_TYPE="static"
|
||||
; EXTRA_CFLAGS for `configure` and `make` php
|
||||
SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS="-g -fstack-protector-strong -fno-ident -fPIE -fvisibility=hidden -fvisibility-inlines-hidden ${SPC_DEFAULT_C_FLAGS}"
|
||||
SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS="-g -fstack-protector-strong -fno-ident -fPIE -fvisibility=hidden -fvisibility-inlines-hidden ${SPC_DEFAULT_CFLAGS}"
|
||||
; EXTRA_CXXFLAGS for `configure` and `make` php
|
||||
SPC_CMD_VAR_PHP_MAKE_EXTRA_CXXFLAGS="-g -fstack-protector-strong -fno-ident -fPIE -fvisibility=hidden -fvisibility-inlines-hidden ${SPC_DEFAULT_CXX_FLAGS}"
|
||||
; EXTRA_LDFLAGS for `make` php, can use -release to set a soname for libphp.so
|
||||
@@ -142,8 +142,8 @@ CXX=${SPC_DEFAULT_CXX}
|
||||
AR=${SPC_DEFAULT_AR}
|
||||
LD=${SPC_DEFAULT_LD}
|
||||
; default compiler flags, used in CMake toolchain file, openssl and pkg-config build
|
||||
SPC_DEFAULT_C_FLAGS="--target=${MAC_ARCH}-apple-darwin -O3 -fno-plt -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -ffunction-sections -fdata-sections"
|
||||
SPC_DEFAULT_CXX_FLAGS="${SPC_DEFAULT_C_FLAGS}"
|
||||
SPC_DEFAULT_CFLAGS="--target=${MAC_ARCH}-apple-darwin -O3 -fno-plt -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -ffunction-sections -fdata-sections"
|
||||
SPC_DEFAULT_CXX_FLAGS="${SPC_DEFAULT_CFLAGS}"
|
||||
SPC_DEFAULT_LD_FLAGS="-Wl,-dead_strip"
|
||||
; phpmicro patches, for more info, see: https://github.com/easysoft/phpmicro/tree/master/patches
|
||||
SPC_MICRO_PATCHES=cli_checks,macos_iconv
|
||||
@@ -158,7 +158,7 @@ SPC_CMD_PREFIX_PHP_CONFIGURE="./configure --prefix= --with-valgrind=no --disable
|
||||
; embed type for php, static (libphp.a) or shared (libphp.dylib)
|
||||
SPC_CMD_VAR_PHP_EMBED_TYPE="static"
|
||||
; EXTRA_CFLAGS for `configure` and `make` php
|
||||
SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS="-g -fstack-protector-strong -fpic -fpie -fvisibility=hidden -fvisibility-inlines-hidden -Werror=unknown-warning-option ${SPC_DEFAULT_C_FLAGS}"
|
||||
SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS="-g -fstack-protector-strong -fpic -fpie -fvisibility=hidden -fvisibility-inlines-hidden -Werror=unknown-warning-option ${SPC_DEFAULT_CFLAGS}"
|
||||
; EXTRA_CXXFLAGS for `configure` and `make` php
|
||||
SPC_CMD_VAR_PHP_MAKE_EXTRA_CXXFLAGS="-g -fstack-protector-strong -fno-ident -fpie -fvisibility=hidden -fvisibility-inlines-hidden -Werror=unknown-warning-option ${SPC_DEFAULT_CXX_FLAGS}"
|
||||
; EXTRA_LDFLAGS for `make` php, can use -release to set a soname for libphp.dylib
|
||||
|
||||
@@ -51,6 +51,6 @@ without modifying the default `config/env.ini` file.
|
||||
SPC_CONCURRENCY=4
|
||||
|
||||
[linux]
|
||||
SPC_DEFAULT_C_FLAGS="-O3"
|
||||
SPC_DEFAULT_CFLAGS="-O3"
|
||||
```
|
||||
|
||||
|
||||
@@ -46,6 +46,6 @@ SPC_CONCURRENCY=4 spc build:php "mbstring,pcntl" --build-cli
|
||||
SPC_CONCURRENCY=4
|
||||
|
||||
[linux]
|
||||
SPC_DEFAULT_C_FLAGS="-O3"
|
||||
SPC_DEFAULT_CFLAGS="-O3"
|
||||
```
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ class libjxl extends LibraryPackage
|
||||
);
|
||||
|
||||
if ($toolchain instanceof ZigToolchain) {
|
||||
$cflags = getenv('SPC_DEFAULT_C_FLAGS') ?: getenv('CFLAGS') ?: '';
|
||||
$cflags = getenv('SPC_DEFAULT_CFLAGS') ?: getenv('CFLAGS') ?: '';
|
||||
$has_avx512 = str_contains($cflags, '-mavx512') || str_contains($cflags, '-march=x86-64-v4');
|
||||
if (!$has_avx512) {
|
||||
$cmake->addConfigureArgs(
|
||||
|
||||
@@ -81,7 +81,7 @@ trait frankenphp
|
||||
$libs = $config['libs'];
|
||||
|
||||
// Go's gcc driver doesn't automatically link against -lgcov or -lrt. Ugly, but necessary fix.
|
||||
if ((str_contains((string) getenv('SPC_DEFAULT_C_FLAGS'), '-fprofile') ||
|
||||
if ((str_contains((string) getenv('SPC_DEFAULT_CFLAGS'), '-fprofile') ||
|
||||
str_contains((string) getenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS'), '-fprofile')) &&
|
||||
$toolchain instanceof GccNativeToolchain) {
|
||||
$cflags .= ' -Wno-error=missing-profile';
|
||||
|
||||
@@ -124,8 +124,8 @@ class LibraryPackage extends Package
|
||||
// get environment variable
|
||||
$env = getenv($this->getSnakeCaseName() . '_CFLAGS') ?: '';
|
||||
// get default c flags
|
||||
$arch_c_flags = getenv('SPC_DEFAULT_C_FLAGS') ?: '';
|
||||
if (!empty(getenv('SPC_DEFAULT_C_FLAGS')) && !str_contains($env, $arch_c_flags)) {
|
||||
$arch_c_flags = getenv('SPC_DEFAULT_CFLAGS') ?: '';
|
||||
if (!empty(getenv('SPC_DEFAULT_CFLAGS')) && !str_contains($env, $arch_c_flags)) {
|
||||
$env .= ' ' . $arch_c_flags;
|
||||
}
|
||||
return trim($env);
|
||||
|
||||
@@ -267,7 +267,7 @@ class UnixCMakeExecutor extends Executor
|
||||
}
|
||||
$os = PHP_OS_FAMILY;
|
||||
$target_arch = arch2gnu(php_uname('m'));
|
||||
$cflags = getenv('SPC_DEFAULT_C_FLAGS');
|
||||
$cflags = getenv('SPC_DEFAULT_CFLAGS');
|
||||
$cc = getenv('CC');
|
||||
$cxx = getenv('CXX');
|
||||
$include = BUILD_INCLUDE_PATH;
|
||||
|
||||
@@ -44,13 +44,13 @@ class ZigToolchain implements UnixToolchainInterface
|
||||
{
|
||||
GlobalEnvManager::addPathIfNotExists($this->getPath());
|
||||
f_passthru('ulimit -n 2048'); // zig opens extra file descriptors, so when a lot of extensions are built statically, 1024 is not enough
|
||||
$cflags = getenv('SPC_DEFAULT_C_FLAGS') ?: '';
|
||||
$cflags = getenv('SPC_DEFAULT_CFLAGS') ?: '';
|
||||
$cxxflags = getenv('SPC_DEFAULT_CXX_FLAGS') ?: '';
|
||||
$extraCflags = getenv('SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS') ?: '';
|
||||
$cflags = trim($cflags . ' -Wno-date-time');
|
||||
$cxxflags = trim($cxxflags . ' -Wno-date-time');
|
||||
$extraCflags = trim($extraCflags . ' -Wno-date-time');
|
||||
GlobalEnvManager::putenv("SPC_DEFAULT_C_FLAGS={$cflags}");
|
||||
GlobalEnvManager::putenv("SPC_DEFAULT_CFLAGS={$cflags}");
|
||||
GlobalEnvManager::putenv("SPC_DEFAULT_CXX_FLAGS={$cxxflags}");
|
||||
GlobalEnvManager::putenv("SPC_CMD_VAR_PHP_MAKE_EXTRA_CFLAGS={$extraCflags}");
|
||||
GlobalEnvManager::putenv('RANLIB=zig-ranlib');
|
||||
@@ -61,7 +61,7 @@ class ZigToolchain implements UnixToolchainInterface
|
||||
$extra_libs = trim($extra_libs . ' -lunwind');
|
||||
GlobalEnvManager::putenv("SPC_EXTRA_LIBS={$extra_libs}");
|
||||
}
|
||||
$cflags = getenv('SPC_DEFAULT_C_FLAGS') ?: getenv('CFLAGS') ?: '';
|
||||
$cflags = getenv('SPC_DEFAULT_CFLAGS') ?: getenv('CFLAGS') ?: '';
|
||||
$has_avx512 = str_contains($cflags, '-mavx512') || str_contains($cflags, '-march=x86-64-v4');
|
||||
if (!$has_avx512) {
|
||||
$extra_vars = getenv('SPC_EXTRA_PHP_VARS') ?: '';
|
||||
|
||||
Reference in New Issue
Block a user