cd "$SOURCE_DIRECTORY/mozilla"  &&

MOZILLA_FIVE_HOME="$INSTALL_ROOT/usr/lib/xulrunner-1.9" &&

make install &&

#
# Script to set MOZILLA_FIVE_HOME
#
cp  ${SCRIPT_DIRECTORY}/${SPELL}.sh  $INSTALL_ROOT/etc/profile.d &&

#
# Create symlink from NSS Root CA store, if it exists.  NSS requires this
# to be in the same directory as the current application binary.  See:
# http://www.mozilla.org/projects/security/pki/nss/loadable_certs.html
# https://bugzilla.mozilla.org/show_bug.cgi?id=128290
# Only create if $MOZILLA_HOME/libnssckbi.so does not exist or is already a
# symlink.
#
if  test  -f   $INSTALL_ROOT/usr/lib/libnssckbi.so;  then
  if  !  test  -f   $MOZILLA_FIVE_HOME/libnssckbi.so  ||
         test  -h   $MOZILLA_FIVE_HOME/libnssckbi.so; then
    ln -sf $TRACK_ROOT/usr/lib/libnssckbi.so  $MOZILLA_FIVE_HOME/libnssckbi.so
  fi                                                                  
fi  &&
if [[ "$XULRUNNER_NULLPLUGIN" == "n" ]]
then
   rm $MOZILLA_FIVE_HOME/plugins/libnullplugin.so
fi

#Need ln -s to for some apps
ln -s $INSTALL_ROOT/usr/lib/xulrunner-1.9/ $INSTALL_ROOT/usr/lib/xulrunner  &&

#libxul.pc needs to include an idl compiler directory
sed -i 's:\/xulrunner-1\.9\/idl:\/xulrunner-1\.9\/idl\/stable:' ${INSTALL_ROOT}/usr/lib/pkgconfig/libxul.pc &&
sed -i '5ilibdir=/usr/lib/xulrunner-1.9' ${INSTALL_ROOT}/usr/lib/pkgconfig/libxul.pc 
