#set -x
# remove any left-over files from previous build
-rm $APP_NAME.jar
-rm $APP_NAME.xpi
-rm files
-rm -rf $TMP_DIR
+rm $APP_NAME.jar 2>/dev/null
+rm $APP_NAME.xpi 2>/dev/null
+rm files 2>/dev/null
+rm -rf $TMP_DIR 2>/dev/null
-vi install.rdf content/about.xul
+#vi install.rdf content/about.xul
$BEFORE_BUILD
+VERSION=`head -1 version`
+
+echo "Build for version $VERSION..."
+
+
mkdir -pv $TMP_DIR/chrome
+mkdir -pv $TMP_DIR/chrome-tmp
# generate the JAR file, excluding CVS and temporary files
JAR_FILE=$TMP_DIR/chrome/$APP_NAME.jar
-echo "Generating $JAR_FILE..."
for CHROME_SUBDIR in $CHROME_PROVIDERS; do
- find $CHROME_SUBDIR -path '*CVS*' -prune -o -type f -print | grep -v \~ >> files
+ cp -r $CHROME_SUBDIR $TMP_DIR/chrome-tmp/
done
-zip -0 -r $JAR_FILE `cat files`
# The following statement should be used instead if you don't wish to use the JAR file
#cp --verbose --parents `cat files` $TMP_DIR/chrome
# prepare components and defaults
echo "Copying various files to $TMP_DIR folder..."
for DIR in $ROOT_DIRS; do
- mkdir $TMP_DIR/$DIR
FILES="`find $DIR -path '*CVS*' -prune -o -type f -print | grep -v \~`"
echo $FILES >> files
- cp -v -r $DIR $TMP_DIR
+ cp -r $DIR $TMP_DIR
done
+# Remove CVS dirs
+echo `pwd`
+echo $TMP_DIR
+find $TMP_DIR -path '*CVS*' -type d -print0 | xargs -0 rm -rf
+
# Copy other files to the root of future XPI.
for ROOT_FILE in $ROOT_FILES install.rdf chrome.manifest; do
cp -v $ROOT_FILE $TMP_DIR
if [ -f "chrome.manifest" ]; then
echo "Preprocessing chrome.manifest..."
+
+ perl -pi -e "s/^(content\s+\S*\s+)(\S*\/)$/\1jar:chrome\/$APP_NAME\.jar!\/\\2/g" chrome.manifest
+ perl -pi -e "s/^(skin|locale)(\s+\S*\s+\S*\s+)(.*\/)$/\1\2jar:chrome\/$APP_NAME\.jar!\/\3/g" chrome.manifest
+
+ cat chrome.manifest
+
# You think this is scary?
#s/^(content\s+\S*\s+)(\S*\/)$/\1jar:chrome\/$APP_NAME\.jar!\/\2/
#s/^(skin|locale)(\s+\S*\s+\S*\s+)(.*\/)$/\1\2jar:chrome\/$APP_NAME\.jar!\/\3/
# (it simply adds jar:chrome/whatever.jar!/ at appropriate positions of chrome.manifest)
fi
+# updating version information - added jkkn
+find . -type f \( -name "*.js" -or -name "*.xul" -or -name "*.rdf" \) | while read y; do
+perl -pi -e "s/\\\$\{VERSION}/$VERSION/g" $y;
+done
+
+echo "Generating $JAR_FILE..."
+cd chrome-tmp
+zip -0 -r ../../$JAR_FILE *
+cd ..
+rm -rf chrome-tmp
+
# generate the XPI file
echo "Generating $APP_NAME.xpi..."
zip -r ../$APP_NAME.xpi *
# remove the working files
rm -rf $TMP_DIR
-cp -v tv2developer.xpi /sites/jkkndk/www.jkkn.net/webroot/tv2developer/
-vi /sites/jkkndk/www.jkkn.net/webroot/tv2developer/update.rdf
+WEBPATH=/sites/jkkndk/www.jkkn.net/webroot/tv2developer/
+cp -v tv2developer.xpi $WEBPATH
+cp -R webroot/ $WEBPATH
+find $WEBPATH -path '*CVS*' -type d -print0 | xargs -0 rm -rf
+find $WEBPATH -type f \( -name "*.html" -or -name "*.php" -or -name "*.rdf" \) | while read y; do
+ perl -pi -e "s/\\\${VERSION}/$VERSION/g" $y;
+done
echo "Done!"
$AFTER_BUILD