# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

EAPI=5

PYTHON_COMPAT=(python2_7 python3_4 python3_5)

inherit distutils-r1 multilib

DESCRIPTION="myhdl is a HDL language written in Python"
HOMEPAGE="http://www.myhdl.org/"
SRC_URI="mirror://sourceforge/project/${PN}/${PN}/${PV}/${P}.tar.gz"

LICENSE="LGPL-2.1"
SLOT="0"
KEYWORDS="~amd64"
# TODO: the cosimulation stuff
# TODO: Still need to do modelsim (Altera) and cver
IUSE="examples doc +iverilog"

DEPEND="
	iverilog? ( sci-electronics/iverilog )
"
RDEPEND="${DEPEND}"

python_install_all() {
	use examples && dodoc -r example
	cd "${S}/doc/build"
	dohtml -r html/
	cd "${S}"
	# XXX: this is a bit ugly, building stuff in src_install
	if use iverilog; then
		cd "${S}/cosimulation/icarus"
		emake || eerror "failed to build iverilog VPI plugin"
		insinto /usr/$(get_libdir)/ivl/
		doins myhdl.vpi
	fi
	distutils-r1_python_install_all
}
