#!/bin/sh

. config/options

$SCRIPTS/install libpciaccess
$SCRIPTS/install freetype
$SCRIPTS/install libX11
$SCRIPTS/install libXfont
#$SCRIPTS/install libXinerama
$SCRIPTS/install libXv
#$SCRIPTS/install libXvMC
$SCRIPTS/install $LIBDRM
$SCRIPTS/install $MESA
$SCRIPTS/install pixman
$SCRIPTS/install dbus
$SCRIPTS/install hal

XORG_SRC="$PKG_BUILD/hw/xfree86"
XORG_DST="$INSTALL/$XORG_PATH_MODULES"

mkdir -p $INSTALL/usr/bin
cp $XORG_SRC/.libs/Xorg $INSTALL/usr/bin
ln -sf /usr/bin/Xorg $INSTALL/usr/bin/X
cp $XORG_SRC/utils/gtf/gtf $INSTALL/usr/bin

#opt:
cp $XORG_SRC/utils/cvt/cvt $INSTALL/usr/bin

mkdir -p $INSTALL/usr/lib
cp $XORG_SRC/parser/.libs/libxf86config.so* $INSTALL/usr/lib

mkdir -p $XORG_DST
cp $XORG_SRC/shadowfb/.libs/libshadowfb.so $XORG_DST
cp $XORG_SRC/dixmods/.libs/libfb.so $XORG_DST
cp $XORG_SRC/dixmods/.libs/libwfb.so $XORG_DST
cp $XORG_SRC/dixmods/.libs/libshadow.so $XORG_DST
cp $XORG_SRC/vbe/.libs/libvbe.so $XORG_DST
cp $XORG_SRC/int10/.libs/libint10.so $XORG_DST
cp $XORG_SRC/exa/.libs/libexa.so $XORG_DST
cp $XORG_SRC/vgahw/.libs/libvgahw.so $XORG_DST
cp $XORG_SRC/xaa/.libs/libxaa.so $XORG_DST
cp $XORG_SRC/xf8_16bpp/.libs/libxf8_16bpp.so $XORG_DST

mkdir -p $XORG_DST/extensions
cp $XORG_SRC/dixmods/.libs/libdbe.so $XORG_DST/extensions
cp $XORG_SRC/dixmods/.libs/libglx.so $XORG_DST/extensions 
cp $XORG_SRC/dixmods/extmod/.libs/libextmod.so $XORG_DST/extensions
cp $XORG_SRC/dri/.libs/libdri.so $XORG_DST/extensions
cp $XORG_SRC/dri2/.libs/libdri2.so $XORG_DST/extensions

mkdir -p $XORG_DST/linux
cp $XORG_SRC/fbdevhw/.libs/libfbdevhw.so $XORG_DST/linux

mkdir -p $XORG_DST/multimedia
cp $XORG_SRC/i2c/.libs/*_drv.so $XORG_DST/multimedia

mkdir -p $INSTALL/etc/X11
cp $PKG_BUILD/dix/protocol.txt $INSTALL/etc/X11

mkdir -p $INSTALL/etc/dbus-1/system.d
cp $PKG_BUILD/config/xorg-server.conf $INSTALL/etc/dbus-1/system.d

mkdir -p $INSTALL/usr/share/hal/fdi/policy/10osvendor/
cp $PKG_BUILD/config/x11-input.fdi $INSTALL/usr/share/hal/fdi/policy/10osvendor/10-x11-input.fdi
