mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-18 21:04:52 +08:00
Fix ngtcp2 and libheif build missing lib bug
This commit is contained in:
parent
11f21304f9
commit
da45aa7f15
@ -4,24 +4,9 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace SPC\builder\macos\library;
|
namespace SPC\builder\macos\library;
|
||||||
|
|
||||||
use SPC\store\FileSystem;
|
|
||||||
|
|
||||||
class libheif extends MacOSLibraryBase
|
class libheif extends MacOSLibraryBase
|
||||||
{
|
{
|
||||||
use \SPC\builder\unix\library\libheif;
|
use \SPC\builder\unix\library\libheif;
|
||||||
|
|
||||||
public const NAME = 'libheif';
|
public const NAME = 'libheif';
|
||||||
|
|
||||||
public function patchBeforeBuild(): bool
|
|
||||||
{
|
|
||||||
if (!str_contains(file_get_contents($this->source_dir . '/CMakeLists.txt'), 'libbrotlienc')) {
|
|
||||||
FileSystem::replaceFileStr(
|
|
||||||
$this->source_dir . '/CMakeLists.txt',
|
|
||||||
'list(APPEND REQUIRES_PRIVATE "libbrotlidec")',
|
|
||||||
'list(APPEND REQUIRES_PRIVATE "libbrotlidec")' . "\n" . ' list(APPEND REQUIRES_PRIVATE "libbrotlienc")'
|
|
||||||
);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,10 +6,24 @@ namespace SPC\builder\unix\library;
|
|||||||
|
|
||||||
use SPC\exception\FileSystemException;
|
use SPC\exception\FileSystemException;
|
||||||
use SPC\exception\RuntimeException;
|
use SPC\exception\RuntimeException;
|
||||||
|
use SPC\store\FileSystem;
|
||||||
use SPC\util\executor\UnixCMakeExecutor;
|
use SPC\util\executor\UnixCMakeExecutor;
|
||||||
|
|
||||||
trait libheif
|
trait libheif
|
||||||
{
|
{
|
||||||
|
public function patchBeforeBuild(): bool
|
||||||
|
{
|
||||||
|
if (!str_contains(file_get_contents($this->source_dir . '/CMakeLists.txt'), 'libbrotlienc')) {
|
||||||
|
FileSystem::replaceFileStr(
|
||||||
|
$this->source_dir . '/CMakeLists.txt',
|
||||||
|
'list(APPEND REQUIRES_PRIVATE "libbrotlidec")',
|
||||||
|
'list(APPEND REQUIRES_PRIVATE "libbrotlidec")' . "\n" . ' list(APPEND REQUIRES_PRIVATE "libbrotlienc")'
|
||||||
|
);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws RuntimeException
|
* @throws RuntimeException
|
||||||
* @throws FileSystemException
|
* @throws FileSystemException
|
||||||
|
|||||||
@ -19,7 +19,11 @@ trait ngtcp2
|
|||||||
protected function build(): void
|
protected function build(): void
|
||||||
{
|
{
|
||||||
UnixAutoconfExecutor::create($this)
|
UnixAutoconfExecutor::create($this)
|
||||||
->optionalLib('openssl', ...ac_with_args('openssl', true))
|
->optionalLib('openssl', fn ($lib) => implode(' ', [
|
||||||
|
'--with-openssl=yes',
|
||||||
|
"OPENSSL_LIBS=\"{$lib->getStaticLibFiles()}\"",
|
||||||
|
"OPENSSL_CFLAGS=\"-I{$lib->getIncludeDir()}\"",
|
||||||
|
]), '--with-openssl=no')
|
||||||
->optionalLib('libev', ...ac_with_args('libev', true))
|
->optionalLib('libev', ...ac_with_args('libev', true))
|
||||||
->optionalLib('nghttp3', ...ac_with_args('libnghttp3', true))
|
->optionalLib('nghttp3', ...ac_with_args('libnghttp3', true))
|
||||||
->optionalLib('jemalloc', ...ac_with_args('jemalloc', true))
|
->optionalLib('jemalloc', ...ac_with_args('jemalloc', true))
|
||||||
@ -34,6 +38,7 @@ trait ngtcp2
|
|||||||
"LIBBROTLIENC_LIBS=\"{$lib->getStaticLibFiles()}\"",
|
"LIBBROTLIENC_LIBS=\"{$lib->getStaticLibFiles()}\"",
|
||||||
])
|
])
|
||||||
)
|
)
|
||||||
|
->appendEnv(['PKG_CONFIG' => '$PKG_CONFIG --static'])
|
||||||
->configure('--enable-lib-only')
|
->configure('--enable-lib-only')
|
||||||
->make();
|
->make();
|
||||||
$this->patchPkgconfPrefix(['libngtcp2.pc', 'libngtcp2_crypto_ossl.pc']);
|
$this->patchPkgconfPrefix(['libngtcp2.pc', 'libngtcp2_crypto_ossl.pc']);
|
||||||
@ -41,7 +46,6 @@ trait ngtcp2
|
|||||||
|
|
||||||
// on macOS, the static library may contain other static libraries?
|
// on macOS, the static library may contain other static libraries?
|
||||||
// ld: archive member 'libssl.a' not a mach-o file in libngtcp2_crypto_ossl.a
|
// ld: archive member 'libssl.a' not a mach-o file in libngtcp2_crypto_ossl.a
|
||||||
shell()->cd(BUILD_LIB_PATH)
|
shell()->cd(BUILD_LIB_PATH)->exec("ar -t libngtcp2_crypto_ossl.a | grep '\\.a$' | xargs -n1 ar d libngtcp2_crypto_ossl.a");
|
||||||
->exec("ar -t libngtcp2_crypto_ossl.a | grep '\\.a$' | xargs -n1 ar d libngtcp2_crypto_ossl.a");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user