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