Index: toolchain.eclass =================================================================== RCS file: /var/cvsroot/gentoo-x86/eclass/toolchain.eclass,v --- toolchain.eclass 13 May 2015 09:12:57 -0000 1.669 +++ toolchain.eclass 20 May 2015 16:38:46 -0000 @@ -146,12 +146,16 @@ tc_version_is_at_least 4.1 && IUSE+=" libssp objc++" tc_version_is_at_least 4.2 && IUSE_DEF+=( openmp ) tc_version_is_at_least 4.3 && IUSE+=" fixed-point" + tc_version_is_at_least 4.6 && IUSE+=" ada" tc_version_is_at_least 4.7 && IUSE+=" go" # Note: while <=gcc-4.7 also supported graphite, it required forked ppl # versions which we dropped. Since graphite was also experimental in # the older versions, we don't want to bother supporting it. #448024 tc_version_is_at_least 4.8 && IUSE+=" graphite" IUSE_DEF+=( sanitize ) tc_version_is_at_least 4.9 && IUSE+=" cilk" + # Compiling the Ada compiler requires an Ada compiler, + # and GNATBOOT_SRC_URI specifies the binary images. + in_iuse ada && IUSE+=${GNATBOOT_SRC_URI:+" gnatboot"} fi [[ ${EAPI:-0} != 0 ]] && IUSE_DEF=( "${IUSE_DEF[@]/#/+}" ) @@ -223,6 +227,18 @@ DEPEND+=" gcj? ( awt? ( ${GCJ_GTK_DEPS} ) ${GCJ_DEPS} )" fi +if in_iuse ada ; then + # Need some Ada compiler to build the Ada compiler: + # Either from installed compiler, ... + GNAT_DEPS="sys-devel/gcc[ada(-)]" + if in_iuse gnatboot ; then + # or from pre-built images, specified via GNATBOOT_SRC_URI. + GNAT_DEPS="!gnatboot? ( ${GNAT_DEPS} )" + fi + DEPEND+=" ada? ( ${GNAT_DEPS} ) " + # TODO: cross support +fi + PDEPEND=">=sys-devel/gcc-config-1.7" #---->> S + SRC_URI essentials <<---- @@ -362,6 +378,10 @@ fi fi + if in_iuse gnatboot ; then + GCC_SRC_URI+=" ada? ( gnatboot? ( ${GNATBOOT_SRC_URI} ) )" + fi + echo "${GCC_SRC_URI}" } @@ -385,6 +405,13 @@ use_if_iuse gcj && ewarn 'GCJ requires a C++ compiler, disabled due to USE="-cxx"' fi + if use_if_iuse ada ; then + if tc-is-cross-compiler || is_crosscompile ; then + # FIXME + ewarn "Cross-compiling Ada not supported yet, disabled" + fi + fi + want_minispecs } @@ -409,6 +436,13 @@ gcc_quick_unpack fi + if use_if_iuse gnatboot ; then + local a + for a in ${A} ; do + [[ ${a} == gnatboot-* ]] && unpack ${a} + done + fi + case ${EAPI:-0} in 0|1) toolchain_src_prepare ;; esac @@ -846,6 +880,7 @@ is_d && GCC_LANG+=",d" is_gcj && GCC_LANG+=",java" is_go && GCC_LANG+=",go" + is_ada && GCC_LANG+=",ada" if is_objc || is_objcxx ; then GCC_LANG+=",objc" if tc_version_is_at_least 4 ; then @@ -861,9 +896,6 @@ is_f77 && GCC_LANG+=",f77" is_f95 && GCC_LANG+=",f95" - # We do NOT want 'ADA support' in here! - # is_ada && GCC_LANG+=",ada" - confgcc+=( --enable-languages=${GCC_LANG} ) ### general options @@ -1200,6 +1232,59 @@ confgcc+=( $(use_enable sanitize libsanitizer) ) fi + if is_ada ; then + confgcc+=( --enable-libada ) + if use_if_iuse gnatboot ; then + local x gnatbin= gnatlib=() + for x in "${WORKDIR}"/etc/env.d/gcc/* ; do + [[ -s ${x} ]] || continue + gnatbin=$( + PATH= + . "${x}" + echo "${WORKDIR}/${PATH##/}" + ) || continue + gnatlib=( $( + LDPATH= + . "${x}" + IFS=: + for x in ${LDPATH} ; do + echo "${WORKDIR}/${x##/}" + done + ) ) || continue + [[ ${gnatbin} ]] && break + done + if [[ -z ${gnatbin} ]] ; then + # old >gnatboot-4.1 image used by gnatbuild.eclass + gnatbin=${WORKDIR}/usr/bin + gnatlib=( ${WORKDIR}/usr/lib ) + export CPATH=${gnatlib}/include + export LIB_DIR=${gnatlib} + export LDFLAGS=-L${gnatlib} + export LIBRARY_PATH=${gnatlib} + fi + export PATH=${gnatbin}:${PATH} + pushd "${gnatbin}" 2>/dev/null + for x in gnat{bind,chop,clean,find,kr,link,ls,make,mem,name,prep,sym,xref} \ + ; do + [[ -x ./${x} ]] && export ${x^^}=${gnatbin}/${x} + done + # CC and CXX need to be the same version as GNAT-tools + for x in gnatgcc gcc; do + [[ -x ./${x} ]] && export CC=${gnatbin}/${x} + done + tc_version_is_at_least 4.8 && + for x in gnatg++ g++; do + [[ -x ./${x} ]] && export CXX=${gnatbin}/${x} + done + popd > /dev/null + for x in "${gnatlib[@]}" ; do + ADA_OBJECTS_PATH+=${ADA_OBJECTS_PATH:+:}${x}/adalib + ADA_INCLUDE_PATH+=${ADA_INCLUDE_PATH:+:}${x}/adainclude + done + export ADA_OBJECTS_PATH ADA_INCLUDE_PATH + fi + fi + # Disable gcc info regeneration -- it ships with generated info pages # already. Our custom version/urls/etc... trigger it. #464008 export gcc_cv_prog_makeinfo_modern=no @@ -1219,6 +1304,13 @@ einfo "LIBPATH: ${LIBPATH}" einfo "DATAPATH: ${DATAPATH}" einfo "STDCXX_INCDIR: ${STDCXX_INCDIR}" + if is_ada ; then + local x + for x in cc cxx gnat{bind,chop,clean,find,kr,link,ls,make,mem,name,prep,sym,xref} \ + ; do + eval "einfo \"(Ada) ${x^^}: \${${x^^}}\"" + done + fi echo einfo "Languages: ${GCC_LANG}" echo @@ -1654,7 +1746,9 @@ cd "${D}"${BINPATH} # Ugh: we really need to auto-detect this list. # It's constantly out of date. - for x in cpp gcc g++ c++ gcov g77 gcj gcjh gfortran gccgo ; do + for x in cpp gcc g++ c++ gcov g77 gcj gcjh gfortran gccgo \ + gnat{bind,chop,clean,find,kr,link,ls,make,mem,name,prep,sym,xref} \ + ; do # For some reason, g77 gets made instead of ${CTARGET}-g77... # this should take care of that [[ -f ${x} ]] && mv ${x} ${CTARGET}-${x} @@ -2100,8 +2194,16 @@ } is_ada() { + if tc-is-cross-compiler || is_crosscompile ; then + # FIXME: Cross-compiling Ada not supported yet + return 1 + fi + if use_if_iuse gnatboot ; then + # does GNATBOOT_SRC_URI define a gnatboot image for current arch? + [[ " ${A}" == *" gnatboot-"* ]] || return 1 + fi gcc-lang-supported ada || return 1 - use ada + use_if_iuse ada } is_cxx() {