#!/bin/bash

piece=$1
ooo_build_tag=$2

source $OO_TOOLSDIR/piece/sys-setup

# sort by lang
$OO_TOOLSDIR/piece/sort-l10n $piece $ooo_build_tag $DESTDIR

# put the rest into the common file list
$OO_TOOLSDIR/piece/merge-file-lists "files-$piece.txt" $DESTDIR/gid_*
# main_transform.xsl will be in l10n-extras
remove_file "files-$piece.txt" $OO_INSTDIR/basis3.0/help/main_transform.xsl
# FIXME: hid.lst will be in testtool package (built in ?)
remove_file "files-$piece.txt" $OO_INSTDIR/basis3.0/program/hid.lst
# non-wanted mess
remove_dir "files-$piece.txt" $OO_INSTDIR/ure

# FIXME: is a generic solution possible?
# remove the duplicated .zip archives
rm -rf $DESTDIR$OO_SOLVERDIR/pck/*.zip

# move the stuff to /usr/share when enabled
if test "$OOO_BUILD_NOARCH" = 'YES' ; then
    $OO_TOOLSDIR/piece/install-l10n-helper $piece $ooo_build_tag "$DESTDIR" files-$piece-*.txt
    $OO_TOOLSDIR/piece/install-devel-helper $piece $ooo_build_tag
fi
