Diff sdcc-4.1.0 with a sdcc-4.2.0

/usr/portage/dev-embedded/sdcc/sdcc-4.2.0.ebuild 2023-10-09 14:52:29.352368347 +0300
1 1
# Copyright 1999-2023 Gentoo Authors
2 2
# Distributed under the terms of the GNU General Public License v2
3 3

  
4
EAPI=7
4
EAPI=8
5 5

  
6
inherit autotools toolchain-funcs
6
inherit autotools
7 7

  
8 8
if [[ ${PV} == "9999" ]] ; then
9 9
	ESVN_REPO_URI="https://svn.code.sf.net/p/sdcc/code/trunk/sdcc"
10 10
	inherit subversion
11 11
else
12 12
	SRC_URI="
13
		mirror://sourceforge/sdcc/${PN}-src-${PV}.tar.bz2
14
		doc? ( mirror://sourceforge/sdcc/${PN}-doc-${PV}.tar.bz2 )
13
		https://downloads.sourceforge.net/project/${PN}/sdcc/${PV}/${PN}-src-${PV}.tar.bz2
14
		doc? ( https://downloads.sourceforge.net/project/${PN}/sdcc-doc/${PV}/${PN}-doc-${PV}.tar.bz2 )
15 15
	"
16
	S="${WORKDIR}/sdcc"
17 16

  
18
	KEYWORDS="~amd64 ~x86"
17
	KEYWORDS="amd64 x86"
19 18
fi
20 19

  
21 20
DESCRIPTION="Small device C compiler (for various microprocessors)"
......
29 28
SLOT="0"
30 29
# in order of configure.ac's AC_DO_PORT stanzas
31 30
SDCC_PORTS="
32
	avr
33 31
	mcs51
34 32
	z80 z180
35 33
	r2k r2ka r3ka
36
	gbz80
34
	sm83
37 35
	tlcs90
38 36
	ez80-z80
39 37
	z80n
......
43 41
	s08
44 42
	stm8
45 43
	pdk13 pdk14 pdk15 pdk16
44
	mos6502 mos65c02
46 45
"
47 46
IUSE="
48 47
	${SDCC_PORTS}
49
	+boehm-gc device-lib doc non-free packihx +sdbinutils sdcdb +sdcpp ucsim
48
	+boehm-gc device-lib doc non-free packihx sdcdb +sdcpp ucsim
50 49
"
51 50

  
52
for port in ${SDCC_PORTS}; do
53
REQUIRED_USE="${REQUIRED_USE}
54
	${port}? ( sdbinutils )
55
"
56
done
57
REQUIRED_USE="${REQUIRED_USE}
58
	|| ( ${SDCC_PORTS} )
59
"
60

  
61
RESTRICT="strip"
62

  
63 51
RDEPEND="
64 52
	dev-libs/boost:=
65
	sys-libs/ncurses:=
66
	sys-libs/readline:0=
53
	sys-libs/zlib:=
67 54
	pic14? ( >=dev-embedded/gputils-0.13.7 )
68 55
	pic16? ( >=dev-embedded/gputils-0.13.7 )
69 56
	boehm-gc? ( dev-libs/boehm-gc:= )
70
	!dev-embedded/sdcc-svn
57
	sdcdb? ( sys-libs/readline:0= )
58
	ucsim? ( sys-libs/ncurses:= )
71 59
"
72 60
DEPEND="
73 61
	${RDEPEND}
74 62
	dev-util/gperf
75 63
"
76 64
PATCHES=(
77
	"${FILESDIR}"/${PN}-3.8.0-override-override.patch
65
	"${FILESDIR}"/sdcc-3.8.0-override-override.patch
66
	"${FILESDIR}"/sdcc-4.2.0-link-tinfo.patch
78 67
)
79 68

  
80 69
src_prepare() {
81 70
	# Fix conflicting variable names between Gentoo and sdcc
82
	find \
83
		'(' -name 'Makefile*.in' -o -name 'configure' ')' \
84
		-exec sed -r -i \
85
			-e 's:\<(PORTDIR|ARCH)\>:SDCC\1:g' \
86
			{} + || die
71
	find device/lib/pic{14,16} device/non-free/lib/pic{14,16} \( \
72
			-name 'configure.ac' -o -name 'Makefile.*' \) \
73
		-exec sed -i 's/\<ARCH\>/SDCC_&/g' {} + || die
74
	find device -name 'Makefile.in' \
75
		-exec sed -i 's/\<PORTDIR\>/SDCC_&/g' {} + || die
76
	# Possible alternative: Patch the following files to not pick up the
77
	# variables from the environment:
78
	# - lib/Makefile.in (PORTDIR ifndef/endif)
79
	# - device/non-free/lib/pic14/Makefile.common.in (ARCH ?= 877)
80
	# - device/non-free/lib/pic16/configure.ac (${ARCH:-18f452})
81
	# - device/lib/pic14/configure.ac (${ARCH:-16f877})
82
	# - device/lib/pic16/configure.ac (${ARCH:-18f452})
87 83

  
88 84
	# Make sure timestamps don't get messed up.
89 85
	[[ ${PV} == "9999" ]] && find "${S}" -type f -exec touch -r . {} +
......
98 94
}
99 95

  
100 96
src_configure() {
101
	# sdbinutils subdir doesn't pass down --docdir properly, so need to
102
	# expand $(datarootdir) ourselves.
103
	econf \
104
		ac_cv_prog_AR="$(tc-getAR)" \
105
		ac_cv_prog_AS="$(tc-getAS)" \
106
		ac_cv_prog_STRIP=true \
107
		$(use_enable boehm-gc libgc) \
108
		$(use_enable device-lib) \
109
		$(use_enable non-free) \
110
		$(use_enable packihx) \
111
		$(use_enable sdbinutils) \
112
		$(use_enable sdcdb) \
113
		$(use_enable sdcpp) \
114
		$(use_enable ucsim) \
115
		\
116
		$(use_enable avr avr-port) \
117
		$(use_enable mcs51 mcs51-port) \
118
		$(use_enable z80 z80-port) \
119
		$(use_enable z180 z180-port) \
120
		$(use_enable r2k r2k-port) \
121
		$(use_enable r2ka r2ka-port) \
122
		$(use_enable r3ka r3ka-port) \
123
		$(use_enable gbz80 gbz80-port) \
124
		$(use_enable tlcs90 tlcs90-port) \
125
		$(use_enable ez80-z80 ez80_z80-port) \
126
		$(use_enable z80n z80n-port) \
127
		$(use_enable ds390 ds390-port) \
128
		$(use_enable ds400 ds400-port) \
129
		$(use_enable pic14 pic14-port) \
130
		$(use_enable pic16 pic16-port) \
131
		$(use_enable hc08 hc08-port) \
132
		$(use_enable s08 s08-port) \
133
		$(use_enable stm8 stm8-port) \
134
		$(use_enable pdk13 pdk13-port) \
135
		$(use_enable pdk14 pdk14-port) \
136
		$(use_enable pdk15 pdk15-port) \
137
		$(use_enable pdk16 pdk16-port) \
138
		\
139
		--disable-doc \
97
	local myeconfargs=(
98
		ac_cv_prog_STRIP=true
140 99
		--without-ccache
100
		--enable-sdbinutils
101

  
102
		$(use_enable ucsim)
103
		$(use_enable device-lib)
104
		$(use_enable packihx)
105
		$(use_enable sdcpp)
106
		$(use_enable sdcdb)
107
		$(use_enable non-free)
108
		$(use_enable boehm-gc libgc)
109

  
110
		$(use_enable mcs51 mcs51-port)
111
		$(use_enable z80 z80-port)
112
		$(use_enable z180 z180-port)
113
		$(use_enable r2k r2k-port)
114
		$(use_enable r2ka r2ka-port)
115
		$(use_enable r3ka r3ka-port)
116
		$(use_enable sm83 sm83-port)
117
		$(use_enable tlcs90 tlcs90-port)
118
		$(use_enable ez80-z80 ez80_z80-port)
119
		$(use_enable z80n z80n-port)
120
		$(use_enable ds390 ds390-port)
121
		$(use_enable ds400 ds400-port)
122
		$(use_enable pic14 pic14-port)
123
		$(use_enable pic16 pic16-port)
124
		$(use_enable hc08 hc08-port)
125
		$(use_enable s08 s08-port)
126
		$(use_enable stm8 stm8-port)
127
		$(use_enable pdk13 pdk13-port)
128
		$(use_enable pdk14 pdk14-port)
129
		$(use_enable pdk15 pdk15-port)
130
		$(use_enable pdk16 pdk16-port)
131
		$(use_enable mos6502 mos6502-port)
132
		$(use_enable mos65c02 mos65c02-port)
133
	)
134
	econf "${myeconfargs[@]}"
135
}
136

  
137
src_compile() {
138
	default
139

  
140
	# Sanity check, as gputils errors/segfaults don't cause make to stop
141
	local libs=()
142
	use pic14 && libs+=( device/lib/build/pic14/libsdcc.lib )
143
	use pic16 && libs+=( device/lib/build/pic16/libsdcc.lib )
144
	for lib in "${libs[@]}"; do
145
		[[ -f "${lib}" ]] || die "Failed to build ${lib}"
146
	done
141 147
}
142 148

  
143 149
src_install() {
144 150
	default
145 151
	dodoc doc/*.txt
146
	find "${D}" -name .deps -exec rm -rf {} + || die
152
	find "${ED}" -type d -name .deps -exec rm -vr {} + || die
147 153

  
148 154
	if use doc && [[ ${PV} != "9999" ]]; then
149 155
		cd "${WORKDIR}"/doc
150 156
		dodoc -r *
151 157
	fi
152

  
153
	# a bunch of archives (*.a) are built & installed by gputils
154
	# for PIC processors, but they do not work with standard `ar`
155
	# & `scanelf` utils and they're not for the host.
156
	dostrip -x /usr/bin
157 158
}
Thank you!