1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
5 inherit autotools toolchain-funcs
7 if [[ ${PV} == "9999" ]] ; then
8 ESVN_REPO_URI="https://svn.code.sf.net/p/sdcc/code/trunk/sdcc"
12 mirror://sourceforge/sdcc/${PN}-src-${PV}.tar.bz2
13 doc? ( mirror://sourceforge/sdcc/${PN}-doc-${PV}.tar.bz2 )
18 DESCRIPTION="Small device C compiler (for various microprocessors)"
19 HOMEPAGE="http://sdcc.sourceforge.net/"
23 non-free? ( MicroChip-SDCC )
24 packihx? ( public-domain )
28 avr ds390 ds400 gbz80 hc08 mcs51 pic14 pic16 r2k r3ka s08 stm8 tlcs90 z180
33 +boehm-gc device-lib doc non-free packihx +sdbinutils sdcdb +sdcpp ucsim
36 for port in ${SDCC_PORTS}; do
37 REQUIRED_USE="${REQUIRED_USE}
38 ${port}? ( sdbinutils )
41 REQUIRED_USE="${REQUIRED_USE}
51 >=dev-embedded/gputils-0.13.7
52 boehm-gc? ( dev-libs/boehm-gc:= )
53 !dev-embedded/sdcc-svn
60 "${FILESDIR}"/${PN}-3.8.0-override-override.patch
64 # Fix conflicting variable names between Gentoo and sdcc
66 '(' -name 'Makefile*.in' -o -name 'configure' ')' \
68 -e 's:\<(PORTDIR|ARCH)\>:SDCC\1:g' \
71 # https://sourceforge.net/p/sdcc/bugs/2398/
72 sed -i -e '1iAR = @AR@' Makefile.common.in || die
74 -e "/^AR =/s:=.*:=$(tc-getAR):" \
75 support/cpp/Makefile.in || die
77 # Make sure timestamps don't get messed up.
78 [[ ${PV} == "9999" ]] && find "${S}" -type f -exec touch -r . {} +
85 # sdbinutils subdir doesn't pass down --docdir properly, so need to
86 # expand $(datarootdir) ourselves.
88 ac_cv_prog_AR="$(tc-getAR)" \
89 ac_cv_prog_AS="$(tc-getAS)" \
90 ac_cv_prog_STRIP=true \
91 $(use_enable avr avr-port) \
92 $(use_enable boehm-gc libgc) \
93 $(use_enable device-lib) \
94 $(use_enable ds390 ds390-port) \
95 $(use_enable ds400 ds400-port) \
96 $(use_enable gbz80 gbz80-port) \
97 $(use_enable hc08 hc08-port) \
98 $(use_enable mcs51 mcs51-port) \
99 $(use_enable non-free) \
100 $(use_enable packihx) \
101 $(use_enable pic14 pic14-port) \
102 $(use_enable pic16 pic16-port) \
103 $(use_enable r2k r2k-port) \
104 $(use_enable r3ka r3ka-port) \
105 $(use_enable s08 s08-port) \
106 $(use_enable sdbinutils) \
107 $(use_enable sdcdb) \
108 $(use_enable sdcpp) \
109 $(use_enable stm8 stm8-port) \
110 $(use_enable tlcs90 tlcs90-port) \
111 $(use_enable ucsim) \
112 $(use_enable z180 z180-port) \
113 $(use_enable z80 z80-port) \
115 --docdir="${EPREFIX}/usr/share/doc/${PF}" \
122 find "${D}" -name .deps -exec rm -rf {} + || die
124 if use doc && [[ ${PV} != "9999" ]]; then
129 # a bunch of archives (*.a) are built & installed by gputils
130 # for PIC processors, but they do not work with standard `ar`
131 # & `scanelf` utils and they're not for the host.
132 dostrip "${D%/}"/usr/bin