mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-17 20:34:51 +08:00
set custom binary name for frankenphp, allow linking against system openssl (fix mssql issues) (#1056)
This commit is contained in:
commit
9634b8bcda
@ -862,6 +862,9 @@
|
|||||||
},
|
},
|
||||||
"openssl": {
|
"openssl": {
|
||||||
"source": "openssl",
|
"source": "openssl",
|
||||||
|
"pkg-configs": [
|
||||||
|
"openssl"
|
||||||
|
],
|
||||||
"static-libs-unix": [
|
"static-libs-unix": [
|
||||||
"libssl.a",
|
"libssl.a",
|
||||||
"libcrypto.a"
|
"libcrypto.a"
|
||||||
@ -974,6 +977,11 @@
|
|||||||
},
|
},
|
||||||
"unixodbc": {
|
"unixodbc": {
|
||||||
"source": "unixodbc",
|
"source": "unixodbc",
|
||||||
|
"pkg-configs": [
|
||||||
|
"odbc",
|
||||||
|
"odbccr",
|
||||||
|
"odbcinst"
|
||||||
|
],
|
||||||
"static-libs-unix": [
|
"static-libs-unix": [
|
||||||
"libodbc.a",
|
"libodbc.a",
|
||||||
"libodbccr.a",
|
"libodbccr.a",
|
||||||
@ -1015,6 +1023,9 @@
|
|||||||
},
|
},
|
||||||
"zlib": {
|
"zlib": {
|
||||||
"source": "zlib",
|
"source": "zlib",
|
||||||
|
"pkg-configs": [
|
||||||
|
"zlib"
|
||||||
|
],
|
||||||
"static-libs-unix": [
|
"static-libs-unix": [
|
||||||
"libz.a"
|
"libz.a"
|
||||||
],
|
],
|
||||||
@ -1028,6 +1039,9 @@
|
|||||||
},
|
},
|
||||||
"zstd": {
|
"zstd": {
|
||||||
"source": "zstd",
|
"source": "zstd",
|
||||||
|
"pkg-configs": [
|
||||||
|
"libzstd"
|
||||||
|
],
|
||||||
"static-libs-unix": [
|
"static-libs-unix": [
|
||||||
"libzstd.a"
|
"libzstd.a"
|
||||||
],
|
],
|
||||||
|
|||||||
@ -96,7 +96,8 @@ class Extension
|
|||||||
fn ($x) => $x->getStaticLibFiles(),
|
fn ($x) => $x->getStaticLibFiles(),
|
||||||
$this->getLibraryDependencies(recursive: true)
|
$this->getLibraryDependencies(recursive: true)
|
||||||
);
|
);
|
||||||
return implode(' ', $ret);
|
$libs = implode(' ', $ret);
|
||||||
|
return deduplicate_flags($libs);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -365,6 +365,27 @@ abstract class LibraryBase
|
|||||||
|
|
||||||
protected function isLibraryInstalled(): bool
|
protected function isLibraryInstalled(): bool
|
||||||
{
|
{
|
||||||
|
if ($pkg_configs = Config::getLib(static::NAME, 'pkg-configs', [])) {
|
||||||
|
$pkg_config_path = getenv('PKG_CONFIG_PATH') ?: '';
|
||||||
|
$search_paths = array_unique(array_filter(explode(is_unix() ? ':' : ';', $pkg_config_path)));
|
||||||
|
|
||||||
|
foreach ($pkg_configs as $name) {
|
||||||
|
$found = false;
|
||||||
|
foreach ($search_paths as $path) {
|
||||||
|
if (file_exists($path . "/{$name}.pc")) {
|
||||||
|
$found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!$found) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// allow using system dependencies if pkg_config_path is explicitly defined
|
||||||
|
if (count($search_paths) > 1) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
foreach (Config::getLib(static::NAME, 'static-libs', []) as $name) {
|
foreach (Config::getLib(static::NAME, 'static-libs', []) as $name) {
|
||||||
if (!file_exists(BUILD_LIB_PATH . "/{$name}")) {
|
if (!file_exists(BUILD_LIB_PATH . "/{$name}")) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@ -72,6 +72,10 @@ trait UnixSystemUtilTrait
|
|||||||
if (!is_file($symbol_file)) {
|
if (!is_file($symbol_file)) {
|
||||||
throw new SPCInternalException("The symbol file {$symbol_file} does not exist, please check if nm command is available.");
|
throw new SPCInternalException("The symbol file {$symbol_file} does not exist, please check if nm command is available.");
|
||||||
}
|
}
|
||||||
|
// https://github.com/ziglang/zig/issues/24662
|
||||||
|
if (ToolchainManager::getToolchainClass() === ZigToolchain::class) {
|
||||||
|
return '-Wl,--export-dynamic'; // needs release 0.16, can be removed then
|
||||||
|
}
|
||||||
// macOS/zig
|
// macOS/zig
|
||||||
if (SPCTarget::getTargetOS() !== 'Linux' || ToolchainManager::getToolchainClass() === ZigToolchain::class) {
|
if (SPCTarget::getTargetOS() !== 'Linux' || ToolchainManager::getToolchainClass() === ZigToolchain::class) {
|
||||||
return "-Wl,-exported_symbols_list,{$symbol_file}";
|
return "-Wl,-exported_symbols_list,{$symbol_file}";
|
||||||
|
|||||||
@ -458,6 +458,7 @@ abstract class UnixBuilderBase extends BuilderBase
|
|||||||
'-ldflags \"-linkmode=external ' . $extLdFlags . ' ' .
|
'-ldflags \"-linkmode=external ' . $extLdFlags . ' ' .
|
||||||
'-X \'github.com/caddyserver/caddy/v2/modules/caddyhttp.ServerHeader=FrankenPHP Caddy\' ' .
|
'-X \'github.com/caddyserver/caddy/v2/modules/caddyhttp.ServerHeader=FrankenPHP Caddy\' ' .
|
||||||
'-X \'github.com/caddyserver/caddy/v2.CustomVersion=FrankenPHP ' .
|
'-X \'github.com/caddyserver/caddy/v2.CustomVersion=FrankenPHP ' .
|
||||||
|
'-X \'github.com/caddyserver/caddy/v2.CustomBinaryName=frankenphp ' .
|
||||||
"v{$frankenPhpVersion} PHP {$libphpVersion} Caddy'\\\" " .
|
"v{$frankenPhpVersion} PHP {$libphpVersion} Caddy'\\\" " .
|
||||||
"-tags={$muslTags}nobadger,nomysql,nopgx{$nobrotli}{$nowatcher}",
|
"-tags={$muslTags}nobadger,nomysql,nopgx{$nobrotli}{$nowatcher}",
|
||||||
'LD_LIBRARY_PATH' => BUILD_LIB_PATH,
|
'LD_LIBRARY_PATH' => BUILD_LIB_PATH,
|
||||||
|
|||||||
@ -93,8 +93,7 @@ trait postgresql
|
|||||||
|
|
||||||
// remove dynamic libs
|
// remove dynamic libs
|
||||||
shell()->cd($this->source_dir . '/build')
|
shell()->cd($this->source_dir . '/build')
|
||||||
->exec("rm -rf {$this->getBuildRootPath()}/lib/*.so.*")
|
->exec("rm -rf {$this->getBuildRootPath()}/lib/*.so*")
|
||||||
->exec("rm -rf {$this->getBuildRootPath()}/lib/*.so")
|
|
||||||
->exec("rm -rf {$this->getBuildRootPath()}/lib/*.dylib");
|
->exec("rm -rf {$this->getBuildRootPath()}/lib/*.dylib");
|
||||||
|
|
||||||
FileSystem::replaceFileStr("{$this->getLibDir()}/pkgconfig/libpq.pc", '-lldap', '-lldap -llber');
|
FileSystem::replaceFileStr("{$this->getLibDir()}/pkgconfig/libpq.pc", '-lldap', '-lldap -llber');
|
||||||
|
|||||||
@ -16,12 +16,11 @@ class UnixAutoconfExecutor extends Executor
|
|||||||
|
|
||||||
protected array $configure_args = [];
|
protected array $configure_args = [];
|
||||||
|
|
||||||
protected array $ignore_args = [];
|
|
||||||
|
|
||||||
public function __construct(protected BSDLibraryBase|LinuxLibraryBase|MacOSLibraryBase $library)
|
public function __construct(protected BSDLibraryBase|LinuxLibraryBase|MacOSLibraryBase $library)
|
||||||
{
|
{
|
||||||
parent::__construct($library);
|
parent::__construct($library);
|
||||||
$this->initShell();
|
$this->initShell();
|
||||||
|
$this->configure_args = $this->getDefaultConfigureArgs();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -29,19 +28,12 @@ class UnixAutoconfExecutor extends Executor
|
|||||||
*/
|
*/
|
||||||
public function configure(...$args): static
|
public function configure(...$args): static
|
||||||
{
|
{
|
||||||
// remove all the ignored args
|
$args = array_merge($args, $this->configure_args);
|
||||||
$args = array_merge($args, $this->getDefaultConfigureArgs(), $this->configure_args);
|
|
||||||
$args = array_diff($args, $this->ignore_args);
|
|
||||||
$configure_args = implode(' ', $args);
|
$configure_args = implode(' ', $args);
|
||||||
|
|
||||||
return $this->seekLogFileOnException(fn () => $this->shell->exec("./configure {$configure_args}"));
|
return $this->seekLogFileOnException(fn () => $this->shell->exec("./configure {$configure_args}"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getConfigureArgsString(): string
|
|
||||||
{
|
|
||||||
return implode(' ', array_merge($this->getDefaultConfigureArgs(), $this->configure_args));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Run make
|
* Run make
|
||||||
*
|
*
|
||||||
@ -111,7 +103,7 @@ class UnixAutoconfExecutor extends Executor
|
|||||||
*/
|
*/
|
||||||
public function removeConfigureArgs(...$args): static
|
public function removeConfigureArgs(...$args): static
|
||||||
{
|
{
|
||||||
$this->ignore_args = [...$this->ignore_args, ...$args];
|
$this->configure_args = array_diff($this->configure_args, $args);
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,8 +125,8 @@ class UnixAutoconfExecutor extends Executor
|
|||||||
private function getDefaultConfigureArgs(): array
|
private function getDefaultConfigureArgs(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'--disable-shared',
|
|
||||||
'--enable-static',
|
'--enable-static',
|
||||||
|
'--disable-shared',
|
||||||
"--prefix={$this->library->getBuildRootPath()}",
|
"--prefix={$this->library->getBuildRootPath()}",
|
||||||
'--with-pic',
|
'--with-pic',
|
||||||
'--enable-pic',
|
'--enable-pic',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user