--- /dev/null
+--- gnatcoll-gpl-2016-src/Makefile.old 2017-01-20 19:39:07.131398270 +0100
++++ gnatcoll-gpl-2016-src/Makefile 2017-01-20 19:42:30.088728844 +0100
+@@ -34,19 +36,19 @@
+ @${RM} src/gnatcoll-atomic.adb
+
+ @echo "====== Building $(@F) libraries ======"
+- ${GPRBUILD} ${GPRBLD_OPTS} -Pgnatcoll_full
++ ${GPRBUILD} ${GPRBLD_OPTS} -Pgnatcoll_full -cargs ${ADAFLAGS}
+
+ @# Need to build libgnatcoll_gtk separately, because its project files
+ @# requires gtkada.gpr, which might not exist on the machine.
+ ifeq (${WITH_GTK},yes)
+- ${GPRBUILD} ${GPRBLD_OPTS} -Psrc/gnatcoll_gtk
++ ${GPRBUILD} ${GPRBLD_OPTS} -Psrc/gnatcoll_gtk -cargs ${ADAFLAGS}
+ endif
+
+ @# Build the tools (the list is the project\'s Main attribute)
+ @# They are not build as part of the above because only the Main from
+ @# gnatcoll_full.gpr are build. We could use aggregate projects to
+ @# speed things up.
+- ${GPRBUILD} ${GPRBLD_OPTS} -q -Psrc/gnatcoll_tools
++ ${GPRBUILD} ${GPRBLD_OPTS} -q -Psrc/gnatcoll_tools -cargs ${ADAFLAGS}
+
+ #######################################################################
+ # install
+@@ -53,7 +53,7 @@
+ #######################################################################
+ # install
+
+-GPRINST_OPTS=-p -f --prefix=${prefix} --install-name=gnatcoll \
++GPRINST_OPTS=-p -f --prefix=$(DESTDIR)${prefix} --install-name=gnatcoll \
+ --exec-subdir=${bindir} --project-subdir=lib/gnat \
+ --build-var=LIBRARY_TYPE --build-name=$(@F) -XLIBRARY_TYPE=$(@F)
+
+@@ -73,9 +73,9 @@
+ ${GPRINSTALL} --mode=usage ${GPRINST_OPTS} -Psrc/gnatcoll_tools
+
+ install_gps_plugin: force
+- mkdir -p $(prefix)/share/gps/plug-ins
++ mkdir -p $(DESTDIR)$(prefix)/share/gps/plug-ins
+ (cd distrib/ ; tar cf - gnatcoll) | \
+- (cd $(prefix)/share/gps/plug-ins ; tar xf -)
++ (cd $(DESTDIR)$(prefix)/share/gps/plug-ins ; tar xf -)
+
+ # Regenerate part of the sources. Unfortunately, this can be run only after
+ # we have build GNATCOLL, and then its tools, even though GNATCOLL itself
+--- gnatcoll-gpl-2015-src/src/gnatcoll_gmp.gpr.in.old 2017-01-07 08:52:14.921110195 +0100
++++ gnatcoll-gpl-2015-src/src/gnatcoll_gmp.gpr.in 2017-01-07 08:55:35.718946607 +0100
+@@ -24,6 +24,7 @@
+
+ package Compiler is
+ for Switches ("Ada") use Gnatcoll_Shared.Compiler'Switches ("Ada");
++ for Driver ("C") use External ("CC", "gcc");
+ for Switches ("C") use Gnatcoll_Shared.Compiler'Switches ("C")
+ & (@GMP_CFLAGS_GPR@);
+ end Compiler;
+--- gnatcoll-gpl-2015-src/src/gnatcoll_iconv.gpr.old 2017-01-07 08:58:01.361112843 +0100
++++ gnatcoll-gpl-2015-src/src/gnatcoll_iconv.gpr 2017-01-07 08:58:23.653687385 +0100
+@@ -26,6 +26,7 @@
+
+ package Compiler is
+ for Switches ("Ada") use GnatColl_Shared.Compiler'Switches ("Ada");
++ for Driver ("C") use External ("CC", "gcc");
+ for Switches ("C") use GnatColl_Shared.Compiler'Switches ("C")
+ & GnatColl_Shared.Iconv_Include;
+ end Compiler;
+--- gnatcoll-gpl-2015-src/src/gnatcoll_sqlite.gpr.old 2017-01-07 09:00:17.146448202 +0100
++++ gnatcoll-gpl-2015-src/src/gnatcoll_sqlite.gpr 2017-01-07 09:00:44.884885281 +0100
+@@ -60,8 +60,9 @@
+
+ -- force full optimization for sqlite, we do not debug it
+ -- in any case.
+- "-O3") & Gnatcoll_Shared.Sqlite_Switches;
++ "-O3", "-fPIC") & Gnatcoll_Shared.Sqlite_Switches;
+ end case;
++ for Driver ("C") use External ("CC", "gcc");
+ end Compiler;
+
+ package Linker is
+--- gnatcoll-gpl-2015-src/src/gnatcoll_postgres.gpr.old 2017-01-07 09:05:09.177756146 +0100
++++ gnatcoll-gpl-2015-src/src/gnatcoll_postgres.gpr 2017-01-07 09:05:34.282279733 +0100
+@@ -38,6 +38,7 @@
+ for Switches ("C") use
+ GnatColl_Shared.Compiler'Switches ("C");
+ end case;
++ for Driver ("C") use External ("CC", "gcc");
+ end Compiler;
+
+ package Linker is
+--- gnatcoll-gpl-2015-src/src/gnatcoll_python.gpr.in.old 2017-01-07 09:12:30.490399897 +0100
++++ gnatcoll-gpl-2015-src/src/gnatcoll_python.gpr.in 2017-01-07 09:12:53.111976591 +0100
+@@ -30,7 +30,8 @@
+ GnatColl_Shared.Compiler'Switches ("Ada");
+
+ for Switches ("C") use
+- ("-g", "-O2") & GnatColl_Shared.Python_Cflags;
++ ("-g", "-O2", "-fPIC") & GnatColl_Shared.Python_Cflags;
++ for Driver ("C") use External ("CC", "gcc");
+ end Compiler;
+
+ package Linker is
+--- gnatcoll-gpl-2016-src/gnatcoll_shared.gpr.in.old 2017-01-20 19:50:03.222808656 +0100
++++ gnatcoll-gpl-2016-src/gnatcoll_shared.gpr.in 2017-01-20 19:50:28.200399274 +0100
+@@ -67,7 +67,7 @@
+
+ when "Production" =>
+ for Switches ("Ada") use ("-O2", "-gnatn", "-gnatws");
+- for Switches ("C") use ("-O2", "-Wunreachable-code");
++ for Switches ("C") use ("-O2", "-Wunreachable-code", "-fPIC");
+ end case;
+
+ case Syslog is
+--- gnatcoll-gpl-2016-src/src/gnatcoll_gtk.gpr.in.old 2017-01-20 19:53:16.647607400 +0100
++++ gnatcoll-gpl-2016-src/src/gnatcoll_gtk.gpr.in 2017-01-20 19:53:57.302925708 +0100
+@@ -63,11 +63,12 @@
+ for Switches ("Ada") use GnatColl_Shared.Compiler'Switches ("Ada");
+
+ for Switches ("C") use
+- ("-g", "-O2")
++ ("-g", "-O2", "-fPIC")
+ & GnatColl_Shared.Python_Cflags
+ & GnatColl_Shared.Pygtk_Include
+ & GnatColl_Shared.PyGobject_Include
+ & Gtk_Include;
++ for Driver ("C") use External ("CC", "gcc");
+ end Compiler;
+
+ package Linker is
+--- gnatcoll-gpl-2016-src/src/gnatcoll__libgpr.gpr.old 2017-02-04 15:56:11.685079607 +0100
++++ gnatcoll-gpl-2016-src/src/gnatcoll__libgpr.gpr 2017-02-04 15:57:00.383221978 +0100
+@@ -49,6 +49,8 @@
+ package Builder renames GnatColl_Shared.Builder;
+
+ package Compiler is
++ for Driver ("C") use External ("CC", "gcc");
++
+ for Switches ("Ada") use GnatColl_Shared.Compiler'Switches ("Ada");
+ for Switches ("C") use GnatColl_Shared.Compiler'Switches ("C");
+ for Switches ("sinfo.adb") use Compiler'Switches ("Ada") & ("-gnatg");
+--- gnatcoll-gpl-2016-src/src/gnatcoll__nogpr.gpr.old 2017-02-04 15:58:41.008450044 +0100
++++ gnatcoll-gpl-2016-src/src/gnatcoll__nogpr.gpr 2017-02-04 15:59:02.815066080 +0100
+@@ -64,6 +64,7 @@
+ for Switches ("Ada") use GnatColl_Shared.Compiler'Switches ("Ada");
+ for Switches ("C") use GnatColl_Shared.Compiler'Switches ("C");
+ for Switches ("sinfo.adb") use Compiler'Switches ("Ada") & ("-gnatg");
++ for Driver ("C") use External ("CC", "gcc");
+
+ case GnatColl_Shared.Atomics is
+ when "intrinsic" =>
--- /dev/null
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit multilib multiprocessing
+
+MYP=${PN}-gpl-${PV}
+
+DESCRIPTION="GNAT Component Collection"
+HOMEPAGE="http://libre.adacore.com"
+SRC_URI="http://mirrors.cdn.adacore.com/art/5739942ac7a447658d00e1e7 -> ${MYP}-src.tar.gz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~amd64"
+IUSE="gmp iconv postgresql projects pygobject python readline +shared sqlite static syslog"
+
+RDEPEND="dev-lang/gnat-gpl
+ gmp? ( dev-libs/gmp:* )
+ postgresql? ( dev-db/postgresql:* )
+ pygobject? (
+ || (
+ dev-python/pygobject:2
+ dev-python/pygobject:3
+ )
+ )
+ python? ( dev-lang/python:2.7 )
+ sqlite? ( dev-db/sqlite )
+ projects? (
+ dev-ada/gprbuild[static?]
+ dev-ada/gprbuild[shared?]
+ )"
+DEPEND="${RDEPEND}
+ dev-ada/gprbuild"
+
+S="${WORKDIR}"/${MYP}-src
+
+PATCHES=( "${FILESDIR}"/${P}-gentoo.patch )
+
+src_configure() {
+ local myConf=""
+ if use sqlite; then
+ myConf="$myConf --with-sqlite=$(get_libdir)"
+ else
+ myConf="$myConf --without-sqlite"
+ fi
+ econf \
+ $(use_with gmp) \
+ $(use_with iconv) \
+ $(use_with postgresql) \
+ $(use_enable projects) \
+ $(use_enable pygobject) \
+ $(use_with python) \
+ $(use_enable readline gpl) \
+ $(use_enable readline) \
+ $(use_enable syslog) \
+ --with-python-exec=python2 \
+ --enable-shared-python \
+ --without-gtk \
+ --disable-pygtk \
+ $myConf
+}
+
+src_compile() {
+ if use shared; then
+ emake PROCESSORS=$(makeopts_jobs) build_library_type/relocatable
+ fi
+ if use static; then
+ emake PROCESSORS=$(makeopts_jobs) build_library_type/static
+ fi
+}
+
+src_install() {
+ if use shared; then
+ emake DESTDIR="${D}" install_library_type/relocatable
+ fi
+ if use static; then
+ emake DESTDIR="${D}" install_library_type/static
+ fi
+ emake DESTDIR="${D}" install_gps_plugin
+ einstalldocs
+}