gzip support in steam, removed special "cat" dependency, improved install-tools script

This commit is contained in:
Thomas Robinson
2008-11-21 17:24:11 -08:00
parent 2ff51a3dbb
commit 043bcc5729
6 changed files with 48 additions and 43 deletions
+2 -3
View File
@@ -23,9 +23,9 @@ while [ $# -ge 1 ]; do
done
mkdir -p $INSTALL_DIR/bin
mkdir -p $INSTALL_DIR/share
mkdir -p $INSTALL_DIR/share/objj
cp -fR objj/ $INSTALL_DIR/share/objj
cp -fR objj/* $INSTALL_DIR/share/objj/.
BINS=`ls objj/bin`
for BIN in $BINS
@@ -35,7 +35,6 @@ do
done
chmod +x $INSTALL_DIR/share/objj/bin/*
chmod +x $INSTALL_DIR/share/objj/lib/cat
cat <<EOT
-3
View File
@@ -18,9 +18,6 @@
<copy file = "${basedir}/commons-logging-1.1.jar" todir = "${Build.Cappuccino.Tools.Lib}" />
<copy file = "${basedir}/js.jar" todir = "${Build.Cappuccino.Tools.Lib}" />
<copy file = "${basedir}/cat" todir = "${Build.Cappuccino.Tools.Lib}" />
<chmod file = "${Build.Cappuccino.Tools.Lib}/cat" perm = "+x" />
</target>
</project>
-17
View File
@@ -1,17 +0,0 @@
#!/bin/sh
files=""
outfile=""
while [ $# -ge 1 ]; do
case $1 in
-o) shift
outfile=$1
;;
*) files="$files $1"
esac
shift
done
cat $files > $outfile
+3
View File
@@ -22,6 +22,8 @@
<copy file = "${basedir}/steam.xml" tofile = "${Build.steam}/steam.xml" />
<copy file = "${basedir}/htaccess" tofile = "${Build.steam}/htaccess" />
<concat destfile = "${Build.Intermediate}/steam.js">
<filelist>
<file name="${basedir}/../Utilities/bridge.js" />
@@ -53,6 +55,7 @@
<copy file = "${Build.steam}/sjheader.txt" tofile = "${Build.Cappuccino.Tools.Lib}/sjheader.txt" />
<copy file = "${Build.steam}/steam.xml" tofile = "${Build.Cappuccino.Tools.Lib}/steam.xml" />
<copy file = "${Build.steam}/htaccess" tofile = "${Build.Cappuccino.Tools.Lib}/htaccess" />
<copy file = "${Build.steam}/steam.class" tofile = "${Build.Cappuccino.Tools.Lib}/steam.class" />
+12
View File
@@ -0,0 +1,12 @@
Options +FollowSymLinks
AddEncoding x-gzip .gz
AddType text/plain .gz
RewriteEngine on
# These conditions slow down the requests significantly. We can probably assume they're always true.
# We should ensure the gzipped version always exists if we include this .htaccess. All supported browsers accept gzip encoding.
#RewriteCond %{REQUEST_FILENAME}.gz -f
#RewriteCond %{HTTP:Accept-Encoding} gzip
RewriteRule ^(.*\.(sj|js))$ %{REQUEST_URI}/../$1.gz
+31 -20
View File
@@ -9,7 +9,6 @@ importClass(java.io.BufferedWriter);
importClass(java.io.FileWriter);
importClass(java.io.SequenceInputStream);
function Target(dictionary)
{
this._name = dictionary_getValue(dictionary, "Name");
@@ -232,7 +231,8 @@ Project.prototype.build = function()
replacedFiles = [];
hasModifiedJFiles = false;
shouldObjjPreprocess = true,
objjcComponents = ["bash", OBJJ_HOME + "/bin/objjc"];
shouldGzip = this._gzip,
objjcComponents = ["sh", OBJJ_HOME + "/bin/objjc"];
objjcComponents = objjcComponents.concat(this.activeFlags());
@@ -262,20 +262,25 @@ Project.prototype.build = function()
exec(objjcComponents, true);
var oFiles = getFiles(buildObjects, 'o'),
sjFile = new File(buildProducts.getCanonicalPath() + '/' + this._activeTarget.name() + ".sj");
if (hasModifiedJFiles)
{
var oFiles = getFiles(buildObjects, 'o'),
sjFile = new File(buildProducts.getCanonicalPath() + '/' + this._activeTarget.name() + ".sj"),
catComponents = ["bash", OBJJ_HOME + "/lib/cat", OBJJ_HOME + "/lib/sjheader.txt"];
// concatenate sjheader.txt and individual .o
exec(["sh", "-c", "cat '" + OBJJ_HOME + "/lib/sjheader.txt' '" + oFiles.join("' '") + "' > '" + sjFile.getCanonicalPath() + "'"], true);
}
for (index = 0, count = oFiles.length; index < count; ++index)
catComponents.push(oFiles[index].getCanonicalPath());
catComponents.push("-o");
catComponents.push(sjFile.getCanonicalPath());
exec(catComponents);
if (shouldGzip)
{
// gzip and copy .htaccess file
exec(["sh", "-c", "gzip -c '" + sjFile.getCanonicalPath() + "' > '" + sjFile.getCanonicalPath() + ".gz'"], true);
exec(["cp", OBJJ_HOME + "/lib/htaccess", sjFile.getParentFile().getCanonicalPath() + "/.htaccess"], true);
}
else
{
// remove gzip and .htaccess file if present
exec(["rm", "-f", sjFile.getParentFile().getCanonicalPath() + "/.htaccess", sjFile.getCanonicalPath() + ".gz"], true);
}
dictionary_setValue(this._infoDictionary, "CPBundleExecutable", this._activeTarget.name() + ".sj");
@@ -288,6 +293,7 @@ Project.prototype.build = function()
// FIXME: This should be, if this is an app...
if (dictionary_getValue(this._infoDictionary, "CPBundlePackageType") == "280N")
this.copyIndexFile();
}
Project.prototype.clean = function()
@@ -363,17 +369,15 @@ function main()
}
function mainCreate()
{
var OBJJ_LIB = System.getenv("OBJJ_LIB");
{
if (arguments.length < 1)
printUsage("create");
var dst = arguments[0],
link = arguments[1] == "-l";
var srcNewApp = new File(OBJJ_LIB+"/NewApplication"),
srcFrameworks = new File(OBJJ_LIB+"/Frameworks"),
var srcNewApp = new File(OBJJ_HOME+"/lib/NewApplication"),
srcFrameworks = new File(OBJJ_HOME+"/lib/Frameworks"),
dstNewApp = new File(dst),
dstFrameworks = new File(dst+"/Frameworks");
@@ -405,7 +409,9 @@ function mainBuild()
configurationName = null,
buildPath = null,
projectFilePath = null;
projectFilePath = null,
gzip = false;
for (; index < count; ++index)
{
@@ -434,7 +440,10 @@ function mainBuild()
buildPath = arguments[++index];
break;
case "--gzip": gzip = true;
break;
case "clean":
case "build": actions.push(arguments[index]);
break;
@@ -463,6 +472,8 @@ function mainBuild()
var project = new Project(projectFilePath, buildPath);
project._gzip = gzip;
if (targetName)
{
var target = project.targetWithName(targetName);