commit:     41f88706dedf15129fff2b8fbd661cc529a0884f
Author:     Tupone Alfredo <tupone <AT> gentoo <DOT> org>
AuthorDate: Sun Oct 14 18:52:01 2018 +0000
Commit:     Alfredo Tupone <tupone <AT> gentoo <DOT> org>
CommitDate: Sun Oct 14 18:52:01 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=41f88706

dev-ada/gprbuild: C files compiled only with gnat provided compiler

Signed-off-by: Alfredo Tupone <tupone <AT> gentoo.org>
Package-Manager: Portage-2.3.49, Repoman-2.3.11

 dev-ada/gprbuild/files/gprbuild-2018.xml | 93 ++++++++++++++++++++++++++++++++
 dev-ada/gprbuild/gprbuild-2018-r1.ebuild | 89 ++++++++++++++++++++++++++++++
 2 files changed, 182 insertions(+)

diff --git a/dev-ada/gprbuild/files/gprbuild-2018.xml 
b/dev-ada/gprbuild/files/gprbuild-2018.xml
new file mode 100644
index 00000000000..56c4f896919
--- /dev/null
+++ b/dev-ada/gprbuild/files/gprbuild-2018.xml
@@ -0,0 +1,93 @@
+<?xml version="1.0" ?>
+<gprconfig>
+  <compiler_description>
+    <name>GNAT-@VER@</name>
+    <executable prefix="1">gnatls-@VER@</executable>
+    <version>
+      <external>${PREFIX}gnatls-@VER@ -v --version</external>
+      <grep regexp="^GNATLS.+?(\d+(\.\d+)?)" group="1"></grep>
+    </version>
+    <languages>Ada</languages>
+    <variable name="gcc_version">
+      <external>${PREFIX}gcc-@VER@ -v</external>
+      <grep regexp="^[-\w]*gcc \S+ (\S+)" group="1"></grep>
+    </variable>
+    <runtimes default="default,kernel,native">
+       <directory group="default" 
>\.\./lib/gcc(-lib)?/$TARGET/$gcc_version/adalib/</directory>
+       <directory group="default" 
contents="^rts-">\.\./lib/gcc(-lib)?/$TARGET/$gcc_version/ada_object_path</directory>
+       <directory group="2" 
>\.\./lib/gcc(-lib)?/$TARGET/$gcc_version/rts-(.*)/adalib/</directory>
+       <directory group="1" >\.\./$TARGET/lib/gnat/(.*)/adalib/</directory>
+    </runtimes>
+    <target>
+      <external>${PREFIX}gcc-@VER@ -dumpmachine</external>
+      <grep regexp="[^\r\n]+"></grep>
+    </target>
+  </compiler_description>
+
+  <configuration>
+    <compilers>
+      <compiler name="GNAT-@VER@" />
+    </compilers>
+   <config>
+   package Compiler is
+      for Driver                   ("Ada") use 
"${PATH(ada)}${PREFIX(ada)}gcc-@VER@";
+      for Language_Kind            ("Ada") use "unit_based";
+      for Dependency_Kind          ("Ada") use "ALI_File";
+      for Leading_Required_Switches        ("Ada") use
+         ("-c", "-x", "ada", "-gnatA")
+             &amp; Compiler'Leading_Required_Switches ("Ada");
+      for Mapping_File_Switches    ("Ada") use ("-gnatem=");
+      for Mapping_Spec_Suffix      ("Ada") use "%s";
+      for Mapping_Body_Suffix      ("Ada") use "%b";
+      for Config_File_Switches     ("Ada") use ("-gnatec=");
+      for Include_Path_File     ("Ada") use "ADA_PRJ_INCLUDE_FILE";
+      for Multi_Unit_Switches ("Ada") use ("-gnateI");
+      for Multi_Unit_Object_Separator ("Ada") use "~";
+      for Config_Body_File_Name ("Ada") use
+           "pragma Source_File_Name_Project (%u, Body_File_Name => ""%f"");";
+      for Config_Spec_File_Name ("Ada") use
+           "pragma Source_File_Name_Project (%u, Spec_File_Name => ""%f"");";
+      for Config_Body_File_Name_Index ("Ada") use
+           "pragma Source_File_Name_Project (%u, Body_File_Name => ""%f"", 
Index => %i);";
+      for Config_Spec_File_Name_Index ("Ada") use
+           "pragma Source_File_Name_Project (%u, Spec_File_Name => ""%f"", 
Index => %i);";
+      for Config_Body_File_Name_Pattern ("Ada") use
+           "pragma Source_File_Name_Project " &amp;
+           "  (Body_File_Name  => ""*%b""," &amp;
+           "   Casing          => %c," &amp;
+           "   Dot_Replacement => ""%d"");";
+      for Config_Spec_File_Name_Pattern ("Ada") use
+           "pragma Source_File_Name_Project " &amp;
+           "  (Spec_File_Name  => ""*%s""," &amp;
+           "   Casing          => %c," &amp;
+           "   Dot_Replacement => ""%d"");";
+      for Config_File_Unique    ("Ada") use "False";
+      for PIC_Option      ("Ada") use ("-fPIC");
+      for Leading_Required_Switches ("Ada") use
+        Compiler'Leading_Required_Switches ("Ada") &amp; 
("--RTS=${RUNTIME_DIR(ada)}");
+      for Driver ("C") use "${PATH(c)}${PREFIX(c)}gcc-@VER@";
+      for Leading_Required_Switches ("C") use
+        ("-c", "-x", "c") &amp; Compiler'Leading_Required_Switches ("C");
+      for Include_Switches_Via_Spec ("C") use ("cc1", "-I");
+      for Max_Command_Line_Length use "8192";
+      for Response_File_Format ("C") use "GCC_GNU";
+      for Dependency_Switches ("C") use ("-MMD", "-MF", "");
+      for PIC_Option ("C") use ("-fPIC");
+   end Compiler;
+
+   package Binder is
+      for Objects_Path_File     ("Ada") use "ADA_PRJ_OBJECTS_FILE";
+      for Driver         ("Ada") use
+          "${GPRCONFIG_PREFIX}libexec/gprbuild/gprbind";
+      for Switches ("Ada") use ("--gnatbind_path=gnatbind-@VER@");
+      for Required_Switches ("Ada") use
+        Binder'Required_Switches ("Ada") &amp; ("--RTS=${RUNTIME_DIR(ada)}");
+   end Binder;
+
+   for Toolchain_Version ("Ada") use "GNAT ${VERSION(ada)}";
+
+for Runtime_Dir       ("Ada") use "${RUNTIME_DIR(ada)}";
+   for Library_Encapsulated_Supported use "true";
+   </config>
+  </configuration>
+</gprconfig>

