################################################################################
#      This file is part of OpenELEC - http://www.openelec.tv
#      Copyright (C) 2009-2012 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, 51 Franklin Street, Suite 500, Boston, MA 02110, USA.
#  http://www.gnu.org/copyleft/gpl.html
################################################################################

PKG_NAME="xorg-server"
PKG_VERSION="1.12.4"
PKG_REV="1"
PKG_ARCH="any"
PKG_LICENSE="OSS"
PKG_SITE="http://www.X.org"
PKG_URL="http://xorg.freedesktop.org/archive/individual/xserver/$PKG_NAME-$PKG_VERSION.tar.bz2"
PKG_DEPENDS="libpciaccess libX11 libXfont libdrm openssl freetype pixman systemd"
PKG_BUILD_DEPENDS="toolchain util-macros font-util fontsproto randrproto recordproto renderproto dri2proto fixesproto damageproto scrnsaverproto videoproto inputproto xf86dgaproto xf86vidmodeproto xf86driproto xf86miscproto glproto libpciaccess libX11 libXfont libxkbfile libdrm openssl freetype pixman fontsproto systemd"
PKG_PRIORITY="optional"
PKG_SECTION="x11/xserver"
PKG_SHORTDESC="xorg-server: The Xorg X server"
PKG_LONGDESC="Xorg is a full featured X server that was originally designed for UNIX and UNIX-like operating systems running on Intel x86 hardware."
PKG_IS_ADDON="no"

PKG_AUTORECONF="yes"

get_graphicdrivers
if [ "$COMPOSITE_SUPPORT" = "yes" ]; then
  PKG_DEPENDS="$PKG_DEPENDS libXcomposite"
  PKG_BUILD_DEPENDS="$PKG_BUILD_DEPENDS libXcomposite"
fi

if [ "$XINERAMA_SUPPORT" = "yes" ]; then
  PKG_DEPENDS="$PKG_DEPENDS libXinerama"
  PKG_BUILD_DEPENDS="$PKG_BUILD_DEPENDS libXinerama"
fi

if [ "$OPENGL" = "Mesa" ]; then
  PKG_DEPENDS="$PKG_DEPENDS Mesa glu"
  PKG_BUILD_DEPENDS="$PKG_BUILD_DEPENDS Mesa glu"
fi

# Additional packages we need for using xorg-server:
# Fonts
  PKG_DEPENDS="$PKG_DEPENDS encodings font-xfree86-type1 font-bitstream-type1 font-misc-misc"

# Server
  PKG_DEPENDS="$PKG_DEPENDS xkeyboard-config xkbcomp"

# Drivers
  PKG_DEPENDS="$PKG_DEPENDS xf86-input-evdev"

  for drv in $XORG_DRIVERS; do
    PKG_DEPENDS="$PKG_DEPENDS xf86-video-$drv"
  done

# Tools
  PKG_DEPENDS="$PKG_DEPENDS pciutils xrandr setxkbmap"

if [ -n "$WINDOWMANAGER" -a "$WINDOWMANAGER" != "none" ]; then
  PKG_DEPENDS="$PKG_DEPENDS $WINDOWMANAGER"
fi

if [ "$DEVTOOLS" = yes ]; then
  PKG_DEPENDS="$PKG_DEPENDS mrxvt"
fi
