1 |
commit: a966554d2bd9b8fe9bc421a57db5d8179ae2e78b |
2 |
Author: Stephen L Arnold <nerdboy <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Jun 26 06:01:33 2016 +0000 |
4 |
Commit: Steve Arnold <nerdboy <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Jun 26 06:19:58 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a966554d |
7 |
|
8 |
gnatbuild.eclass: legacy fixes for older versions and bug 558346. |
9 |
|
10 |
See virtual/gnat changes and ebuild updates. |
11 |
|
12 |
Signed-off-by: Stephen L Arnold <nerdboy <AT> gentoo.org> |
13 |
|
14 |
eclass/gnatbuild.eclass | 155 ++++++++++++++++++++++++++++++++---------------- |
15 |
1 file changed, 104 insertions(+), 51 deletions(-) |
16 |
|
17 |
diff --git a/eclass/gnatbuild.eclass b/eclass/gnatbuild.eclass |
18 |
index 43f7e59..d6bc63c 100644 |
19 |
--- a/eclass/gnatbuild.eclass |
20 |
+++ b/eclass/gnatbuild.eclass |
21 |
@@ -1,10 +1,9 @@ |
22 |
-# Copyright 1999-2015 Gentoo Foundation |
23 |
+## Copyright 1999-2016 Gentoo Foundation |
24 |
# Distributed under the terms of the GNU General Public License v2 |
25 |
-# $Id$ |
26 |
-# |
27 |
-# Authors: George Shapovalov <george@g.o> |
28 |
-# Steve Arnold <nerdboy@g.o> |
29 |
+# $Header: $ |
30 |
# |
31 |
+# Author: George Shapovalov <george@g.o> |
32 |
+# Author: Steve Arnold <nerdboy@g.o> |
33 |
# Belongs to: ada herd <ada@g.o> |
34 |
# |
35 |
# Notes: |
36 |
@@ -19,19 +18,27 @@ |
37 |
#WANT_AUTOMAKE="1.8" |
38 |
#WANT_AUTOCONF="2.1" |
39 |
|
40 |
-inherit eutils versionator toolchain-funcs flag-o-matic multilib autotools \ |
41 |
- libtool fixheadtails gnuconfig pax-utils |
42 |
+inherit eutils fixheadtails flag-o-matic gnuconfig libtool multilib pax-utils toolchain-funcs versionator |
43 |
+ |
44 |
+FEATURES=${FEATURES/multilib-strict/} |
45 |
|
46 |
-EXPORT_FUNCTIONS pkg_setup pkg_postinst pkg_postrm src_unpack src_compile src_install |
47 |
+EXPORT_FUNCTIONS="pkg_setup pkg_postinst pkg_postrm src_unpack src_configure src_compile src_install" |
48 |
|
49 |
IUSE="nls" |
50 |
# multilib is supported via profiles now, multilib usevar is deprecated |
51 |
|
52 |
-DEPEND=">=app-eselect/eselect-gnat-1.3 |
53 |
- sys-devel/bc |
54 |
-" |
55 |
+RDEPEND="app-eselect/eselect-gnat |
56 |
+ virtual/libiconv |
57 |
+ nls? ( virtual/libintl )" |
58 |
|
59 |
-RDEPEND="app-eselect/eselect-gnat" |
60 |
+DEPEND="${RDEPEND} |
61 |
+ >=app-eselect/eselect-gnat-1.3-r1 |
62 |
+ >=sys-libs/glibc-2.12 |
63 |
+ >=sys-devel/binutils-2.23 |
64 |
+ sys-devel/bc |
65 |
+ >=sys-devel/bison-1.875 |
66 |
+ >=sys-devel/flex-2.5.4 |
67 |
+ nls? ( sys-devel/gettext )" |
68 |
|
69 |
# Note! |
70 |
# It may not be safe to source this at top level. Only source inside local |
71 |
@@ -140,7 +147,7 @@ is_multilib() { |
72 |
[[ ${GCCMAJOR} < 3 ]] && return 1 |
73 |
case ${CTARGET} in |
74 |
mips64*|powerpc64*|s390x*|sparc64*|x86_64*) |
75 |
- has_multilib_profile || use multilib ;; |
76 |
+ has_multilib_profile ;; |
77 |
*) false ;; |
78 |
esac |
79 |
} |
80 |
@@ -200,7 +207,7 @@ create_eselect_conf() { |
81 |
echo " bin_prefix=${CTARGET}" >> "${D}/${gnat_config_file}" |
82 |
|
83 |
for abi in $(get_all_abis) ; do |
84 |
- add_profile_eselect_conf "${D}/${gnat_config_file}" "${abi}" |
85 |
+ add_profile_eselect_conf "${gnat_config_file}" "${abi}" |
86 |
done |
87 |
} |
88 |
|
89 |
@@ -213,7 +220,7 @@ should_we_eselect_gnat() { |
90 |
# if the current config is invalid, we definitely want a new one |
91 |
# Note: due to bash quirkiness, the following must not be 1 line |
92 |
local curr_config |
93 |
- curr_config=$(eselect gnat show | grep ${CTARGET} | awk '{ print $1 }') || return 0 |
94 |
+ curr_config=$(eselect --colour=no gnat show | grep ${CTARGET} | awk '{ print $1 }') || return 0 |
95 |
[[ -z ${curr_config} ]] && return 0 |
96 |
|
97 |
# The logic is basically "try to keep the same profile if possible" |
98 |
@@ -246,7 +253,7 @@ do_gnat_config() { |
99 |
elog "Ada handling in Gentoo allows you to have multiple gnat variants" |
100 |
elog "installed in parallel and automatically manage Ada libs." |
101 |
elog "Please take a look at the Ada project page for some documentation:" |
102 |
- elog "https://www.gentoo.org/proj/en/prog_lang/ada/index.xml" |
103 |
+ elog "http://www.gentoo.org/proj/en/prog_lang/ada/index.xml" |
104 |
} |
105 |
|
106 |
|
107 |
@@ -309,12 +316,11 @@ gnatbuild_pkg_postinst() { |
108 |
elog |
109 |
. ${GnatCommon} || die "failed to source common code" |
110 |
if [[ ! -f ${PRIMELIST} ]] || [[ ! -s ${PRIMELIST} ]]; then |
111 |
- mkdir -p ${SETTINGSDIR} |
112 |
echo "${gnat_profile}" > ${PRIMELIST} |
113 |
elog "The list of primary compilers was empty and got assigned ${gnat_profile}." |
114 |
fi |
115 |
elog "Please edit ${PRIMELIST} and list there gnat profiles intended" |
116 |
- elog "for common use, one per line." |
117 |
+ elog "for common use." |
118 |
} |
119 |
|
120 |
|
121 |
@@ -333,7 +339,10 @@ gnatbuild_pkg_postrm() { |
122 |
# common unpack stuff |
123 |
gnatbuild_src_unpack() { |
124 |
debug-print-function ${FUNCNAME} $@ |
125 |
- [ -z "$1" ] && gnatbuild_src_unpack all |
126 |
+ if [[ -z "$1" ]]; then |
127 |
+ gnatbuild_src_unpack all |
128 |
+ return $? |
129 |
+ fi |
130 |
|
131 |
while [ "$1" ]; do |
132 |
case $1 in |
133 |
@@ -417,6 +426,12 @@ gnatbuild_src_unpack() { |
134 |
done |
135 |
} |
136 |
|
137 |
+# for now just dont run default configure |
138 |
+gnatbuild_src_configure() { |
139 |
+ # do nothing |
140 |
+ : |
141 |
+} |
142 |
+ |
143 |
# it would be nice to split configure and make steps |
144 |
# but both need to operate inside specially tuned evironment |
145 |
# so just do sections for now (as in eclass section of handbook) |
146 |
@@ -441,7 +456,14 @@ gnatbuild_src_compile() { |
147 |
# so many paths are not identical to the installed ones. |
148 |
# Plus it was simplified even more in new releases. |
149 |
if [[ ${BOOT_SLOT} > 4.1 ]] ; then |
150 |
- GNATLIB="${GNATBOOT}/lib" |
151 |
+ case $(tc-arch) in |
152 |
+ arm) |
153 |
+ GNATLIB="${GNATBOOT}/lib/gcc/${BOOT_TARGET}/${BOOT_SLOT}" |
154 |
+ ;; |
155 |
+ *) |
156 |
+ GNATLIB="${GNATBOOT}/lib" |
157 |
+ ;; |
158 |
+ esac |
159 |
else |
160 |
GNATLIB="${GNATBOOT}/lib/gnatgcc/${BOOT_TARGET}/${BOOT_SLOT}" |
161 |
fi |
162 |
@@ -465,10 +487,10 @@ gnatbuild_src_compile() { |
163 |
export ADA_OBJECTS_PATH="${GNATLIB}/adalib" |
164 |
export ADA_INCLUDE_PATH="${GNATLIB}/adainclude" |
165 |
|
166 |
-# einfo "CC=${CC}, |
167 |
-# ADA_INCLUDE_PATH=${ADA_INCLUDE_PATH}, |
168 |
-# LDFLAGS=${LDFLAGS}, |
169 |
-# PATH=${PATH}" |
170 |
+ einfo "CC=${CC}, |
171 |
+ ADA_INCLUDE_PATH=${ADA_INCLUDE_PATH}, |
172 |
+ LDFLAGS=${LDFLAGS}, |
173 |
+ PATH=${PATH}" |
174 |
|
175 |
while [ "$1" ]; do |
176 |
case $1 in |
177 |
@@ -492,9 +514,9 @@ gnatbuild_src_compile() { |
178 |
fi |
179 |
|
180 |
if version_is_at_least 4.6 ; then |
181 |
- confgcc+=( $(use_enable lto) ) |
182 |
- else |
183 |
- confgcc+=( --disable-lto ) |
184 |
+ confgcc="${confgcc} --enable-lto" |
185 |
+ elif tc_version_is_at_least 4.5 ; then |
186 |
+ confgcc="${confgcc} --disable-lto --disable-plugin" |
187 |
fi |
188 |
|
189 |
# reasonably sane globals (from toolchain) |
190 |
@@ -503,9 +525,13 @@ gnatbuild_src_compile() { |
191 |
--with-system-zlib \ |
192 |
--disable-checking \ |
193 |
--disable-werror \ |
194 |
- --disable-libgomp \ |
195 |
--disable-libmudflap \ |
196 |
--disable-libssp \ |
197 |
+ --disable-altivec \ |
198 |
+ --disable-fixed-point \ |
199 |
+ --disable-libgcj \ |
200 |
+ --disable-libcilkrts \ |
201 |
+ --disable-libsanitizer \ |
202 |
--disable-libunwind-exceptions" |
203 |
|
204 |
if in_iuse openmp ; then |
205 |
@@ -518,19 +544,19 @@ gnatbuild_src_compile() { |
206 |
then |
207 |
case $(tc-arch) in |
208 |
arm) |
209 |
- confgcc+=( --disable-libgomp ) |
210 |
+ confgcc="${confgcc} --disable-libgomp" |
211 |
;; |
212 |
*) |
213 |
- confgcc+=( $(use_enable openmp libgomp) ) |
214 |
+ confgcc="${confgcc} $(use_enable openmp libgomp)" |
215 |
;; |
216 |
esac |
217 |
else |
218 |
# Force disable as the configure script can be dumb #359855 |
219 |
- confgcc+=( --disable-libgomp ) |
220 |
+ confgcc="${confgcc} --disable-libgomp" |
221 |
fi |
222 |
else |
223 |
# For gcc variants where we don't want openmp (e.g. kgcc) |
224 |
- confgcc+=( --disable-libgomp ) |
225 |
+ confgcc="${confgcc} --disable-libgomp" |
226 |
fi |
227 |
|
228 |
# ACT's gnat-gpl does not like libada for whatever reason.. |
229 |
@@ -542,8 +568,11 @@ gnatbuild_src_compile() { |
230 |
fi |
231 |
|
232 |
# set some specifics available in later versions |
233 |
- if version_is_at_least 4.3 ; then |
234 |
+ if version_is_at_least 4.7 ; then |
235 |
einfo "setting gnat thread model" |
236 |
+ confgcc="${confgcc} --enable-threads=posix" |
237 |
+ confgcc="${confgcc} --enable-shared=boehm-gc,ada,libada" |
238 |
+ elif version_is_at_least 4.3 ; then |
239 |
confgcc="${confgcc} --enable-threads=gnat" |
240 |
confgcc="${confgcc} --enable-shared=boehm-gc,ada,libada" |
241 |
else |
242 |
@@ -567,23 +596,33 @@ gnatbuild_src_compile() { |
243 |
|
244 |
einfo "confgcc=${confgcc}" |
245 |
|
246 |
- # need to strip graphite flags or we'll get the |
247 |
+ export gcc_cv_lto_plugin=1 # okay to build, default to opt-in |
248 |
+ export gcc_cv_prog_makeinfo_modern=no |
249 |
+ export ac_cv_have_x='have_x=yes ac_x_includes= ac_x_libraries=' |
250 |
+ export gcc_cv_libc_provides_ssp=yes |
251 |
+ |
252 |
+ # need to strip graphite/lto flags or we'll get the |
253 |
# dreaded C compiler cannot create executables... |
254 |
# error. |
255 |
- strip-flags -floop-interchange -floop-strip-mine -floop-block |
256 |
+ strip-flags |
257 |
+ replace-flags -O? -O2 |
258 |
+ filter-flags '-mabi*' -m31 -m32 -m64 |
259 |
+ filter-flags -frecord-gcc-switches |
260 |
+ filter-flags -mno-rtm -mno-htm |
261 |
+ #filter-flags -floop-interchange -floop-strip-mine -floop-block |
262 |
+ #filter-flags -fuse-linker-plugin -flto* |
263 |
|
264 |
cd "${GNATBUILD}" |
265 |
- CFLAGS="${CFLAGS}" CXXFLAGS="${CXXFLAGS}" "${S}"/configure \ |
266 |
- --prefix=${PREFIX} \ |
267 |
- --bindir=${BINPATH} \ |
268 |
- --includedir=${INCLUDEPATH} \ |
269 |
+ CC="${CC}" CFLAGS="${CFLAGS}" CXXFLAGS="${CFLAGS}" "${S}"/configure \ |
270 |
+ --prefix="${PREFIX}" \ |
271 |
+ --bindir="${BINPATH}" \ |
272 |
+ --includedir="${INCLUDEPATH}" \ |
273 |
--libdir="${LIBPATH}" \ |
274 |
--libexecdir="${LIBEXECPATH}" \ |
275 |
- --datadir=${DATAPATH} \ |
276 |
- --mandir=${DATAPATH}/man \ |
277 |
- --infodir=${DATAPATH}/info \ |
278 |
- --program-prefix=gnat \ |
279 |
- --enable-languages="c,ada" \ |
280 |
+ --datadir="${DATAPATH}" \ |
281 |
+ --mandir="${DATAPATH}"/man \ |
282 |
+ --infodir="${DATAPATH}"/info \ |
283 |
+ --enable-languages=c,ada \ |
284 |
--with-gcc \ |
285 |
${confgcc} || die "configure failed" |
286 |
;; |
287 |
@@ -606,13 +645,19 @@ gnatbuild_src_compile() { |
288 |
gnatmake xsinfo && \ |
289 |
gnatmake xeinfo && \ |
290 |
gnatmake xnmake || die "building helper tools" |
291 |
+ |
292 |
+ mv xeinfo xnmake xsinfo xtreeprs bin/ |
293 |
;; |
294 |
|
295 |
bootstrap) |
296 |
debug-print-section bootstrap |
297 |
# and, finally, the build itself |
298 |
cd "${GNATBUILD}" |
299 |
- emake bootstrap || die "bootstrap failed" |
300 |
+ emake \ |
301 |
+ LDFLAGS="${LDFLAGS}" \ |
302 |
+ LIBPATH="${LIBPATH}" \ |
303 |
+ CC="${CC}" \ |
304 |
+ bootstrap-lean || die "bootstrap failed" |
305 |
;; |
306 |
|
307 |
gnatlib_and_tools) |
308 |
@@ -692,10 +737,16 @@ gnatbuild_src_install() { |
309 |
cd "${GNATBUILD}" |
310 |
make DESTDIR="${D}" install || die |
311 |
|
312 |
+ # Disable RANDMMAP so PCH works. #301299 |
313 |
+ pax-mark r "${D}"${LIBEXECPATH}/{gnat1,cc1,cc1plus} |
314 |
+ # Quiet QA warnings, wait for adacore exec stack patch in gcc 7 |
315 |
+ export QA_EXECSTACK="${BINPATH:1}/gnatls ${BINPATH:1}/gnatname |
316 |
+ ${BINPATH:1}/gnatmake ${BINPATH:1}/gnatclean ${BINPATH:1}/gnat" |
317 |
+ |
318 |
if use doc ; then |
319 |
if (( $(bc <<< "${GNATBRANCH} > 4.3") )) ; then |
320 |
#make a convenience info link |
321 |
- elog "Yay! Math is good." |
322 |
+ ewarn "Yay! Math works." |
323 |
dosym gnat_ugn.info ${DATAPATH}/info/gnat.info |
324 |
fi |
325 |
fi |
326 |
@@ -728,9 +779,9 @@ gnatbuild_src_install() { |
327 |
# force gnatgcc to use its own specs - versions prior to 3.4.6 read specs |
328 |
# from system gcc location. Do the simple wrapper trick for now |
329 |
# !ATTN! change this if eselect-gnat starts to follow eselect-compiler |
330 |
+ cd "${D}${BINPATH}" |
331 |
if [[ ${GCCVER} < 3.4.6 ]] ; then |
332 |
# gcc 4.1 uses builtin specs. What about 4.0? |
333 |
- cd "${D}${BINPATH}" |
334 |
mv gnatgcc gnatgcc_2wrap |
335 |
cat > gnatgcc << EOF |
336 |
#! /bin/bash |
337 |
@@ -742,6 +793,11 @@ BINDIR=\$(dirname \$0) |
338 |
\${BINDIR}/gnatgcc_2wrap -specs="${LIBPATH}/specs" -I"${LIBPATH}/include" \$@ |
339 |
EOF |
340 |
chmod a+x gnatgcc |
341 |
+ else |
342 |
+ local i |
343 |
+ for i in cpp gcc gcov ; do |
344 |
+ ln -s ${i} gnat${i} |
345 |
+ done |
346 |
fi |
347 |
|
348 |
# earlier gnat's generate some Makefile's at generic location, need to |
349 |
@@ -751,7 +807,7 @@ EOF |
350 |
|
351 |
# use gid of 0 because some stupid ports don't have |
352 |
# the group 'root' set to gid 0 (toolchain.eclass) |
353 |
- chown -R root:0 "${D}${LIBPATH}" |
354 |
+# chown -R root:0 "${D}${LIBPATH}" |
355 |
;; |
356 |
|
357 |
cleanup) |
358 |
@@ -774,9 +830,6 @@ EOF |
359 |
"${D}${LIBEXECPATH}"/liblto_plugin.la \ |
360 |
|| die "sed update of .la file failed!" |
361 |
fi |
362 |
- |
363 |
- # add config directory (bug 440660) |
364 |
- keepdir /etc/ada |
365 |
;; |
366 |
|
367 |
prep_env) |