Skip to content

Commit af5b907

Browse files
authored
Dynamic linking environment variable (#14)
1 parent c3f5e28 commit af5b907

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

binding.gyp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# may be redefined in command line on configuration stage
44
# "BUILD_LIBRDKAFKA%": "<!(echo ${BUILD_LIBRDKAFKA:-1})"
55
"BUILD_LIBRDKAFKA%": "<!(node ./util/get-env.js BUILD_LIBRDKAFKA 1)",
6+
"CKJS_LINKING%": "<!(node ./util/get-env.js CKJS_LINKING static)",
67
},
78
"targets": [
89
{
@@ -85,7 +86,17 @@
8586
],
8687
'conditions': [
8788
[
88-
'OS=="linux"',
89+
['OS=="linux"', 'CKJS_LINKING="dynamic"'],
90+
{
91+
"libraries": [
92+
"../build/deps/librdkafka.so",
93+
"../build/deps/librdkafka++.so",
94+
"-Wl,-rpath='$$ORIGIN/../deps'",
95+
],
96+
}
97+
],
98+
[
99+
['OS=="linux"', 'CKJS_LINKING!="dynamic"'],
89100
{
90101
"libraries": [
91102
"../build/deps/librdkafka-static.a",

deps/librdkafka.gyp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"librdkafka/config.h",
2727
],
2828
"action": [
29-
"make", "-C", "librdkafka", "libs", "install"
29+
"make", "-j5", "-C", "librdkafka", "libs", "install"
3030
],
3131
"conditions": [
3232
[

util/configure.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ if (isWin) {
1919
var childProcess = require('child_process');
2020

2121
try {
22-
childProcess.execSync('./configure --install-deps --source-deps-only --disable-lz4-ext --enable-static --enable-strip --disable-gssapi --prefix=' + releaseDir + ' --libdir=' + releaseDir, {
22+
let opts = '--install-deps --source-deps-only --disable-lz4-ext --enable-static --enable-strip --disable-gssapi';
23+
if (process.env['CKJS_LINKING'] === 'dynamic')
24+
opts = '';
25+
childProcess.execSync(`./configure ${opts} --prefix=${releaseDir} --libdir=${releaseDir}`, {
2326
cwd: baseDir,
2427
stdio: [0,1,2]
2528
});

0 commit comments

Comments
 (0)