#!/bin/sh

################################################################################
#      This file is part of OpenELEC - http://www.openelec.tv
#      Copyright (C) 2009-2011 Stephan Raue (stephan@openelec.tv)
#
#  This Program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 2, or (at your option)
#  any later version.
#
#  This Program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with OpenELEC.tv; see the file COPYING.  If not, write to
#  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
#  http://www.gnu.org/copyleft/gpl.html
################################################################################

. config/options $1

mkdir -p $INSTALL/usr/lib
  cp -P $PKG_BUILD/src/.libs/libX11*.so* $INSTALL/usr/lib
  rm -rf $INSTALL/usr/lib/libX11*.so*T

mkdir -p $INSTALL/usr/lib/X11
  cp -P $PKG_BUILD/src/xcms/Xcms.txt $INSTALL/usr/lib/X11

mkdir -p $INSTALL/usr/lib/X11/locale/common
  cp -P $PKG_BUILD/modules/im/ximcp/.libs/ximcp.so* $INSTALL/usr/lib/X11/locale/common
  rm -rf $INSTALL/usr/lib/X11/locale/common/ximcp.so*T
  cp -P $PKG_BUILD/modules/lc/Utf8/.libs/xlcUTF8Load.so* $INSTALL/usr/lib/X11/locale/common
  rm -rf $INSTALL/usr/lib/X11/locale/common/xlcUTF8Load.so*T
  cp -P $PKG_BUILD/modules/lc/def/.libs/xlcDef.so* $INSTALL/usr/lib/X11/locale/common
  rm -rf $INSTALL/usr/lib/X11/locale/common/xlcDef.so*T
  cp -P $PKG_BUILD/modules/lc/gen/.libs/xlibi18n.so* $INSTALL/usr/lib/X11/locale/common
  rm -rf $INSTALL/usr/lib/X11/locale/common/xlibi18n.so*T
  cp -P $PKG_BUILD/modules/lc/xlocale/.libs/xlocale.so* $INSTALL/usr/lib/X11/locale/common
  rm -rf $INSTALL/usr/lib/X11/locale/common/xlocale.so*T
  cp -P $PKG_BUILD/modules/om/generic/.libs/xomGeneric.so* $INSTALL/usr/lib/X11/locale/common
  rm -rf $INSTALL/usr/lib/X11/locale/common/xomGeneric.so*T

mkdir -p $INSTALL/usr/share/X11/locale
  cp $PKG_BUILD/src/XErrorDB $INSTALL/usr/share/X11/

mkdir -p $INSTALL/usr/share/X11/locale
  cp $PKG_BUILD/nls/compose.dir $INSTALL/usr/share/X11/locale
  cp $PKG_BUILD/nls/locale.alias $INSTALL/usr/share/X11/locale
  cp $PKG_BUILD/nls/locale.dir $INSTALL/usr/share/X11/locale

  for i in `find $PKG_BUILD/nls/* -type d`; do
    LOCALE=`basename $i`
    mkdir -p $INSTALL/usr/share/X11/locale/$LOCALE
      cp $PKG_BUILD/nls/$LOCALE/Compose $INSTALL/usr/share/X11/locale/$LOCALE
      cp $PKG_BUILD/nls/$LOCALE/XI18N_OBJS $INSTALL/usr/share/X11/locale/$LOCALE
      cp $PKG_BUILD/nls/$LOCALE/XLC_LOCALE $INSTALL/usr/share/X11/locale/$LOCALE
  done
