aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/node/binding.gyp
diff options
context:
space:
mode:
authorGravatar Nicolas Noble <nicolasnoble@users.noreply.github.com>2015-07-08 10:39:06 -0700
committerGravatar Nicolas Noble <nicolasnoble@users.noreply.github.com>2015-07-08 10:39:06 -0700
commit10441a94012307abd001b89508f73a54ade088c2 (patch)
treead036b001fc3fbc1d74f8a8d6d69adb3cf8173f0 /src/node/binding.gyp
parent265d43041f8301ae2fe19093724698ffbc1ba072 (diff)
parent06e5471aa466c4ea796582f813ac071f9ec6f5c5 (diff)
Merge pull request #2310 from murgatroid99/node_pkg_config
Use pkg-config when building the Node extension, if possible
Diffstat (limited to 'src/node/binding.gyp')
-rw-r--r--src/node/binding.gyp55
1 files changed, 41 insertions, 14 deletions
diff --git a/src/node/binding.gyp b/src/node/binding.gyp
index 259c0b5de4..6ba233388a 100644
--- a/src/node/binding.gyp
+++ b/src/node/binding.gyp
@@ -16,14 +16,48 @@
'ldflags': [
'-g'
],
- 'link_settings': {
- 'libraries': [
- '-lpthread',
- '-lgrpc',
- '-lgpr'
- ]
- },
"conditions": [
+ ['OS != "win"', {
+ 'variables': {
+ 'pkg_config_grpc': '<!(pkg-config --exists grpc >/dev/null 2>&1 && echo true || echo false)'
+ },
+ 'conditions': [
+ ['pkg_config_grpc == "true"', {
+ 'link_settings': {
+ 'libraries': [
+ '<!@(pkg-config --libs-only-l --static grpc)'
+ ]
+ },
+ 'cflags': [
+ '<!@(pkg-config --cflags grpc)'
+ ],
+ 'libraries': [
+ '<!@(pkg-config --libs-only-L --static grpc)'
+ ],
+ 'ldflags': [
+ '<!@(pkg-config --libs-only-other --static grpc)'
+ ]
+ }, {
+ 'link_settings': {
+ 'libraries': [
+ '-lpthread',
+ '-lgrpc',
+ '-lgpr'
+ ],
+ },
+ 'conditions':[
+ ['OS != "mac"', {
+ 'link_settings': {
+ 'libraries': [
+ '-lrt'
+ ]
+ }
+ }]
+ ]
+ }
+ ]
+ ]
+ }],
['OS == "mac"', {
'xcode_settings': {
'MACOSX_DEPLOYMENT_TARGET': '10.9',
@@ -32,13 +66,6 @@
'-stdlib=libc++'
]
}
- }],
- ['OS != "mac"', {
- 'link_settings': {
- 'libraries': [
- '-lrt'
- ]
- }
}]
],
"target_name": "grpc",