Gentoo Archives: gentoo-commits

From: Steve Arnold <nerdboy@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/
Date: Sat, 04 Jun 2016 04:05:41
Message-Id: 1465013081.b646a6bbe391980e38b851699291bb6c224bc3c5.nerdboy@gentoo
1 commit: b646a6bbe391980e38b851699291bb6c224bc3c5
2 Author: Stephen L Arnold <nerdboy <AT> gentoo <DOT> org>
3 AuthorDate: Sat Jun 4 02:44:44 2016 +0000
4 Commit: Steve Arnold <nerdboy <AT> gentoo <DOT> org>
5 CommitDate: Sat Jun 4 04:04:41 2016 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b646a6bb
7
8 gnatbuild-r1.eclass: version bump to r1
9
10 New version for updated gnat-gcc-4.9 and future releases. Supports new
11 bootstrap compilers, upstream config. Other arches in progress.
12
13 eclass/gnatbuild-r1.eclass | 1104 ++++++++++++++++++++++++++++++++++++++++++++
14 1 file changed, 1104 insertions(+)
15
16 diff --git a/eclass/gnatbuild-r1.eclass b/eclass/gnatbuild-r1.eclass
17 new file mode 100644
18 index 0000000..0a53043
19 --- /dev/null
20 +++ b/eclass/gnatbuild-r1.eclass
21 @@ -0,0 +1,1104 @@
22 +# Copyright 1999-2016 Gentoo Foundation
23 +# Distributed under the terms of the GNU General Public License v2
24 +# $Id$
25 +#
26 +# Author: George Shapovalov <george@g.o>
27 +# Author: Steve Arnold <nerdboy@g.o>
28 +# Belongs to: ada project <ada@g.o>
29 +#
30 +# Notes:
31 +# HOMEPAGE and LICENSE are set in appropriate ebuild, as
32 +# gnat is developed by FSF and AdaCore "in parallel"
33 +#
34 +# The following vars can be set in ebuild before inheriting this eclass. They
35 +# will be respected:
36 +# SLOT
37 +# BOOT_SLOT - where old bootstrap is used as it works fine for 4.4 - 4.6
38 +
39 +#WANT_AUTOMAKE="1.8"
40 +#WANT_AUTOCONF="2.1"
41 +
42 +inherit eutils fixheadtails flag-o-matic gnuconfig libtool multilib pax-utils toolchain-funcs versionator
43 +
44 +FEATURES=${FEATURES/multilib-strict/}
45 +
46 +EXPORTED_FUNCTIONS="pkg_setup pkg_postinst pkg_postrm src_unpack src_configure src_compile src_install"
47 +
48 +EXPORT_FUNCTIONS ${EXPORTED_FUNCTIONS}
49 +
50 +IUSE="nls openmp hardened multilib"
51 +# multilib is supported via profiles now, multilib usevar is deprecated
52 +
53 +RDEPEND="virtual/libiconv
54 + nls? ( virtual/libintl )"
55 +
56 +DEPEND="${RDEPEND}
57 + >=app-eselect/eselect-gnat-1.5
58 + >=sys-libs/glibc-2.12
59 + >=sys-devel/binutils-2.23
60 + sys-devel/bc
61 + >=sys-devel/bison-1.875
62 + >=sys-devel/flex-2.5.4
63 + nls? ( sys-devel/gettext )"
64 +
65 +# Note!
66 +# It may not be safe to source this at top level. Only source inside local
67 +# functions!
68 +GnatCommon="/usr/share/gnat/lib/gnat-common.bash"
69 +
70 +#---->> globals and SLOT <<----
71 +
72 +# just a check, this location seems to vary too much, easier to track it in
73 +# ebuild
74 +#[ -z "${GNATSOURCE}" ] && die "please set GNATSOURCE in ebuild! (before inherit)"
75 +
76 +# versioning
77 +# because of gnatpro/gnatgpl we need to track both gcc and gnat versions
78 +
79 +# these simply default to $PV
80 +GNATMAJOR=$(get_version_component_range 1)
81 +GNATMINOR=$(get_version_component_range 2)
82 +GNATBRANCH=$(get_version_component_range 1-2)
83 +GNATRELEASE=$(get_version_component_range 1-3)
84 +# this one is for the gnat-gpl which is versioned by gcc backend and ACT version
85 +# number added on top
86 +ACT_Ver=$(get_version_component_range 4)
87 +
88 +# GCCVER and SLOT logic
89 +#
90 +# I better define vars for package names, as there was discussion on proper
91 +# naming and it may change
92 +PN_GnatGCC="gnat-gcc"
93 +PN_GnatGpl="gnat-gpl"
94 +
95 +# ATTN! GCCVER stands for the provided backend gcc, not the one on the system
96 +# so tc-* functions are of no use here. The present versioning scheme makes
97 +# GCCVER basically a part of PV, but *this may change*!!
98 +#
99 +# GCCVER can be set in the ebuild.
100 +[[ -z ${GCCVER} ]] && GCCVER="${GNATRELEASE}"
101 +
102 +
103 +# finally extract GCC version strings
104 +GCCMAJOR=$(get_version_component_range 1 "${GCCVER}")
105 +GCCMINOR=$(get_version_component_range 2 "${GCCVER}")
106 +GCCBRANCH=$(get_version_component_range 1-2 "${GCCVER}")
107 +GCCRELEASE=$(get_version_component_range 1-3 "${GCCVER}")
108 +
109 +# SLOT logic, make it represent gcc backend, as this is what matters most
110 +# There are some special cases, so we allow it to be defined in the ebuild
111 +# ATTN!! If you set SLOT in the ebuild, don't forget to make sure that
112 +# BOOT_SLOT is also set properly!
113 +[[ -z ${SLOT} ]] && SLOT="${GCCBRANCH}"
114 +
115 +# possible future crosscompilation support
116 +export CTARGET=${CTARGET:-${CHOST}}
117 +
118 +is_crosscompile() {
119 + [[ ${CHOST} != ${CTARGET} ]]
120 +}
121 +
122 +# Bootstrap CTARGET and SLOT logic. For now BOOT_TARGET=CHOST is "guaranteed" by
123 +# profiles, so mostly watch out for the right SLOT used in the bootstrap.
124 +# As above, with SLOT, it may need to be defined in the ebuild
125 +BOOT_TARGET=${CTARGET}
126 +[[ -z ${BOOT_SLOT} ]] && BOOT_SLOT=${SLOT}
127 +
128 +# for newer bootstrap starting with 4.9 (still experimental)
129 +BOOT_VER=${GCCRELEASE}
130 +
131 +# set our install locations
132 +PREFIX=${GNATBUILD_PREFIX:-/usr} # not sure we need this hook, but may be..
133 +LIBPATH=${PREFIX}/$(get_libdir)/${PN}/${CTARGET}/${SLOT}
134 +LIBEXECPATH=${PREFIX}/libexec/${PN}/${CTARGET}/${SLOT}
135 +INCLUDEPATH=${LIBPATH}/include
136 +BINPATH=${PREFIX}/${CTARGET}/${PN}-bin/${SLOT}
137 +DATAPATH=${PREFIX}/share/${PN}-data/${CTARGET}/${SLOT}
138 +# ATTN! the one below should match the path defined in eselect-gnat module
139 +CONFIG_PATH="/usr/share/gnat/eselect"
140 +gnat_profile="${CTARGET}-${PN}-${SLOT}"
141 +gnat_config_file="${CONFIG_PATH}/${gnat_profile}"
142 +
143 +# ebuild globals
144 +if [[ ${PN} == "${PN_GnatPro}" ]] && [[ ${GNATMAJOR} == "3" ]]; then
145 + DEPEND="x86? ( >=app-shells/tcsh-6.0 )"
146 +fi
147 +S="${WORKDIR}/gcc-${GCCVER}"
148 +
149 +# bootstrap globals, common to src_unpack and src_compile
150 +GNATBOOT="${WORKDIR}/usr"
151 +GNATBUILD="${WORKDIR}/build"
152 +#GNATBUILD="${BUILD_DIR}"
153 +
154 +# necessary for detecting lib locations and creating env.d entry
155 +#XGCC="${GNATBUILD}/gcc/xgcc -B${GNATBUILD}/gcc"
156 +
157 +#----<< globals and SLOT >>----
158 +
159 +# set SRC_URI's in ebuilds for now
160 +
161 +#----<< global toolchain vars >>----
162 +
163 +: ${TARGET_ABI:=${ABI}}
164 +: ${TARGET_MULTILIB_ABIS:=${MULTILIB_ABIS}}
165 +: ${TARGET_DEFAULT_ABI:=${DEFAULT_ABI}}
166 +
167 +
168 +#---->> specs + env.d logic <<----
169 +# TODO!!!
170 +# set MANPATH, etc..
171 +#----<< specs + env.d logic >>----
172 +
173 +
174 +#---->> some helper functions <<----
175 +tc_version_is_at_least() {
176 + version_is_at_least "$1" "${2:-${GCCBRANCH}}"
177 +}
178 +
179 +guess_patch_type_in_dir() {
180 + [[ -n $(ls "$1"/*.bz2 2>/dev/null) ]] \
181 + && EPATCH_SUFFIX="patch.bz2" \
182 + || EPATCH_SUFFIX="patch"
183 +}
184 +
185 +# configure to build with the hardened GCC specs as the default
186 +make_gcc_hard() {
187 + # we want to be able to control the pie patch logic via something other
188 + # than ALL_CFLAGS...
189 + sed -e '/^ALL_CFLAGS/iHARD_CFLAGS = ' \
190 + -e 's|^ALL_CFLAGS = |ALL_CFLAGS = $(HARD_CFLAGS) |' \
191 + -i "${S}"/gcc/Makefile.in
192 + # Need to add HARD_CFLAGS to ALL_CXXFLAGS on >= 4.7
193 + if tc_version_is_at_least 4.7 ; then
194 + sed -e '/^ALL_CXXFLAGS/iHARD_CFLAGS = ' \
195 + -e 's|^ALL_CXXFLAGS = |ALL_CXXFLAGS = $(HARD_CFLAGS) |' \
196 + -i "${S}"/gcc/Makefile.in
197 + fi
198 +
199 + # defaults to enable for new gnatbuild
200 + if use hardened ; then
201 + gcc_hard_flags=" -DEFAULT_PIE_SSP"
202 + else
203 + gcc_hard_flags+=" -DEFAULT_SSP"
204 + fi
205 +
206 + sed -i \
207 + -e "/^HARD_CFLAGS = /s|=|= ${gcc_hard_flags} |" \
208 + "${S}"/gcc/Makefile.in || die
209 +
210 +}
211 +
212 +gcc-multilib-configure() {
213 + if ! is_multilib ; then
214 + confgcc="${confgcc} --disable-multilib"
215 + # Fun times: if we are building for a target that has multiple
216 + # possible ABI formats, and the user has told us to pick one
217 + # that isn't the default, then not specifying it via the list
218 + # below will break that on us.
219 + else
220 + confgcc="${confgcc} --enable-multilib"
221 + fi
222 +
223 + # translate our notion of multilibs into gcc's
224 + local abi list
225 + for abi in $(get_all_abis TARGET) ; do
226 + local l=$(gcc-abi-map ${abi})
227 + [[ -n ${l} ]] && list+=",${l}"
228 + done
229 + if [[ -n ${list} ]] ; then
230 + case ${CTARGET} in
231 + x86_64*)
232 + tc_version_is_at_least 4.8 && confgcc="${confgcc} --with-multilib-list=${list:1}"
233 + ;;
234 + esac
235 + fi
236 +}
237 +
238 +gcc-abi-map() {
239 + # Convert the ABI name we use in Gentoo to what gcc uses
240 + local map=()
241 + case ${CTARGET} in
242 + mips*) map=("o32 32" "n32 n32" "n64 64") ;;
243 + x86_64*) map=("amd64 m64" "x86 m32" "x32 mx32") ;;
244 + esac
245 +
246 + local m
247 + for m in "${map[@]}" ; do
248 + l=( ${m} )
249 + [[ $1 == ${l[0]} ]] && echo ${l[1]} && break
250 + done
251 +}
252 +
253 +is_multilib() {
254 + tc_version_is_at_least 3 || return 1
255 + use multilib
256 +}
257 +
258 +## note: replaced with minspecs (sort of)
259 +#create_specs_file() {
260 +# einfo "Creating a vanilla gcc specs file"
261 +# "${WORKDIR}"/build/gcc/xgcc -dumpspecs > "${WORKDIR}"/build/vanilla.specs
262 +#}
263 +
264 +# eselect stuff taken straight from toolchain.eclass and greatly simplified
265 +add_profile_eselect_conf() {
266 + local gnat_config_file=$1
267 + local abi=$2
268 + local var
269 +
270 + echo >> "${D}/${gnat_config_file}"
271 + if ! is_multilib ; then
272 + echo " ctarget=${CTARGET}" >> "${D}/${gnat_config_file}"
273 + else
274 + echo "[${abi}]" >> "${D}/${gnat_config_file}"
275 + var="CTARGET_${abi}"
276 + if [[ -n ${!var} ]] ; then
277 + echo " ctarget=${!var}" >> "${D}/${gnat_config_file}"
278 + else
279 + var="CHOST_${abi}"
280 + if [[ -n ${!var} ]] ; then
281 + echo " ctarget=${!var}" >> "${D}/${gnat_config_file}"
282 + else
283 + echo " ctarget=${CTARGET}" >> "${D}/${gnat_config_file}"
284 + fi
285 + fi
286 + fi
287 +
288 + var="CFLAGS_${abi}"
289 + if [[ -n ${!var} ]] ; then
290 + echo " cflags=${!var}" >> "${D}/${gnat_config_file}"
291 + fi
292 +}
293 +
294 +create_eselect_conf() {
295 + local abi
296 +
297 + dodir ${CONFIG_PATH}
298 +
299 + echo "[global]" > "${D}/${gnat_config_file}"
300 + echo " version=${CTARGET}-${SLOT}" >> "${D}/${gnat_config_file}"
301 + echo " binpath=${BINPATH}" >> "${D}/${gnat_config_file}"
302 + echo " libexecpath=${LIBEXECPATH}" >> "${D}/${gnat_config_file}"
303 + echo " ldpath=${LIBPATH}" >> "${D}/${gnat_config_file}"
304 + echo " manpath=${DATAPATH}/man" >> "${D}/${gnat_config_file}"
305 + echo " infopath=${DATAPATH}/info" >> "${D}/${gnat_config_file}"
306 + echo " bin_prefix=${CTARGET}" >> "${D}/${gnat_config_file}"
307 +
308 + for abi in $(get_all_abis) ; do
309 + add_profile_eselect_conf "${gnat_config_file}" "${abi}"
310 + done
311 +}
312 +
313 +should_we_eselect_gnat() {
314 + # we only want to switch compilers if installing to / or /tmp/stage1root
315 + [[ ${ROOT} == "/" ]] || return 1
316 +
317 + # if the current config is invalid, we definitely want a new one
318 + # Note: due to bash quirkiness, the following must not be 1 line
319 + local curr_config
320 + curr_config=$(eselect --colour=no gnat show | grep ${CTARGET} | awk '{ print $1 }') || return 0
321 + [[ -z ${curr_config} ]] && return 0
322 +
323 + # The logic is basically "try to keep the same profile if possible"
324 +
325 + if [[ ${curr_config} == ${CTARGET}-${PN}-${SLOT} ]] ; then
326 + return 0
327 + else
328 + elog "The current gcc config appears valid, so it will not be"
329 + elog "automatically switched for you. If you would like to"
330 + elog "switch to the newly installed gcc version, do the"
331 + elog "following:"
332 + echo
333 + elog "eselect gnat set <profile>"
334 + echo
335 + ebeep
336 + return 1
337 + fi
338 +}
339 +
340 +# active compiler selection, called from pkg_postinst
341 +do_gnat_config() {
342 + eselect gnat set ${CTARGET}-${PN}-${SLOT} &> /dev/null
343 +
344 + elog "The following gnat profile has been activated:"
345 + elog "${CTARGET}-${PN}-${SLOT}"
346 + elog ""
347 + elog "The compiler has been installed as gnatgcc, and the coverage testing"
348 + elog "tool as gnatgcov."
349 + elog ""
350 + elog "Ada handling in Gentoo allows you to have multiple gnat variants"
351 + elog "installed in parallel and automatically manage Ada libs."
352 + elog "Please take a look at the Ada project page for some documentation:"
353 + elog "http://www.gentoo.org/proj/en/prog_lang/ada/index.xml"
354 +}
355 +
356 +
357 +# Taken straight from the toolchain.eclass. Only removed the "obsolete hunk"
358 +#
359 +# The purpose of this DISGUSTING gcc multilib hack is to allow 64bit libs
360 +# to live in lib instead of lib64 where they belong, with 32bit libraries
361 +# in lib32. This hack has been around since the beginning of the amd64 port,
362 +# and we're only now starting to fix everything that's broken. Eventually
363 +# this should go away.
364 +#
365 +# Travis Tilley <lv@g.o> (03 Sep 2004)
366 +#
367 +disgusting_gcc_multilib_HACK() {
368 + local config
369 + local libdirs
370 + if has_multilib_profile ; then
371 + case $(tc-arch) in
372 + amd64)
373 + config="i386/t-linux64"
374 + libdirs="../$(get_abi_LIBDIR amd64) ../$(get_abi_LIBDIR x86)" \
375 + ;;
376 + ppc64)
377 + config="rs6000/t-linux64"
378 + libdirs="../$(get_abi_LIBDIR ppc64) ../$(get_abi_LIBDIR ppc)" \
379 + ;;
380 + esac
381 + else
382 + die "Your profile is no longer supported by portage."
383 + fi
384 +
385 + einfo "updating multilib directories to be: ${libdirs}"
386 + sed -i -e "s:^MULTILIB_OSDIRNAMES.*:MULTILIB_OSDIRNAMES = ${libdirs}:" "${S}"/gcc/config/${config}
387 +}
388 +
389 +
390 +#---->> pkg_* <<----
391 +gnatbuild-r1_pkg_setup() {
392 + debug-print-function ${FUNCNAME} $@
393 +
394 + # Setup variables which would normally be in the profile
395 + if is_crosscompile ; then
396 + multilib_env ${CTARGET}
397 + fi
398 +
399 + # we dont want to use the installed compiler's specs to build gnat!
400 + unset GCC_SPECS
401 + unset LANGUAGES #265283
402 +}
403 +
404 +gnatbuild-r1_pkg_postinst() {
405 + if should_we_eselect_gnat; then
406 + do_gnat_config
407 + else
408 + eselect gnat update
409 + fi
410 +
411 + # if primary compiler list is empty, add this profile to the list, so
412 + # that users are not left without active compilers (making sure that
413 + # libs are getting built for at least one)
414 + elog
415 + . ${GnatCommon} || die "failed to source common code"
416 + if [[ ! -f ${PRIMELIST} ]] || [[ ! -s ${PRIMELIST} ]]; then
417 + echo "${gnat_profile}" > ${PRIMELIST}
418 + elog "The list of primary compilers was empty and got assigned ${gnat_profile}."
419 + fi
420 + elog "Please edit ${PRIMELIST} and list there gnat profiles intended"
421 + elog "for common use."
422 +}
423 +
424 +
425 +gnatbuild-r1_pkg_postrm() {
426 + # "eselect gnat update" now removes the env.d file if the corresponding
427 + # gnat profile was unmerged
428 + eselect gnat update
429 + elog "If you just unmerged the last gnat in this SLOT, your active gnat"
430 + elog "profile got unset. Please check what eselect gnat show tells you"
431 + elog "and set the desired profile"
432 +}
433 +#---->> pkg_* <<----
434 +
435 +#---->> src_* <<----
436 +
437 +# common unpack stuff
438 +gnatbuild-r1_src_unpack() {
439 + debug-print-function ${FUNCNAME} $@
440 +
441 + [ -z "$1" ] && gnatbuild-r1_src_unpack all
442 +
443 + while [ "$1" ]; do
444 + case $1 in
445 + base_unpack)
446 + unpack ${A}
447 + pax-mark E $(find ${GNATBOOT} -name gnat1)
448 +
449 + cd "${S}"
450 + # patching gcc sources, following the toolchain
451 + # first, the common patches
452 + guess_patch_type_in_dir "${WORKDIR}"/patch
453 + EPATCH_MULTI_MSG="Applying common Gentoo patches ..." \
454 + epatch "${WORKDIR}"/patch
455 + guess_patch_type_in_dir "${WORKDIR}"/piepatch
456 + EPATCH_MULTI_MSG="Applying Gentoo PIE patches ..." \
457 + epatch "${WORKDIR}"/piepatch
458 +
459 + if [[ -d "${FILESDIR}"/patches ]] && [[ ! -z $(ls "${FILESDIR}"/patches/*.patch 2>/dev/null) ]] ; then
460 + EPATCH_MULTI_MSG="Applying local Gentoo patches ..." \
461 + epatch "${FILESDIR}"/patches/*.patch
462 + fi
463 + #
464 + # then per SLOT
465 + if [[ -d "${FILESDIR}"/patches/${SLOT} ]] && [[ ! -z $(ls "${FILESDIR}"/patches/${SLOT}/*.patch 2>/dev/null) ]] ; then
466 + EPATCH_MULTI_MSG="Applying SLOT-specific Gentoo patches ..." \
467 + epatch "${FILESDIR}"/patches/${SLOT}/*.patch
468 + fi
469 +
470 + # add hardening as per toolchain eclass
471 + make_gcc_hard
472 +
473 + # Replacing obsolete head/tail with POSIX compliant ones
474 + ht_fix_file */configure
475 +
476 +# if ! is_crosscompile && is_multilib && \
477 +# [[ ( $(tc-arch) == "amd64" || $(tc-arch) == "ppc64" ) && -z ${SKIP_MULTILIB_HACK} ]] ; then
478 +# disgusting_gcc_multilib_HACK || die "multilib hack failed"
479 +# fi
480 +
481 + # Fixup libtool to correctly generate .la files with portage
482 + cd "${S}"
483 + elibtoolize --portage --shallow --no-uclibc
484 +
485 + gnuconfig_update
486 + # update configure files
487 + einfo "Fixing misc issues in configure files"
488 + for f in $(grep -l 'autoconf version 2.13' $(find "${S}" -name configure)) ; do
489 + ebegin " Updating ${f}"
490 + patch "${f}" "${FILESDIR}"/gcc-configure-LANG.patch >& "${T}"/configure-patch.log \
491 + || eerror "Please file a bug about this"
492 + eend $?
493 + done
494 +
495 + # apply global slot/path patch
496 + EPATCH_MULTI_MSG="Adjusting default paths for gnat-gcc ..." \
497 + epatch "${FILESDIR}"/${PN}-4.9.3-make-default-paths-match-slot.patch
498 + sed -i -e "s|SLOT_MARKER|${BOOT_SLOT}|" "${S}"/gcc/Makefile.in
499 +
500 + [[ ${CHOST} == ${CTARGET} ]] && epatch "${FILESDIR}"/gcc-spec-env-r1.patch
501 +
502 +# this is only needed for gnat-gpl-4.1 and breaks for gnat-gcc, so
503 +# this block was moved to corresponding ebuild
504 +# pushd "${S}"/gnattools &> /dev/null
505 +# eautoconf
506 +# popd &> /dev/null
507 + ;;
508 +
509 + common_prep)
510 + # Prepare the gcc source directory
511 + cd "${S}/gcc"
512 + touch cstamp-h.in
513 + touch ada/[es]info.h
514 + touch ada/nmake.ad[bs]
515 + # set the compiler name to gnatgcc
516 + for i in `find ada/ -name '*.ad[sb]'`; do \
517 + sed -i -e "s/\"gcc\"/\"gnatgcc\"/g" ${i}; \
518 + done
519 + # add -fPIC flag to shared libs for 3.4* backend
520 + if [ "3.4" == "${GCCBRANCH}" ] ; then
521 + cd ada
522 + epatch "${FILESDIR}"/gnat-Make-lang.in.patch
523 + fi
524 +
525 + # gcc 4.3 sources seem to have a common omission of $(DESTDIR),
526 + # that leads to make install trying to rm -f file on live system.
527 + # As we do not need this rm, we simply remove the whole line
528 + if [ "4.3" == "${GCCBRANCH}" ] ; then
529 + sed -i -e "/\$(RM) \$(bindir)/d" "${S}"/gcc/ada/Make-lang.in
530 + fi
531 +
532 + find "${S}" -name Makefile.in \
533 + -exec sed -i '/^pkgconfigdir/s:=.*:=$(toolexeclibdir)/pkgconfig:' {} +
534 +
535 + mkdir -p "${GNATBUILD}"
536 + ;;
537 +
538 + all)
539 + gnatbuild-r1_src_unpack base_unpack common_prep
540 + ;;
541 + esac
542 + shift
543 + done
544 +}
545 +
546 +# for now just dont run default configure
547 +gnatbuild-r1_src_configure() {
548 + :
549 +}
550 +
551 +# it would be nice to split configure and make steps
552 +# but both need to operate inside specially tuned evironment
553 +# so just do sections for now (as in eclass section of handbook)
554 +# sections are: configure, make-tools, bootstrap,
555 +# gnatlib_and_tools, gnatlib-shared
556 +gnatbuild-r1_src_compile() {
557 + debug-print-function ${FUNCNAME} $@
558 +
559 + if [[ -z "$1" ]]; then
560 + gnatbuild-r1_src_compile all
561 + return $?
562 + fi
563 +
564 + if [[ "all" == "$1" ]]
565 + then # specialcasing "all" to avoid scanning sources unnecessarily
566 + gnatbuild-r1_src_compile configure make-tools \
567 + bootstrap gnatlib_and_tools gnatlib-shared
568 +
569 + else
570 + # Set some paths to our bootstrap compiler.
571 + export PATH="${GNATBOOT}/bin:${PATH}"
572 + # !ATTN! the bootstrap compilers have a very simplystic structure,
573 + # so many paths are not identical to the installed ones.
574 + # Plus it was simplified even more in new releases.
575 + if [[ ${BOOT_SLOT} > 4.1 ]] ; then
576 + case $(tc-arch) in
577 + arm)
578 + GNATLIB="${GNATBOOT}/lib/gcc/${BOOT_TARGET}/${BOOT_SLOT}"
579 + ;;
580 + x86|amd64)
581 + GNATLIB="${GNATBOOT}/lib/gcc/${BOOT_TARGET}/${BOOT_VER}"
582 + ;;
583 + *)
584 + GNATLIB="${GNATBOOT}/lib"
585 + ;;
586 + esac
587 + else
588 + GNATLIB="${GNATBOOT}/lib/gnatgcc/${BOOT_TARGET}/${BOOT_SLOT}"
589 + fi
590 +
591 + export CC="${GNATBOOT}/bin/gnatgcc"
592 + export CXX="${GNATBOOT}/bin/gnatg++"
593 + export LDFLAGS="${LDFLAGS}"
594 + export CFLAGS="${CFLAGS}"
595 + export CXXFLAGS="${CFLAGS}"
596 + # CPATH is supposed to be applied for any language, thus
597 + # superceding either of C/CPLUS/OBJC_INCLUDE_PATHs
598 + export CPATH="${GNATLIB}/include"
599 + LIB_DIR="${GNATLIB}"
600 + LDFLAGS="${LDFLAGS} -L${GNATLIB}"
601 +
602 + # additional vars from gnuada and elsewhere
603 + export LIBRARY_PATH="${GNATLIB}"
604 +
605 + STDCXX_INCDIR="${LIBPATH}/include/g++-v${SLOT/\.*/}"
606 +
607 + export ADA_OBJECTS_PATH="${GNATLIB}/adalib"
608 + export ADA_INCLUDE_PATH="${GNATLIB}/adainclude"
609 +
610 + while [ "$1" ]; do
611 + case $1 in
612 + configure)
613 + debug-print-section configure
614 +
615 + # Configure gcc
616 + local confgcc
617 + confgcc="${confgcc} --host=${CHOST}"
618 +
619 + # some cross-compile logic from toolchain
620 + if is_crosscompile || tc-is-cross-compiler ; then
621 + confgcc="${confgcc} --target=${CTARGET}"
622 + fi
623 + [[ -n ${CBUILD} ]] && confgcc="${confgcc} --build=${CBUILD}"
624 +
625 + # Native Language Support
626 + if use nls ; then
627 + confgcc="${confgcc} --enable-nls --without-included-gettext"
628 + else
629 + confgcc="${confgcc} --disable-nls"
630 + fi
631 +
632 + if tc_version_is_at_least 4.6 ; then
633 + confgcc="${confgcc} --enable-lto"
634 + else
635 + confgcc="${confgcc} --disable-lto"
636 + fi
637 +
638 + # setup multilib abi stuff
639 + gcc-multilib-configure
640 +
641 + use hardened && confgcc="${confgcc} --enable-esp"
642 +
643 + # reasonably sane globals (from toolchain)
644 + # also disable mudflap and ssp
645 + confgcc="${confgcc} \
646 + --enable-languages="c,ada,c++" \
647 + --with-gcc \
648 + --with-system-zlib \
649 + --enable-obsolete \
650 + --enable-secureplt \
651 + --disable-werror \
652 + --enable-checking=release \
653 + --enable-libstdcxx-time \
654 + --disable-libmudflap \
655 + --disable-libssp \
656 + --disable-altivec \
657 + --disable-fixed-point \
658 + --disable-libgcj \
659 + --disable-libcilkrts \
660 + --disable-libquadmath \
661 + --enable-libsanitizer \
662 + --enable-targets=all \
663 + --with-bugurl=https://bugs.gentoo.org/ \
664 + --with-python-dir=${DATAPATH/$PREFIX/}/python"
665 +
666 + if in_iuse openmp ; then
667 + # Make sure target has pthreads support. #326757 #335883
668 + # There shouldn't be a chicken&egg problem here as openmp won't
669 + # build without a C library, and you can't build that w/out
670 + # already having a compiler ...
671 + if ! is_crosscompile || \
672 + $(tc-getCPP ${CTARGET}) -E - <<<"#include <pthread.h>" >& /dev/null
673 + then
674 + case $(tc-arch) in
675 + arm)
676 + confgcc="${confgcc} --disable-libgomp"
677 + ;;
678 + *)
679 + if use openmp ; then
680 + confgcc="${confgcc} --enable-libgomp"
681 + else
682 + confgcc="${confgcc} --disable-libgomp"
683 + fi
684 + ;;
685 + esac
686 + else
687 + # Force disable as the configure script can be dumb #359855
688 + confgcc="${confgcc} --disable-libgomp"
689 + fi
690 + else
691 + # For gcc variants where we don't want openmp (e.g. kgcc)
692 + confgcc="${confgcc} --disable-libgomp"
693 + fi
694 +
695 + # ACT's gnat-gpl does not like libada for whatever reason..
696 + if tc_version_is_at_least 4.2 ; then
697 + confgcc="${confgcc} --enable-libada"
698 +# else
699 +# einfo "ACT's gnat-gpl does not like libada, disabling"
700 +# confgcc="${confgcc} --disable-libada"
701 + fi
702 +
703 + # set some specifics available in later versions
704 + confgcc="${confgcc} --enable-shared"
705 + if tc_version_is_at_least 4.7 ; then
706 + einfo "setting gnat thread model"
707 + confgcc="${confgcc} --enable-threads=posix"
708 + confgcc="${confgcc} --enable-shared=boehm-gc,ada,libada"
709 + elif tc_version_is_at_least 4.3 ; then
710 + confgcc="${confgcc} --enable-threads=gnat"
711 + confgcc="${confgcc} --enable-shared=boehm-gc,ada,libada"
712 + else
713 + confgcc="${confgcc} --enable-threads=posix"
714 + fi
715 +
716 + # harfloat vs soft
717 + case $(tc-is-softfloat) in
718 + yes) confgcc="${confgcc} --with-float=soft" ;;
719 + softfp) confgcc="${confgcc} --with-float=softfp" ;;
720 + *)
721 + # If they've explicitly opt-ed in, do hardfloat,
722 + # otherwise let the gcc default kick in.
723 + case ${CTARGET//_/-} in
724 + *-hardfloat-*|*eabihf) confgcc="${confgcc} --with-float=hard" ;;
725 + esac
726 + esac
727 +
728 + # multilib and arch support
729 + case $(tc-arch) in
730 + arm)
731 + local a arm_arch=${CTARGET%%-*}
732 + # Remove trailing endian variations first: eb el be bl b l
733 + for a in e{b,l} {b,l}e b l ; do
734 + if [[ ${arm_arch} == *${a} ]] ; then
735 + arm_arch=${arm_arch%${a}}
736 + break
737 + fi
738 + done
739 + # Convert armv7{a,r,m} to armv7-{a,r,m}
740 + [[ ${arm_arch} == armv7? ]] && arm_arch=${arm_arch/7/7-}
741 + # See if this is a valid --with-arch flag
742 + if (srcdir=${S}/gcc target=${CTARGET} with_arch=${arm_arch};
743 + . "${srcdir}"/config.gcc) &>/dev/null
744 + then
745 + confgcc="${confgcc} --with-arch=${arm_arch}"
746 + fi
747 +
748 + # Make default mode thumb for microcontroller classes #418209
749 + [[ ${arm_arch} == *-m ]] && confgcc="${confgcc} --with-mode=thumb"
750 +
751 + # Enable hardvfp
752 + if [[ $(tc-is-softfloat) == "no" ]] && \
753 + [[ ${CTARGET} == armv[67]* ]]
754 + then
755 + # Follow the new arm hardfp distro standard by default
756 + confgcc="${confgcc} --with-float=hard"
757 + case ${CTARGET} in
758 + armv6*) confgcc="${confgcc} --with-fpu=vfp" ;;
759 + armv7*) confgcc="${confgcc} --with-fpu=vfpv3-d16" ;;
760 + esac
761 + fi
762 + ;;
763 + mips)
764 + # Add --with-abi flags to set default ABI
765 + confgcc="${confgcc} --with-abi=$(gcc-abi-map ${TARGET_DEFAULT_ABI})"
766 + ;;
767 + ppc)
768 + # Set up defaults based on current CFLAGS
769 + is-flagq -mfloat-gprs=double && confgcc="${confgcc} --enable-e500-double"
770 + [[ ${CTARGET//_/-} == *-e500v2-* ]] && confgcc="${confgcc} --enable-e500-double"
771 + ;;
772 + amd64)
773 + if is_multilib ; then
774 + confgcc="${confgcc} --enable-multilib"
775 + if has x32 $(get_all_abis TARGET) ; then
776 + confgcc="${confgcc} --with-abi=$(gcc-abi-map ${TARGET_DEFAULT_ABI})"
777 + fi
778 + else
779 + confgcc="${confgcc} --disable-multilib"
780 + fi
781 + ;;
782 + x86)
783 + confgcc="${confgcc} --with-arch=${CTARGET%%-*}"
784 + confgcc="${confgcc} --disable-multilib"
785 + ;;
786 + esac
787 +
788 + # __cxa_atexit is "essential for fully standards-compliant handling of
789 + # destructors", but apparently requires glibc.
790 + if [[ ${CTARGET} == *-gnu* ]] ; then
791 + confgcc="${confgcc} --enable-__cxa_atexit"
792 + confgcc="${confgcc} --enable-clocale=gnu"
793 + fi
794 +
795 + export gcc_cv_lto_plugin=1 # okay to build, default to opt-in
796 + export gcc_cv_prog_makeinfo_modern=no
797 + export ac_cv_have_x='have_x=yes ac_x_includes= ac_x_libraries='
798 + use hardened && export gcc_cv_libc_provides_ssp=yes
799 +
800 + # need to strip graphite/lto flags or we'll get the
801 + # dreaded C compiler cannot create executables...
802 + # error.
803 +# filter-flags -floop-interchange -floop-strip-mine -floop-block
804 +# filter-flags -fuse-linker-plugin -flto*
805 + strip-flags
806 + replace-flags -O? -O2
807 + filter-flags '-mabi*' -m31 -m32 -m64
808 + filter-flags -frecord-gcc-switches
809 + filter-flags -mno-rtm -mno-htm
810 +
811 + # gold linker barfs on some arches/configs :/
812 + #tc-ld-is-gold && tc-ld-disable-gold
813 +
814 + case $(tc-arch) in
815 + amd64|x86)
816 + filter-flags '-mcpu=*'
817 + ;;
818 + *)
819 + ;;
820 + esac
821 +
822 +# strip-unsupported-flags
823 +
824 + STAGE1_CFLAGS="${CFLAGS} -fPIC"
825 + use hardened && STAGE1_CFLAGS="-O2 -fPIC"
826 + BOOT_CFLAGS="$(get_abi_CFLAGS ${TARGET_DEFAULT_ABI}) ${CFLAGS} -fPIC"
827 + is_crosscompile && BOOT_CFLAGS="-O2 -fPIC"
828 +
829 + einfo "Environment vars:
830 + CC=${CC},
831 + CXX=${CXX},
832 + CTARGET=${CTARGET}
833 + ABI=${TARGET_DEFAULT_ABI},
834 + TARGET_ABI=${TARGET_ABI}.
835 + TARGET_MULTILIB_ABIS=${TARGET_MULTILIB_ABIS},
836 + TARGET_DEFAULT_ABI=${TARGET_DEFAULT_ABI},
837 + GCC_ABI=$(gcc-abi-map ${TARGET_DEFAULT_ABI})
838 + ADA_OBJECTS_PATH=${ADA_OBJECTS_PATH},
839 + ADA_INCLUDE_PATH=${ADA_INCLUDE_PATH},
840 + PATH=${PATH}"
841 +
842 + confgcc="${confgcc} ${EXTRA_ECONF}"
843 + einfo "Configuring with confgcc=${confgcc}"
844 +
845 + pushd "${GNATBUILD}" > /dev/null
846 + CC="${CC}" CXX="${CXX}" \
847 + LDFLAGS="${LDFLAGS}" \
848 + CFLAGS="${CFLAGS}" \
849 + CXXFLAGS="${CFLAGS}" \
850 + "${S}"/configure \
851 + --prefix="${PREFIX}" \
852 + --bindir="${BINPATH}" \
853 + --includedir="${INCLUDEPATH}" \
854 + --datadir="${DATAPATH}" \
855 + --mandir="${DATAPATH}"/man \
856 + --infodir="${DATAPATH}"/info \
857 + --with-gxx-include-dir="${STDCXX_INCDIR}" \
858 + --with-pkgversion="Gentoo Hardened ${GNATRELEASE} p${PATCH_VER}, pie-${PIE_VER}" \
859 + ${confgcc} || die "configure failed"
860 + popd > /dev/null
861 + ;;
862 +
863 + make-tools)
864 + debug-print-section make-tools
865 + # Compile helper tools
866 + cd "${GNATBOOT}"
867 + cp "${S}"/gcc/ada/xtreeprs.adb .
868 + cp "${S}"/gcc/ada/xsinfo.adb .
869 + cp "${S}"/gcc/ada/xeinfo.adb .
870 + cp "${S}"/gcc/ada/xnmake.adb .
871 + cp "${S}"/gcc/ada/xutil.ad{s,b} .
872 + if (( ${GNATMINOR} > 5 )) ; then
873 + cp "${S}"/gcc/ada/einfo.ad{s,b} .
874 + cp "${S}"/gcc/ada/csinfo.adb .
875 + cp "${S}"/gcc/ada/ceinfo.adb .
876 + fi
877 +
878 + gnatmake xtreeprs && \
879 + gnatmake xsinfo && \
880 + gnatmake xeinfo && \
881 + gnatmake xnmake || die "building helper tools"
882 +
883 + mv xeinfo xnmake xsinfo xtreeprs bin/
884 + ;;
885 +
886 + bootstrap)
887 + debug-print-section bootstrap
888 + # and, finally, the build itself
889 + # do we need this? STAGE1_CFLAGS="${CFLAGS}"
890 + # or this? bootstrap-lean
891 + # removing both to try --disable-bootstrap
892 + pushd "${GNATBUILD}" >/dev/null
893 +
894 + emake \
895 + LDFLAGS="${LDFLAGS}" \
896 + LIBPATH="${LIBPATH}" \
897 + CC="${CC}" CXX="${CXX}" \
898 + STAGE1_CFLAGS="${STAGE1_CFLAGS}" \
899 + LIBRARY_VERSION="${SLOT}" \
900 + BOOT_CFLAGS="${BOOT_CFLAGS}" \
901 + bootstrap-lean \
902 + || die "bootstrap failed"
903 +
904 + popd >/dev/null
905 + ;;
906 +
907 + gnatlib_and_tools)
908 + debug-print-section gnatlib_and_tools
909 + einfo "building gnatlib_and_tools"
910 + cd "${GNATBUILD}"
911 + emake -j1 -C gcc gnatlib_and_tools || \
912 + die "gnatlib_and_tools failed"
913 + ;;
914 +
915 + gnatlib-shared)
916 + debug-print-section gnatlib-shared
917 + einfo "building shared lib"
918 + cd "${GNATBUILD}"
919 + rm -f gcc/ada/rts/*.{o,ali} || die
920 + #otherwise make tries to reuse already compiled (without -fPIC) objs..
921 + emake -j1 -C gcc gnatlib-shared LIBRARY_VERSION="${SLOT}" || \
922 + die "gnatlib-shared failed"
923 + ;;
924 +
925 + esac
926 + shift
927 + done # while
928 + fi # "all" == "$1"
929 +}
930 +# -- end gnatbuild-r1_src_compile
931 +
932 +
933 +gnatbuild-r1_src_install() {
934 + debug-print-function ${FUNCNAME} $@
935 +
936 + if [[ -z "$1" ]] ; then
937 + gnatbuild-r1_src_install all
938 + return $?
939 + fi
940 +
941 + while [ "$1" ]; do
942 + case $1 in
943 + install) # runs provided make install
944 + debug-print-section install
945 +
946 + # Looks like we need an access to the bootstrap compiler here too
947 + # as gnat apparently wants to compile something during the installation
948 + # The spotted obuser was xgnatugn, used to process gnat_ugn_urw.texi,
949 + # during preparison of the docs.
950 + export PATH="${GNATBOOT}/bin:${PATH}"
951 + if [[ ${BOOT_SLOT} > 4.1 ]] ; then
952 + GNATLIB="${GNATBOOT}/lib"
953 + elif [[ ${BOOT_SLOT} > 4.8 ]] ; then
954 + GNATLIB="${GNATBOOT}/lib/gnatgcc/${BOOT_TARGET}/${BOOT_VER}"
955 + else
956 + GNATLIB="${GNATBOOT}/lib/gnatgcc/${BOOT_TARGET}/${BOOT_SLOT}"
957 + fi
958 +
959 + export CC="${GNATBOOT}/bin/gnatgcc"
960 + #export INCLUDE_DIR="${GNATLIB}/include"
961 + #export C_INCLUDE_PATH="${GNATLIB}/include"
962 + #export CPLUS_INCLUDE_PATH="${GNATLIB}/include"
963 + export ADA_OBJECTS_PATH="${GNATLIB}/adalib"
964 + export ADA_INCLUDE_PATH="${GNATLIB}/adainclude"
965 +
966 + # Do not allow symlinks in /usr/lib/gcc/${CHOST}/${MY_PV}/include as
967 + # this can break the build.
968 + find "${GNATBUILD}"/\*gcc/include/ -type l -delete
969 +
970 + # Remove generated headers, as they can cause things to break
971 + # (ncurses, openssl, etc). (from toolchain.eclass)
972 + for x in $(find "${WORKDIR}"/build/gcc/include/ -name '*.h') ; do
973 + grep -q 'It has been auto-edited by fixincludes from' "${x}" \
974 + && rm -f "${x}"
975 + done
976 +
977 +
978 + cd "${GNATBUILD}"
979 + make -j1 DESTDIR="${D}" install || die
980 +
981 + find "${D}" -name install-tools -prune -type d -exec rm -rf "{}" \;
982 + find "${D}" -name libiberty.a -delete
983 +
984 + # Disable RANDMMAP so PCH works. #301299
985 + pax-mark r "${D}${LIBEXECPATH}"/{gnat1,cc1,cc1plus}
986 +
987 + # Quiet QA warnings, wait for adacore exec stack patch in gcc 7
988 + # (note: needs testing with hardened emulate trampolines)
989 + #if use hardened ; then
990 + # pax-mark Emr "${D}"${BINPATH}/{gnatmake,gnatname,gnatls,gnatclean,gnat}
991 + #else
992 + # export QA_EXECSTACK="${BINPATH:1}/gnatls ${BINPATH:1}/gnatname
993 + # ${BINPATH:1}/gnatmake ${BINPATH:1}/gnatclean ${BINPATH:1}/gnat
994 + # ${LIBEXECPATH:1}/gnat1 ${LIBPATH:1}/adalib/libgnat-${SLOT}.so"
995 + #fi
996 +# export QA_EXECSTACK="${BINPATH:1}/gnatls ${BINPATH:1}/gnatname
997 +# ${BINPATH:1}/gnatmake ${BINPATH:1}/gnatclean ${BINPATH:1}/gnat"
998 +
999 + use hardened && pax-mark E "${D}${BINPATH}"/{gnatmake,gnatname,gnatls,gnatclean,gnat}
1000 +
1001 + if use doc ; then
1002 + if (( $(bc <<< "${GNATBRANCH} > 4.3") )) ; then
1003 + #make a convenience info link
1004 + ewarn "Yay! Math works."
1005 + dosym gnat_ugn.info ${DATAPATH}/info/gnat.info
1006 + fi
1007 + fi
1008 + ;;
1009 +
1010 + move_libs)
1011 + debug-print-section move_libs
1012 +
1013 + # first we need to remove some stuff to make moving easier
1014 + #rm -rf "${D}${LIBPATH}"/{32,include}
1015 + # gcc insists on installing libs in its own place
1016 + cp -a -t "${D}${LIBPATH}"/ "${D}${PREFIX}"/lib/gcc/"${CTARGET}/${GCCRELEASE}"/*
1017 + cp -a -t "${D}${LIBEXECPATH}"/ "${D}${PREFIX}"/libexec/gcc/"${CTARGET}/${GCCRELEASE}"/*
1018 + rm -rf "${D}${PREFIX}"/libexec/gcc
1019 +
1020 + # libgcc_s and, with gcc>=4.0, other libs get installed in multilib specific locations by gcc
1021 + # we pull everything together to simplify working environment
1022 + if is_multilib ; then
1023 + case $(tc-arch) in
1024 + amd64)
1025 + cp -a -t "${D}${LIBPATH}"/ "${D}${PREFIX}"/lib/"${PN}/${CTARGET}/${SLOT}"/*
1026 + mv -t "${D}${LIBPATH}"/32/ "${D}${PREFIX}"/lib32/*
1027 + mv -t "${D}${LIBPATH}"/ "${D}${PREFIX}"/lib64/lib*
1028 + rm -rf "${D}${PREFIX}"/lib "${D}${PREFIX}"/lib32
1029 + ;;
1030 + ppc64)
1031 + # not supported yet, will have to be adjusted when we
1032 + # actually build gnat for that arch
1033 + ;;
1034 + esac
1035 + else
1036 + # x86 cleanup (maybe arm)
1037 + mv -t "${D}${LIBPATH}"/ "${D}${PREFIX}/lib/gcc/${CTARGET}/${GCCRELEASE}"/*
1038 + mv -t "${D}${LIBPATH}"/ "${D}${PREFIX}"/lib/lib*
1039 + #mv -t "${D}${LIBPATH}"/include/ "${D}${LIBPATH}"/gcc/"${CTARGET}/${GCCRELEASE}"/include/*
1040 + rm -rf "${D}${PREFIX}"/lib/gcc
1041 + rm -rf "${D}${LIBPATH}"/gcc
1042 + fi
1043 +
1044 + local py gdbdir=/usr/share/gdb/auto-load${LIBPATH/\/lib\//\/$(get_libdir)\/}
1045 + pushd "${D}${LIBPATH}" >/dev/null
1046 + for py in $(find . -name '*-gdb.py') ; do
1047 + local multidir=${py%/*}
1048 + insinto "${gdbdir}/${multidir}"
1049 + sed -i "/^libdir =/s:=.*:= '${LIBPATH}/${multidir}':" "${py}" || die
1050 + doins "${py}" || die
1051 + rm "${py}" || die
1052 + done
1053 + popd >/dev/null
1054 + ;;
1055 +
1056 + cleanup)
1057 + debug-print-section cleanup
1058 +
1059 + # force gnatgcc to use its own specs - versions prior to 3.4.6 read specs
1060 + # from system gcc location. Do the simple wrapper trick for now
1061 + # !ATTN! change this if eselect-gnat starts to follow eselect-compiler
1062 + cd "${D}${BINPATH}"
1063 + if [[ ${GCCVER} < 3.4.6 ]] ; then
1064 + # gcc 4.1 uses builtin specs. What about 4.0?
1065 + mv gnatgcc gnatgcc_2wrap
1066 + cat > gnatgcc << EOF
1067 +#! /bin/bash
1068 +# wrapper to cause gnatgcc read appropriate specs and search for the right .h
1069 +# files (in case no matching gcc is installed)
1070 +BINDIR=\$(dirname \$0)
1071 +# The paths in the next line have to be absolute, as gnatgcc may be called from
1072 +# any location
1073 +\${BINDIR}/gnatgcc_2wrap -specs="${LIBPATH}/specs" -I"${LIBPATH}/include" \$@
1074 +EOF
1075 + chmod a+x gnatgcc
1076 + else
1077 + local i
1078 + for i in cpp gcc gcov c++ g++ ; do
1079 + ln -s ${i} gnat${i}
1080 + done
1081 + fi
1082 +
1083 + # earlier gnat's generate some Makefile's at generic location, need to
1084 + # move to avoid collisions
1085 + [ -f "${D}${PREFIX}"/share/gnat/Makefile.generic ] &&
1086 + mv "${D}${PREFIX}"/share/gnat/Makefile.* "${D}${DATAPATH}"
1087 +
1088 + rm -rf "${D}${LIBPATH}"/install-tools "${D}${LIBEXECPATH}"/install-tools
1089 +
1090 + # remove duplicate docs
1091 + rm -rf "${D}${DATAPATH}"/info
1092 + rm -rf "${D}${DATAPATH}"/man
1093 +
1094 + # fix .la path for lto plugin
1095 + [ -f "${D}${LIBEXECPATH}"/liblto_plugin.la ] &&
1096 + sed -i -e \
1097 + "/libdir=/c\libdir='${LIBEXECPATH}'" \
1098 + "${D}${LIBEXECPATH}"/liblto_plugin.la
1099 +
1100 + # use gid of 0 because some stupid ports don't have
1101 + # the group 'root' set to gid 0 (toolchain.eclass)
1102 + chown -R root:0 "${D}${LIBPATH}" 2>/dev/null
1103 +
1104 + # add hardening spec stuff
1105 + if use hardened ; then
1106 + insinto "${LIBPATH}"
1107 + doins "${WORKDIR}"/specs/*.specs || die "failed to install specs"
1108 + fi
1109 + ;;
1110 +
1111 + prep_env)
1112 + # instead of putting junk under /etc/env.d/gnat we recreate env files as
1113 + # needed with eselect
1114 + create_eselect_conf
1115 + ;;
1116 +
1117 + all)
1118 + # remove the move to test new install paths # move_libs
1119 + gnatbuild-r1_src_install install move_libs cleanup prep_env
1120 + ;;
1121 + esac
1122 + shift
1123 + done # while
1124 +}
1125 +# -- end gnatbuild-r1_src_install