#make the .dll library (xpcom)
echo '*******************************************'
echo '** Using a pre-built dll                 **'
echo '**                                       **'
echo '** To rebuild the windows xpcom dll      **'
echo '** 1. edit the win/makefile.mak          **'
echo '** 2. enter the path to your gecko-sdk   **'
echo '** 3. In cmd box, enter the following:   **'
echo '** 4. nmake cfg=Release makefile.mak     **'
echo '*******************************************'
echo

#copy all files to a temp directory
rm -rf temp
mkdir temp
cp -r common temp
cp -r win temp
cd temp

#remove all svn stuff
echo 'Removing svn stuff'
find . -name "*svn*" |xargs rm -rf

#build the casa.jar
echo 'building casa.jar'
cd common/casajar
zip -rD casa.jar *
mv casa.jar ../.

#copy files to correct location
cd ../..
cp win/Release/MiCASAKeys.dll win/xpi/components/.
cp common/casa.jar win/xpi/chrome/.

#now zip up the xpi
cd win/xpi
echo 'creating XPI'
zip -rD casa4windows.xpi *

# copy xpi to extensions folder
cp casa4windows.xpi ../../../.
cd ../../..

echo 'Done'