#!/bin/sh

. config/options

cd $BUILD/$1*

do_install usr/bin
do_install usr/lib/xine

mkdir -p $INSTALL/usr/lib/vdr
cp -P libvdr-xineliboutput.so* libxineliboutput*.so* \
  $INSTALL/usr/lib/vdr

for loc in $INCLUDED_LOCALES; do
  LOCALE=`echo $loc|cut -f1 -d.`
  if [ -d locale/$LOCALE ]; then
    mkdir -p $INSTALL/usr/share/locale/$LOCALE
    cp -PR locale/$LOCALE/* $INSTALL/usr/share/locale/$LOCALE/
  fi
done

mkdir -p $INSTALL/etc/vdr/plugins/xineliboutput
cp -P examples/allowed_hosts.conf $INSTALL/etc/vdr/plugins/xineliboutput
[ "$SERVICES" = yes ] && echo '0.0.0.0/0' >>$INSTALL/etc/vdr/plugins/xineliboutput/allowed_hosts.conf

NAME=`echo $1 | sed s/vdr-//`
mkdir -p $INSTALL/etc/vdr/plugins.d
echo "PLUGIN=${NAME}" > $INSTALL/etc/vdr/plugins.d/50_$NAME
echo "OPTIONS=\"--local=none --remote=37890\"" >> $INSTALL/etc/vdr/plugins.d/50_$NAME
echo "ENABLED=yes" >> $INSTALL/etc/vdr/plugins.d/50_$NAME

if pkg_uses $1 bluray; then
  cd xine/BluRay
  do_install usr/lib/xine
fi

exit 0
