Skip to content

Commit

Permalink
finish support for #124 with using --target
Browse files Browse the repository at this point in the history
  • Loading branch information
Dane Springmeyer committed Nov 12, 2014
1 parent c27644f commit 791d2bf
Showing 1 changed file with 6 additions and 18 deletions.
24 changes: 6 additions & 18 deletions lib/util/versioning.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,44 +66,32 @@ function get_runtime_abi(runtime, target_version) {
if (runtime != 'node') {
throw new Error("Unknown Runtime: '" + runtime + "'");
}
var target_abi;
if (!target_version) {
return get_node_abi_for_process(runtime,process.versions);
} else {
var cross_obj;
// abi_crosswalk generated with ./scripts/abi_crosswalk.js
if (abi_crosswalk[target_version]) {
target_abi = abi_crosswalk[target_version].node_abi;
cross_obj = abi_crosswalk[target_version];
} else {
var target_parts = target_version.split('.').map(function(i) { return +i });
if (target_parts.length == 3 && (target_parts[1] % 2 == 0)) {
var patch = target_parts[2];
while (--patch > 0) {
var new_target = '' + target_parts[0] + '.' + target_parts[1] + '.' + patch;
if (abi_crosswalk[new_target]) {
target_abi = abi_crosswalk[new_target].node_abi;
cross_obj = abi_crosswalk[target_version];
break;
}
}
}
}
if (!target_abi) {
throw new Error("Unsupported target version: " + target_abi);
if (!cross_obj) {
throw new Error("Unsupported target version: " + target_version);
}
// abi_crosswalk uses 1 for node versions lacking process.versions.modules
// process.versions.modules added in >= v0.10.4 and v0.11.7
if (target_abi > 1) {
return runtime+'-v' + (+target_abi);
} else {
// no support for node-webkit unless > 0.10.x
if (runtime != 'node') {
throw new Error("Runtime '" + runtime + "' unsupported for target version: " + target_version);
}
if (!abi_crosswalk[target_version]) {
throw new Error("Unsupported target version: " + target_version);
}
target_abi = abi_crosswalk[target_version].v8;
return 'v8-' + target_abi;
}
return get_node_abi_for_target(runtime, target_version, cross_obj.v8, cross_obj.node_abi > 1 ? cross_obj.node_abi : undefined);
}
}
}
Expand Down

0 comments on commit 791d2bf

Please sign in to comment.