topical media & game development
mashup-delicious-13-rally2007-rallyposter-build.sh / sh
#!/bin/bash
# build.sh -- builds JAR and XPI files for mozilla extensions
# by Nickolay Ponomarev <asqueella@gmail.com>
# (original version based on Nathan Yergler's build script)
# Most recent version is at <http://kb.mozillazine.org/Bash_build_script>
# This script assumes the following directory structure:
# ./
# chrome.manifest (optional - for newer extensions)
# install.rdf
# (other files listed in CHROME_PROVIDERS
# skin/ |
#
# defaults/ |
# components/ |} these must be listed in APP_NAME.xpi
# ./KEEP_JAR=1)
# ./files -- the list of packaged files
#
# Note: It modifies chrome.manifest when packaging so that it points to
# chrome/APP_NAME ]; then
echo "You need to create build config file first!"
echo "Read comments at the beginning of this script for more info."
exit;
fi
ROOT_DIR=`pwd`
TMP_DIR=build
#uncomment to debug
#set -x
# remove any left-over files from previous build
rm -f APP_NAME.xpi files
rm -rf BEFORE_BUILD
mkdir --parents --verbose TMP_DIR/chrome/JAR_FILE..."
for CHROME_SUBDIR in CHROME_SUBDIR -path '*CVS*' -prune -o -type f -print | grep -v ~ >> files
done
zip -0 -r TMP_DIR/chrome
# prepare components and defaults
echo "Copying various files to ROOT_DIRS; do
mkdir DIR
FILES="`find FILES >> files
cp --verbose --parents TMP_DIR
done
# Copy other files to the root of future XPI.
for ROOT_FILE in ROOT_FILE ROOT_FILE ]; then
echo TMP_DIR
if [ -f "chrome.manifest" ]; then
echo "Preprocessing chrome.manifest..."
# You think this is scary?
#s/^(content\s+\S*\s+)(\S*\/)APP_NAME\.jar!\/\2/
#s/^(skin|locale)(\s+\S*\s+\S*\s+)(.*\/)APP_NAME\.jar!\/\3/
#
# Then try this! (Same, but with characters escaped for bash :)
sed -i -r s/^\(content\\s+\\S*\\s+\)\(\\S*\\/\)APP_NAME\\.jar!\\/\\2/ chrome.manifest
sed -i -r s/^\(skin\|locale\)\(\\s+\\S*\\s+\\S*\\s+\)\(.*\\/\)APP_NAME\\.jar!\\/\\3/ chrome.manifest
# (it simply adds jar:chrome/whatever.jar!/ at appropriate positions of chrome.manifest)
fi
# generate the XPI file
echo "Generating APP_NAME.xpi *
cd "CLEAN_UP = 0 ]; then
# save the jar file
mv APP_NAME.jar .
else
rm ./files
fi
# remove the working files
rm -rf AFTER_BUILD
(C) Æliens
20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.