Blizzard / node-rdkafka

Node.js bindings for librdkafka
MIT License
2.12k stars 397 forks source link

[FEATURE REQUEST] Allow to pass arbitrary compilation options to librdkafka via env variables #1077

Open enzo-cappa opened 7 months ago

enzo-cappa commented 7 months ago

Hello! I would like to propose adding support for a new configuration via env variables.

What

Add option to pass configuration options to the build process of librdkafka, so it's possible to pass arbitrary configurations to the build process.

Why

The compiled libraries fail in some scenarios when using the default configuration for librdkafka. In our case it was on Ubuntu FIPS environments. The only method we found to make it work is to add the configurations:

--disable-lz4-ext --enable-static --disable-gssapi

to the configure process call in util/configure.js. It's not easy to apply the change in our build scripts, the options we have right now are:

All of them are quite complex.

What it would look like

I suggest support an env variable, adding something like the following code to util/configure.js around line 23:

  let opts = process.env["RDKAFKA_OPTS"];
  childProcess.execSync(`./configure ${opts} --prefix=${releaseDir} --libdir=${releaseDir}`, {

Which will allow us to pass the options in the RDKAFKA_OPTS env var.

I can create a PR if this is something you would support.

Thanks!