| 1 |
#!/bin/bash |
| 2 |
|
| 3 |
SHORTNAME="bidimailui" |
| 4 |
VERSION="0.9.7" |
| 5 |
TARGET="$1" |
| 6 |
case "$TARGET" in |
| 7 |
tbird | tb | thunderbird) |
| 8 |
TARGET=tbird |
| 9 |
PREPROCESSOR_PARAMS="-DMOZ_THUNDERBIRD" |
| 10 |
;; |
| 11 |
suitelegacy | sl | slegacy) |
| 12 |
TARGET=suitelegacy |
| 13 |
PREPROCESSOR_PARAMS="-DMOZ_SUITE -DMOZ_SUITE_LEGACY" |
| 14 |
;; |
| 15 |
suiterunner | sr | srunner) |
| 16 |
TARGET=suiterunner |
| 17 |
PREPROCESSOR_PARAMS="-DMOZ_SUITE -DMOZ_SUITERUNNER" |
| 18 |
;; |
| 19 |
*) |
| 20 |
echo "please specify either thunderbird, suitelegacy or suiterunner" |
| 21 |
exit 1 |
| 22 |
;; |
| 23 |
esac |
| 24 |
|
| 25 |
if [ -z "$EXTENSION_RELEASE" ]; then |
| 26 |
VERSION="${VERSION}b" |
| 27 |
fi |
| 28 |
|
| 29 |
# all arguments after the target app are #define 'd in the XUL preprocessor, |
| 30 |
# with a DEBUG_ prefix; so if you want to, say, have debugging code specific |
| 31 |
# to the function myFancyFunc(), write it like so: |
| 32 |
# |
| 33 |
# #ifdef DEBUG_myFancyFunc |
| 34 |
# debugging code etc. etc. |
| 35 |
# #endif |
| 36 |
# |
| 37 |
# then invoke |
| 38 |
# |
| 39 |
# dobuild tbird myFancyFunc |
| 40 |
# |
| 41 |
# to have your debugging code enabled |
| 42 |
|
| 43 |
|
| 44 |
shift 1 |
| 45 |
|
| 46 |
if [ -n "$1" ]; then |
| 47 |
PREPROCESSOR_PARAMS+=" -DDEBUG" |
| 48 |
while [ -n "$1" ]; do |
| 49 |
PREPROCESSOR_PARAMS="$PREPROCESSOR_PARAMS -DDEBUG_$1" |
| 50 |
shift 1 |
| 51 |
done |
| 52 |
else |
| 53 |
PREPROCESSOR_PARAMS+=" --no-line-comments" |
| 54 |
fi |
| 55 |
|
| 56 |
PREPROCESSOR_PARAMS="$PREPROCESSOR_PARAMS -DVERSION=$VERSION" |
| 57 |
echo -e "Building the XPI with the following definitions:\n\n$PREPROCESSOR_PARAMS\n" |
| 58 |
BUILDDIR="build/$TARGET" |
| 59 |
XPINAME="${SHORTNAME}_${VERSION}_${TARGET}.xpi" |
| 60 |
LINKNAME="${SHORTNAME}_${TARGET}.xpi" |
| 61 |
BUILDTOOLSDIR="../buildtools" |
| 62 |
export PERL5LIB="`pwd`/$BUILDTOOLSDIR" |
| 63 |
|
| 64 |
# TODO: split builddir by /'s and try to create everything along the path |
| 65 |
if [ ! -d build ] ; then mkdir build; fi |
| 66 |
if [ ! -d $BUILDDIR ] ; then mkdir $BUILDDIR; else rm -rf $BUILDDIR/*; fi |
| 67 |
|
| 68 |
$BUILDTOOLSDIR/preprocessor.pl $PREPROCESSOR_PARAMS jar.mn > $BUILDDIR/jar.mn |
| 69 |
$BUILDTOOLSDIR/make-jars.pl -v -z zip -p "$BUILDTOOLSDIR/preprocessor.pl $PREPROCESSOR_PARAMS" -s . -d . < $BUILDDIR/jar.mn || exit |
| 70 |
echo -e "\nJAR files ready\n" |
| 71 |
$BUILDTOOLSDIR/preprocessor.pl $PREPROCESSOR_PARAMS install.rdf > $BUILDDIR/install.rdf |
| 72 |
rm -rf bidimailpack |
| 73 |
rm -rf bidimailpack-mac-skin |
| 74 |
rm -f installed-chrome.txt |
| 75 |
|
| 76 |
mkdir $BUILDDIR/defaults |
| 77 |
mkdir $BUILDDIR/defaults/preferences |
| 78 |
cp defaults/preferences/bidimailui.js $BUILDDIR/defaults/preferences |
| 79 |
mkdir $BUILDDIR/chrome |
| 80 |
mv bidimailpack.jar $BUILDDIR/chrome/bidimailpack.jar |
| 81 |
|
| 82 |
case "$TARGET" in |
| 83 |
tbird) |
| 84 |
mkdir $BUILDDIR/platform/ |
| 85 |
mkdir $BUILDDIR/platform/Darwin |
| 86 |
mkdir $BUILDDIR/platform/Darwin/chrome |
| 87 |
mv bidimailpack-mac-skin.jar $BUILDDIR/platform/Darwin/chrome |
| 88 |
$BUILDTOOLSDIR/preprocessor.pl $PREPROCESSOR_PARAMS chrome.manifest > $BUILDDIR/chrome.manifest |
| 89 |
cp platform/Darwin/chrome.manifest $BUILDDIR/platform/Darwin/chrome.manifest |
| 90 |
cd $BUILDDIR |
| 91 |
zip -r $XPINAME \ |
| 92 |
chrome/bidimailpack.jar \ |
| 93 |
defaults/ \ |
| 94 |
platform/Darwin/chrome.manifest \ |
| 95 |
platform/Darwin/chrome/bidimailpack-mac-skin.jar \ |
| 96 |
install.rdf \ |
| 97 |
chrome.manifest || exit |
| 98 |
;; |
| 99 |
suitelegacy) |
| 100 |
$BUILDTOOLSDIR/preprocessor.pl $PREPROCESSOR_PARAMS install.js > $BUILDDIR/install.js |
| 101 |
cd $BUILDDIR |
| 102 |
zip -r $XPINAME \ |
| 103 |
chrome/bidimailpack.jar \ |
| 104 |
defaults/ \ |
| 105 |
install.rdf \ |
| 106 |
install.js || exit |
| 107 |
;; |
| 108 |
suiterunner) |
| 109 |
$BUILDTOOLSDIR/preprocessor.pl $PREPROCESSOR_PARAMS chrome.manifest > $BUILDDIR/chrome.manifest |
| 110 |
cd $BUILDDIR |
| 111 |
zip -r $XPINAME \ |
| 112 |
chrome/bidimailpack.jar \ |
| 113 |
defaults/ \ |
| 114 |
install.rdf \ |
| 115 |
chrome.manifest || exit |
| 116 |
;; |
| 117 |
esac |
| 118 |
ln $XPINAME $LINKNAME |
| 119 |
echo -e "\nXPI ready\n" |