mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-17 12:24:53 +08:00
Merge branch 'main' into fix/grpc-build
This commit is contained in:
commit
2350d2d5ca
@ -862,6 +862,9 @@
|
||||
},
|
||||
"openssl": {
|
||||
"source": "openssl",
|
||||
"pkg-configs": [
|
||||
"openssl"
|
||||
],
|
||||
"static-libs-unix": [
|
||||
"libssl.a",
|
||||
"libcrypto.a"
|
||||
@ -974,6 +977,11 @@
|
||||
},
|
||||
"unixodbc": {
|
||||
"source": "unixodbc",
|
||||
"pkg-configs": [
|
||||
"odbc",
|
||||
"odbccr",
|
||||
"odbcinst"
|
||||
],
|
||||
"static-libs-unix": [
|
||||
"libodbc.a",
|
||||
"libodbccr.a",
|
||||
@ -1015,6 +1023,9 @@
|
||||
},
|
||||
"zlib": {
|
||||
"source": "zlib",
|
||||
"pkg-configs": [
|
||||
"zlib"
|
||||
],
|
||||
"static-libs-unix": [
|
||||
"libz.a"
|
||||
],
|
||||
@ -1028,6 +1039,9 @@
|
||||
},
|
||||
"zstd": {
|
||||
"source": "zstd",
|
||||
"pkg-configs": [
|
||||
"libzstd"
|
||||
],
|
||||
"static-libs-unix": [
|
||||
"libzstd.a"
|
||||
],
|
||||
|
||||
@ -96,7 +96,8 @@ class Extension
|
||||
fn ($x) => $x->getStaticLibFiles(),
|
||||
$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
|
||||
{
|
||||
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) {
|
||||
if (!file_exists(BUILD_LIB_PATH . "/{$name}")) {
|
||||
return false;
|
||||
|
||||
@ -72,6 +72,10 @@ trait UnixSystemUtilTrait
|
||||
if (!is_file($symbol_file)) {
|
||||
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
|
||||
if (SPCTarget::getTargetOS() !== 'Linux' || ToolchainManager::getToolchainClass() === ZigToolchain::class) {
|
||||
return "-Wl,-exported_symbols_list,{$symbol_file}";
|
||||
|
||||
@ -458,6 +458,7 @@ abstract class UnixBuilderBase extends BuilderBase
|
||||
'-ldflags \"-linkmode=external ' . $extLdFlags . ' ' .
|
||||
'-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.CustomBinaryName=frankenphp ' .
|
||||
"v{$frankenPhpVersion} PHP {$libphpVersion} Caddy'\\\" " .
|
||||
"-tags={$muslTags}nobadger,nomysql,nopgx{$nobrotli}{$nowatcher}",
|
||||
'LD_LIBRARY_PATH' => BUILD_LIB_PATH,
|
||||
|
||||
@ -93,8 +93,7 @@ trait postgresql
|
||||
|
||||
// remove dynamic libs
|
||||
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");
|
||||
|
||||
FileSystem::replaceFileStr("{$this->getLibDir()}/pkgconfig/libpq.pc", '-lldap', '-lldap -llber');
|
||||
|
||||
@ -16,12 +16,11 @@ class UnixAutoconfExecutor extends Executor
|
||||
|
||||
protected array $configure_args = [];
|
||||
|
||||
protected array $ignore_args = [];
|
||||
|
||||
public function __construct(protected BSDLibraryBase|LinuxLibraryBase|MacOSLibraryBase $library)
|
||||
{
|
||||
parent::__construct($library);
|
||||
$this->initShell();
|
||||
$this->configure_args = $this->getDefaultConfigureArgs();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -29,19 +28,12 @@ class UnixAutoconfExecutor extends Executor
|
||||
*/
|
||||
public function configure(...$args): static
|
||||
{
|
||||
// remove all the ignored args
|
||||
$args = array_merge($args, $this->getDefaultConfigureArgs(), $this->configure_args);
|
||||
$args = array_diff($args, $this->ignore_args);
|
||||
$args = array_merge($args, $this->configure_args);
|
||||
$configure_args = implode(' ', $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
|
||||
*
|
||||
@ -111,7 +103,7 @@ class UnixAutoconfExecutor extends Executor
|
||||
*/
|
||||
public function removeConfigureArgs(...$args): static
|
||||
{
|
||||
$this->ignore_args = [...$this->ignore_args, ...$args];
|
||||
$this->configure_args = array_diff($this->configure_args, $args);
|
||||
return $this;
|
||||
}
|
||||
|
||||
@ -133,8 +125,8 @@ class UnixAutoconfExecutor extends Executor
|
||||
private function getDefaultConfigureArgs(): array
|
||||
{
|
||||
return [
|
||||
'--disable-shared',
|
||||
'--enable-static',
|
||||
'--disable-shared',
|
||||
"--prefix={$this->library->getBuildRootPath()}",
|
||||
'--with-pic',
|
||||
'--enable-pic',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user