make_normal  &&

MOZILLA_HOME=$INSTALL_ROOT/usr/lib/icecat &&

#
# everything coming into /usr/lib/icecat-${VERSION/rc*}/
# must actually go to /usr/lib/icecat/
#
mkdir -p $MOZILLA_HOME &&
ln -fns $MOZILLA_HOME $MOZILLA_HOME-${VERSION/rc*} &&
mkdir -p $INSTALL_ROOT/usr/share/idl/icecat &&
ln -fns $TRACK_ROOT/usr/share/idl/icecat \
        $INSTALL_ROOT/usr/share/idl/icecat-${VERSION/rc*} &&

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_HOME/libnssckbi.so  ||
         test  -h   $MOZILLA_HOME/libnssckbi.so; then
    ln -sf $TRACK_ROOT/usr/lib/libnssckbi.so  $MOZILLA_HOME/libnssckbi.so
  fi                                                                  
fi  &&
if [[ "$ICECAT_NULLPLUGIN" == "n" ]]
then
   rm $MOZILLA_HOME/plugins/libnullplugin.so
fi  &&

# make the pkgconfig files reference the nspr from the standalone nspr spell
sedit  's/nspr/mozilla-nspr/'  ${INSTALL_ROOT}/usr/lib/pkgconfig/icecat-js.pc  &&
sedit  's/nspr/mozilla-nspr/'  ${INSTALL_ROOT}/usr/lib/pkgconfig/icecat-nss.pc  &&
sedit  's/nspr/mozilla-nspr/'  ${INSTALL_ROOT}/usr/lib/pkgconfig/icecat-xpcom.pc  &&

#
# install icecat script so it loads properly even if MOZILLA_FIVE_HOME is
# not set or set to a different mozilla/firefox directory
#
install  -m  755  -o  root  -g  root  $SCRIPT_DIRECTORY/icecat  \
         $INSTALL_ROOT/usr/bin
