Commit 805edbaf authored by John Haley's avatar John Haley

Fix build on windows

parent 9543011c
......@@ -42,6 +42,6 @@ if (require.main === module) {
console.log("nothing to do");
}
else {
module.exports();
module.exports().done();
}
}
var nodePreGypConstructor = require("node-pre-gyp");
var nodePreGyp = new nodePreGypConstructor.Run();
var path = require("path");
var buildFlags = require("../utils/buildFlags");
var exec = require("../utils/execPromise");
module.exports = function install() {
console.log("[nodegit] Running install script");
// we need to add 2 blank entires to help the parser later.
var argv = ["", "", "install"];
var nodePreGypCmd = path.join(
__dirname,
"..",
"node_modules",
".bin",
"node-pre-gyp"
);
if (process.platform === "win32") {
nodePreGypCmd += ".cmd";
}
var cmd = [nodePreGypCmd, "install"];
if (buildFlags.mustBuild) {
argv.push("--build-from-source");
console.info(
"[nodegit] Pre-built download disabled, building from source."
);
cmd.push("--build-from-source");
if (buildFlags.debugBuild) {
argv.push("--debug");
console.info("[nodegit] Building debug version.");
cmd.push("--debug");
}
}
else {
argv.push("--fallback-to-build");
cmd.push("--fallback-to-build");
}
nodePreGyp.parseArgv(argv);
function run() {
var command = nodePreGyp.todo.shift();
if (!command) {
return;
}
nodePreGyp.commands[command.name](command.args, function (err) {
if (err) {
console.error(command.name + " error");
console.error("stack", err.stack);
console.error("not ok");
console.log(err.message);
return process.exit(1);
}
var args_array = [].slice.call(arguments, 1);
if (args_array.length) {
console.log.apply(console, args_array);
}
// now run the next command in the queue
process.nextTick(run);
return exec(cmd.join(" "))
.then(function() {
console.info("[nodegit] Completed installation successfully.");
});
}
run();
};
// Called on the command line
if (require.main === module) {
module.exports();
module.exports()
.catch(function(e) {
console.error("[nodegit] ERROR - Could not finish install");
console.error(e);
process.exit(1);
});
}
#!/usr/bin/env node
var fse = require("fs-extra");
var path = require("path");
var child_process = require("child_process");
var exec = require("../utils/execPromise");
var buildFlags = require("../utils/buildFlags");
var rootPath = path.join(__dirname, "..");
......@@ -16,25 +15,37 @@ function printStandardLibError() {
console.log("");
console.log("$ sudo add-apt-repository ppa:ubuntu-toolchain-r/test");
console.log("$ sudo apt-get update");
console.log("$ sudo apt-get install libstdc++-4.9-dev");
}
console.log("$ sudo apt-get install libstdc++-4.9-dev");
child_process.exec("node dist/nodegit.js", function(error, stdout, stderr) {
if (stderr) {
if (process.pladtform !== "linux" && ~stderr.indexOf("libstdc++")) {
printStandardLibError();
}
module.exports = function install() {
return exec("node dist/nodegit.js")
.then(function() {
// Is we're using NodeGit from a package manager then let's clean up after
// ourselves when we install successfully.
if (!buildFlags.mustBuild) {
fse.removeSync(path.join(rootPath, "vendor"));
fse.removeSync(path.join(rootPath, "src"));
fse.removeSync(path.join(rootPath, "include"));
fse.removeSync(path.join(rootPath, "build/Release/*.a"));
fse.removeSync(path.join(rootPath, "build/Release/obj.target"));
}
});
};
return;
}
// Called on the command line
if (require.main === module) {
module.exports()
.catch(function(e) {
console.error("[nodegit] ERROR - Could not finish postinstall");
// Is we're using NodeGit from a package manager then let's clean up after
// ourselves when we install successfully.
if (!buildFlags.mustBuild) {
fse.removeSync(path.join(rootPath, "vendor"));
fse.removeSync(path.join(rootPath, "src"));
fse.removeSync(path.join(rootPath, "include"));
fse.removeSync(path.join(rootPath, "build/Release/*.a"));
fse.removeSync(path.join(rootPath, "build/Release/obj.target"));
}
});
if (process.pladtform !== "linux" && ~e.indexOf("libstdc++")) {
printStandardLibError();
}
else {
console.error(e);
}
process.exit(1);
});
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment