-
Notifications
You must be signed in to change notification settings - Fork 40
Support cross-installing of prebuilt packages via npm_config_* vars #50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -4,13 +4,22 @@ var proc = require('child_process') | |||||||||||||||||||
var os = require('os') | ||||||||||||||||||||
var path = require('path') | ||||||||||||||||||||
|
||||||||||||||||||||
var targetMismatch = (process.env.npm_config_platform && process.platform !== process.env.npm_config_platform) || | ||||||||||||||||||||
(process.env.npm_config_arch && process.arch !== process.env.npm_config_arch) | ||||||||||||||||||||
vweevers marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||
|
||||||||||||||||||||
if (!buildFromSource()) { | ||||||||||||||||||||
proc.exec('node-gyp-build-test', function (err, stdout, stderr) { | ||||||||||||||||||||
if (err) { | ||||||||||||||||||||
if (verbose()) console.error(stderr) | ||||||||||||||||||||
preinstall() | ||||||||||||||||||||
} | ||||||||||||||||||||
}) | ||||||||||||||||||||
if (targetMismatch) { | ||||||||||||||||||||
// If the target is mismatched, then we can't test prebuilds. | ||||||||||||||||||||
// Instead, we just check whether a matching prebuild exists, and fail if it doesn't. | ||||||||||||||||||||
require('./index').path() | ||||||||||||||||||||
Comment on lines
+13
to
+14
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
I think it should be attempting to do a build instead of simply failing if there is no prebuild found. Perhaps it should only attempt the build if the platforms match? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Having too many fallbacks makes behavior unpredictable. This PR makes a very reasonable assumption that if the platform doesn't match, compiling likely won't work. We still have
Not sure I understand the question. If the platforms match, then the behavior is the same as before (meaning: we find & test a prebuild, or build from source). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Then this will be a breaking change. With 4.5.0 I can do a I really shouldn't need to specify
I mean that if I am trying to build There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh I see, you were talking about only a platform match, rather than both platform & arch. OK, if we keep this PR as-is (and I think we should, but I want to think about your use case for a bit) then we'll make it semver-major. |
||||||||||||||||||||
} else { | ||||||||||||||||||||
proc.exec('node-gyp-build-test', function (err, stdout, stderr) { | ||||||||||||||||||||
vweevers marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||
if (err) { | ||||||||||||||||||||
if (verbose()) console.error(stderr) | ||||||||||||||||||||
preinstall() | ||||||||||||||||||||
} | ||||||||||||||||||||
}) | ||||||||||||||||||||
} | ||||||||||||||||||||
} else { | ||||||||||||||||||||
preinstall() | ||||||||||||||||||||
} | ||||||||||||||||||||
|
Uh oh!
There was an error while loading. Please reload this page.