Skip to content

Commit 5cb6a75

Browse files
committed
add extra features to librdkafka (curl, ssl, sasl
1 parent 5476385 commit 5cb6a75

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

config/lib.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,10 @@
513513
],
514514
"cpp-library": true,
515515
"lib-suggests": [
516+
"curl",
517+
"liblz4",
518+
"openssl",
519+
"zlib",
516520
"zstd"
517521
]
518522
},

src/SPC/builder/extension/rdkafka.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ public function patchBeforeBuildconf(): bool
1515
{
1616
FileSystem::replaceFileStr("{$this->source_dir}/config.m4", "-L\$RDKAFKA_DIR/\$PHP_LIBDIR -lm\n", "-L\$RDKAFKA_DIR/\$PHP_LIBDIR -lm \$RDKAFKA_LIBS\n");
1717
FileSystem::replaceFileStr("{$this->source_dir}/config.m4", "-L\$RDKAFKA_DIR/\$PHP_LIBDIR -lm\"\n", '-L$RDKAFKA_DIR/$PHP_LIBDIR -lm $RDKAFKA_LIBS"');
18+
FileSystem::replaceFileStr("{$this->source_dir}/config.m4", 'PHP_CHECK_LIBRARY($LIBNAME,$LIBSYMBOL,', 'AC_CHECK_LIB([$LIBNAME], [$LIBSYMBOL],');
1819
return true;
1920
}
2021

@@ -39,6 +40,9 @@ public function getUnixConfigureArg(bool $shared = false): string
3940
{
4041
$pkgconf_libs = shell()->execWithResult('pkg-config --libs --static rdkafka')[1];
4142
$pkgconf_libs = trim(implode('', $pkgconf_libs));
43+
$pkgconf_libs = str_replace(BUILD_LIB_PATH . '/lib', '-l', $pkgconf_libs);
44+
$pkgconf_libs = str_replace('.a', '', $pkgconf_libs);
45+
$pkgconf_libs = deduplicate_flags($pkgconf_libs);
4246
return '--with-rdkafka=' . ($shared ? 'shared,' : '') . BUILD_ROOT_PATH . ' RDKAFKA_LIBS="' . $pkgconf_libs . '"';
4347
}
4448
}

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

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,28 @@ protected function build(): void
3232
'zstd',
3333
function ($lib) {
3434
putenv("STATIC_LIB_libzstd={$lib->getLibDir()}/libzstd.a");
35-
return '';
35+
return '--enable-zstd';
3636
},
3737
'--disable-zstd'
3838
)
39+
->optionalLib(
40+
'curl',
41+
function () {
42+
$pkg_libs = shell()->execWithResult('pkg-config --libs --static libcurl')[1];
43+
putenv("STATIC_LIB_libcurl={$pkg_libs}");
44+
return '--enable-curl';
45+
},
46+
'--disable-curl'
47+
)
48+
->optionalLib('openssl', '--enable-ssl', '--disable-ssl')
49+
->optionalLib('zlib', '--enable-zlib', '--disable-zlib')
3950
->removeConfigureArgs(
4051
'--with-pic',
4152
'--enable-pic',
4253
)
4354
->configure(
44-
'--disable-curl',
4555
'--disable-sasl',
4656
'--disable-valgrind',
47-
'--disable-zlib',
48-
'--disable-ssl',
4957
)
5058
->make();
5159

0 commit comments

Comments
 (0)