#!/bin/sh

. config/options

$SCRIPTS/build expat
$SCRIPTS/build glproto
$SCRIPTS/build dri2proto
$SCRIPTS/build libdrm
$SCRIPTS/build libXext
$SCRIPTS/build libXdamage
$SCRIPTS/build libXfixes
$SCRIPTS/build libXxf86vm
$SCRIPTS/build libxcb
$SCRIPTS/build libX11

get_graphicdrivers

cd $PKG_BUILD
HOST_CC=$HOST_CC \
HOST_OPT_FLAGS="$HOST_CFLAGS" \
X11_INCLUDES= \
DRI_DRIVER_INSTALL_DIR="$XORG_PATH_DRI" \
DRI_DRIVER_SEARCH_DIR="$XORG_PATH_DRI" \
./configure --host=$TARGET_NAME \
            --build=$HOST_NAME \
            --prefix=/usr \
            --sysconfdir=/etc \
            --localstatedir=/var \
            --disable-static \
            --enable-shared \
            --disable-debug \
            --disable-selinux \
            --enable-xcb \
            --disable-glx-tls \
            --enable-driglx-direct \
            --disable-egl \
            --enable-glu \
            --disable-gl-osmesa \
            --disable-glut \
            --disable-glw \
            --disable-motif \
            --with-driver=dri \
            --with-dri-drivers=$MESA_DRIVERS \
            --with-dri-driverdir="$XORG_PATH_DRI" \
            --with-xorg-driver-dir="$XORG_PATH_DRIVERS" \
            --with-x \
            --without-demos \
            --disable-gallium \

make -C src/glsl CC=$HOST_CC CFLAGS="$HOST_CFLAGS" LDFLAGS="$HOST_LDFLAGS"
mv src/glsl/apps/compile ./host_compile

make clean

make GLSL_CL="\$(TOP)/host_compile"

make -C progs/xdemos

$MAKEINSTALL -C src/mesa
$MAKEINSTALL -C src/glu
