Skip to content

Commit

Permalink
Changed to a more portable Node version check in binding.gyp
Browse files Browse the repository at this point in the history
  • Loading branch information
murgatroid99 committed Oct 20, 2015
1 parent e2a1bf4 commit c07c734
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
7 changes: 4 additions & 3 deletions binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,11 @@
# io.js always reports versions >0 and always exports ALPN symbols.
# Therefore, Node's major version will be truthy if and only if it
# supports ALPN. The output of "node -v" is v[major].[minor].[patch],
# like "v4.1.1" in a recent version. We use grep to extract just the
# major version. "4", would be the output for the example.
# like "v4.1.1" in a recent version. We use cut to split by period and
# take the first field (resulting in "v[major]"), then use cut again
# to take all but the first character, removing the "v".
'defines': [
'TSI_OPENSSL_ALPN_SUPPORT=<!(node -v | grep -oP "(?<=v)(\d+)(?=\.\d+\.\d+)")'
'TSI_OPENSSL_ALPN_SUPPORT=<!(node --version | cut -d. -f1 | cut -c2-)'
],
'include_dirs': [
'.',
Expand Down
7 changes: 4 additions & 3 deletions templates/binding.gyp.template
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,11 @@
# io.js always reports versions >0 and always exports ALPN symbols.
# Therefore, Node's major version will be truthy if and only if it
# supports ALPN. The output of "node -v" is v[major].[minor].[patch],
# like "v4.1.1" in a recent version. We use grep to extract just the
# major version. "4", would be the output for the example.
# like "v4.1.1" in a recent version. We use cut to split by period and
# take the first field (resulting in "v[major]"), then use cut again
# to take all but the first character, removing the "v".
'defines': [
'TSI_OPENSSL_ALPN_SUPPORT=<!(node -v | grep -oP "(?<=v)(\d+)(?=\.\d+\.\d+)")'
'TSI_OPENSSL_ALPN_SUPPORT=<!(node --version | cut -d. -f1 | cut -c2-)'
],
'include_dirs': [
'.',
Expand Down

0 comments on commit c07c734

Please sign in to comment.