From 56bc9e942508f8790eb1e6dddc33411fb6163ca7 Mon Sep 17 00:00:00 2001
From: Steve Arnold <nerdboy@gentoo.org>
Date: Thu, 14 Nov 2013 06:20:06 +0000
Subject: updated gnatbuild for new ebuilds and lto use flag handling

---
 eclass/gnatbuild.eclass | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

(limited to 'eclass')

diff --git a/eclass/gnatbuild.eclass b/eclass/gnatbuild.eclass
index 6f7261ed2496..6e6d185fbb8c 100644
--- a/eclass/gnatbuild.eclass
+++ b/eclass/gnatbuild.eclass
@@ -1,6 +1,6 @@
 # Copyright 1999-2012 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/gnatbuild.eclass,v 1.56 2013/08/02 17:38:57 george Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/gnatbuild.eclass,v 1.57 2013/11/14 06:20:06 nerdboy Exp $
 #
 # Author: George Shapovalov <george@gentoo.org>
 # Belongs to: ada herd <ada@gentoo.org>
@@ -485,12 +485,19 @@ gnatbuild_src_compile() {
 					confgcc="${confgcc} --disable-nls"
 				fi
 
+				if [ "${GNATMINOR}" -ge "6" ] ; then
+					confgcc+=( $(use_enable lto) )
+				elif [ "${GNATMINOR}" -ge "5" ] ; then
+					confgcc+=( --disable-lto )
+				fi
+
 				# reasonably sane globals (from toolchain)
 				# also disable mudflap and ssp
 				confgcc="${confgcc} \
 					--with-system-zlib \
 					--disable-checking \
 					--disable-werror \
+					--disable-libgomp \
 					--disable-libmudflap \
 					--disable-libssp \
 					--disable-libunwind-exceptions"
@@ -554,6 +561,11 @@ gnatbuild_src_compile() {
 				cp "${S}"/gcc/ada/xeinfo.adb   .
 				cp "${S}"/gcc/ada/xnmake.adb   .
 				cp "${S}"/gcc/ada/xutil.ad{s,b}   .
+				if [[ ${GNATMINOR} > 5 ]] ; then
+					cp "${S}"/gcc/ada/einfo.ad{s,b}  .
+					cp "${S}"/gcc/ada/csinfo.adb  .
+					cp "${S}"/gcc/ada/ceinfo.adb  .
+				fi
 				gnatmake xtreeprs && \
 				gnatmake xsinfo   && \
 				gnatmake xeinfo   && \
@@ -645,7 +657,7 @@ gnatbuild_src_install() {
 		make DESTDIR="${D}" install || die
 
 		#make a convenience info link
-		dosym ${DATAPATH}/info/gnat_ugn_unw.info ${DATAPATH}/info/gnat.info
+		dosym ${DATAPATH}/info/gnat_ugn.info ${DATAPATH}/info/gnat.info
 		;;
 
 	move_libs)
@@ -713,6 +725,14 @@ EOF
 		# remove duplicate docs
 		rm -f  "${D}${DATAPATH}"/info/{dir,gcc,cpp}*
 		rm -rf "${D}${DATAPATH}"/man/man7/
+
+		# fix .la path for lto plugin
+		if use lto ; then
+			sed -i -e \
+				"/libdir=/c\libdir='${LIBEXECPATH}'" \
+				"${D}${LIBEXECPATH}"/liblto_plugin.la \
+				|| die "sed update of .la file failed!"
+		fi
 		;;
 
 	prep_env)
-- 
cgit v1.2.3-65-gdbad