#!/bin/sh

# build rpms ; passing -l option will build language packs too

# make sure we're running in the right directory

ooobuildbindir=`dirname "$0"`
[ "$ooobuildbindir" != "" ] && cd "$ooobuildbindir"

#
# See setup for user tweakables.
#
. ./setup
. $OOBUILDDIR/*.[sS]et.sh
. ./setup

# System Mozilla
if test "$SYSTEM_MOZILLA" = "YES"; then
    export LD_LIBRARY_PATH="$MOZ_LIB":"$LD_LIBRARY_PATH"
fi

# Create RPMs
# http://installation.openoffice.org/how_to_create_native_installer.html
cd $OOBUILDDIR/instsetoo_native/util
dmake openoffice || exit 1
if test "$1" = "-l" ; then
  dmake ooolanguagepack || exit 1
fi

# Summary
echo
echo "Packaging succeeded, the rpms are stored in:"
echo "$OOBUILDDIR/instsetoo_native/*.pro/OpenOffice/install/*/RPMS"
ls -d "$OOBUILDDIR/instsetoo_native/*.pro/OpenOffice/install/*/RPMS"
