aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/node/binding.gyp
diff options
context:
space:
mode:
authorGravatar murgatroid99 <mlumish@google.com>2015-07-06 11:08:22 -0700
committerGravatar murgatroid99 <mlumish@google.com>2015-07-06 11:08:22 -0700
commitb0d8b31b444a09e6f8a90047c0506f6cdf29986b (patch)
treef6c9300bd33fa37923fd0bee555fe5fd9245f8e1 /src/node/binding.gyp
parent8497c79155d47f2fb0f4765890ab259380c7749f (diff)
Use pkg-config in node's binding.gyp
Diffstat (limited to 'src/node/binding.gyp')
-rw-r--r--src/node/binding.gyp52
1 files changed, 38 insertions, 14 deletions
diff --git a/src/node/binding.gyp b/src/node/binding.gyp
index 83f72fabca..e0220397d6 100644
--- a/src/node/binding.gyp
+++ b/src/node/binding.gyp
@@ -16,14 +16,45 @@
'ldflags': [
'-g'
],
- 'link_settings': {
- 'libraries': [
- '-lpthread',
- '-lgrpc',
- '-lgpr'
- ]
- },
"conditions": [
+ ['OS != "win"', {
+ 'variables': {
+ 'has_pkg_config': '<!(command -v pkg-config >/dev/null 2>&1 && echo true || echo false)'
+ },
+ 'conditions': [
+ ['has_pkg_config == "true"', {
+ 'link_settings': {
+ 'libraries': [
+ '<!@(pkg-config --libs-only-l grpc)'
+ ]
+ },
+ 'cflags': [
+ '<!@(pkg-config --cflags grpc)'
+ ],
+ 'libraries': [
+ '<!@(pkg-config --libs-only-L 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 +63,6 @@
'-stdlib=libc++'
]
}
- }],
- ['OS != "mac"', {
- 'link_settings': {
- 'libraries': [
- '-lrt'
- ]
- }
}]
],
"target_name": "grpc",