SUMMARY="QEMU is a generic and open source machine emulator and virtualizer."
DESCRIPTION="
QEMU is a generic and open source machine emulator and virtualizer.
"
HOMEPAGE="http://wiki.qemu.org/"
SRC_URI="git+https://github.com/mmlr/qemu-haiku.git#e57972be33c91222a580d47c68b135aa8fa7b4c3"
COPYRIGHT="2003-2008 Fabrice Bellard"
LICENSE="GNU GPL v2"
REVISION="1"
ARCHITECTURES="x86"

PROVIDES="
	qemu = $portVersion
	cmd:qemu = $portVersion
	cmd:qemu_img = $portVersion
	cmd:qemu_io = $portVersion
	cmd:qemu_system_alpha = $portVersion
	cmd:qemu_system_arm = $portVersion
	cmd:qemu_system_cris = $portVersion
	cmd:qemu_system_i386 = $portVersion
	cmd:qemu_system_lm32 = $portVersion
	cmd:qemu_system_m68k = $portVersion
	cmd:qemu_system_microblaze = $portVersion
	cmd:qemu_system_microblazeel = $portVersion
	cmd:qemu_system_mips = $portVersion
	cmd:qemu_system_mips64 = $portVersion
	cmd:qemu_system_mips64el = $portVersion
	cmd:qemu_system_mipsel = $portVersion
	cmd:qemu_system_moxie = $portVersion
	cmd:qemu_system_or32 = $portVersion
	cmd:qemu_system_ppc = $portVersion
	cmd:qemu_system_ppc64 = $portVersion
	cmd:qemu_system_ppcemb = $portVersion
	cmd:qemu_system_s390x = $portVersion
	cmd:qemu_system_sh4 = $portVersion
	cmd:qemu_system_sh4eb = $portVersion
	cmd:qemu_system_sparc = $portVersion
	cmd:qemu_system_sparc64 = $portVersion
	cmd:qemu_system_unicore32 = $portVersion
	cmd:qemu_system_x86_64 = $portVersion
	cmd:qemu_system_xtensa = $portVersion
	cmd:qemu_system_xtensaeb = $portVersion
	"

REQUIRES="
	haiku >= $haikuVersion
	lib:libz
	lib:libintl
	glib2 >= 2.12
	pixman
	"

BUILD_REQUIRES="
	devel:libz
	devel:libfdt
	glib2_devel >= 2.12
	pixman_devel
	"

BUILD_PREREQUIRES="
	haiku_devel >= $haikuVersion
	cmd:gcc
	cmd:ld
	cmd:make
	cmd:pkg_config
	cmd:pod2man
	cmd:python
	"

BUILD()
{
	chmod +x configure
	./configure --prefix=$prefix --mandir=$manDir --datadir=$dataDir/qemu \
		--docdir=$docDir --bindir=$binDir --libdir=$libDir \
		--sysconfdir=$settingsDir/qemu
	make $jobArgs
}

INSTALL()
{
	make install

	# provide convenience symlink to just "qemu"
	ln -s qemu-system-i386 $binDir/qemu

	# remove empty target config file
	rm $settingsDir/qemu/target-x86_64.conf
}
