dev-qt/qtwebengine: Fix build without dev-qt/qtlocation
[gentoo.git] / dev-embedded / sdcc / sdcc-2.9.0.ebuild
1 # Copyright 1999-2016 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI="2"
5
6 inherit eutils
7
8 if [[ ${PV} == "9999" ]] ; then
9         ESVN_REPO_URI="https://svn.code.sf.net/p/sdcc/code/trunk/sdcc"
10         inherit subversion autotools
11         docs_compile() { return 0; }
12 else
13         SRC_URI="mirror://sourceforge/sdcc/${PN}-src-${PV}.tar.bz2
14                 doc? ( mirror://sourceforge/sdcc/${PN}-doc-${PV}.tar.bz2 )"
15         KEYWORDS="~amd64 ~x86"
16         docs_compile() { return 1; }
17 fi
18
19 DESCRIPTION="Small device C compiler (for various microprocessors)"
20 HOMEPAGE="http://sdcc.sourceforge.net/"
21
22 LICENSE="GPL-2"
23 SLOT="0"
24 IUSE="+boehm-gc doc"
25 RESTRICT="strip"
26
27 RDEPEND="sys-libs/ncurses
28         sys-libs/readline
29         >=dev-embedded/gputils-0.13.7
30         boehm-gc? ( dev-libs/boehm-gc )
31         !dev-embedded/sdcc-svn"
32 DEPEND="${RDEPEND}"
33 if docs_compile ; then
34         DEPEND+="
35                 doc? (
36                         >=app-office/lyx-1.3.4
37                         dev-tex/latex2html
38                 )"
39 fi
40
41 S=${WORKDIR}/${PN}
42
43 src_prepare() {
44         # Fix conflicting variable names between Gentoo and sdcc
45         find \
46                 '(' -name 'Makefile*.in' -o -name configure ')' \
47                 -exec sed -r -i \
48                         -e 's:\<(PORTDIR|ARCH)\>:SDCC\1:g' \
49                         {} + || die
50
51         epatch "${FILESDIR}"/${P}-gcc44.patch
52         epatch "${FILESDIR}"/${P}-getline.patch
53         epatch "${FILESDIR}"/${P}-headers.patch
54         epatch "${FILESDIR}"/${P}-build.patch
55
56         # We'll install doc manually
57         sed -i -e '/SDCC_DOC/d' Makefile.in || die
58         sed -i -e 's/all install-doc/all/' as/Makefile.in || die
59         sed -i -e 's/ doc//' sim/ucsim/packages_in.mk || die
60
61         [[ ${PV} == "9999" ]] && eautoreconf
62 }
63
64 src_configure() {
65         ac_cv_prog_STRIP=true \
66         econf \
67                 $(use_enable boehm-gc libgc) \
68                 $(docs_compile && use_enable doc || echo --disable-doc)
69 }
70
71 fsrc_compile() {
72         emake || die
73         if docs_compile && use doc ; then
74                 cd doc
75                 local d
76                 for d in cdbfileformat sdccman test_suite_spec ; do
77                         lyx -e html ${d} || die
78                 done
79         fi
80 }
81
82 src_install() {
83         emake DESTDIR="${D}" install || die
84         dodoc doc/*.txt doc/*/*.txt
85         find "${D}" -name .deps -exec rm -rf {} +
86
87         if use doc ; then
88                 docs_compile || cd "${WORKDIR}"/doc
89                 dohtml -r *
90         fi
91
92         # a bunch of archives (*.a) are built & installed by gputils
93         # for PIC processors, but they do not work with standard `ar`
94         # & `scanelf` utils and they're not for the host.
95         env RESTRICT="" prepstrip "${D%/}"/usr/bin
96 }