1 # Copyright 1999-2018 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
5 # Removal on 2018-05-18.
7 # Author: George Shapovalov <george@gentoo.org>
8 # Author: Steve Arnold <nerdboy@gentoo.org>
9 # No maintainer <maintainer-needed@gentoo.org>
12 # HOMEPAGE and LICENSE are set in appropriate ebuild, as
13 # gnat is developed by FSF and AdaCore "in parallel"
15 # The following vars can be set in ebuild before inheriting this eclass. They
18 # BOOT_SLOT - where old bootstrap is used as it works fine
23 inherit eutils fixheadtails flag-o-matic gnuconfig libtool multilib pax-utils toolchain-funcs versionator
25 FEATURES=${FEATURES/multilib-strict/}
27 EXPORT_FUNCTIONS="pkg_setup pkg_postinst pkg_postrm src_unpack src_configure src_compile src_install"
30 # multilib is supported via profiles now, multilib usevar is deprecated
32 RDEPEND="app-eselect/eselect-gnat
34 nls? ( virtual/libintl )"
37 >=app-eselect/eselect-gnat-1.3-r1
39 >=sys-devel/binutils-2.23
41 >=sys-devel/bison-1.875
42 >=sys-devel/flex-2.5.4
43 nls? ( sys-devel/gettext )"
46 # It may not be safe to source this at top level. Only source inside local
48 GnatCommon="/usr/share/gnat/lib/gnat-common.bash"
50 #---->> globals and SLOT <<----
52 # just a check, this location seems to vary too much, easier to track it in
54 #[ -z "${GNATSOURCE}" ] && die "please set GNATSOURCE in ebuild! (before inherit)"
57 # because of gnatpro/gnatgpl we need to track both gcc and gnat versions
59 # these simply default to $PV
60 GNATMAJOR=$(get_version_component_range 1)
61 GNATMINOR=$(get_version_component_range 2)
62 GNATBRANCH=$(get_version_component_range 1-2)
63 GNATRELEASE=$(get_version_component_range 1-3)
64 # this one is for the gnat-gpl which is versioned by gcc backend and ACT version
66 ACT_Ver=$(get_version_component_range 4)
68 # GCCVER and SLOT logic
70 # I better define vars for package names, as there was discussion on proper
71 # naming and it may change
75 # ATTN! GCCVER stands for the provided backend gcc, not the one on the system
76 # so tc-* functions are of no use here. The present versioning scheme makes
77 # GCCVER basically a part of PV, but *this may change*!!
79 # GCCVER can be set in the ebuild.
80 [[ -z ${GCCVER} ]] && GCCVER="${GNATRELEASE}"
83 # finally extract GCC version strings
84 GCCMAJOR=$(get_version_component_range 1 "${GCCVER}")
85 GCCMINOR=$(get_version_component_range 2 "${GCCVER}")
86 GCCBRANCH=$(get_version_component_range 1-2 "${GCCVER}")
87 GCCRELEASE=$(get_version_component_range 1-3 "${GCCVER}")
89 # SLOT logic, make it represent gcc backend, as this is what matters most
90 # There are some special cases, so we allow it to be defined in the ebuild
91 # ATTN!! If you set SLOT in the ebuild, don't forget to make sure that
92 # BOOT_SLOT is also set properly!
93 [[ -z ${SLOT} ]] && SLOT="${GCCBRANCH}"
95 # possible future crosscompilation support
96 export CTARGET=${CTARGET:-${CHOST}}
99 [[ ${CHOST} != ${CTARGET} ]]
102 # Bootstrap CTARGET and SLOT logic. For now BOOT_TARGET=CHOST is "guaranteed" by
103 # profiles, so mostly watch out for the right SLOT used in the bootstrap.
104 # As above, with SLOT, it may need to be defined in the ebuild
105 BOOT_TARGET=${CTARGET}
106 [[ -z ${BOOT_SLOT} ]] && BOOT_SLOT=${SLOT}
108 # set our install locations
109 PREFIX=${GNATBUILD_PREFIX:-/usr} # not sure we need this hook, but may be..
110 LIBPATH=${PREFIX}/$(get_libdir)/${PN}/${CTARGET}/${SLOT}
111 LIBEXECPATH=${PREFIX}/libexec/${PN}/${CTARGET}/${SLOT}
112 INCLUDEPATH=${LIBPATH}/include
113 BINPATH=${PREFIX}/${CTARGET}/${PN}-bin/${SLOT}
114 DATAPATH=${PREFIX}/share/${PN}-data/${CTARGET}/${SLOT}
115 # ATTN! the one below should match the path defined in eselect-gnat module
116 CONFIG_PATH="/usr/share/gnat/eselect"
117 gnat_profile="${CTARGET}-${PN}-${SLOT}"
118 gnat_config_file="${CONFIG_PATH}/${gnat_profile}"
122 if [[ ${PN} == "${PN_GnatPro}" ]] && [[ ${GNATMAJOR} == "3" ]]; then
123 DEPEND="x86? ( >=app-shells/tcsh-6.0 )"
125 S="${WORKDIR}/gcc-${GCCVER}"
127 # bootstrap globals, common to src_unpack and src_compile
128 GNATBOOT="${WORKDIR}/usr"
129 GNATBUILD="${WORKDIR}/build"
131 # necessary for detecting lib locations and creating env.d entry
132 #XGCC="${GNATBUILD}/gcc/xgcc -B${GNATBUILD}/gcc"
134 #----<< globals and SLOT >>----
136 # set SRC_URI's in ebuilds for now
138 #----<< support checks >>----
139 # skipping this section - do not care about hardened/multilib for now
141 #---->> specs + env.d logic <<----
144 #----<< specs + env.d logic >>----
147 #---->> some helper functions <<----
149 [[ ${GCCMAJOR} < 3 ]] && return 1
151 mips64*|powerpc64*|s390x*|sparc64*|x86_64*)
152 has_multilib_profile ;;
157 # adapted from toolchain,
158 # left only basic multilib functionality and cut off mips stuff
160 create_specs_file() {
161 einfo "Creating a vanilla gcc specs file"
162 "${WORKDIR}"/build/gcc/xgcc -dumpspecs > "${WORKDIR}"/build/vanilla.specs
166 # eselect stuff taken straight from toolchain.eclass and greatly simplified
167 add_profile_eselect_conf() {
168 local gnat_config_file=$1
172 echo >> "${D}/${gnat_config_file}"
173 if ! is_multilib ; then
174 echo " ctarget=${CTARGET}" >> "${D}/${gnat_config_file}"
176 echo "[${abi}]" >> "${D}/${gnat_config_file}"
178 if [[ -n ${!var} ]] ; then
179 echo " ctarget=${!var}" >> "${D}/${gnat_config_file}"
182 if [[ -n ${!var} ]] ; then
183 echo " ctarget=${!var}" >> "${D}/${gnat_config_file}"
185 echo " ctarget=${CTARGET}" >> "${D}/${gnat_config_file}"
191 if [[ -n ${!var} ]] ; then
192 echo " cflags=${!var}" >> "${D}/${gnat_config_file}"
197 create_eselect_conf() {
202 echo "[global]" > "${D}/${gnat_config_file}"
203 echo " version=${CTARGET}-${SLOT}" >> "${D}/${gnat_config_file}"
204 echo " binpath=${BINPATH}" >> "${D}/${gnat_config_file}"
205 echo " libexecpath=${LIBEXECPATH}" >> "${D}/${gnat_config_file}"
206 echo " ldpath=${LIBPATH}" >> "${D}/${gnat_config_file}"
207 echo " manpath=${DATAPATH}/man" >> "${D}/${gnat_config_file}"
208 echo " infopath=${DATAPATH}/info" >> "${D}/${gnat_config_file}"
209 echo " bin_prefix=${CTARGET}" >> "${D}/${gnat_config_file}"
211 for abi in $(get_all_abis) ; do
212 add_profile_eselect_conf "${gnat_config_file}" "${abi}"
218 should_we_eselect_gnat() {
219 # we only want to switch compilers if installing to / or /tmp/stage1root
220 [[ ${ROOT} == "/" ]] || return 1
222 # if the current config is invalid, we definitely want a new one
223 # Note: due to bash quirkiness, the following must not be 1 line
225 curr_config=$(eselect --colour=no gnat show | grep ${CTARGET} | awk '{ print $1 }') || return 0
226 [[ -z ${curr_config} ]] && return 0
228 # The logic is basically "try to keep the same profile if possible"
230 if [[ ${curr_config} == ${CTARGET}-${PN}-${SLOT} ]] ; then
233 elog "The current gcc config appears valid, so it will not be"
234 elog "automatically switched for you. If you would like to"
235 elog "switch to the newly installed gcc version, do the"
238 elog "eselect gnat set <profile>"
245 # active compiler selection, called from pkg_postinst
247 eselect gnat set ${CTARGET}-${PN}-${SLOT} &> /dev/null
249 elog "The following gnat profile has been activated:"
250 elog "${CTARGET}-${PN}-${SLOT}"
252 elog "The compiler has been installed as gnatgcc, and the coverage testing"
253 elog "tool as gnatgcov."
255 elog "Ada handling in Gentoo allows you to have multiple gnat variants"
256 elog "installed in parallel and automatically manage Ada libs."
257 elog "Please take a look at the Ada project page for some documentation:"
258 elog "http://www.gentoo.org/proj/en/prog_lang/ada/index.xml"
262 # Taken straight from the toolchain.eclass. Only removed the "obsolete hunk"
264 # The purpose of this DISGUSTING gcc multilib hack is to allow 64bit libs
265 # to live in lib instead of lib64 where they belong, with 32bit libraries
266 # in lib32. This hack has been around since the beginning of the amd64 port,
267 # and we're only now starting to fix everything that's broken. Eventually
268 # this should go away.
270 # Travis Tilley <lv@gentoo.org> (03 Sep 2004)
272 disgusting_gcc_multilib_HACK() {
275 if has_multilib_profile ; then
278 config="i386/t-linux64"
279 libdirs="../$(get_abi_LIBDIR amd64) ../$(get_abi_LIBDIR x86)" \
282 config="rs6000/t-linux64"
283 libdirs="../$(get_abi_LIBDIR ppc64) ../$(get_abi_LIBDIR ppc)" \
287 die "Your profile is no longer supported by portage."
290 einfo "updating multilib directories to be: ${libdirs}"
291 sed -i -e "s:^MULTILIB_OSDIRNAMES.*:MULTILIB_OSDIRNAMES = ${libdirs}:" "${S}"/gcc/config/${config}
296 gnatbuild_pkg_setup() {
297 debug-print-function ${FUNCNAME} $@
299 # Setup variables which would normally be in the profile
300 if is_crosscompile ; then
301 multilib_env ${CTARGET}
304 # we dont want to use the installed compiler's specs to build gnat!
308 gnatbuild_pkg_postinst() {
309 if should_we_eselect_gnat; then
315 # if primary compiler list is empty, add this profile to the list, so
316 # that users are not left without active compilers (making sure that
317 # libs are getting built for at least one)
319 . ${GnatCommon} || die "failed to source common code"
320 if [[ ! -f ${PRIMELIST} ]] || [[ ! -s ${PRIMELIST} ]]; then
321 echo "${gnat_profile}" > ${PRIMELIST}
322 elog "The list of primary compilers was empty and got assigned ${gnat_profile}."
324 elog "Please edit ${PRIMELIST} and list there gnat profiles intended"
325 elog "for common use."
329 gnatbuild_pkg_postrm() {
330 # "eselect gnat update" now removes the env.d file if the corresponding
331 # gnat profile was unmerged
333 elog "If you just unmerged the last gnat in this SLOT, your active gnat"
334 elog "profile got unset. Please check what eselect gnat show tells you"
335 elog "and set the desired profile"
341 # common unpack stuff
342 gnatbuild_src_unpack() {
343 debug-print-function ${FUNCNAME} $@
344 if [[ -z "$1" ]]; then
345 gnatbuild_src_unpack all
353 pax-mark E $(find ${GNATBOOT} -name gnat1)
356 # patching gcc sources, following the toolchain
357 # first, the common patches
358 if [[ -d "${FILESDIR}"/patches ]] && [[ ! -z $(ls "${FILESDIR}"/patches/*.patch 2>/dev/null) ]] ; then
359 EPATCH_MULTI_MSG="Applying common Gentoo patches ..." \
360 epatch "${FILESDIR}"/patches/*.patch
364 if [[ -d "${FILESDIR}"/patches/${SLOT} ]] && [[ ! -z $(ls "${FILESDIR}"/patches/${SLOT}/*.patch 2>/dev/null) ]] ; then
365 EPATCH_MULTI_MSG="Applying SLOT-specific Gentoo patches ..." \
366 epatch "${FILESDIR}"/patches/${SLOT}/*.patch
368 # Replacing obsolete head/tail with POSIX compliant ones
369 ht_fix_file */configure
371 # if ! is_crosscompile && is_multilib && \
372 # [[ ( $(tc-arch) == "amd64" || $(tc-arch) == "ppc64" ) && -z ${SKIP_MULTILIB_HACK} ]] ; then
373 # disgusting_gcc_multilib_HACK || die "multilib hack failed"
376 # Fixup libtool to correctly generate .la files with portage
378 elibtoolize --portage --shallow --no-uclibc
381 # update configure files
382 einfo "Fixing misc issues in configure files"
383 for f in $(grep -l 'autoconf version 2.13' $(find "${S}" -name configure)) ; do
384 ebegin " Updating ${f}"
385 patch "${f}" "${FILESDIR}"/gcc-configure-LANG.patch >& "${T}"/configure-patch.log \
386 || eerror "Please file a bug about this"
390 # this is only needed for gnat-gpl-4.1 and breaks for gnat-gcc, so
391 # this block was moved to corresponding ebuild
392 # pushd "${S}"/gnattools &> /dev/null
398 # Prepare the gcc source directory
402 touch ada/nmake.ad[bs]
403 # set the compiler name to gnatgcc
404 for i in `find ada/ -name '*.ad[sb]'`; do \
405 sed -i -e "s/\"gcc\"/\"gnatgcc\"/g" ${i}; \
407 # add -fPIC flag to shared libs for 3.4* backend
408 if [ "3.4" == "${GCCBRANCH}" ] ; then
410 epatch "${FILESDIR}"/gnat-Make-lang.in.patch
413 # gcc 4.3 sources seem to have a common omission of $(DESTDIR),
414 # that leads to make install trying to rm -f file on live system.
415 # As we do not need this rm, we simply remove the whole line
416 if [ "4.3" == "${GCCBRANCH}" ] ; then
417 sed -i -e "/\$(RM) \$(bindir)/d" "${S}"/gcc/ada/Make-lang.in
420 mkdir -p "${GNATBUILD}"
424 gnatbuild_src_unpack base_unpack common_prep
431 # for now just dont run default configure
432 gnatbuild_src_configure() {
437 # it would be nice to split configure and make steps
438 # but both need to operate inside specially tuned evironment
439 # so just do sections for now (as in eclass section of handbook)
440 # sections are: configure, make-tools, bootstrap,
441 # gnatlib_and_tools, gnatlib-shared
442 gnatbuild_src_compile() {
443 debug-print-function ${FUNCNAME} $@
444 if [[ -z "$1" ]]; then
445 gnatbuild_src_compile all
449 if [[ "all" == "$1" ]]
450 then # specialcasing "all" to avoid scanning sources unnecessarily
451 gnatbuild_src_compile configure make-tools \
452 bootstrap gnatlib_and_tools gnatlib-shared
455 # Set some paths to our bootstrap compiler.
456 export PATH="${GNATBOOT}/bin:${PATH}"
457 # !ATTN! the bootstrap compilers have a very simplystic structure,
458 # so many paths are not identical to the installed ones.
459 # Plus it was simplified even more in new releases.
460 if [[ ${BOOT_SLOT} > 4.1 ]] ; then
463 GNATLIB="${GNATBOOT}/lib/gcc/${BOOT_TARGET}/${BOOT_SLOT}"
466 GNATLIB="${GNATBOOT}/lib"
470 GNATLIB="${GNATBOOT}/lib/gnatgcc/${BOOT_TARGET}/${BOOT_SLOT}"
473 export CC="${GNATBOOT}/bin/gnatgcc"
474 # CPATH is supposed to be applied for any language, thus
475 # superceding either of C/CPLUS/OBJC_INCLUDE_PATHs
476 export CPATH="${GNATLIB}/include"
477 #export INCLUDE_DIR="${GNATLIB}/include"
478 #export C_INCLUDE_PATH="${GNATLIB}/include"
479 #export CPLUS_INCLUDE_PATH="${GNATLIB}/include"
480 export LIB_DIR="${GNATLIB}"
481 export LDFLAGS="-L${GNATLIB}"
483 # additional vars from gnuada and elsewhere
484 #export LD_RUN_PATH="${LIBPATH}"
485 export LIBRARY_PATH="${GNATLIB}"
486 #export LD_LIBRARY_PATH="${GNATLIB}"
487 # export COMPILER_PATH="${GNATBOOT}/bin/"
489 export ADA_OBJECTS_PATH="${GNATLIB}/adalib"
490 export ADA_INCLUDE_PATH="${GNATLIB}/adainclude"
493 ADA_INCLUDE_PATH=${ADA_INCLUDE_PATH},
500 debug-print-section configure
504 # some cross-compile logic from toolchain
505 confgcc="${confgcc} --host=${CHOST}"
506 if is_crosscompile || tc-is-cross-compiler ; then
507 confgcc="${confgcc} --target=${CTARGET}"
509 [[ -n ${CBUILD} ]] && confgcc="${confgcc} --build=${CBUILD}"
511 # Native Language Support
513 confgcc="${confgcc} --enable-nls --without-included-gettext"
515 confgcc="${confgcc} --disable-nls"
518 if version_is_at_least 4.6 ; then
519 confgcc="${confgcc} --enable-lto"
520 elif tc_version_is_at_least 4.5 ; then
521 confgcc="${confgcc} --disable-lto --disable-plugin"
524 # reasonably sane globals (from toolchain)
525 # also disable mudflap and ssp
526 confgcc="${confgcc} \
530 --disable-libmudflap \
533 --disable-fixed-point \
535 --disable-libcilkrts \
536 --disable-libsanitizer \
537 --disable-libunwind-exceptions"
539 if in_iuse openmp ; then
540 # Make sure target has pthreads support. #326757 #335883
541 # There shouldn't be a chicken&egg problem here as openmp won't
542 # build without a C library, and you can't build that w/out
543 # already having a compiler ...
544 if ! is_crosscompile || \
545 $(tc-getCPP ${CTARGET}) -E - <<<"#include <pthread.h>" >& /dev/null
549 confgcc="${confgcc} --disable-libgomp"
552 confgcc="${confgcc} $(use_enable openmp libgomp)"
556 # Force disable as the configure script can be dumb #359855
557 confgcc="${confgcc} --disable-libgomp"
560 # For gcc variants where we don't want openmp (e.g. kgcc)
561 confgcc="${confgcc} --disable-libgomp"
564 # ACT's gnat-gpl does not like libada for whatever reason..
565 if version_is_at_least 4.2 ; then
566 confgcc="${confgcc} --enable-libada"
568 # einfo "ACT's gnat-gpl does not like libada, disabling"
569 # confgcc="${confgcc} --disable-libada"
572 # set some specifics available in later versions
573 if version_is_at_least 4.7 ; then
574 einfo "setting gnat thread model"
575 confgcc="${confgcc} --enable-threads=posix"
576 confgcc="${confgcc} --enable-shared=boehm-gc,ada,libada"
577 elif version_is_at_least 4.3 ; then
578 confgcc="${confgcc} --enable-threads=gnat"
579 confgcc="${confgcc} --enable-shared=boehm-gc,ada,libada"
581 confgcc="${confgcc} --enable-threads=posix"
582 confgcc="${confgcc} --enable-shared"
586 if is_multilib ; then
587 confgcc="${confgcc} --enable-multilib"
589 confgcc="${confgcc} --disable-multilib"
592 # __cxa_atexit is "essential for fully standards-compliant handling of
593 # destructors", but apparently requires glibc.
594 if [[ ${CTARGET} == *-gnu* ]] ; then
595 confgcc="${confgcc} --enable-__cxa_atexit"
596 confgcc="${confgcc} --enable-clocale=gnu"
599 einfo "confgcc=${confgcc}"
601 export gcc_cv_lto_plugin=1 # okay to build, default to opt-in
602 export gcc_cv_prog_makeinfo_modern=no
603 export ac_cv_have_x='have_x=yes ac_x_includes= ac_x_libraries='
604 export gcc_cv_libc_provides_ssp=yes
606 # need to strip graphite/lto flags or we'll get the
607 # dreaded C compiler cannot create executables...
610 replace-flags -O? -O2
611 filter-flags '-mabi*' -m31 -m32 -m64
612 filter-flags -frecord-gcc-switches
613 filter-flags -mno-rtm -mno-htm
614 #filter-flags -floop-interchange -floop-strip-mine -floop-block
615 #filter-flags -fuse-linker-plugin -flto*
618 CC="${CC}" CFLAGS="${CFLAGS}" CXXFLAGS="${CFLAGS}" "${S}"/configure \
619 --prefix="${PREFIX}" \
620 --bindir="${BINPATH}" \
621 --includedir="${INCLUDEPATH}" \
622 --libdir="${LIBPATH}" \
623 --libexecdir="${LIBEXECPATH}" \
624 --datadir="${DATAPATH}" \
625 --mandir="${DATAPATH}"/man \
626 --infodir="${DATAPATH}"/info \
627 --enable-languages=c,ada \
629 ${confgcc} || die "configure failed"
633 debug-print-section make-tools
634 # Compile helper tools
636 cp "${S}"/gcc/ada/xtreeprs.adb .
637 cp "${S}"/gcc/ada/xsinfo.adb .
638 cp "${S}"/gcc/ada/xeinfo.adb .
639 cp "${S}"/gcc/ada/xnmake.adb .
640 cp "${S}"/gcc/ada/xutil.ad{s,b} .
641 if (( ${GNATMINOR} > 5 )) ; then
642 cp "${S}"/gcc/ada/einfo.ad{s,b} .
643 cp "${S}"/gcc/ada/csinfo.adb .
644 cp "${S}"/gcc/ada/ceinfo.adb .
646 gnatmake xtreeprs && \
649 gnatmake xnmake || die "building helper tools"
651 mv xeinfo xnmake xsinfo xtreeprs bin/
655 debug-print-section bootstrap
656 # and, finally, the build itself
659 LDFLAGS="${LDFLAGS}" \
660 LIBPATH="${LIBPATH}" \
662 bootstrap-lean || die "bootstrap failed"
666 debug-print-section gnatlib_and_tools
667 einfo "building gnatlib_and_tools"
669 emake -j1 -C gcc gnatlib_and_tools || \
670 die "gnatlib_and_tools failed"
674 debug-print-section gnatlib-shared
675 einfo "building shared lib"
677 rm -f gcc/ada/rts/*.{o,ali} || die
678 #otherwise make tries to reuse already compiled (without -fPIC) objs..
679 emake -j1 -C gcc gnatlib-shared LIBRARY_VERSION="${GCCBRANCH}" || \
680 die "gnatlib-shared failed"
688 # -- end gnatbuild_src_compile
691 gnatbuild_src_install() {
692 debug-print-function ${FUNCNAME} $@
694 if [[ -z "$1" ]] ; then
695 gnatbuild_src_install all
701 install) # runs provided make install
702 debug-print-section install
704 # Looks like we need an access to the bootstrap compiler here too
705 # as gnat apparently wants to compile something during the installation
706 # The spotted obuser was xgnatugn, used to process gnat_ugn_urw.texi,
707 # during preparison of the docs.
708 export PATH="${GNATBOOT}/bin:${PATH}"
709 if [[ ${BOOT_SLOT} > 4.1 ]] ; then
710 GNATLIB="${GNATBOOT}/lib"
712 GNATLIB="${GNATBOOT}/lib/gnatgcc/${BOOT_TARGET}/${BOOT_SLOT}"
715 export CC="${GNATBOOT}/bin/gnatgcc"
716 export INCLUDE_DIR="${GNATLIB}/include"
717 export C_INCLUDE_PATH="${GNATLIB}/include"
718 export CPLUS_INCLUDE_PATH="${GNATLIB}/include"
719 export LIB_DIR="${GNATLIB}"
720 export LDFLAGS="-L${GNATLIB}"
721 export ADA_OBJECTS_PATH="${GNATLIB}/adalib"
722 export ADA_INCLUDE_PATH="${GNATLIB}/adainclude"
724 # Do not allow symlinks in /usr/lib/gcc/${CHOST}/${MY_PV}/include as
725 # this can break the build.
726 for x in "${GNATBUILD}"/gcc/include/* ; do
727 if [ -L ${x} ] ; then
731 # Remove generated headers, as they can cause things to break
732 # (ncurses, openssl, etc). (from toolchain.eclass)
733 for x in $(find "${WORKDIR}"/build/gcc/include/ -name '*.h') ; do
734 grep -q 'It has been auto-edited by fixincludes from' "${x}" \
740 make DESTDIR="${D}" install || die
742 # Disable RANDMMAP so PCH works. #301299
743 pax-mark r "${D}"${LIBEXECPATH}/{gnat1,cc1,cc1plus}
744 # Quiet QA warnings, wait for adacore exec stack patch in gcc 7
745 export QA_EXECSTACK="${BINPATH:1}/gnatls ${BINPATH:1}/gnatname
746 ${BINPATH:1}/gnatmake ${BINPATH:1}/gnatclean ${BINPATH:1}/gnat"
749 if (( $(bc <<< "${GNATBRANCH} > 4.3") )) ; then
750 #make a convenience info link
751 ewarn "Yay! Math works."
752 dosym gnat_ugn.info ${DATAPATH}/info/gnat.info
758 debug-print-section move_libs
760 # first we need to remove some stuff to make moving easier
761 rm -rf "${D}${LIBPATH}"/{32,include,libiberty.a}
762 # gcc insists on installing libs in its own place
763 mv "${D}${LIBPATH}/gcc/${CTARGET}/${GCCRELEASE}"/* "${D}${LIBPATH}"
764 mv "${D}${LIBEXECPATH}/gcc/${CTARGET}/${GCCRELEASE}"/* "${D}${LIBEXECPATH}"
766 # libgcc_s and, with gcc>=4.0, other libs get installed in multilib specific locations by gcc
767 # we pull everything together to simplify working environment
768 if has_multilib_profile ; then
771 mv "${D}${LIBPATH}"/../$(get_abi_LIBDIR amd64)/* "${D}${LIBPATH}"
772 mv "${D}${LIBPATH}"/../$(get_abi_LIBDIR x86)/* "${D}${LIBPATH}"/32
775 # not supported yet, will have to be adjusted when we
776 # actually build gnat for that arch
781 # force gnatgcc to use its own specs - versions prior to 3.4.6 read specs
782 # from system gcc location. Do the simple wrapper trick for now
783 # !ATTN! change this if eselect-gnat starts to follow eselect-compiler
785 if [[ ${GCCVER} < 3.4.6 ]] ; then
786 # gcc 4.1 uses builtin specs. What about 4.0?
787 mv gnatgcc gnatgcc_2wrap
790 # wrapper to cause gnatgcc read appropriate specs and search for the right .h
791 # files (in case no matching gcc is installed)
792 BINDIR=\$(dirname \$0)
793 # The paths in the next line have to be absolute, as gnatgcc may be called from
795 \${BINDIR}/gnatgcc_2wrap -specs="${LIBPATH}/specs" -I"${LIBPATH}/include" \$@
800 for i in cpp gcc gcov ; do
805 # earlier gnat's generate some Makefile's at generic location, need to
806 # move to avoid collisions
807 [ -f "${D}${PREFIX}"/share/gnat/Makefile.generic ] &&
808 mv "${D}${PREFIX}"/share/gnat/Makefile.* "${D}${DATAPATH}"
810 # use gid of 0 because some stupid ports don't have
811 # the group 'root' set to gid 0 (toolchain.eclass)
812 # chown -R root:0 "${D}${LIBPATH}"
816 debug-print-section cleanup
818 rm -rf "${D}${LIBPATH}"/{gcc,install-tools,../lib{32,64}}
819 rm -rf "${D}${LIBEXECPATH}"/{gcc,install-tools}
821 # this one is installed by gcc and is a duplicate even here anyway
822 rm -f "${D}${BINPATH}/${CTARGET}-gcc-${GCCRELEASE}"
824 # remove duplicate docs
825 rm -f "${D}${DATAPATH}"/info/{dir,gcc,cpp}*
826 rm -rf "${D}${DATAPATH}"/man/man7/
828 # fix .la path for lto plugin
831 "/libdir=/c\libdir='${LIBEXECPATH}'" \
832 "${D}${LIBEXECPATH}"/liblto_plugin.la \
833 || die "sed update of .la file failed!"
838 # instead of putting junk under /etc/env.d/gnat we recreate env files as
839 # needed with eselect
844 gnatbuild_src_install install move_libs cleanup prep_env
850 # -- end gnatbuild_src_install