Skip to content

Commit 617b0de

Browse files
committed
add -lpthread and -ldl in openssl::getStaticLibFiles
1 parent 92ad792 commit 617b0de

4 files changed

Lines changed: 15 additions & 4 deletions

File tree

config/lib.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,8 @@
654654
"openssl"
655655
],
656656
"lib-suggests": [
657-
"nghttp3"
657+
"nghttp3",
658+
"brotli"
658659
]
659660
},
660661
"onig": {

src/SPC/builder/linux/library/openssl.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,4 +92,13 @@ public function build(): void
9292
FileSystem::replaceFileRegex(BUILD_LIB_PATH . '/pkgconfig/libcrypto.pc', '/Libs.private:.*/m', 'Libs.private: ${libdir}/libz.a');
9393
FileSystem::replaceFileRegex(BUILD_LIB_PATH . '/cmake/OpenSSL/OpenSSLConfig.cmake', '/set\(OPENSSL_LIBCRYPTO_DEPENDENCIES .*\)/m', 'set(OPENSSL_LIBCRYPTO_DEPENDENCIES "${OPENSSL_LIBRARY_DIR}/libz.a")');
9494
}
95+
96+
public function getStaticLibFiles(string $style = 'autoconf', bool $recursive = true): string
97+
{
98+
$libFiles = parent::getStaticLibFiles($style, $recursive);
99+
if (!str_contains('-ldl -lpthread', $libFiles)) {
100+
$libFiles .= ' -ldl -lpthread';
101+
}
102+
return $libFiles;
103+
}
95104
}

src/SPC/builder/macos/MacOSBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function makeAutoconfArgs(string $name, array $lib_specs): string
5656
foreach ($lib_specs as $libName => $arr) {
5757
$lib = $this->getLib($libName);
5858
if ($lib === null && str_starts_with($libName, 'lib')) {
59-
$lib = $this->getExt(substr($libName, 3));
59+
$lib = $this->getLib(substr($libName, 3));
6060
}
6161

6262
$arr = $arr ?? [];

src/SPC/builder/unix/library/ngtcp2.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ protected function build(): void
2323
'jemalloc' => null,
2424
'libnghttp3' => null,
2525
]);
26-
if (PHP_OS_FAMILY === 'Linux') {
27-
$args = preg_replace('/OPENSSL_LIBS="(.*?)"/', 'OPENSSL_LIBS="\1 -lpthread -ldl"', $args);
26+
if ($brotli = $this->builder->getLib('brotli')) {
27+
$args .= ' --with-libbrotlidec=yes LIBBROTLIDEC_CFLAGS="-I' . BUILD_ROOT_PATH . '/include" LIBBROTLIDEC_LIBS="' . $brotli->getStaticLibFiles() . '"';
28+
$args .= ' --with-libbrotlienc=yes LIBBROTLIENC_CFLAGS="-I' . BUILD_ROOT_PATH . '/include" LIBBROTLIENC_LIBS="' . $brotli->getStaticLibFiles() . '"';
2829
}
2930

3031
shell()->cd($this->source_dir)

0 commit comments

Comments
 (0)