diff --git a/dev-ada/gprbuild/gprbuild-2018-r1.ebuild 
b/dev-ada/gprbuild/gprbuild-2018-r1.ebuild
new file mode 100644
index 00000000000..3f325332e8e
--- /dev/null
+++ b/dev-ada/gprbuild/gprbuild-2018-r1.ebuild
@@ -0,0 +1,89 @@
+# Copyright 1999-2018 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit toolchain-funcs multiprocessing
+
+MYP=${PN}-gpl-${PV}
+
+DESCRIPTION="Multi-Language Management"
+HOMEPAGE="http://libre.adacore.com/";
+SRC_URI="
+       http://mirrors.cdn.adacore.com/art/5b0819dfc7a447df26c27a68
+               -> ${MYP}-src.tar.gz
+       http://mirrors.cdn.adacore.com/art/5b0819dec7a447df26c27a40
+               -> xmlada-gpl-${PV}-src.tar.gz"
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="gnat_2016 gnat_2017 +gnat_2018"
+
+DEPEND="gnat_2016? ( dev-lang/gnat-gpl:4.9.4 )
+       gnat_2017? ( dev-lang/gnat-gpl:6.3.0 )
+       gnat_2018? ( dev-lang/gnat-gpl:7.3.1 )"
+RDEPEND="${DEPEND}"
+
+S="${WORKDIR}"/${MYP}-src
+
+REQUIRED_USE="!gnat_2016 ^^ ( gnat_2017 gnat_2018 )"
+PATCHES=( "${FILESDIR}"/${P}-gentoo.patch )
+
+src_prepare() {
+       if use gnat_2016; then
+               GCC_PV=4.9.4
+       elif use gnat_2017; then
+               GCC_PV=6.3.0
+       else
+               GCC_PV=7.3.1
+       fi
+       sed -e "s:@VER@:${GCC_PV}:g" "${FILESDIR}"/${P}.xml > gnat-${GCC_PV}.xml
+       rm share/gprconfig/c.xml || die
+       default
+       sed -i \
+               -e "s:@GNATBIND@:gnatbind-${GCC_PV}:g" \
+               src/gprlib.adb \
+               || die
+       sed -i \
+               -e "s:\"-Wl,-r\":\"-r\":g" \
+               share/gprconfig/linker.xml \
+               || die
+}
+
+src_configure() {
+       emake prefix="${D}"usr setup
+}
+
+bin_progs="gprbuild gprconfig gprclean gprinstall gprname gprls"
+lib_progs="gprlib gprbind"
+
+src_compile() {
+       GCC=${CHOST}-gcc-${GCC_PV}
+       GNATMAKE=${CHOST}-gnatmake-${GCC_PV}
+       local xmlada_src="../xmlada-gpl-${PV}-src"
+       incflags="-Isrc -Igpr/src -I${xmlada_src}/sax -I${xmlada_src}/dom \
+               -I${xmlada_src}/schema -I${xmlada_src}/unicode \
+               -I${xmlada_src}/input_sources"
+       ${GCC} -c ${CFLAGS} gpr/src/gpr_imports.c -o gpr_imports.o || die
+       for bin in ${bin_progs}; do
+               ${GNATMAKE} -j$(makeopts_jobs) ${incflags} $ADAFLAGS 
${bin}-main \
+                       -o ${bin} -largs gpr_imports.o || die
+       done
+       for lib in $lib_progs; do
+               ${GNATMAKE} -j$(makeopts_jobs) ${incflags} ${lib} $ADAFLAGS \
+                       -largs gpr_imports.o || die
+       done
+}
+
+src_install() {
+       dobin ${bin_progs}
+       exeinto /usr/libexec/gprbuild
+       doexe ${lib_progs}
+       insinto /usr/share/gprconfig
+       doins share/gprconfig/*
+       insinto /usr/share/gpr
+       doins share/_default.gpr
+       insinto /usr/share/gprconfig
+       doins gnat-${GCC_PV}.xml
+       einstalldocs
+}

Reply via email to