#!/bin/sh +x

#--
#-- 2008-01-02  Matt Farmer  <dev@mattfarmer.net>
#--             * Initial Release

#-- Configurable Variables
overlaydir="/usr/local/portage"

#-- Static Varibles
packages="app-emulation/qemu-user app-emulation/qemu-softmmu"

#-- Mask newer version of qemu so we don't accidently upgrade to it
echo ">app-emulation/qemu-0.8.2" >> /etc/portage/package.mask

#-- Setup our portage overlay
for d in ${packages}; do
  mkdir -p ${overlaydir}/${d}
  cp -r /usr/portage/${d}/files ${overlaydir}/${d}/
done

#-- Copy over patch files
for d in ${packages}; do
  cp qemu-0.8.2-gcc4-hacks.patch ${overlaydir}/${d}/files/
done;
cp qemu-user-0.8.2-r1.ebuild ${overlaydir}/app-emulation/qemu-user/
cp qemu-softmmu-0.8.2-r2.ebuild ${overlaydir}/app-emulation/qemu-softmmu

#-- Sign the files
ebuild ${overlaydir}/app-emulation/qemu-user/qemu-user-0.8.2-r1.ebuild digest
ebuild ${overlaydir}/app-emulation/qemu-softmmu/qemu-softmmu-0.8.2-r2.ebuild digest

#-- Done!  Now should be ready to run `TARGET_LIST="mips-user mips-softmmu" emerge -av =qemu-0.8.2`
#-- adjusting TARGET_LIST to be the systems you'd like to build.
#-- Tested with i686-pc-linux-gnu-4.1.2
