remove lto related stuff again, not worth using

This commit is contained in:
DubbleClick 2025-07-28 19:43:01 +07:00
parent 3087dc86f8
commit 342192fd67
7 changed files with 20 additions and 32 deletions

View File

@ -90,6 +90,7 @@ LD=${SPC_LINUX_DEFAULT_LD}
; default compiler flags, used in CMake toolchain file, openssl and pkg-config build
SPC_DEFAULT_C_FLAGS="-fPIC -Os"
SPC_DEFAULT_CXX_FLAGS="-fPIC -Os"
SPC_DEFAULT_LD_FLAGS=""
; upx executable path
UPX_EXEC=${PKG_ROOT_PATH}/bin/upx
; phpmicro patches, for more info, see: https://github.com/easysoft/phpmicro/tree/master/patches

View File

@ -35,6 +35,7 @@ class LinuxBuilder extends UnixBuilderBase
// cflags
$this->arch_c_flags = getenv('SPC_DEFAULT_C_FLAGS');
$this->arch_cxx_flags = getenv('SPC_DEFAULT_CXX_FLAGS');
$this->arch_ld_flags = getenv('SPC_DEFAULT_LD_FLAGS');
// create pkgconfig and include dir (some libs cannot create them automatically)
f_mkdir(BUILD_LIB_PATH . '/pkgconfig', recursive: true);

View File

@ -38,6 +38,7 @@ class MacOSBuilder extends UnixBuilderBase
// cflags
$this->arch_c_flags = getenv('SPC_DEFAULT_C_FLAGS');
$this->arch_cxx_flags = getenv('SPC_DEFAULT_CXX_FLAGS');
$this->arch_ld_flags = getenv('SPC_DEFAULT_LD_FLAGS');
// create pkgconfig and include dir (some libs cannot create them automatically)
f_mkdir(BUILD_LIB_PATH . '/pkgconfig', recursive: true);

View File

@ -97,16 +97,6 @@ trait UnixLibraryTrait
return trim($env);
}
public function getLibExtraLdFlags(): string
{
return getenv($this->getSnakeCaseName() . '_LDFLAGS') ?: '';
}
public function getLibExtraLibs(): string
{
return getenv($this->getSnakeCaseName() . '_LIBS') ?: '';
}
public function getLibExtraCXXFlags(): string
{
$env = getenv($this->getSnakeCaseName() . '_CXXFLAGS') ?: '';
@ -115,4 +105,18 @@ trait UnixLibraryTrait
}
return trim($env);
}
public function getLibExtraLdFlags(): string
{
$env = getenv($this->getSnakeCaseName() . '_LDFLAGS') ?: '';
if (!str_contains($env, $this->builder->arch_ld_flags)) {
$env .= ' ' . $this->builder->arch_ld_flags;
}
return trim($env);
}
public function getLibExtraLibs(): string
{
return getenv($this->getSnakeCaseName() . '_LIBS') ?: '';
}
}

View File

@ -26,6 +26,9 @@ abstract class UnixBuilderBase extends BuilderBase
/** @var string C++ flags */
public string $arch_cxx_flags;
/** @var string LD flags */
public string $arch_ld_flags;
public function proveLibs(array $sorted_libraries): void
{
// search all supported libs

View File

@ -17,14 +17,6 @@ trait librdkafka
*/
protected function build(): void
{
$cflags = $this->builder->arch_c_flags;
$cxxflags = $this->builder->arch_cxx_flags;
$patched_cflags = preg_replace('/\s*-flto(=\S*)?\s*/', ' ', $cflags);
$patched_cxxflags = preg_replace('/\s*-flto(=\S*)?\s*/', ' ', $cxxflags);
$this->builder->arch_c_flags = $patched_cflags;
$this->builder->arch_cxx_flags = $patched_cxxflags;
FileSystem::replaceFileStr(
$this->source_dir . '/lds-gen.py',
"funcs.append('rd_ut_coverage_check')",
@ -64,8 +56,5 @@ trait librdkafka
->exec("rm -rf {$this->getLibDir()}/*.so.*")
->exec("rm -rf {$this->getLibDir()}/*.so")
->exec("rm -rf {$this->getLibDir()}/*.dylib");
$this->builder->arch_c_flags = $cflags;
$this->builder->arch_cxx_flags = $cxxflags;
}
}

View File

@ -16,14 +16,6 @@ trait unixodbc
*/
protected function build(): void
{
$cflags = $this->builder->arch_c_flags;
$cxxflags = $this->builder->arch_cxx_flags;
$patched_cflags = preg_replace('/\s*-flto(=\S*)?\s*/', ' ', $cflags);
$patched_cxxflags = preg_replace('/\s*-flto(=\S*)?\s*/', ' ', $cxxflags);
$this->builder->arch_c_flags = $patched_cflags;
$this->builder->arch_cxx_flags = $patched_cxxflags;
UnixAutoconfExecutor::create($this)
->configure(
'--disable-debug',
@ -35,8 +27,5 @@ trait unixodbc
->make();
$this->patchPkgconfPrefix(['odbc.pc', 'odbccr.pc', 'odbcinst.pc']);
$this->patchLaDependencyPrefix();
$this->builder->arch_c_flags = $cflags;
$this->builder->arch_cxx_flags = $cxxflags;
}
}