Skip to content

Commit

Permalink
add node-pre-gyp support for precompiled binaries
Browse files Browse the repository at this point in the history
  • Loading branch information
rvagg committed Jun 15, 2016
1 parent 5ea241d commit 57e48c3
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 43 deletions.
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# Files
.lock-wscript
.nyc_output

# Filetypes
.*.swp

# Paths
/build
/node_modules
/coverage
/coverage
/binding
/.nyc_output
13 changes: 12 additions & 1 deletion .npmignore
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
build
.lock-wscript
.travis.yml
.dntrc
.npmignore
.*.swp
/build
/node_modules
/coverage
/binding
/.nyc_output
/test
/examples
71 changes: 36 additions & 35 deletions binding.gyp
Original file line number Diff line number Diff line change
@@ -1,37 +1,31 @@
{
'targets':
[
'targets': [
{
'target_name': 'bignum',
'sources': [ 'bignum.cc' ],
'include_dirs': [
"<!(node -e \"require('nan')\")"
],
'conditions':
[

'conditions': [
# For Windows, require either a 32-bit or 64-bit
# separately-compiled OpenSSL library.
# Currently set up to use with the following OpenSSL distro:
#
# http:https://slproweb.com/products/Win32OpenSSL.html
# Currently set up to use with the following OpenSSL distro:
#
# http:https://slproweb.com/products/Win32OpenSSL.html
[
'OS=="win"',
{
'conditions':
[
'OS=="win"', {
'conditions': [
[
'target_arch=="x64"',
{
'variables': {
'target_arch=="x64"', {
'variables': {
'openssl_root%': 'C:/OpenSSL-Win64'
},
}, {
'variables': {
'openssl_root%': 'C:/OpenSSL-Win32'
}
}
]
'variables': {
'openssl_root%': 'C:/OpenSSL-Win32'
}
}
]
],
'libraries': [
'-l<(openssl_root)/lib/libeay32.lib',
Expand All @@ -41,29 +35,26 @@
],
},


# Otherwise, if not Windows, link against the exposed OpenSSL
# in Node.
# in Node.
{
'conditions':
[
[
'target_arch=="ia32"',
{
'conditions': [
[
'target_arch=="ia32"', {
'variables': {
'openssl_config_path': '<(nodedir)/deps/openssl/config/piii'
}
}
],
[
'target_arch=="x64"', {
[
'target_arch=="x64"', {
'variables': {
'openssl_config_path': '<(nodedir)/deps/openssl/config/k8'
},
}
],
[
'target_arch=="arm"', {
],
[
'target_arch=="arm"', {
'variables': {
'openssl_config_path': '<(nodedir)/deps/openssl/config/arm'
}
Expand All @@ -83,14 +74,24 @@
}
},
]
],
],
'include_dirs': [
"<(nodedir)/deps/openssl/openssl/include",
"<(openssl_config_path)"
]
}
}
]
]
}, {
'target_name': 'action_after_build',
'type': 'none',
'dependencies': [ '<(module_name)' ],
'copies': [
{
'files': [ '<(PRODUCT_DIR)/<(module_name).node' ],
'destination': '<(module_path)'
}
]
}
]
}
}
5 changes: 4 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
var bin = require('bindings')('bignum.node')
var binary = require('node-pre-gyp')
var path = require('path')
var binPath = binary.find(path.resolve(path.join(__dirname, 'package.json')))
var bin = require(binPath)
var BigNum = bin.BigNum

module.exports = BigNum
Expand Down
18 changes: 14 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,29 @@
},
"dependencies": {
"bindings": "~1.2.1",
"nan": "^2.3.4"
"nan": "^2.3.4",
"node-pre-gyp": "~0.6.28"
},
"devDependencies": {
"aws-sdk": "~2.4.0",
"put": "~0.0.5",
"standard": "~7.1.2",
"tap": "~5.7.2"
},
"license": "MIT",
"scripts": {
"install": "node-gyp configure build",
"preinstall": "npm install node-pre-gyp",
"install": "node-pre-gyp install --fallback-to-build",
"test": "standard && tap --cov test/*.js"
},
"binary": {
"host": "https://rvagg-node.s3-us-west-2.amazonaws.com",
"module_name": "bignum",
"module_path": "./binding",
"remote_path": "./{name}/v{version}"
},
"license": "MIT",
"contributors": [
"James Halliday <[email protected]>"
"James Halliday <[email protected]>",
"Rod Vagg <[email protected]>"
]
}

0 comments on commit 57e48c3

Please sign in to comment.