mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-20 15:25:36 +08:00
Apply openssl patch changes in feat/pgo-v3
This commit is contained in:
@@ -11,6 +11,7 @@ use StaticPHP\Package\LibraryPackage;
|
|||||||
use StaticPHP\Package\PackageBuilder;
|
use StaticPHP\Package\PackageBuilder;
|
||||||
use StaticPHP\Package\ToolPackage;
|
use StaticPHP\Package\ToolPackage;
|
||||||
use StaticPHP\Registry\PackageLoader;
|
use StaticPHP\Registry\PackageLoader;
|
||||||
|
use StaticPHP\Runtime\SystemTarget;
|
||||||
use StaticPHP\Util\FileSystem;
|
use StaticPHP\Util\FileSystem;
|
||||||
use StaticPHP\Util\System\LinuxUtil;
|
use StaticPHP\Util\System\LinuxUtil;
|
||||||
|
|
||||||
@@ -57,7 +58,7 @@ class openssl
|
|||||||
public function buildForDarwin(LibraryPackage $pkg): void
|
public function buildForDarwin(LibraryPackage $pkg): void
|
||||||
{
|
{
|
||||||
$zlib_libs = $pkg->getInstaller()->getLibraryPackage('zlib')->getStaticLibFiles();
|
$zlib_libs = $pkg->getInstaller()->getLibraryPackage('zlib')->getStaticLibFiles();
|
||||||
$arch = getenv('SPC_ARCH');
|
$arch = SystemTarget::getTargetArch();
|
||||||
|
|
||||||
shell()->cd($pkg->getSourceDir())->initializeEnv($pkg)
|
shell()->cd($pkg->getSourceDir())->initializeEnv($pkg)
|
||||||
->exec(
|
->exec(
|
||||||
@@ -76,12 +77,7 @@ class openssl
|
|||||||
#[BuildFor('Linux')]
|
#[BuildFor('Linux')]
|
||||||
public function build(LibraryPackage $lib): void
|
public function build(LibraryPackage $lib): void
|
||||||
{
|
{
|
||||||
$arch = getenv('SPC_ARCH');
|
$arch = SystemTarget::getTargetArch();
|
||||||
|
|
||||||
$env = "CC='" . getenv('CC') . ' -idirafter ' . BUILD_INCLUDE_PATH .
|
|
||||||
' -idirafter /usr/include/ ' .
|
|
||||||
' -idirafter /usr/include/' . getenv('SPC_ARCH') . '-linux-gnu/ ' .
|
|
||||||
"' ";
|
|
||||||
|
|
||||||
$ex_lib = trim($lib->getInstaller()->getLibraryPackage('zlib')->getStaticLibFiles()) . ' -ldl -pthread';
|
$ex_lib = trim($lib->getInstaller()->getLibraryPackage('zlib')->getStaticLibFiles()) . ' -ldl -pthread';
|
||||||
$zlib_extra =
|
$zlib_extra =
|
||||||
@@ -92,9 +88,15 @@ class openssl
|
|||||||
$openssl_dir ??= LinuxUtil::getOSRelease()['dist'] === 'redhat' ? '/etc/pki/tls' : '/etc/ssl';
|
$openssl_dir ??= LinuxUtil::getOSRelease()['dist'] === 'redhat' ? '/etc/pki/tls' : '/etc/ssl';
|
||||||
$ex_lib = trim($ex_lib);
|
$ex_lib = trim($ex_lib);
|
||||||
|
|
||||||
|
// anything we want included (PGO -fprofile-*, LTO, custom hardening)
|
||||||
|
// has to be appended on the command line *after* the target name.
|
||||||
|
$userCFlags = trim((string) getenv('SPC_DEFAULT_CFLAGS'));
|
||||||
|
$userLdFlags = trim((string) getenv('SPC_DEFAULT_LDFLAGS'));
|
||||||
|
$userExtra = trim($userCFlags . ' ' . $userLdFlags);
|
||||||
|
|
||||||
shell()->cd($lib->getSourceDir())->initializeEnv($lib)
|
shell()->cd($lib->getSourceDir())->initializeEnv($lib)
|
||||||
->exec(
|
->exec(
|
||||||
"{$env} ./Configure no-shared zlib " .
|
'./Configure no-shared zlib ' .
|
||||||
"--prefix={$lib->getBuildRootPath()} " .
|
"--prefix={$lib->getBuildRootPath()} " .
|
||||||
"--libdir={$lib->getLibDir()} " .
|
"--libdir={$lib->getLibDir()} " .
|
||||||
"--openssldir={$openssl_dir} " .
|
"--openssldir={$openssl_dir} " .
|
||||||
@@ -102,7 +104,8 @@ class openssl
|
|||||||
'enable-pie ' .
|
'enable-pie ' .
|
||||||
'no-legacy ' .
|
'no-legacy ' .
|
||||||
'no-tests ' .
|
'no-tests ' .
|
||||||
"linux-{$arch}"
|
"linux-{$arch} " .
|
||||||
|
$userExtra
|
||||||
)
|
)
|
||||||
->exec('make clean')
|
->exec('make clean')
|
||||||
->exec("make -j{$lib->getBuilder()->concurrency} CNF_EX_LIBS=\"{$ex_lib}\"")
|
->exec("make -j{$lib->getBuilder()->concurrency} CNF_EX_LIBS=\"{$ex_lib}\"")
|
||||||
|
|||||||
Reference in New Issue
Block a user