3 # Set up paths for finding files.
4 if [ -z "$FEDIR" ]; then FEDIR
=$PWD/..
/resources
; fi
5 if [ -z "$CONFIGDIR" ]; then CONFIGDIR
=$FEDIR/..
/..
/config
; fi
6 if [ -z "$XPIFILES" ]; then XPIFILES
=$PWD/resources
; fi
7 if [ -z "$XPIROOT" ]; then XPIROOT
=$PWD/xpi-tree
; fi
8 if [ -z "$JARROOT" ]; then JARROOT
=$PWD/jar-tree
; fi
9 if [ -z "$PERL" ]; then PERL
=perl
; fi
10 if [ -z "$DEBUG" ]; then DEBUG
=0; fi
22 ## Call this with lots of parameters to run a command, log errors, and abort
23 ## if it fails. Supports redirection if '>' and '<' are passed as arguments,
25 ## safeCommand cmd arg1 arg2 '<' input.file '>' output-file
27 ## Note: only a single input and single output redirection is supported.
29 function safeCommand
()
37 if [ "$LASTP" = "<" ]; then
38 if [ -n "$INF" ]; then
39 echo "ERROR: Multiple input files passed to safeCommand()." >&2
43 elif [ "$LASTP" = ">" ]; then
44 if [ -n "$OUTF" ]; then
45 echo "ERROR: Multiple output files passed to safeCommand()." >&2
49 elif [ "$P" = ">" -o "$P" = "<" ]; then
53 CMD_COUNT
=$
((CMD_COUNT
+1))
58 if [ $DEBUG -gt 0 ]; then
60 showParams
"${CMD[@]}"
62 echo 'OUTPUT :' "$OUTF"
65 touch log.stdout log.stderr
66 if [ -z "$INF" -a -z "$OUTF" ]; then
67 "${CMD[@]}" 1>log.stdout
2>log.stderr
68 elif [ -z "$INF" ]; then
69 "${CMD[@]}" 1> "$OUTF" 2>log.stderr
70 elif [ -z "$OUTF" ]; then
71 "${CMD[@]}" < "$INF" 1>log.stdout
2>log.stderr
73 "${CMD[@]}" < "$INF" 1> "$OUTF" 2>log.stderr
77 if [ $DEBUG -gt 0 ]; then
80 if [ "$EC" != "0" ]; then
84 rm -f log.stdout log.stderr
87 rm -f log.stdout log.stderr
92 ## Begin real program ##
95 if [ "$1" = "clean" ]; then
96 echo -n "Cleaning up files"
108 if ! [ -d "$FEDIR" ]; then
109 echo "ERROR: Base JavaScript Debugger directory (FEDIR) not found."
112 if ! [ -d "$CONFIGDIR" ]; then
113 echo "ERROR: mozilla/config directory (CONFIGDIR) not found."
118 # Extract version number.
119 VERSION
=`cat $FEDIR/../version.txt`
121 if [ -z "$VERSION" ]; then
122 echo "ERROR: Unable to get version number."
126 echo Beginning build of JavaScript Debugger
$VERSION...
129 # Check for existing.
130 if [ -r "venkman-$VERSION.xpi" ]; then
131 echo " WARNING: output XPI will be overwritten."
135 # Check for required directory layouts.
136 echo -n " Checking XPI structure"
138 if ! [ -d xpi-tree
]; then mkdir xpi-tree
; fi
140 if ! [ -d xpi-tree
/chrome
]; then mkdir xpi-tree
/chrome
; fi
142 if ! [ -d xpi-tree
/components
]; then mkdir xpi-tree
/components
; fi
145 echo -n " Checking JAR structure"
147 if ! [ -d jar-tree
]; then mkdir jar-tree
; fi
151 # Make Toolkit updates.
152 echo -n " Updating Toolkit Extension files"
154 safeCommand
$PERL $CONFIGDIR/preprocessor.pl
-DVENKMAN_VERSION=$VERSION "$XPIFILES/install.rdf" '>' "$XPIROOT/install.rdf"
158 # Make Mozilla Suite / SeaMonkey 1.x updates.
159 echo -n " Updating XPFE Extension files"
161 safeCommand
sed "s|@REVISION@|$VERSION|g" '<' "$XPIFILES/install.js" '>' "$XPIROOT/install.js"
163 safeCommand
mv "$FEDIR/content/contents.rdf" "$FEDIR/content/contents.rdf.in"
165 safeCommand
sed "s|@MOZILLA_VERSION@|vnk-$VERSION|g;s|\(chrome:displayName=\)\"[^\"]\{1,\}\"|\1\"JavaScript Debugger $VERSION\"|g" '<' "$FEDIR/content/contents.rdf.in" '>' "$FEDIR/content/contents.rdf"
167 safeCommand
rm "$FEDIR/content/contents.rdf.in"
169 safeCommand
mv "$FEDIR/locale/en-US/contents.rdf" "$FEDIR/locale/en-US/contents.rdf.in"
171 safeCommand
sed "s|@MOZILLA_VERSION@|vnk-$VERSION|g" '<' "$FEDIR/locale/en-US/contents.rdf.in" '>' "$FEDIR/locale/en-US/contents.rdf"
173 safeCommand
rm "$FEDIR/locale/en-US/contents.rdf.in"
178 echo -n " Constructing JAR package"
183 safeCommand
$PERL make-jars.pl
-v -z zip -p preprocessor.pl
-s "$FEDIR" -d "$JARROOT" -- -DVENKMAN_VERSION=$VERSION '<' "$FEDIR/jar.mn"
190 echo -n " Constructing XPI package"
192 safeCommand
cp -v "$JARROOT/venkman.jar" "$XPIROOT/chrome/"
194 safeCommand
cp -v "$FEDIR/../js/venkman-service.js" "$XPIROOT/components/"
196 safeCommand
chmod 664 "$XPIROOT/chrome/venkman.jar"
198 safeCommand
chmod 664 "$XPIROOT/components/venkman-service.js"
202 safeCommand
zip -vr ..
/venkman-
$VERSION.xpi .
-i "*" -x "log*"
207 echo "Build of JavaScript Debugger $VERSION... ALL DONE"