virtual/monkeysphere-validation-agent: Drop Monkeysphere
[wtk-overlay.git] / dev-embedded / simulavr / simulavr-9999.ebuild
1 # Copyright 1999-2012 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: $
4
5 EAPI="4"
6
7 inherit autotools eutils
8
9 if [[ "${PV}" == "9999" ]]; then
10         inherit git-2
11         EGIT_BRANCH="master"
12         EGIT_REPO_URI="git://git.savannah.nongnu.org/${PN}.git"
13         SRC_URI=""
14 else
15         SRC_URI="http://download.savannah.nongnu.org/releases/${PN}/${P}.tar.gz"
16 fi
17
18 DESCRIPTION="A simulator for the Atmel AVR family of microcontrollers"
19 HOMEPAGE="http://www.nongnu.org/${PN}/"
20
21 LICENSE="GPL-2"
22 SLOT="0"
23 KEYWORDS="~amd64"
24 IUSE="doc python static-libs tcl verilog"
25
26 RDEPEND="sys-libs/ncurses"
27 DEPEND="${RDEPEND}
28         >=dev-lang/swig-2.0.0
29         doc? ( app-doc/doxygen[dot] dev-python/sphinx )
30         python? ( >=dev-lang/python-2.4 )
31         tcl? ( dev-lang/tcl dev-tcltk/itcl )
32         verilog? ( sci-electronics/iverilog )"
33
34 pkg_setup() {
35         if ! has_version cross-avr/gcc; then
36                 eerror
37                 eerror "${PN} requires avr-gcc >= 4.3.4 to be installed."
38                 eerror "You can install it by running:"
39                 eerror "  # crossdev -t avr"
40                 eerror
41                 die "Missing avr-gcc"
42         fi
43         if ! has_version cross-avr/binutils; then
44                 eerror
45                 eerror "${PN} requires avr binutils >= 2.20 to be installed."
46                 eerror "You can install it by running:"
47                 eerror "  # crossdev -t avr"
48                 eerror
49                 die "Missing avr binutils"
50         fi
51 }
52
53 src_prepare() {
54         epatch "${FILESDIR}/${PV}"-*.patch
55         if [[ "${PV}" == "9999" ]]; then
56                 ./bootstrap
57         fi
58 }
59
60 src_configure() {
61         local my_conf="--enable-dependency-tracking"
62         local BINUTILS=$(binutils-config --get-current-profile avr)
63         local BINUTILS_CONFIG="/etc/env.d/binutils/${BINUTILS}"
64         local BINUTILS_PATH=$(sed -n 's/^LIBPATH="\(.*\)"$/\1/p' "${BINUTILS_CONFIG}")
65         my_conf="${my_conf} --with-bfd=${BINUTILS_PATH}"
66         my_conf="${my_conf} $(use_enable python)"
67         my_conf="${my_conf} $(use_enable static-libs static)"
68         my_conf="${my_conf} $(use_enable tcl)"
69         my_conf="${my_conf} $(use_enable verilog)"
70         my_conf="${my_conf} $(use_enable doc doxygen-doc)"
71         my_conf="${my_conf} $(use_enable doc doxygen-html)"
72         LDFLAGS="-Wl,-rpath=${BINUTILS_PATH},--enable-new-dtags ${LDFLAGS}" econf ${my_conf} --docdir="${EPREFIX}/usr/share/doc/${PF}"
73 }
74
75 src_compile() {
76         emake
77         if use doc; then
78                 make web-html
79                 make doxygen-doc
80         fi
81 }
82
83 src_install() {
84         emake DESTDIR="${D}" install
85         dodoc NEWS README* AUTHORS SUPPORT TODO ChangeLog
86         if use doc; then
87                 dohtml -r doc/web_build/html/*
88                 _E_DOCDESTTREE_="doxygen" dohtml -r doc/doxygen-doc/html/*
89         fi
90 }