#!/bin/bash
# install bash script - invoked from package-ooo

ln -sf . "$OOINSTDIR/solver/$INPATH"

# environment
cp $OOBUILDDIR/*.[sS]et.sh $DEST

# openoffice lst
cp -R $OOBUILDDIR/instsetoo_native $DEST

# setup_native - not built; odd deps ...
cp $OOBUILDDIR/../setup_native/source/packinfo/*.txt $DEST/bin

# autoconf stuff (needed for SDK)
cp $OOBUILDDIR/config.guess  $DEST/bin
cp $OOBUILDDIR/config.sub  $DEST/bin

# ooo-build
mkdir -p $OOINSTDIR/ooo-build/bin
mkdir -p $OOINSTDIR/ooo-build/patches
mkdir -p $OOINSTDIR/ooo-build/po
mkdir -p $OOINSTDIR/ooo-build/desktop
mkdir -p $OOINSTDIR/ooo-build/man
cp -a $TOOLSDIR/bin/* $OOINSTDIR/ooo-build/bin || exit 1;
cp -a $TOOLSDIR/patches/* $OOINSTDIR/ooo-build/patches || exit 1;
cp -a $TOOLSDIR/po/ooo-build-*.sdf $OOINSTDIR/ooo-build/po || exit 1;
cp -a $TOOLSDIR/desktop/* $OOINSTDIR/ooo-build/desktop || exit 1;
cp -a $TOOLSDIR/man/* $OOINSTDIR/ooo-build/man || exit 1;

# copy pieces of interest into src to be moved out later ...
echo "copy source pieces"
mkdir -p $OOINSTDIR/ooo-build/src
cp -a \
   $TOOLSDIR/src/*.dic \
   $TOOLSDIR/src/*.bmp \
   $TOOLSDIR/src/*.config.in \
   $TOOLSDIR/src/*.pc.in \
   $TOOLSDIR/src/*.png \
   $TOOLSDIR/src/*.jpg \
   $TOOLSDIR/src/*.patch \
   $TOOLSDIR/src/*.odb \
   $TOOLSDIR/src/acor*.dat \
   $TOOLSDIR/src/sg3.* \
   $TOOLSDIR/src/sofficerc-upstream \
   $TOOLSDIR/src/default_images \
   $TOOLSDIR/src/helpcontent2 \
   $TOOLSDIR/src/icons \
   $TOOLSDIR/src/layout \
   $OOINSTDIR/ooo-build/src || exit 1;
# src/sdf
mkdir -p $OOINSTDIR/ooo-build/src/sdf
cp -a \
    $TOOLSDIR/src/sdf/*.sdf \
    $TOOLSDIR/src/sdf/README \
    $OOINSTDIR/ooo-build/src/sdf || exit 1;

# branding stuff should go into noarch path
if test "$OOO_BUILD_NOARCH" = 'YES' ; then
    OO_INSTDIR_SHARE=`echo $OOINSTDIR | sed -e "s|lib6\?4\?|share|"`
    mkdir -p $OO_INSTDIR_SHARE/ooo-build/src
    mv \
	$OOINSTDIR/ooo-build/src/sofficerc-upstream \
	$OO_INSTDIR_SHARE/ooo-build/src || exit 1;
fi

find $OOINSTDIR/ooo-build -depth -name "CVS" -type d -exec rm -rf {} \;
find $OOINSTDIR/ooo-build -name "*.orig" -exec rm -rf {} \;
find $OOINSTDIR/ooo-build -type f -exec chmod go-w {} \;

echo "done bootstrap specific install"
