dev-embedded/sdcc: avoid makeinfo depend
[gentoo.git] / dev-embedded / sdcc / sdcc-3.8.0-r1.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5 inherit autotools toolchain-funcs
6
7 if [[ ${PV} == "9999" ]] ; then
8         ESVN_REPO_URI="https://svn.code.sf.net/p/sdcc/code/trunk/sdcc"
9         inherit subversion
10 else
11         SRC_URI="
12                 mirror://sourceforge/sdcc/${PN}-src-${PV}.tar.bz2
13                 doc? ( mirror://sourceforge/sdcc/${PN}-doc-${PV}.tar.bz2 )
14         "
15         KEYWORDS="amd64 x86"
16 fi
17
18 DESCRIPTION="Small device C compiler (for various microprocessors)"
19 HOMEPAGE="http://sdcc.sourceforge.net/"
20
21 LICENSE="
22         GPL-2 ZLIB
23         non-free? ( MicroChip-SDCC )
24         packihx? ( public-domain )
25 "
26 SLOT="0"
27 SDCC_PORTS="
28         avr ds390 ds400 gbz80 hc08 mcs51 pic14 pic16 r2k r3ka s08 stm8 tlcs90 z180
29         z80
30 "
31 IUSE="
32         ${SDCC_PORTS}
33         +boehm-gc device-lib doc non-free packihx +sdbinutils sdcdb +sdcpp ucsim
34 "
35
36 for port in ${SDCC_PORTS}; do
37 REQUIRED_USE="${REQUIRED_USE}
38         ${port}? ( sdbinutils )
39 "
40 done
41 REQUIRED_USE="${REQUIRED_USE}
42         || ( ${SDCC_PORTS} )
43 "
44
45 RESTRICT="strip"
46
47 RDEPEND="
48         dev-libs/boost:=
49         sys-libs/ncurses:=
50         sys-libs/readline:0=
51         >=dev-embedded/gputils-0.13.7
52         boehm-gc? ( dev-libs/boehm-gc:= )
53         !dev-embedded/sdcc-svn
54 "
55 DEPEND="
56         ${RDEPEND}
57         dev-util/gperf
58 "
59 PATCHES=(
60         "${FILESDIR}"/${PN}-3.8.0-override-override.patch
61 )
62
63 src_prepare() {
64         # Fix conflicting variable names between Gentoo and sdcc
65         find \
66                 '(' -name 'Makefile*.in' -o -name 'configure' ')' \
67                 -exec sed -r -i \
68                         -e 's:\<(PORTDIR|ARCH)\>:SDCC\1:g' \
69                         {} + || die
70
71         # Make sure timestamps don't get messed up.
72         [[ ${PV} == "9999" ]] && find "${S}" -type f -exec touch -r . {} +
73
74         default
75         eautoreconf
76
77         # Avoid 'bfd.info' rebuild with 'makeinfo': bug #705424
78         # Build dependencies are: eautoreconf->Makefile.in->bfdver.texi->bfd.info
79         touch support/sdbinutils/bfd/doc/bfdver.texi || die
80         touch support/sdbinutils/bfd/doc/bfd.info || die
81 }
82
83 src_configure() {
84         # sdbinutils subdir doesn't pass down --docdir properly, so need to
85         # expand $(datarootdir) ourselves.
86         econf \
87                 ac_cv_prog_AR="$(tc-getAR)" \
88                 ac_cv_prog_AS="$(tc-getAS)" \
89                 ac_cv_prog_STRIP=true \
90                 $(use_enable avr avr-port) \
91                 $(use_enable boehm-gc libgc) \
92                 $(use_enable device-lib) \
93                 $(use_enable ds390 ds390-port) \
94                 $(use_enable ds400 ds400-port) \
95                 $(use_enable gbz80 gbz80-port) \
96                 $(use_enable hc08 hc08-port) \
97                 $(use_enable mcs51 mcs51-port) \
98                 $(use_enable non-free) \
99                 $(use_enable packihx) \
100                 $(use_enable pic14 pic14-port) \
101                 $(use_enable pic16 pic16-port) \
102                 $(use_enable r2k r2k-port) \
103                 $(use_enable r3ka r3ka-port) \
104                 $(use_enable s08 s08-port) \
105                 $(use_enable sdbinutils) \
106                 $(use_enable sdcdb) \
107                 $(use_enable sdcpp) \
108                 $(use_enable stm8 stm8-port) \
109                 $(use_enable tlcs90 tlcs90-port) \
110                 $(use_enable ucsim) \
111                 $(use_enable z180 z180-port) \
112                 $(use_enable z80 z80-port) \
113                 --disable-doc \
114                 --docdir="${EPREFIX}/usr/share/doc/${PF}" \
115                 --without-ccache
116 }
117
118 src_install() {
119         default
120         dodoc doc/*.txt
121         find "${D}" -name .deps -exec rm -rf {} + || die
122
123         if use doc && [[ ${PV} != "9999" ]]; then
124                 cd "${WORKDIR}"/doc
125                 dodoc -r *
126         fi
127
128         # a bunch of archives (*.a) are built & installed by gputils
129         # for PIC processors, but they do not work with standard `ar`
130         # & `scanelf` utils and they're not for the host.
131         dostrip /usr/bin
132 }