mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-08-25 04:57:03 +00:00
Previously, when popen was called, the 3 streams (stdin, stderr and stdourt) where never closed. This was the reason of the having an impossible number of open files. This patch ensure all streams are closed after using them. This means that the ulimit trick is no more necessary
78 lines
2.1 KiB
JavaScript
78 lines
2.1 KiB
JavaScript
|
|
require("../../common.jake");
|
|
|
|
var OS = require("os"),
|
|
task = require("jake").task,
|
|
stream = require("narwhal/term").stream,
|
|
applicationName = "XcodeCapp.app";
|
|
|
|
task ("build", function()
|
|
{
|
|
// If sw_vers does not exist, we aren't on Mac OS X
|
|
if (!executableExists("sw_vers"))
|
|
OS.exit(0);
|
|
|
|
// No building on 10.6
|
|
var p = OS.popen(["sw_vers", "-productVersion"]);
|
|
|
|
if (p.wait() === 0)
|
|
{
|
|
var versions = p.stdout.read().split("."),
|
|
majorVersion = parseInt(versions[0], 10),
|
|
minorVersion = parseInt(versions[1], 10),
|
|
buildVersion = parseInt(versions[2], 10);
|
|
|
|
if (majorVersion < 10 || minorVersion < 7)
|
|
{
|
|
colorPrint("XcodeCapp can only be built on Mac OS X 10.7+. You can download the binary here: https://www.dropbox.com/sh/gxdgm356gyb9tqc/rFNyl8hcVG", "red");
|
|
OS.exit(0);
|
|
}
|
|
}
|
|
|
|
p.stdin.close();
|
|
p.stdout.close();
|
|
p.stderr.close();
|
|
|
|
if (executableExists("xcodebuild"))
|
|
{
|
|
var args = "-sdk macosx -alltargets -configuration Release",
|
|
installPath = FILE.join("/", "Applications", applicationName);
|
|
|
|
// Remove an old symlink, the application is built directly into /Applications now.
|
|
if (FILE.isLink(installPath))
|
|
FILE.remove(installPath);
|
|
|
|
if (OS.system("xcodebuild " + args))
|
|
OS.exit(1);
|
|
|
|
if (!executableExists("xcc"))
|
|
{
|
|
print("\nWould you like to install the xcc command line tool in /usr/local/bin? yes or no:");
|
|
|
|
if (system.stdin.readLine() == "yes\n")
|
|
{
|
|
sudo(["mkdir", "-p", "/usr/local/bin"]);
|
|
sudo(["ln", "-s", "/Applications/XcodeCapp.app/Contents/MacOS/xcc", "/usr/local/bin/"]);
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
print("Building " + applicationName + " requires Xcode.");
|
|
}
|
|
});
|
|
|
|
task ("clean", function()
|
|
{
|
|
if (OS.system("xcodebuild clean"))
|
|
OS.exit(1);
|
|
});
|
|
|
|
task ("clobber", function()
|
|
{
|
|
if (OS.system("xcodebuild clean"))
|
|
OS.exit(1);
|
|
});
|
|
|
|
task ("default", ["build"]);
|