diff --git a/Tools/Install/install-tools b/Tools/Install/install-tools
index 7baa38b5d..a7f833263 100755
--- a/Tools/Install/install-tools
+++ b/Tools/Install/install-tools
@@ -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 <
-
-
-
diff --git a/Tools/Utilities/cat b/Tools/Utilities/cat
deleted file mode 100755
index 58aec1794..000000000
--- a/Tools/Utilities/cat
+++ /dev/null
@@ -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
diff --git a/Tools/steam/build.xml b/Tools/steam/build.xml
index f4cbf2b1b..375a41da8 100644
--- a/Tools/steam/build.xml
+++ b/Tools/steam/build.xml
@@ -22,6 +22,8 @@
+
+
@@ -53,6 +55,7 @@
+
diff --git a/Tools/steam/htaccess b/Tools/steam/htaccess
new file mode 100644
index 000000000..6afc67f10
--- /dev/null
+++ b/Tools/steam/htaccess
@@ -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
diff --git a/Tools/steam/steam.js b/Tools/steam/steam.js
index 578ca94e4..d326c6649 100644
--- a/Tools/steam/steam.js
+++ b/Tools/steam/steam.js
@@ -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);