#!/bin/bash
section=driver
version=7.4
mkdir $section
cd $section

# download and check packages
grep -v '^#' ../${section}-${version}.wget | wget -i- -c \
    -B http://xorg.freedesktop.org/releases/individual/${section}/
md5sum -c ../${section}-${version}.md5

# build packages
for package in $(grep -v '^#' ../driver-7.4.wget)
do
  packagedir=${package%.tar.bz2}
  tar -xf $package
  cd $packagedir
  case $packagedir in
  xf86-input-evdev-[0-9]* | xf86-video-ati-[0-9]* | \
  xf86-video-fbdev-[0-9]* | xf86-video-glint-[0-9]* | \
  xf86-video-newport-[0-9]* )
    sed -i -e "s/\xc3\xb8/\\\\[\/o]/" \
           -e "s/\xc3\xa4/\\\\[:a]/" \
           -e "s/\xc3\x9c/\\\\[:U]/" man/*.man
    ;;
  esac &&
  ./configure $XORG_CONFIG \
      --with-xorg-module-dir=$XORG_PREFIX/lib/X11/modules
  make
  make install
  cd ..
  rm -rf $packagedir
done 2>&1 | tee -a ../driver-7.4-compile.log