#!/bin/sh

. config/options $1

XORG_SRC="$PKG_BUILD/hw/xfree86"

get_graphicdrivers

if [ "$XINERAMA_SUPPORT" = "yes" ]; then
  XORG_XINERAMA="--enable-xinerama"
else
  XORG_XINERAMA="--disable-xinerama"
fi

cd $PKG_BUILD
./configure --host=$TARGET_NAME \
            --build=$HOST_NAME \
            --prefix=/usr \
            --sysconfdir=/etc \
            --localstatedir=/var \
            --datarootdir=/usr/share \
            --disable-static \
            --enable-shared \
            --disable-debug \
            --disable-builddocs \
            --disable-strict-compilation \
            --enable-largefile \
            --enable-visibility \
            --enable-pc98=auto \
            --enable-install-libxf86config \
            --disable-xselinux \
            --with-pic \
            --enable-aiglx \
            --enable-glx-tls \
            --enable-registry \
            --disable-composite \
            $XORG_XINERAMA \
            --enable-mitshm \
            --disable-xres \
            --disable-record \
            --enable-xv \
            --disable-xvmc \
            --enable-dga \
            --disable-screensaver \
            --disable-xdmcp \
            --disable-xdm-auth-1 \
            --enable-glx \
            --enable-dri \
            --enable-dri2 \
            --enable-xf86vidmode \
            --enable-xace \
            --disable-xcsecurity \
            --disable-xcalibrate \
            --disable-tslib \
            --enable-dbe \
            --disable-xf86bigfont \
            --enable-dpms \
            --enable-config-udev \
            --disable-config-dbus \
            --disable-config-hal \
            --enable-xfree86-utils \
            --enable-xorg \
            --disable-windowswm \
            --disable-dmx \
            --disable-xvfb \
            --disable-xnest \
            --disable-xquartz \
            --disable-standalone-xpbproxy \
            --disable-xwin \
            --disable-kdrive \
            --disable-xephyr \
            --disable-xfake \
            --enable-xfbdev \
            --disable-install-setuid \
            --disable-secure-rpc \
            --with-int10=x86emu \
            --disable-ipv6 \
            --with-gnu-ld \
            --with-sha1=libcrypto \
            --with-os-vendor="OpenELEC.tv" \
            --with-module-dir=$XORG_PATH_MODULES \
            --with-xkb-path=$XORG_PATH_XKB \
            --with-xkb-output=/var/cache/xkb \
            --with-log-dir=/var/log \
            --with-dri-driver-path=$XORG_PATH_DRI \
            --with-fontrootdir=$XORG_PATH_FONTS \
            --with-default-font-path="$XORG_PATH_FONTS/misc,built-ins"

make

make DESTDIR=$SYSROOT_PREFIX install
