1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
5 # Authors: George Shapovalov <george@gentoo.org>
6 # Steve Arnold <nerdboy@gentoo.org>
8 # Belongs to: ada herd <ada@gentoo.org>
11 # HOMEPAGE and LICENSE are set in appropriate ebuild, as
12 # gnat is developed by FSF and AdaCore "in parallel"
14 # The following vars can be set in ebuild before inheriting this eclass. They
17 # BOOT_SLOT - where old bootstrap is used as it works fine
22 inherit eutils versionator toolchain-funcs flag-o-matic multilib autotools \
23 libtool fixheadtails gnuconfig pax-utils
25 EXPORT_FUNCTIONS pkg_setup pkg_postinst pkg_postrm src_unpack src_compile src_install
28 # multilib is supported via profiles now, multilib usevar is deprecated
30 DEPEND=">=app-eselect/eselect-gnat-1.3
34 RDEPEND="app-eselect/eselect-gnat"
37 # It may not be safe to source this at top level. Only source inside local
39 GnatCommon="/usr/share/gnat/lib/gnat-common.bash"
41 #---->> globals and SLOT <<----
43 # just a check, this location seems to vary too much, easier to track it in
45 #[ -z "${GNATSOURCE}" ] && die "please set GNATSOURCE in ebuild! (before inherit)"
48 # because of gnatpro/gnatgpl we need to track both gcc and gnat versions
50 # these simply default to $PV
51 GNATMAJOR=$(get_version_component_range 1)
52 GNATMINOR=$(get_version_component_range 2)
53 GNATBRANCH=$(get_version_component_range 1-2)
54 GNATRELEASE=$(get_version_component_range 1-3)
55 # this one is for the gnat-gpl which is versioned by gcc backend and ACT version
57 ACT_Ver=$(get_version_component_range 4)
59 # GCCVER and SLOT logic
61 # I better define vars for package names, as there was discussion on proper
62 # naming and it may change
66 # ATTN! GCCVER stands for the provided backend gcc, not the one on the system
67 # so tc-* functions are of no use here. The present versioning scheme makes
68 # GCCVER basically a part of PV, but *this may change*!!
70 # GCCVER can be set in the ebuild.
71 [[ -z ${GCCVER} ]] && GCCVER="${GNATRELEASE}"
74 # finally extract GCC version strings
75 GCCMAJOR=$(get_version_component_range 1 "${GCCVER}")
76 GCCMINOR=$(get_version_component_range 2 "${GCCVER}")
77 GCCBRANCH=$(get_version_component_range 1-2 "${GCCVER}")
78 GCCRELEASE=$(get_version_component_range 1-3 "${GCCVER}")
80 # SLOT logic, make it represent gcc backend, as this is what matters most
81 # There are some special cases, so we allow it to be defined in the ebuild
82 # ATTN!! If you set SLOT in the ebuild, don't forget to make sure that
83 # BOOT_SLOT is also set properly!
84 [[ -z ${SLOT} ]] && SLOT="${GCCBRANCH}"
86 # possible future crosscompilation support
87 export CTARGET=${CTARGET:-${CHOST}}
90 [[ ${CHOST} != ${CTARGET} ]]
93 # Bootstrap CTARGET and SLOT logic. For now BOOT_TARGET=CHOST is "guaranteed" by
94 # profiles, so mostly watch out for the right SLOT used in the bootstrap.
95 # As above, with SLOT, it may need to be defined in the ebuild
96 BOOT_TARGET=${CTARGET}
97 [[ -z ${BOOT_SLOT} ]] && BOOT_SLOT=${SLOT}
99 # set our install locations
100 PREFIX=${GNATBUILD_PREFIX:-/usr} # not sure we need this hook, but may be..
101 LIBPATH=${PREFIX}/$(get_libdir)/${PN}/${CTARGET}/${SLOT}
102 LIBEXECPATH=${PREFIX}/libexec/${PN}/${CTARGET}/${SLOT}
103 INCLUDEPATH=${LIBPATH}/include
104 BINPATH=${PREFIX}/${CTARGET}/${PN}-bin/${SLOT}
105 DATAPATH=${PREFIX}/share/${PN}-data/${CTARGET}/${SLOT}
106 # ATTN! the one below should match the path defined in eselect-gnat module
107 CONFIG_PATH="/usr/share/gnat/eselect"
108 gnat_profile="${CTARGET}-${PN}-${SLOT}"
109 gnat_config_file="${CONFIG_PATH}/${gnat_profile}"
113 if [[ ${PN} == "${PN_GnatPro}" ]] && [[ ${GNATMAJOR} == "3" ]]; then
114 DEPEND="x86? ( >=app-shells/tcsh-6.0 )"
116 S="${WORKDIR}/gcc-${GCCVER}"
118 # bootstrap globals, common to src_unpack and src_compile
119 GNATBOOT="${WORKDIR}/usr"
120 GNATBUILD="${WORKDIR}/build"
122 # necessary for detecting lib locations and creating env.d entry
123 #XGCC="${GNATBUILD}/gcc/xgcc -B${GNATBUILD}/gcc"
125 #----<< globals and SLOT >>----
127 # set SRC_URI's in ebuilds for now
129 #----<< support checks >>----
130 # skipping this section - do not care about hardened/multilib for now
132 #---->> specs + env.d logic <<----
135 #----<< specs + env.d logic >>----
138 #---->> some helper functions <<----
140 [[ ${GCCMAJOR} < 3 ]] && return 1
142 mips64*|powerpc64*|s390x*|sparc64*|x86_64*)
143 has_multilib_profile || use multilib ;;
148 # adapted from toolchain,
149 # left only basic multilib functionality and cut off mips stuff
151 create_specs_file() {
152 einfo "Creating a vanilla gcc specs file"
153 "${WORKDIR}"/build/gcc/xgcc -dumpspecs > "${WORKDIR}"/build/vanilla.specs
157 # eselect stuff taken straight from toolchain.eclass and greatly simplified
158 add_profile_eselect_conf() {
159 local gnat_config_file=$1
163 echo >> "${D}/${gnat_config_file}"
164 if ! is_multilib ; then
165 echo " ctarget=${CTARGET}" >> "${D}/${gnat_config_file}"
167 echo "[${abi}]" >> "${D}/${gnat_config_file}"
169 if [[ -n ${!var} ]] ; then
170 echo " ctarget=${!var}" >> "${D}/${gnat_config_file}"
173 if [[ -n ${!var} ]] ; then
174 echo " ctarget=${!var}" >> "${D}/${gnat_config_file}"
176 echo " ctarget=${CTARGET}" >> "${D}/${gnat_config_file}"
182 if [[ -n ${!var} ]] ; then
183 echo " cflags=${!var}" >> "${D}/${gnat_config_file}"
188 create_eselect_conf() {
193 echo "[global]" > "${D}/${gnat_config_file}"
194 echo " version=${CTARGET}-${SLOT}" >> "${D}/${gnat_config_file}"
195 echo " binpath=${BINPATH}" >> "${D}/${gnat_config_file}"
196 echo " libexecpath=${LIBEXECPATH}" >> "${D}/${gnat_config_file}"
197 echo " ldpath=${LIBPATH}" >> "${D}/${gnat_config_file}"
198 echo " manpath=${DATAPATH}/man" >> "${D}/${gnat_config_file}"
199 echo " infopath=${DATAPATH}/info" >> "${D}/${gnat_config_file}"
200 echo " bin_prefix=${CTARGET}" >> "${D}/${gnat_config_file}"
202 for abi in $(get_all_abis) ; do
203 add_profile_eselect_conf "${D}/${gnat_config_file}" "${abi}"
209 should_we_eselect_gnat() {
210 # we only want to switch compilers if installing to / or /tmp/stage1root
211 [[ ${ROOT} == "/" ]] || return 1
213 # if the current config is invalid, we definitely want a new one
214 # Note: due to bash quirkiness, the following must not be 1 line
216 curr_config=$(eselect gnat show | grep ${CTARGET} | awk '{ print $1 }') || return 0
217 [[ -z ${curr_config} ]] && return 0
219 # The logic is basically "try to keep the same profile if possible"
221 if [[ ${curr_config} == ${CTARGET}-${PN}-${SLOT} ]] ; then
224 elog "The current gcc config appears valid, so it will not be"
225 elog "automatically switched for you. If you would like to"
226 elog "switch to the newly installed gcc version, do the"
229 elog "eselect gnat set <profile>"
236 # active compiler selection, called from pkg_postinst
238 eselect gnat set ${CTARGET}-${PN}-${SLOT} &> /dev/null
240 elog "The following gnat profile has been activated:"
241 elog "${CTARGET}-${PN}-${SLOT}"
243 elog "The compiler has been installed as gnatgcc, and the coverage testing"
244 elog "tool as gnatgcov."
246 elog "Ada handling in Gentoo allows you to have multiple gnat variants"
247 elog "installed in parallel and automatically manage Ada libs."
248 elog "Please take a look at the Ada project page for some documentation:"
249 elog "https://www.gentoo.org/proj/en/prog_lang/ada/index.xml"
253 # Taken straight from the toolchain.eclass. Only removed the "obsolete hunk"
255 # The purpose of this DISGUSTING gcc multilib hack is to allow 64bit libs
256 # to live in lib instead of lib64 where they belong, with 32bit libraries
257 # in lib32. This hack has been around since the beginning of the amd64 port,
258 # and we're only now starting to fix everything that's broken. Eventually
259 # this should go away.
261 # Travis Tilley <lv@gentoo.org> (03 Sep 2004)
263 disgusting_gcc_multilib_HACK() {
266 if has_multilib_profile ; then
269 config="i386/t-linux64"
270 libdirs="../$(get_abi_LIBDIR amd64) ../$(get_abi_LIBDIR x86)" \
273 config="rs6000/t-linux64"
274 libdirs="../$(get_abi_LIBDIR ppc64) ../$(get_abi_LIBDIR ppc)" \
278 die "Your profile is no longer supported by portage."
281 einfo "updating multilib directories to be: ${libdirs}"
282 sed -i -e "s:^MULTILIB_OSDIRNAMES.*:MULTILIB_OSDIRNAMES = ${libdirs}:" "${S}"/gcc/config/${config}
287 gnatbuild_pkg_setup() {
288 debug-print-function ${FUNCNAME} $@
290 # Setup variables which would normally be in the profile
291 if is_crosscompile ; then
292 multilib_env ${CTARGET}
295 # we dont want to use the installed compiler's specs to build gnat!
299 gnatbuild_pkg_postinst() {
300 if should_we_eselect_gnat; then
306 # if primary compiler list is empty, add this profile to the list, so
307 # that users are not left without active compilers (making sure that
308 # libs are getting built for at least one)
310 . ${GnatCommon} || die "failed to source common code"
311 if [[ ! -f ${PRIMELIST} ]] || [[ ! -s ${PRIMELIST} ]]; then
312 mkdir -p ${SETTINGSDIR}
313 echo "${gnat_profile}" > ${PRIMELIST}
314 elog "The list of primary compilers was empty and got assigned ${gnat_profile}."
316 elog "Please edit ${PRIMELIST} and list there gnat profiles intended"
317 elog "for common use, one per line."
321 gnatbuild_pkg_postrm() {
322 # "eselect gnat update" now removes the env.d file if the corresponding
323 # gnat profile was unmerged
325 elog "If you just unmerged the last gnat in this SLOT, your active gnat"
326 elog "profile got unset. Please check what eselect gnat show tells you"
327 elog "and set the desired profile"
333 # common unpack stuff
334 gnatbuild_src_unpack() {
335 debug-print-function ${FUNCNAME} $@
336 [ -z "$1" ] && gnatbuild_src_unpack all
342 pax-mark E $(find ${GNATBOOT} -name gnat1)
345 # patching gcc sources, following the toolchain
346 # first, the common patches
347 if [[ -d "${FILESDIR}"/patches ]] && [[ ! -z $(ls "${FILESDIR}"/patches/*.patch 2>/dev/null) ]] ; then
348 EPATCH_MULTI_MSG="Applying common Gentoo patches ..." \
349 epatch "${FILESDIR}"/patches/*.patch
353 if [[ -d "${FILESDIR}"/patches/${SLOT} ]] && [[ ! -z $(ls "${FILESDIR}"/patches/${SLOT}/*.patch 2>/dev/null) ]] ; then
354 EPATCH_MULTI_MSG="Applying SLOT-specific Gentoo patches ..." \
355 epatch "${FILESDIR}"/patches/${SLOT}/*.patch
357 # Replacing obsolete head/tail with POSIX compliant ones
358 ht_fix_file */configure
360 # if ! is_crosscompile && is_multilib && \
361 # [[ ( $(tc-arch) == "amd64" || $(tc-arch) == "ppc64" ) && -z ${SKIP_MULTILIB_HACK} ]] ; then
362 # disgusting_gcc_multilib_HACK || die "multilib hack failed"
365 # Fixup libtool to correctly generate .la files with portage
367 elibtoolize --portage --shallow --no-uclibc
370 # update configure files
371 einfo "Fixing misc issues in configure files"
372 for f in $(grep -l 'autoconf version 2.13' $(find "${S}" -name configure)) ; do
373 ebegin " Updating ${f}"
374 patch "${f}" "${FILESDIR}"/gcc-configure-LANG.patch >& "${T}"/configure-patch.log \
375 || eerror "Please file a bug about this"
379 # this is only needed for gnat-gpl-4.1 and breaks for gnat-gcc, so
380 # this block was moved to corresponding ebuild
381 # pushd "${S}"/gnattools &> /dev/null
387 # Prepare the gcc source directory
391 touch ada/nmake.ad[bs]
392 # set the compiler name to gnatgcc
393 for i in `find ada/ -name '*.ad[sb]'`; do \
394 sed -i -e "s/\"gcc\"/\"gnatgcc\"/g" ${i}; \
396 # add -fPIC flag to shared libs for 3.4* backend
397 if [ "3.4" == "${GCCBRANCH}" ] ; then
399 epatch "${FILESDIR}"/gnat-Make-lang.in.patch
402 # gcc 4.3 sources seem to have a common omission of $(DESTDIR),
403 # that leads to make install trying to rm -f file on live system.
404 # As we do not need this rm, we simply remove the whole line
405 if [ "4.3" == "${GCCBRANCH}" ] ; then
406 sed -i -e "/\$(RM) \$(bindir)/d" "${S}"/gcc/ada/Make-lang.in
409 mkdir -p "${GNATBUILD}"
413 gnatbuild_src_unpack base_unpack common_prep
420 # it would be nice to split configure and make steps
421 # but both need to operate inside specially tuned evironment
422 # so just do sections for now (as in eclass section of handbook)
423 # sections are: configure, make-tools, bootstrap,
424 # gnatlib_and_tools, gnatlib-shared
425 gnatbuild_src_compile() {
426 debug-print-function ${FUNCNAME} $@
427 if [[ -z "$1" ]]; then
428 gnatbuild_src_compile all
432 if [[ "all" == "$1" ]]
433 then # specialcasing "all" to avoid scanning sources unnecessarily
434 gnatbuild_src_compile configure make-tools \
435 bootstrap gnatlib_and_tools gnatlib-shared
438 # Set some paths to our bootstrap compiler.
439 export PATH="${GNATBOOT}/bin:${PATH}"
440 # !ATTN! the bootstrap compilers have a very simplystic structure,
441 # so many paths are not identical to the installed ones.
442 # Plus it was simplified even more in new releases.
443 if [[ ${BOOT_SLOT} > 4.1 ]] ; then
444 GNATLIB="${GNATBOOT}/lib"
446 GNATLIB="${GNATBOOT}/lib/gnatgcc/${BOOT_TARGET}/${BOOT_SLOT}"
449 export CC="${GNATBOOT}/bin/gnatgcc"
450 # CPATH is supposed to be applied for any language, thus
451 # superceding either of C/CPLUS/OBJC_INCLUDE_PATHs
452 export CPATH="${GNATLIB}/include"
453 #export INCLUDE_DIR="${GNATLIB}/include"
454 #export C_INCLUDE_PATH="${GNATLIB}/include"
455 #export CPLUS_INCLUDE_PATH="${GNATLIB}/include"
456 export LIB_DIR="${GNATLIB}"
457 export LDFLAGS="-L${GNATLIB}"
459 # additional vars from gnuada and elsewhere
460 #export LD_RUN_PATH="${LIBPATH}"
461 export LIBRARY_PATH="${GNATLIB}"
462 #export LD_LIBRARY_PATH="${GNATLIB}"
463 # export COMPILER_PATH="${GNATBOOT}/bin/"
465 export ADA_OBJECTS_PATH="${GNATLIB}/adalib"
466 export ADA_INCLUDE_PATH="${GNATLIB}/adainclude"
469 # ADA_INCLUDE_PATH=${ADA_INCLUDE_PATH},
470 # LDFLAGS=${LDFLAGS},
476 debug-print-section configure
480 # some cross-compile logic from toolchain
481 confgcc="${confgcc} --host=${CHOST}"
482 if is_crosscompile || tc-is-cross-compiler ; then
483 confgcc="${confgcc} --target=${CTARGET}"
485 [[ -n ${CBUILD} ]] && confgcc="${confgcc} --build=${CBUILD}"
487 # Native Language Support
489 confgcc="${confgcc} --enable-nls --without-included-gettext"
491 confgcc="${confgcc} --disable-nls"
494 if version_is_at_least 4.6 ; then
495 confgcc+=( $(use_enable lto) )
497 confgcc+=( --disable-lto )
500 # reasonably sane globals (from toolchain)
501 # also disable mudflap and ssp
502 confgcc="${confgcc} \
507 --disable-libmudflap \
509 --disable-libunwind-exceptions"
511 if in_iuse openmp ; then
512 # Make sure target has pthreads support. #326757 #335883
513 # There shouldn't be a chicken&egg problem here as openmp won't
514 # build without a C library, and you can't build that w/out
515 # already having a compiler ...
516 if ! is_crosscompile || \
517 $(tc-getCPP ${CTARGET}) -E - <<<"#include <pthread.h>" >& /dev/null
521 confgcc+=( --disable-libgomp )
524 confgcc+=( $(use_enable openmp libgomp) )
528 # Force disable as the configure script can be dumb #359855
529 confgcc+=( --disable-libgomp )
532 # For gcc variants where we don't want openmp (e.g. kgcc)
533 confgcc+=( --disable-libgomp )
536 # ACT's gnat-gpl does not like libada for whatever reason..
537 if version_is_at_least 4.2 ; then
538 confgcc="${confgcc} --enable-libada"
540 # einfo "ACT's gnat-gpl does not like libada, disabling"
541 # confgcc="${confgcc} --disable-libada"
544 # set some specifics available in later versions
545 if version_is_at_least 4.3 ; then
546 einfo "setting gnat thread model"
547 confgcc="${confgcc} --enable-threads=gnat"
548 confgcc="${confgcc} --enable-shared=boehm-gc,ada,libada"
550 confgcc="${confgcc} --enable-threads=posix"
551 confgcc="${confgcc} --enable-shared"
555 if is_multilib ; then
556 confgcc="${confgcc} --enable-multilib"
558 confgcc="${confgcc} --disable-multilib"
561 # __cxa_atexit is "essential for fully standards-compliant handling of
562 # destructors", but apparently requires glibc.
563 if [[ ${CTARGET} == *-gnu* ]] ; then
564 confgcc="${confgcc} --enable-__cxa_atexit"
565 confgcc="${confgcc} --enable-clocale=gnu"
568 einfo "confgcc=${confgcc}"
570 # need to strip graphite flags or we'll get the
571 # dreaded C compiler cannot create executables...
573 strip-flags -floop-interchange -floop-strip-mine -floop-block
576 CFLAGS="${CFLAGS}" CXXFLAGS="${CXXFLAGS}" "${S}"/configure \
578 --bindir=${BINPATH} \
579 --includedir=${INCLUDEPATH} \
580 --libdir="${LIBPATH}" \
581 --libexecdir="${LIBEXECPATH}" \
582 --datadir=${DATAPATH} \
583 --mandir=${DATAPATH}/man \
584 --infodir=${DATAPATH}/info \
585 --program-prefix=gnat \
586 --enable-languages="c,ada" \
588 ${confgcc} || die "configure failed"
592 debug-print-section make-tools
593 # Compile helper tools
595 cp "${S}"/gcc/ada/xtreeprs.adb .
596 cp "${S}"/gcc/ada/xsinfo.adb .
597 cp "${S}"/gcc/ada/xeinfo.adb .
598 cp "${S}"/gcc/ada/xnmake.adb .
599 cp "${S}"/gcc/ada/xutil.ad{s,b} .
600 if (( ${GNATMINOR} > 5 )) ; then
601 cp "${S}"/gcc/ada/einfo.ad{s,b} .
602 cp "${S}"/gcc/ada/csinfo.adb .
603 cp "${S}"/gcc/ada/ceinfo.adb .
605 gnatmake xtreeprs && \
608 gnatmake xnmake || die "building helper tools"
612 debug-print-section bootstrap
613 # and, finally, the build itself
615 emake bootstrap || die "bootstrap failed"
619 debug-print-section gnatlib_and_tools
620 einfo "building gnatlib_and_tools"
622 emake -j1 -C gcc gnatlib_and_tools || \
623 die "gnatlib_and_tools failed"
627 debug-print-section gnatlib-shared
628 einfo "building shared lib"
630 rm -f gcc/ada/rts/*.{o,ali} || die
631 #otherwise make tries to reuse already compiled (without -fPIC) objs..
632 emake -j1 -C gcc gnatlib-shared LIBRARY_VERSION="${GCCBRANCH}" || \
633 die "gnatlib-shared failed"
641 # -- end gnatbuild_src_compile
644 gnatbuild_src_install() {
645 debug-print-function ${FUNCNAME} $@
647 if [[ -z "$1" ]] ; then
648 gnatbuild_src_install all
654 install) # runs provided make install
655 debug-print-section install
657 # Looks like we need an access to the bootstrap compiler here too
658 # as gnat apparently wants to compile something during the installation
659 # The spotted obuser was xgnatugn, used to process gnat_ugn_urw.texi,
660 # during preparison of the docs.
661 export PATH="${GNATBOOT}/bin:${PATH}"
662 if [[ ${BOOT_SLOT} > 4.1 ]] ; then
663 GNATLIB="${GNATBOOT}/lib"
665 GNATLIB="${GNATBOOT}/lib/gnatgcc/${BOOT_TARGET}/${BOOT_SLOT}"
668 export CC="${GNATBOOT}/bin/gnatgcc"
669 export INCLUDE_DIR="${GNATLIB}/include"
670 export C_INCLUDE_PATH="${GNATLIB}/include"
671 export CPLUS_INCLUDE_PATH="${GNATLIB}/include"
672 export LIB_DIR="${GNATLIB}"
673 export LDFLAGS="-L${GNATLIB}"
674 export ADA_OBJECTS_PATH="${GNATLIB}/adalib"
675 export ADA_INCLUDE_PATH="${GNATLIB}/adainclude"
677 # Do not allow symlinks in /usr/lib/gcc/${CHOST}/${MY_PV}/include as
678 # this can break the build.
679 for x in "${GNATBUILD}"/gcc/include/* ; do
680 if [ -L ${x} ] ; then
684 # Remove generated headers, as they can cause things to break
685 # (ncurses, openssl, etc). (from toolchain.eclass)
686 for x in $(find "${WORKDIR}"/build/gcc/include/ -name '*.h') ; do
687 grep -q 'It has been auto-edited by fixincludes from' "${x}" \
693 make DESTDIR="${D}" install || die
696 if (( $(bc <<< "${GNATBRANCH} > 4.3") )) ; then
697 #make a convenience info link
698 elog "Yay! Math is good."
699 dosym gnat_ugn.info ${DATAPATH}/info/gnat.info
705 debug-print-section move_libs
707 # first we need to remove some stuff to make moving easier
708 rm -rf "${D}${LIBPATH}"/{32,include,libiberty.a}
709 # gcc insists on installing libs in its own place
710 mv "${D}${LIBPATH}/gcc/${CTARGET}/${GCCRELEASE}"/* "${D}${LIBPATH}"
711 mv "${D}${LIBEXECPATH}/gcc/${CTARGET}/${GCCRELEASE}"/* "${D}${LIBEXECPATH}"
713 # libgcc_s and, with gcc>=4.0, other libs get installed in multilib specific locations by gcc
714 # we pull everything together to simplify working environment
715 if has_multilib_profile ; then
718 mv "${D}${LIBPATH}"/../$(get_abi_LIBDIR amd64)/* "${D}${LIBPATH}"
719 mv "${D}${LIBPATH}"/../$(get_abi_LIBDIR x86)/* "${D}${LIBPATH}"/32
722 # not supported yet, will have to be adjusted when we
723 # actually build gnat for that arch
728 # force gnatgcc to use its own specs - versions prior to 3.4.6 read specs
729 # from system gcc location. Do the simple wrapper trick for now
730 # !ATTN! change this if eselect-gnat starts to follow eselect-compiler
731 if [[ ${GCCVER} < 3.4.6 ]] ; then
732 # gcc 4.1 uses builtin specs. What about 4.0?
734 mv gnatgcc gnatgcc_2wrap
737 # wrapper to cause gnatgcc read appropriate specs and search for the right .h
738 # files (in case no matching gcc is installed)
739 BINDIR=\$(dirname \$0)
740 # The paths in the next line have to be absolute, as gnatgcc may be called from
742 \${BINDIR}/gnatgcc_2wrap -specs="${LIBPATH}/specs" -I"${LIBPATH}/include" \$@
747 # earlier gnat's generate some Makefile's at generic location, need to
748 # move to avoid collisions
749 [ -f "${D}${PREFIX}"/share/gnat/Makefile.generic ] &&
750 mv "${D}${PREFIX}"/share/gnat/Makefile.* "${D}${DATAPATH}"
752 # use gid of 0 because some stupid ports don't have
753 # the group 'root' set to gid 0 (toolchain.eclass)
754 chown -R root:0 "${D}${LIBPATH}"
758 debug-print-section cleanup
760 rm -rf "${D}${LIBPATH}"/{gcc,install-tools,../lib{32,64}}
761 rm -rf "${D}${LIBEXECPATH}"/{gcc,install-tools}
763 # this one is installed by gcc and is a duplicate even here anyway
764 rm -f "${D}${BINPATH}/${CTARGET}-gcc-${GCCRELEASE}"
766 # remove duplicate docs
767 rm -f "${D}${DATAPATH}"/info/{dir,gcc,cpp}*
768 rm -rf "${D}${DATAPATH}"/man/man7/
770 # fix .la path for lto plugin
773 "/libdir=/c\libdir='${LIBEXECPATH}'" \
774 "${D}${LIBEXECPATH}"/liblto_plugin.la \
775 || die "sed update of .la file failed!"
778 # add config directory (bug 440660)
783 # instead of putting junk under /etc/env.d/gnat we recreate env files as
784 # needed with eselect
789 gnatbuild_src_install install move_libs cleanup prep_env
795 # -- end gnatbuild_src_install