Skip to content

Commit

Permalink
Only build (and link lpcap) for mac
Browse files Browse the repository at this point in the history
Use updated NAN expose for Electron compatibility
  • Loading branch information
Bartel-C8 committed Nov 10, 2023
1 parent a637ab6 commit 12e1ce4
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
12 changes: 8 additions & 4 deletions binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,15 @@
"include_dirs": [
"<!(node -e \"require('nan')\")"
],
"link_settings": {
"libraries": [
"conditions": [
['OS == "mac"', {
"link_settings": {
"libraries": [
"-lpcap"
]
}
]
}
}]
]
}
]
}
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
"type": "git",
"url": "git://github.com/plus100kt/node_pcap.git"
},
"os": [
"darwin"
],
"engines": {
"node": ">=18.0.0"
},
Expand Down
6 changes: 5 additions & 1 deletion pcap_binding.cc
Original file line number Diff line number Diff line change
Expand Up @@ -147,5 +147,9 @@ void Initialize(Local<Object> exports)
}

DISABLE_WCAST_FUNCTION_TYPE
NODE_MODULE(pcap_binding, Initialize)
#if NODE_MAJOR_VERSION >= 10
NAN_MODULE_WORKER_ENABLED(pcap_binding, Initialize)
#else
NODE_MODULE(pcap_binding, Initialize)
#endif
DISABLE_WCAST_FUNCTION_TYPE_END

0 comments on commit 12e1ce4

Please sign in to comment.