summaryrefslogtreecommitdiff
path: root/app-eselect/eselect-gnat
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
committerV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
commit4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch)
treeba5f07bf3f9d22d82e54a462313f5d244036c768 /app-eselect/eselect-gnat
reinit the tree, so we can have metadata
Diffstat (limited to 'app-eselect/eselect-gnat')
-rw-r--r--app-eselect/eselect-gnat/Manifest14
-rw-r--r--app-eselect/eselect-gnat/eselect-gnat-1.3-r1.ebuild35
-rw-r--r--app-eselect/eselect-gnat/eselect-gnat-1.4-r1.ebuild38
-rw-r--r--app-eselect/eselect-gnat/eselect-gnat-1.4.ebuild38
-rw-r--r--app-eselect/eselect-gnat/eselect-gnat-1.5-r1.ebuild38
-rw-r--r--app-eselect/eselect-gnat/eselect-gnat-1.5.ebuild38
-rw-r--r--app-eselect/eselect-gnat/files/gnat-common-1.3-r1.bash222
-rw-r--r--app-eselect/eselect-gnat/files/gnat-common-1.4-r1.bash225
-rw-r--r--app-eselect/eselect-gnat/files/gnat-common-1.5.bash225
-rw-r--r--app-eselect/eselect-gnat/files/gnat.eselect-1.3206
-rw-r--r--app-eselect/eselect-gnat/files/gnat.eselect-1.4229
-rw-r--r--app-eselect/eselect-gnat/files/gnat.eselect-1.5225
-rw-r--r--app-eselect/eselect-gnat/metadata.xml6
13 files changed, 1539 insertions, 0 deletions
diff --git a/app-eselect/eselect-gnat/Manifest b/app-eselect/eselect-gnat/Manifest
new file mode 100644
index 000000000000..60004ae61e57
--- /dev/null
+++ b/app-eselect/eselect-gnat/Manifest
@@ -0,0 +1,14 @@
+AUX gnat-common-1.3-r1.bash 6725 SHA256 5cdae7e043cddbafb4c86dd4c310665045bee0db424f6c6d3a6ed924903498ad SHA512 431aba32979fec9ea76232ff66add372945f829c5cd4a4feea609d025a6d97b459812c9e1484fd54dce8b89d3fad2ab5f55315485be4617f53ca49b226ee28c3 WHIRLPOOL 3b415e2843cb125eed5783fa8aea89dc047f0042979b8fd2b6ba61b579719d397676df4e703297b49e6d80517ef0188d6dc1c819d0ce11d21f61caffa00b738f
+AUX gnat-common-1.4-r1.bash 6681 SHA256 4d187cdf8b9b08cd42b2cdfe6ee3e0652f62b8c05bed64c8c3bbeceeef36f502 SHA512 590f91db9fd2c52333f0749edf94cd7d994aa1704c1e32dc00b2325daa3c605f0ea26d9b94387f443c86ac121b8d6f1fe571c173332b12998c2f27dde28a8e25 WHIRLPOOL 9135326ad05db2b115dbaac7d6e5fc85fe0feb1a31d8892da218c9ea4ca891d98db3d1550837b8f1a18e5d22eb58415e2ce892edca47ed0ae0c4f67248719f3d
+AUX gnat-common-1.5.bash 6681 SHA256 8e17e87f52d72e5667b1ee045832319154aa85ceb9592e74bc650ebfbe473ba3 SHA512 b190a7b14bc12c6f8a7e702d735e8f42f7b0bd63112ddb2cfb6738c417c146a9d4391266f390403967301eacfeec15360d17d645b87596220e35d20f6354d0d0 WHIRLPOOL 0cd32a476e26b4e91b7a33116335a28fa3f5feffea478c5c2fb3347bd61fe56e1beff2b982b45713f3bfa366d093f9f5ac44f62121eca6cfa1f10f2879c5463a
+AUX gnat.eselect-1.3 5246 SHA256 057072fb00b40e82031b68ee97e83ba68ada37ef57f520ce21df20e22da4dc1b SHA512 e884847e1e736be0d6c12bb11d6f203f618040cce9e9c82007f8ec3b1e2d40f78b3e75535eb6f64e6a137c63128eaeb5ccce6113adfc9cb025c078e1af709cd3 WHIRLPOOL a76c7d342b85cf1c4039a68cb726b25553ab6b3ddcf138d228ffd67b118973a32c91e123ed32caf79bece335dd0e7f8ada10a56db5ffccf63a72dbc5cef93ad4
+AUX gnat.eselect-1.4 5969 SHA256 778213712bbb0fd603572b773571a94b1ca89d80e148ba51e31177cc7253bf37 SHA512 a001a13f3d2b2c4488ea622021d733c8dfeb25e65e7a9576450fca08368d89da1c8314d547d0aeb6c7ce78076bd58a2a9e6b266311fe3f58cf3bf80a1fed5402 WHIRLPOOL 7538ae80569e386b27a78f0120e818136b2e83ee1a19cd84314b145290f15a056b950e268552a0eee2c5ec755630338f53e5bbdf01387a59c403d288c2f4799b
+AUX gnat.eselect-1.5 5899 SHA256 702d00015bbef54f170113cc49d43b20c86f5877141c8c9009a4cfc3934fbe40 SHA512 5da16c411a85d0f3e534e4f2754b69ea43b7c7e0f830f631b63d72499b87f9c83636f003f30c2af016fb91870a35dd7cbe120d716507dae1e9bf1a1a628fa08f WHIRLPOOL 39201ff2ef93126ce4c005576cf336fed862f97b57a776176c76fd94655b2b4f4217d301793131517222d6d5bd130931bcf4048f3156cdf98b1e0c17db284da0
+EBUILD eselect-gnat-1.3-r1.ebuild 690 SHA256 485594127bb3728e66776c841b335db325bbcc0e98809b4586adc6c831aba987 SHA512 03f464778716d4cbcf6d6fe51f155706c71c61b5df7779482d460831962e8db0d695232d508d20d9366f8a2c146a8d0ad20777b657a1cd210dade1313d338e91 WHIRLPOOL c9e238f4717f6e11d0992b6c5f926d49541a147cf082197a78f77d7e07aa8d90fb528830a59cfd755aea0dec8918695b898613e4174593a7528e5d52d7bfcd38
+EBUILD eselect-gnat-1.4-r1.ebuild 793 SHA256 5f0f14bbab3cd25a0acef59378c1d7869cdea5c1a3b15d5fc09422a63ee03fb0 SHA512 a3c540b99da39052188efaa890d58e0c116d5f216543e24dd6731c5749ae875fa24c1cbd15d46999b63f25dea61fb92ee5c0818a50db7bf8d821d88e97e2f41d WHIRLPOOL eaacf62cdeb86f4b725fe79b1a5e11036eac23744f747d4cec5347e16c6da0c8abe849f9b7d01cbc69601ad633bb73478a4421237ff29f36181b09ffebadacc9
+EBUILD eselect-gnat-1.4.ebuild 793 SHA256 0f2193c3ad62fa8ce25f6d302e1e17fc3a87cca1e7dbd1a3294d2ff967545f09 SHA512 2bf96e840b64f79ccba6a2dc5dd6565b3d29ffaab0c728ac9ced970daeae108e06b2c45b870324682c3eea8d2f54d4df0caed8743c37dab049d7bc1b1539a76e WHIRLPOOL 8bed1231c033399fc0a4e896e3665a80087a0816e86ca1bcd61bc97940a48401ca8606d17b339d58aaeea0c6a641aeabab97dc83e56adc59fa336342c70882c3
+EBUILD eselect-gnat-1.5-r1.ebuild 812 SHA256 88302cf9ea11a448ea40d95e9e62d9f4c7359d6387c38890715b63b6cf1cd4ff SHA512 3ab0e5e084c28475ad8bb7c4e0aa775b00a5a1c972d64f4f7cd1779a5acb97497449cd9eade5a57e88f988d8b0d5829914b7397ce3190989ece1b1247f11d8e2 WHIRLPOOL 7d5c691694c818b75a434dd94dc88e1b57145c1055a98cc5d5f01b0c2d070e806894e41c44a903df116ac388802af1fffd279165aca7f70b52ecc2edce0eca0c
+EBUILD eselect-gnat-1.5.ebuild 808 SHA256 6fe67667fc4050e997453c03901380fecfaec57ab626e67b54aa98cc7b835169 SHA512 83db89788fd1594f3655dcca9ed626f457da1b6e1771401029b6dc2ffdf861e250daa3e3b6886f1624b4002919cf33890448480e74387729cb4967ce450e1102 WHIRLPOOL 2b62f552388bbe1e58d4b61a784f0456c1fdbf08bd01099a90845fee325eaece5e36dbb902653a49525b365aa0208e74b50844f98915b0348db8ae1402af183e
+MISC ChangeLog 4130 SHA256 cd12091b709c7532cd4b831d86840029e7f75b1da5440f760f022cdc6325d6e0 SHA512 6be2529c94b7ebcf195bb5968857faf914ee62fe6ad0306e3ebb4b10f79964b911defb1e1da01875d66f627e5dff97be2002eef78f00781b3e9474994c3a65e0 WHIRLPOOL 6d823d2eb3ac70a1379e1d0e741db0a9ccb1a08ebca50486cf94064c3f671b4a6a2b9661c46936eef7ad2e73b6efc8f853598f25b8b63bccd3a0ee1590d472a8
+MISC ChangeLog-2015 6507 SHA256 4fbd60988e17ff8454f1b1a0731e5bc1a4fb2198edc7e1f87708dc2710c87bca SHA512 b2be8b12133d4a067d2d3c3f52d379835bdf530dc4a3cd8c303eeca3a59c536d202dcf884f385e1f999b15d2809e96b0fb3bf1b472452cfeded0a868c6fbe6c7 WHIRLPOOL eacdbf17298dbf3aed1dc2b667367fa053f05ea88d7d48b1096e092418478761bacae0b80a91a368cd8e81d957ad533ac433570ac0cae1dafd2c8b580cafd127
+MISC metadata.xml 252 SHA256 53bffe900a9c369e928d80db0bea5cd33438653144525e850ebb9d22d4ed30f0 SHA512 fe0cf16be4ef184cd8dfe3a4ca09a9eb04ff7c954efa447e3587e573a644224528b148226843524ae30aae177782703f166cf115e184bfda24da9f0605c8323a WHIRLPOOL b61406922ef716c991e4fbe887a31a3f1d9528726cd4ad6b56b8c1b88f217cb8d72d108da3f98ea000dc81d3bd9dd872358300e919d475e4fa1dc4af04da9903
diff --git a/app-eselect/eselect-gnat/eselect-gnat-1.3-r1.ebuild b/app-eselect/eselect-gnat/eselect-gnat-1.3-r1.ebuild
new file mode 100644
index 000000000000..c05adffcd12e
--- /dev/null
+++ b/app-eselect/eselect-gnat/eselect-gnat-1.3-r1.ebuild
@@ -0,0 +1,35 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+
+inherit eutils
+
+DESCRIPTION="gnat module for eselect"
+HOMEPAGE="https://www.gentoo.org"
+SRC_URI=""
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="amd64 ppc x86"
+
+IUSE=""
+RDEPEND="app-admin/eselect"
+
+S="${WORKDIR}"
+
+MODULEDIR="/usr/share/eselect/modules"
+
+# NOTE!!
+# This path is duplicated in gnat-eselect module,
+# adjust in both locations!
+LIBDIR="/usr/share/gnat/lib"
+
+src_install() {
+ dodir ${MODULEDIR}
+ insinto ${MODULEDIR}
+ newins "${FILESDIR}"/gnat.eselect-${PV} gnat.eselect
+ dodir ${LIBDIR}
+ insinto ${LIBDIR}
+ newins "${FILESDIR}"/gnat-common-${PVR}.bash gnat-common.bash
+}
diff --git a/app-eselect/eselect-gnat/eselect-gnat-1.4-r1.ebuild b/app-eselect/eselect-gnat/eselect-gnat-1.4-r1.ebuild
new file mode 100644
index 000000000000..c5e81999f4c6
--- /dev/null
+++ b/app-eselect/eselect-gnat/eselect-gnat-1.4-r1.ebuild
@@ -0,0 +1,38 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+
+inherit eutils
+
+DESCRIPTION="gnat module for eselect"
+HOMEPAGE="https://www.gentoo.org"
+SRC_URI=""
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~x86"
+
+IUSE=""
+RDEPEND="app-admin/eselect"
+
+S="${WORKDIR}"
+
+MODULEDIR="/usr/share/eselect/modules"
+
+# NOTE!!
+# This path is duplicated in gnat-eselect module,
+# adjust in both locations!
+LIBDIR="/usr/share/gnat/lib"
+
+src_install() {
+ dodir ${MODULEDIR}
+ insinto ${MODULEDIR}
+ newins "${FILESDIR}"/gnat.eselect-${PV} gnat.eselect
+ dodir ${LIBDIR}
+ insinto ${LIBDIR}
+ # !ATTN!
+ # Make sure to adjust version of installed file to a proper one if there is
+ # a change!
+ newins "${FILESDIR}"/gnat-common-${PVR}.bash gnat-common.bash
+}
diff --git a/app-eselect/eselect-gnat/eselect-gnat-1.4.ebuild b/app-eselect/eselect-gnat/eselect-gnat-1.4.ebuild
new file mode 100644
index 000000000000..73a6543927f5
--- /dev/null
+++ b/app-eselect/eselect-gnat/eselect-gnat-1.4.ebuild
@@ -0,0 +1,38 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+
+inherit eutils
+
+DESCRIPTION="gnat module for eselect"
+HOMEPAGE="https://www.gentoo.org"
+SRC_URI=""
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~x86"
+
+IUSE=""
+RDEPEND="app-admin/eselect"
+
+S="${WORKDIR}"
+
+MODULEDIR="/usr/share/eselect/modules"
+
+# NOTE!!
+# This path is duplicated in gnat-eselect module,
+# adjust in both locations!
+LIBDIR="/usr/share/gnat/lib"
+
+src_install() {
+ dodir ${MODULEDIR}
+ insinto ${MODULEDIR}
+ newins "${FILESDIR}"/gnat.eselect-${PV} gnat.eselect
+ dodir ${LIBDIR}
+ insinto ${LIBDIR}
+ # !ATTN!
+ # Make sure to adjust version of installed file to a proper one if there is
+ # a change!
+ newins "${FILESDIR}"/gnat-common-1.3-r1.bash gnat-common.bash
+}
diff --git a/app-eselect/eselect-gnat/eselect-gnat-1.5-r1.ebuild b/app-eselect/eselect-gnat/eselect-gnat-1.5-r1.ebuild
new file mode 100644
index 000000000000..c3ec41a07026
--- /dev/null
+++ b/app-eselect/eselect-gnat/eselect-gnat-1.5-r1.ebuild
@@ -0,0 +1,38 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+
+inherit eutils
+
+DESCRIPTION="gnat module for eselect"
+HOMEPAGE="https://www.gentoo.org"
+SRC_URI=""
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~ppc ~x86 ~sparc"
+
+IUSE=""
+RDEPEND=">=app-admin/eselect-1.2.5"
+
+S="${WORKDIR}"
+
+MODULEDIR="/usr/share/eselect/modules"
+
+# NOTE!!
+# This path is duplicated in gnat-eselect module,
+# adjust in both locations!
+LIBDIR="/usr/share/gnat/lib"
+
+src_install() {
+ dodir ${MODULEDIR}
+ insinto ${MODULEDIR}
+ newins "${FILESDIR}"/gnat.eselect-${PV} gnat.eselect
+ dodir ${LIBDIR}
+ insinto ${LIBDIR}
+ # !ATTN!
+ # Make sure to adjust version of installed file to a proper one if there is
+ # a change!
+ newins "${FILESDIR}"/gnat-common-${PV}.bash gnat-common.bash
+}
diff --git a/app-eselect/eselect-gnat/eselect-gnat-1.5.ebuild b/app-eselect/eselect-gnat/eselect-gnat-1.5.ebuild
new file mode 100644
index 000000000000..fe933b324b5d
--- /dev/null
+++ b/app-eselect/eselect-gnat/eselect-gnat-1.5.ebuild
@@ -0,0 +1,38 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+
+inherit eutils
+
+DESCRIPTION="gnat module for eselect"
+HOMEPAGE="https://www.gentoo.org"
+SRC_URI=""
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc ~x86 ~sparc"
+
+IUSE=""
+RDEPEND=">=app-admin/eselect-1.2.5"
+
+S="${WORKDIR}"
+
+MODULEDIR="/usr/share/eselect/modules"
+
+# NOTE!!
+# This path is duplicated in gnat-eselect module,
+# adjust in both locations!
+LIBDIR="/usr/share/gnat/lib"
+
+src_install() {
+ dodir ${MODULEDIR}
+ insinto ${MODULEDIR}
+ newins "${FILESDIR}"/gnat.eselect-${PV} gnat.eselect
+ dodir ${LIBDIR}
+ insinto ${LIBDIR}
+ # !ATTN!
+ # Make sure to adjust version of installed file to a proper one if there is
+ # a change!
+ newins "${FILESDIR}"/gnat-common-1.4-r1.bash gnat-common.bash
+}
diff --git a/app-eselect/eselect-gnat/files/gnat-common-1.3-r1.bash b/app-eselect/eselect-gnat/files/gnat-common-1.3-r1.bash
new file mode 100644
index 000000000000..d65994515022
--- /dev/null
+++ b/app-eselect/eselect-gnat/files/gnat-common-1.3-r1.bash
@@ -0,0 +1,222 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+#
+# Original Author: George Shapovalov <george@gentoo.org>
+# Purpose: Contains common vars/locations and functions for use by gnat.eclass,
+# gnat.eselect and gnatbuild.eclass.
+#
+# NOTE!!!
+# This code should just define vars (try to limit these!) and simple functions.
+# No bash extensions!!
+# That is, no portage or eclass constructs are allowed!
+#
+
+
+
+# ----------------------------------
+# Globals
+
+# Environmantal stuff (for env update)
+SPECSDIR="/usr/share/gnat/eselect"
+ENVDIR="/etc/env.d"
+MARKER="55gnat-"
+
+# User configurable settings
+SETTINGSDIR="/etc/ada"
+PRIMELIST="${SETTINGSDIR}/primary_compilers"
+
+## Lib install locations
+##
+## Gnat profile dependent files go under under ${LibTop}/${Gnat_Profile}/${PN}
+## and common files go unde SpecsDir, DataDir
+#PREFIX=/usr
+## Replace %LIBDIR% below with $(get_libdir) in eclasses and ebuilds (top level Ok, inherit multilib)
+## or $(profile2libdir ${profile}) in this code, eselect module or anywhere
+## outside portage (as profile will be available only during actual execution, this only should
+## be done inside corresponding functions).
+#AdalibSpecsDir=${PREFIX}/include/ada
+#AdalibDataDir=${PREFIX}/share/ada
+#AdalibLibTop=${PREFIX}/%LIBDIR%/ada
+
+
+# ------------------------------------
+# Helpers
+#
+
+# get_all_profile_components splits gnat profile and returns pace separated list of its components:
+# x86_64-pc-linux-gnu-gnat-gcc-4.1 -> x86_64-pc-linux-gnu gcc 4.1
+# args:
+# $1 - the string to split
+get_all_profile_components() {
+ local GnatSLOT=${1##*-}
+ local remainder=${1%-*}
+ local GnatPkg=${remainder##*-}
+ remainder=${remainder%-gnat-*}
+ echo "${remainder} ${GnatPkg} ${GnatSLOT}"
+}
+
+# similar to above, returns only SLOT component:
+# x86_64-pc-linux-gnu-gnat-gcc-4.1 -> 4.1
+# args:
+# $1 - the string to extract the slot from
+get_gnat_SLOT() {
+ echo "${1##*-}"
+}
+
+# returns only Pkg component:
+# x86_64-pc-linux-gnu-gnat-gcc-4.1 -> gcc
+# args:
+# $1 - the string to extract the slot from
+get_gnat_Pkg() {
+ local remainder=${1%-*}
+ echo "${remainder##*-}"
+}
+
+# returns only Arch component:
+# x86_64-pc-linux-gnu-gnat-gcc-4.1 -> x86_64-pc-linux-gnu
+# args:
+# $1 - the string to extract the slot from
+get_gnat_Arch() {
+ echo ${1%-gnat-*}
+}
+
+
+
+## -------------------------------------------
+# gnat profile and lib detection functions
+
+
+# create a list of all gnat env.d files
+# for now use trivial implementation - store name of active profile in the
+# env file name, so it gets called 55gnat-${ARCH}-${PN}-${SLOT}
+get_env_list() {
+ for fn in ${ENVDIR}/${MARKER}*; do
+ echo $(basename ${fn})
+ done
+}
+
+
+
+# find all installed compilers and return a list
+find_all_compilers() {
+ [[ ! -d ${SPECSDIR} ]] && exit
+ for fn in ${SPECSDIR}/*; do
+ [[ ! -d ${fn} ]] && echo $(basename ${fn});
+ done
+}
+
+# find installed primary compilers and return a list
+find_primary_compilers() {
+ [[ ! -f ${PRIMELIST} ]] && exit
+ for fn in $(cat ${PRIMELIST}); do
+ [[ -f ${SPECSDIR}/${fn} ]] && echo ${fn};
+ done
+}
+
+# find installed libs and return a list
+find_all_libs() {
+ [[ ! -d ${SPECSDIR} ]] && exit
+ for fn in ${SPECSDIR}/*; do
+ [[ -d ${fn} ]] && echo $(basename ${fn});
+ done
+}
+
+# find libs that have been built for a given profile
+# Arguments:
+# $1 - gnat profile for which to detect active libs
+find_libs4profile() {
+ libs=( $(find_all_libs) )
+
+ for (( i = 0 ; i < ${#libs[@]} ; i = i + 1 )) ; do
+ [[ -f ${SPECSDIR}/${libs[$i]}/$1 ]] && echo "${libs[$i]}"
+ done
+}
+
+
+
+
+## -----------------------
+# main action - central part of do_set and helpers
+
+
+# extracts values of the passed var definition from given spec file
+# params:
+# $1: spec file (as generated by gnabuild.eclass)
+# $2: variable name
+get_var_from_spec() {
+ local var=$(grep -e "^ *$2=" $1|cut -d= -f2)
+ echo ${var}
+}
+
+
+# Cycle through given libs and form a ':' separated list of settings for the given
+# var. Returned string starts with ':' if there is any non-empty setting,
+# otherwise returns empty string. Repeating settings are omitted, that is
+# unique entry is added only first time it is encountered. No need to have some
+# common dir listed many times in PATH for example.
+#
+# params:
+# $1 - name of env var to process
+# $2 - name of gnat profile
+# $3.. - list of libs to check (to avoid its composition every time)
+# - the list is expanded to list of args at the point of call
+get_lib_var_settings() {
+ local envVar=$1
+ local toset=$2
+ #echo "get_lib_var_settings params:$@" >> /tmp/eselect-gnat.rep
+ if [[ "none" != ${3} ]]; then
+ local envString
+ local specLine
+ while [[ -n $3 ]]; do
+ specLine=$(get_var_from_spec ${SPECSDIR}/$3/${toset} ${envVar})
+ #echo "$3:${specLine}." >> /tmp/eselect-gnat.rep
+ if [[ -n ${specLine} ]] && [[ ! ${envString} =~ ${specLine} ]]; then
+ envString="${envString}:${specLine}"
+ fi
+ shift
+ done
+ echo "${envString}"
+ fi
+}
+
+
+
+# The action!
+# Part common for do_set and do_update of gnat.eselect, also used in gnat.eclass
+# to set environment during lib build and installation
+#
+# params:
+# $1 - profile to set (toset param inside)
+# $2 - envfile
+
+generate_envFile() {
+ local toset=$1
+ local envfile=$2
+
+ local binpath="$(get_var_from_spec ${SPECSDIR}/${toset} binpath)"
+ local libexecpath="$(get_var_from_spec ${SPECSDIR}/${toset} libexecpath)"
+ local libs=( $(find_libs4profile ${toset}) )
+ #echo "generate_envFile: ${libs[@]}" >> /tmp/eselect-gnat.rep
+ if (( 0 == ${#libs[@]} )); then
+ libs="none"
+ fi
+
+ local MyPath="${binpath}:${libexecpath}$(get_lib_var_settings PATH ${toset} ${libs[@]})"
+ echo "PATH=${MyPath}" > "${envfile}"
+ echo "ROOTPATH=${MyPath}" >> "${envfile}"
+ echo "MANPATH=$(get_var_from_spec ${SPECSDIR}/${toset} manpath)$(get_lib_var_settings MANPATH ${toset} ${libs[@]})" >> "${envfile}"
+ echo "INFOPATH=$(get_var_from_spec ${SPECSDIR}/${toset} infopath)$(get_lib_var_settings INFOPATH ${toset} ${libs[@]})" >> "${envfile}"
+ # the next three use the common base
+ local libBase=$(get_var_from_spec ${SPECSDIR}/${toset} ldpath)
+ echo "LDPATH=${libBase}:${libBase}/adalib$(get_lib_var_settings LDPATH ${toset} ${libs[@]})" >> "${envfile}"
+ echo "ADA_INCLUDE_PATH=${libBase}/adainclude$(get_lib_var_settings ADA_INCLUDE_PATH ${toset} ${libs[@]})" >> "${envfile}"
+ echo "ADA_OBJECTS_PATH=${libBase}/adalib$(get_lib_var_settings ADA_OBJECTS_PATH ${toset} ${libs[@]})" >> "${envfile}"
+ # ADA_PROJECT_PATH may not be set in any of the installed packages,
+ # we should only create this line if cumulative var is non-empty
+ My_ProjectPath=$(get_lib_var_settings ADA_PROJECT_PATH ${toset} ${libs[@]})
+ if [[ -n ${My_ProjectPath} ]]; then
+ echo "ADA_PROJECT_PATH=${My_ProjectPath}" >> "${envfile}"
+ fi
+}
+
diff --git a/app-eselect/eselect-gnat/files/gnat-common-1.4-r1.bash b/app-eselect/eselect-gnat/files/gnat-common-1.4-r1.bash
new file mode 100644
index 000000000000..5f3c0c8bf8b7
--- /dev/null
+++ b/app-eselect/eselect-gnat/files/gnat-common-1.4-r1.bash
@@ -0,0 +1,225 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+#
+# Author: George Shapovalov <george@gentoo.org>
+# Purpose: Contains common vars/locations and functions for use by gnat.eclass,
+# gnat.eselect and gnatbuild.eclass.
+#
+# NOTE!!!
+# This code should just define vars (try to limit these!) and simple functions.
+# No bash extensions!!
+# That is, no portage or eclass constructs are allowed!
+#
+
+
+
+# ----------------------------------
+# Globals
+
+# Environmantal stuff (for env update)
+SPECSDIR="/usr/share/gnat/eselect"
+ENVDIR="/etc/env.d"
+MARKER="55gnat-"
+
+# User configurable settings
+SETTINGSDIR="/etc/ada"
+PRIMELIST="${SETTINGSDIR}/primary_compilers"
+
+## Lib install locations
+##
+## Gnat profile dependent files go under under ${LibTop}/${Gnat_Profile}/${PN}
+## and common files go unde SpecsDir, DataDir
+#PREFIX=/usr
+## Replace %LIBDIR% below with $(get_libdir) in eclasses and ebuilds (top level Ok, inherit multilib)
+## or $(profile2libdir ${profile}) in this code, eselect module or anywhere
+## outside portage (as profile will be available only during actual execution, this only should
+## be done inside corresponding functions).
+#AdalibSpecsDir=${PREFIX}/include/ada
+#AdalibDataDir=${PREFIX}/share/ada
+#AdalibLibTop=${PREFIX}/%LIBDIR%/ada
+
+
+# ------------------------------------
+# Helpers
+#
+
+# get_all_profile_components splits gnat profile and returns pace separated list of its components:
+# x86_64-pc-linux-gnu-gnat-gcc-4.1 -> x86_64-pc-linux-gnu gcc 4.1
+# args:
+# $1 - the string to split
+get_all_profile_components() {
+ local GnatSLOT=${1##*-}
+ local remainder=${1%-*}
+ local GnatPkg=${remainder##*-}
+ remainder=${remainder%-gnat-*}
+ echo "${remainder} ${GnatPkg} ${GnatSLOT}"
+}
+
+# similar to above, returns only SLOT component:
+# x86_64-pc-linux-gnu-gnat-gcc-4.1 -> 4.1
+# args:
+# $1 - the string to extract the slot from
+get_gnat_SLOT() {
+ echo "${1##*-}"
+}
+
+# returns only Pkg component:
+# x86_64-pc-linux-gnu-gnat-gcc-4.1 -> gcc
+# args:
+# $1 - the string to extract the slot from
+get_gnat_Pkg() {
+ local remainder=${1%-*}
+ echo "${remainder##*-}"
+}
+
+# returns only Arch component:
+# x86_64-pc-linux-gnu-gnat-gcc-4.1 -> x86_64-pc-linux-gnu
+# args:
+# $1 - the string to extract the slot from
+get_gnat_Arch() {
+ echo ${1%-gnat-*}
+}
+
+
+
+## -------------------------------------------
+# gnat profile and lib detection functions
+
+
+# create a list of all gnat env.d files
+# for now use trivial implementation - store name of active profile in the
+# env file name, so it gets called 55gnat-${ARCH}-${PN}-${SLOT}
+get_env_list() {
+ for fn in ${ENVDIR}/${MARKER}*; do
+ echo $(basename ${fn})
+ done
+}
+
+
+
+# find all installed compilers and return a list
+find_all_compilers() {
+ [[ ! -d ${SPECSDIR} ]] && exit
+ for fn in ${SPECSDIR}/*; do
+ [[ ! -d ${fn} ]] && echo $(basename ${fn});
+ done
+}
+
+# find installed primary compilers and return a list
+find_primary_compilers() {
+ [[ ! -f ${PRIMELIST} ]] && exit
+ for fn in $(cat ${PRIMELIST}); do
+ [[ -f ${SPECSDIR}/${fn} ]] && echo ${fn};
+ done
+}
+
+# find installed libs and return a list
+find_all_libs() {
+ [[ ! -d ${SPECSDIR} ]] && exit
+ for fn in ${SPECSDIR}/*; do
+ [[ -d ${fn} ]] && echo $(basename ${fn});
+ done
+}
+
+# find libs that have been built for a given profile
+# Arguments:
+# $1 - gnat profile for which to detect active libs
+find_libs4profile() {
+ libs=( $(find_all_libs) )
+
+ for (( i = 0 ; i < ${#libs[@]} ; i = i + 1 )) ; do
+ [[ -f ${SPECSDIR}/${libs[$i]}/$1 ]] && echo "${libs[$i]}"
+ done
+}
+
+
+
+
+## -----------------------
+# main action - central part of do_set and helpers
+
+
+# extracts values of the passed var definition from given spec file
+# params:
+# $1: spec file (as generated by gnabuild.eclass)
+# $2: variable name
+get_var_from_spec() {
+ local var=$(grep -e "^ *$2=" $1|cut -d= -f2)
+ echo ${var}
+}
+
+
+# Cycle through given libs and form a ':' separated list of settings for the given
+# var. Repeating settings are omitted, that is unique entry is added only first
+# time it is encountered.
+#
+# params:
+# $1 - name of env var to process
+# $2 - name of gnat profile
+# $3.. - list of libs to check (to avoid its composition every time)
+# - the list is expanded to list of args at the point of call
+get_lib_var_settings() {
+ local envVar=$1
+ local toset=$2
+ #echo "get_lib_var_settings params:$@" >> /tmp/eselect-gnat.rep
+ if [[ "none" != ${3} ]]; then
+ local envString
+ local specLine=$(get_var_from_spec ${SPECSDIR}/$3/${toset} ${envVar})
+ if [[ -n ${specLine} ]]; then
+ envString="${specLine}"
+ fi
+ shift
+ #
+ while [[ -n $3 ]]; do
+ specLine=$(get_var_from_spec ${SPECSDIR}/$3/${toset} ${envVar})
+ #echo "$3:${specLine}." >> /tmp/eselect-gnat.rep
+ if [[ -n ${specLine} ]] && [[ ! ${envString} =~ ${specLine} ]]; then
+ envString="${envString}:${specLine}"
+ fi
+ shift
+ done
+ echo "${envString}"
+ fi
+}
+
+
+
+# The action!
+# Part common for do_set and do_update of gnat.eselect, also used in gnat.eclass
+# to set environment during lib build and installation
+#
+# params:
+# $1 - profile to set (toset param inside)
+# $2 - envfile
+
+generate_envFile() {
+ local toset=$1
+ local envfile=$2
+
+ local binpath="$(get_var_from_spec ${SPECSDIR}/${toset} binpath)"
+ local libexecpath="$(get_var_from_spec ${SPECSDIR}/${toset} libexecpath)"
+ local libs=( $(find_libs4profile ${toset}) )
+ #echo "generate_envFile: ${libs[@]}" >> /tmp/eselect-gnat.rep
+ if (( 0 == ${#libs[@]} )); then
+ libs="none"
+ fi
+
+ local MyPath="${binpath}:${libexecpath}:$(get_lib_var_settings PATH ${toset} ${libs[@]})"
+ echo "PATH=${MyPath}" > "${envfile}"
+ echo "ROOTPATH=${MyPath}" >> "${envfile}"
+ echo "MANPATH=$(get_var_from_spec ${SPECSDIR}/${toset} manpath):$(get_lib_var_settings MANPATH ${toset} ${libs[@]})" >> "${envfile}"
+ echo "INFOPATH=$(get_var_from_spec ${SPECSDIR}/${toset} infopath):$(get_lib_var_settings INFOPATH ${toset} ${libs[@]})" >> "${envfile}"
+ # the next three use the common base
+ local libBase=$(get_var_from_spec ${SPECSDIR}/${toset} ldpath)
+ echo "LDPATH=${libBase}:${libBase}/adalib:$(get_lib_var_settings LDPATH ${toset} ${libs[@]})" >> "${envfile}"
+ echo "ADA_INCLUDE_PATH=${libBase}/adainclude:$(get_lib_var_settings ADA_INCLUDE_PATH ${toset} ${libs[@]})" >> "${envfile}"
+ echo "ADA_OBJECTS_PATH=${libBase}/adalib:$(get_lib_var_settings ADA_OBJECTS_PATH ${toset} ${libs[@]})" >> "${envfile}"
+ # ADA_PROJECT_PATH may not be set in any of the installed packages,
+ # we should only create this line if cumulative var is non-empty
+ My_ProjectPath=$(get_lib_var_settings ADA_PROJECT_PATH ${toset} ${libs[@]})
+ if [[ -n ${My_ProjectPath} ]]; then
+ echo "ADA_PROJECT_PATH=${My_ProjectPath}" >> "${envfile}"
+ fi
+}
+
diff --git a/app-eselect/eselect-gnat/files/gnat-common-1.5.bash b/app-eselect/eselect-gnat/files/gnat-common-1.5.bash
new file mode 100644
index 000000000000..05af905579ae
--- /dev/null
+++ b/app-eselect/eselect-gnat/files/gnat-common-1.5.bash
@@ -0,0 +1,225 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+#
+# Author: George Shapovalov <george@gentoo.org>
+# Purpose: Contains common vars/locations and functions for use by gnat.eclass,
+# gnat.eselect and gnatbuild.eclass.
+#
+# NOTE!!!
+# This code should just define vars (try to limit these!) and simple functions.
+# No bash extensions!!
+# That is, no portage or eclass constructs are allowed!
+#
+
+
+
+# ----------------------------------
+# Globals
+
+# Environmantal stuff (for env update)
+SPECSDIR="/usr/share/gnat/eselect"
+ENVDIR="/etc/env.d"
+MARKER="55gnat-"
+
+# User configurable settings
+SETTINGSDIR="/etc/ada"
+PRIMELIST="${SETTINGSDIR}/primary_compilers"
+
+## Lib install locations
+##
+## Gnat profile dependent files go under under ${LibTop}/${Gnat_Profile}/${PN}
+## and common files go unde SpecsDir, DataDir
+#PREFIX=/usr
+## Replace %LIBDIR% below with $(get_libdir) in eclasses and ebuilds (top level Ok, inherit multilib)
+## or $(profile2libdir ${profile}) in this code, eselect module or anywhere
+## outside portage (as profile will be available only during actual execution, this only should
+## be done inside corresponding functions).
+#AdalibSpecsDir=${PREFIX}/include/ada
+#AdalibDataDir=${PREFIX}/share/ada
+#AdalibLibTop=${PREFIX}/%LIBDIR%/ada
+
+
+# ------------------------------------
+# Helpers
+#
+
+# get_all_profile_components splits gnat profile and returns pace separated list of its components:
+# x86_64-pc-linux-gnu-gnat-gcc-4.1 -> x86_64-pc-linux-gnu gcc 4.1
+# args:
+# $1 - the string to split
+get_all_profile_components() {
+ local GnatSLOT=${1##*-}
+ local remainder=${1%-*}
+ local GnatPkg=${remainder##*-}
+ remainder=${remainder%-gnat-*}
+ echo "${remainder} ${GnatPkg} ${GnatSLOT}"
+}
+
+# similar to above, returns only SLOT component:
+# x86_64-pc-linux-gnu-gnat-gcc-4.1 -> 4.1
+# args:
+# $1 - the string to extract the slot from
+get_gnat_SLOT() {
+ echo "${1##*-}"
+}
+
+# returns only Pkg component:
+# x86_64-pc-linux-gnu-gnat-gcc-4.1 -> gcc
+# args:
+# $1 - the string to extract the slot from
+get_gnat_Pkg() {
+ local remainder=${1%-*}
+ echo "${remainder##*-}"
+}
+
+# returns only Arch component:
+# x86_64-pc-linux-gnu-gnat-gcc-4.1 -> x86_64-pc-linux-gnu
+# args:
+# $1 - the string to extract the slot from
+get_gnat_Arch() {
+ echo ${1%-gnat-*}
+}
+
+
+
+## -------------------------------------------
+# gnat profile and lib detection functions
+
+
+# create a list of all gnat env.d files
+# for now use trivial implementation - store name of active profile in the
+# env file name, so it gets called 55gnat-${ARCH}-${PN}-${SLOT}
+get_env_list() {
+ for fn in ${ENVDIR}/${MARKER}*; do
+ echo $(basename ${fn})
+ done
+}
+
+
+
+# find all installed compilers and return a list
+find_all_compilers() {
+ [[ ! -d ${SPECSDIR} ]] && exit
+ for fn in ${SPECSDIR}/*; do
+ [[ ! -d ${fn} ]] && echo $(basename ${fn});
+ done
+}
+
+# find installed primary compilers and return a list
+find_primary_compilers() {
+ [[ ! -f ${PRIMELIST} ]] && exit
+ for fn in $(cat ${PRIMELIST}); do
+ [[ -f ${SPECSDIR}/${fn} ]] && echo ${fn};
+ done
+}
+
+# find installed libs and return a list
+find_all_libs() {
+ [[ ! -d ${SPECSDIR} ]] && exit
+ for fn in ${SPECSDIR}/*; do
+ [[ -d ${fn} ]] && echo $(basename ${fn});
+ done
+}
+
+# find libs that have been built for a given profile
+# Arguments:
+# $1 - gnat profile for which to detect active libs
+find_libs4profile() {
+ libs=( $(find_all_libs) )
+
+ for (( i = 0 ; i < ${#libs[@]} ; i = i + 1 )) ; do
+ [[ -f ${SPECSDIR}/${libs[$i]}/$1 ]] && echo "${libs[$i]}"
+ done
+}
+
+
+
+
+## -----------------------
+# main action - central part of do_set and helpers
+
+
+# extracts values of the passed var definition from given spec file
+# params:
+# $1: spec file (as generated by gnabuild.eclass)
+# $2: variable name
+get_var_from_spec() {
+ local var=$(grep -e "^ *$2=" $1|cut -d= -f2)
+ echo ${var}
+}
+
+
+# Cycle through given libs and form a ':' separated list of settings for the given
+# var. Repeating settings are omitted, that is unique entry is added only first
+# time it is encountered.
+#
+# params:
+# $1 - name of env var to process
+# $2 - name of gnat profile
+# $3.. - list of libs to check (to avoid its composition every time)
+# - the list is expanded to list of args at the point of call
+get_lib_var_settings() {
+ local envVar=$1
+ local toset=$2
+ #echo "get_lib_var_settings params:$@" >> /tmp/eselect-gnat.rep
+ if [[ "none" != ${3} ]]; then
+ local envString
+ local specLine=$(get_var_from_spec ${SPECSDIR}/$3/${toset} ${envVar})
+ if [[ -n ${specLine} ]]; then
+ envString="${specLine}"
+ fi
+ shift
+ #
+ while [[ -n $3 ]]; do
+ specLine=$(get_var_from_spec ${SPECSDIR}/$3/${toset} ${envVar})
+ #echo "$3:${specLine}." >> /tmp/eselect-gnat.rep
+ if [[ -n ${specLine} ]] && [[ ! ${envString} =~ ${specLine} ]]; then
+ envString="${envString}:${specLine}"
+ fi
+ shift
+ done
+ echo "${envString}"
+ fi
+}
+
+
+
+# The action!
+# Part common for do_set and do_update of gnat.eselect, also used in gnat.eclass
+# to set environment during lib build and installation
+#
+# params:
+# $1 - profile to set (toset param inside)
+# $2 - envfile
+
+generate_envFile() {
+ local toset=$1
+ local envfile=$2
+
+ local binpath="$(get_var_from_spec ${SPECSDIR}/${toset} binpath)"
+ local libexecpath="$(get_var_from_spec ${SPECSDIR}/${toset} libexecpath)"
+ local libs=( $(find_libs4profile ${toset}) )
+ #echo "generate_envFile: ${libs[@]}" >> /tmp/eselect-gnat.rep
+ if (( 0 == ${#libs[@]} )); then
+ libs="none"
+ fi
+
+ local MyPath="${binpath}:${libexecpath}:$(get_lib_var_settings PATH ${toset} ${libs[@]})"
+ echo "PATH=${MyPath}" > "${envfile}"
+ echo "ROOTPATH=${MyPath}" >> "${envfile}"
+ echo "MANPATH=$(get_var_from_spec ${SPECSDIR}/${toset} manpath):$(get_lib_var_settings MANPATH ${toset} ${libs[@]})" >> "${envfile}"
+ echo "INFOPATH=$(get_var_from_spec ${SPECSDIR}/${toset} infopath):$(get_lib_var_settings INFOPATH ${toset} ${libs[@]})" >> "${envfile}"
+ # the next three use the common base
+ local libBase=$(get_var_from_spec ${SPECSDIR}/${toset} ldpath)
+ echo "LDPATH=${libBase}:${libBase}/adalib:$(get_lib_var_settings LDPATH ${toset} ${libs[@]})" >> "${envfile}"
+ echo "ADA_INCLUDE_PATH=${libBase}/adainclude:$(get_lib_var_settings ADA_INCLUDE_PATH ${toset} ${libs[@]})" >> "${envfile}"
+ echo "ADA_OBJECTS_PATH=${libBase}/adalib:$(get_lib_var_settings ADA_OBJECTS_PATH ${toset} ${libs[@]})" >> "${envfile}"
+ # ADA_PROJECT_PATH may not be set in any of the installed packages,
+ # we should only create this line if cumulative var is non-empty
+ My_ProjectPath=$(get_lib_var_settings ADA_PROJECT_PATH ${toset} ${libs[@]})
+ if [[ -n ${My_ProjectPath} ]]; then
+ echo "ADA_PROJECT_PATH=${My_ProjectPath}" >> "${envfile}"
+ fi
+}
+
diff --git a/app-eselect/eselect-gnat/files/gnat.eselect-1.3 b/app-eselect/eselect-gnat/files/gnat.eselect-1.3
new file mode 100644
index 000000000000..548926524747
--- /dev/null
+++ b/app-eselect/eselect-gnat/files/gnat.eselect-1.3
@@ -0,0 +1,206 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+DESCRIPTION="Manage the installed gnat compilers"
+MAINTAINER="ada@gentoo.org"
+SVN_DATE='$Date: 2015/03/31 16:48:57 $'
+VERSION=$(svn_date_to_version "${SVN_DATE}" )
+
+# "inheriting" common stuff
+# this crude sourcing has to stay the way it is, as common code
+# cannot be part of some eclass (bug #192505)
+. /usr/share/gnat/lib/gnat-common.bash
+
+
+### Phylosophy
+# Each gnat installs a "specs" file named ${ARCH}-${PN}-${SLOT} under ${SPECSDIR}
+# Each lib creates a dir with its name under ${SPECSDIR} and populates it with
+# similar specs files (same name scheme)
+# Recognizing gnat specs from lib specs is then eazy - test entry for being a
+# dir, then just check what gnat profiles are installed for each lib..
+# doset then creates env file that combines settings for gnat and for the
+# corresponding profile of each installed lib..
+
+
+### Helpers
+
+# return *the* name of the active profile, checking that we do not have multiple
+# env files.
+# There can be only one!
+get_current_gnat() {
+ local profiles=( $(get_env_list) )
+
+ if [ ${profiles[@]} == "${MARKER}*" ]; then exit; fi
+
+ if (( 1 == ${#profiles[@]} )); then
+ local active=${profiles[0]#${MARKER}}
+ else
+ die -q "${ENVDIR} contains multiple gnat profiles, please cleanup!"
+ fi
+
+ if [ -f ${SPECSDIR}/${active} ]; then
+ echo ${active}
+ else
+ die -q "the active env.d profile does not correspond to any installed gnat!"
+ fi
+}
+
+# check if the passed arg represents the installed gnat and return it or
+# not_found
+# takes args:
+# $1 - list ID to check
+get_name_from_list() {
+ compiler=$1
+
+ compilers=( $(find_all_compilers) )
+ for (( i = 0 ; i < ${#compilers[@]} ; i = i + 1 )) ; do
+ if [[ ${compilers[$i]} == ${compiler} ]] ; then
+ echo ${compiler}
+ return
+ fi
+ done
+
+ echo "(not-found)"
+}
+
+
+# removes env files (for compiler and libs)
+# params:
+# $1: the name of profile for which to remove env file
+unset_env() {
+ rm -f ${ENVDIR}/${MARKER}$1 &> /dev/null
+}
+
+
+### show action ###
+
+describe_show() {
+ echo "Show the active gnat compiler/profile and installed libs"
+}
+
+do_show() {
+ write_list_start "Current gnat version:"
+ active=$(get_current_gnat)
+ if [ ! -z ${active} ] ; then # not sure why [ -n ] does not do the same
+ write_kv_list_entry "$active" ""
+ libs=( $(find_libs4profile ${active}) )
+ write_list_start "Active libs:"
+ write_numbered_list "${libs[@]}"
+ else
+ write_kv_list_entry "(none set)" ""
+ fi
+}
+
+### list action ###
+
+describe_list() {
+ echo "List installed gnat compilers and libs"
+}
+
+do_list() {
+ compilers=( $(find_all_compilers ) )
+ active=$(get_current_gnat)
+
+ write_list_start "Available gnat compilers:"
+
+ if [[ -n ${compilers[@]} ]] ; then
+ local i
+ for (( i = 0 ; i < ${#compilers[@]} ; i = i + 1 )) ; do
+ linkversion=${compilers[${i}]}
+
+ [[ $linkversion == $active ]] && \
+ compilers[${i}]="${compilers[${i}]} $(highlight '*' )"
+ done
+ write_numbered_list "${compilers[@]}"
+
+ # now the libs
+ libs=( $(find_all_libs) )
+ write_list_start "Installed libs:"
+ for (( i = 0 ; i < ${#libs[@]} ; i = i + 1 )) ; do
+ [ -f ${SPECSDIR}/${libs[$i]}/${active} ] && \
+ libs[${i}]="${libs[${i}]} $(highlight '*' )"
+ done
+ write_numbered_list "${libs[@]}"
+ else
+ write_kv_list_entry "(none found)" ""
+ fi
+}
+
+
+### set action ###
+
+describe_set() {
+ echo "Set active gnat compiler"
+}
+
+# The set action. Parameters:
+# $1 - name of profile to set, obligatory, passed by eselect
+# $2 - optional, name of env file to generate. Used from gnat.eclass.
+do_set() {
+ if [[ -z ${1} ]] ; then
+ # no parameter
+ die -q "You didn't tell me which gnat to use"
+ fi
+
+ local toset=$(get_name_from_list $1)
+ if [[ ${toset} == "(not-found)" ]] ; then
+ die -q "I don't recognise the selection"
+ fi
+
+ # the action!
+ # in this implementation simply create an appropriate env file
+ local active=$(get_current_gnat)
+ if [[ -z ${2} ]] ; then
+ local envfile="${ENVDIR}/${MARKER}${toset}"
+
+ # now we need to remove an old env file, which is guaranteed to
+ # be unique by get_current_gnat above
+ if [[ -n ${active} ]] ; then
+ unset_env ${active}
+ fi
+ # just for a good measure remove the one we are going to write
+ unset_env ${toset}
+ else
+ local envfile="$2"
+ fi
+
+ generate_envFile ${toset} ${envfile}
+
+ # force update environment
+ # should be replaced with "do_action env update" when #172472 gets resolved
+ env-update &> /dev/null
+}
+
+
+
+### update action ###
+#
+# This action regenerates the /etc/env.d file for the current profile. Basically
+# the same as set, only it does not take any parameters. It should be called from ebuilds
+# installing Ada libs
+
+describe_update() {
+ echo "Update active gnat profile picking up new libs."
+}
+
+do_update() {
+ local toset=$(get_current_gnat)
+ local envfile="${ENVDIR}/${MARKER}${toset}"
+ generate_envFile ${toset} ${envfile}
+ do_action env update &> /dev/null
+}
+
+### unset action ###
+
+describe_unset() {
+ echo "Remove settings for currently active gnat"
+}
+
+do_unset() {
+ local active=$(get_current_gnat)
+ # check whether we have any profile set before removing anything..
+ if [[ -n ${active} ]] ; then
+ unset_env ${active}
+ do_action env update &> /dev/null
+ fi
+}
diff --git a/app-eselect/eselect-gnat/files/gnat.eselect-1.4 b/app-eselect/eselect-gnat/files/gnat.eselect-1.4
new file mode 100644
index 000000000000..f2a72092c53a
--- /dev/null
+++ b/app-eselect/eselect-gnat/files/gnat.eselect-1.4
@@ -0,0 +1,229 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+DESCRIPTION="Manage the installed gnat compilers"
+MAINTAINER="ada@gentoo.org"
+SVN_DATE='$Date: 2015/03/31 16:48:57 $'
+VERSION=$(svn_date_to_version "${SVN_DATE}" )
+
+# "inheriting" common stuff
+# this crude sourcing has to stay the way it is, as common code
+# cannot be part of some eclass (bug #192505)
+. /usr/share/gnat/lib/gnat-common.bash
+
+
+### Phylosophy
+# Each gnat installs a "specs" file named ${ARCH}-${PN}-${SLOT} under ${SPECSDIR}
+# Each lib creates a dir with its name under ${SPECSDIR} and populates it with
+# similar specs files (same name scheme)
+# Recognizing gnat specs from lib specs is then eazy - test entry for being a
+# dir, then just check what gnat profiles are installed for each lib..
+# doset then creates env file that combines settings for gnat and for the
+# corresponding profile of each installed lib..
+
+
+### Helpers
+
+# return *the* name of the active profile, checking that we do not have multiple
+# env files.
+# There can be only one!
+get_current_gnat() {
+ local profiles=( $(get_env_list) )
+
+ if [ ${profiles[@]} == "${MARKER}*" ]; then exit; fi
+
+ if (( 1 == ${#profiles[@]} )); then
+ local active=${profiles[0]#${MARKER}}
+ else
+ die -q "${ENVDIR} contains multiple gnat profiles, please cleanup!"
+ fi
+
+ echo ${active}
+# disabling this check, as we want to use get_current_gnat with empty profile
+# as an indication that last gnat in SLOT was removed
+# if [ -f ${SPECSDIR}/${active} ]; then
+# echo ${active}
+# else
+# die -q "the active env.d profile does not correspond to any installed gnat!"
+# fi
+}
+
+# validity check that was removed from get_current_gnat, in case we need it
+# somewhere..
+# Arguments:
+# $1 - name of the gnat profiel to check
+profile_is_valid() {
+ if [[ -n $1 ]] ; then
+ [[ -f ${SPECSDIR}/$1 ]] || return 1
+ fi
+}
+
+# check if the passed arg represents the installed gnat and return it or
+# not_found
+# takes args:
+# $1 - list ID to check
+get_name_from_list() {
+ compiler=$1
+
+ compilers=( $(find_all_compilers) )
+ for (( i = 0 ; i < ${#compilers[@]} ; i = i + 1 )) ; do
+ if [[ ${compilers[$i]} == ${compiler} ]] ; then
+ echo ${compiler}
+ return
+ fi
+ done
+
+ echo "(not-found)"
+}
+
+
+# removes env files (for compiler and libs)
+# params:
+# $1: the name of profile for which to remove env file
+unset_env() {
+ rm -f ${ENVDIR}/${MARKER}$1 &> /dev/null
+}
+
+
+### show action ###
+
+describe_show() {
+ echo "Show the active gnat compiler/profile and installed libs"
+}
+
+do_show() {
+ active=$(get_current_gnat)
+ if $(profile_is_valid ${active}); then
+ write_list_start "Current gnat version:"
+ if [[ -n ${active} ]] ; then
+ write_kv_list_entry "$active" ""
+ libs=( $(find_libs4profile ${active}) )
+ write_list_start "Active libs:"
+ write_numbered_list "${libs[@]}"
+ else
+ write_kv_list_entry "(none set)" ""
+ fi
+ else
+ write_error_msg "The active profile in ${ENVDIR} is not valid! Please set a valid profile!"
+ fi
+}
+
+### list action ###
+
+describe_list() {
+ echo "List installed gnat compilers and libs"
+}
+
+do_list() {
+ compilers=( $(find_all_compilers ) )
+ active=$(get_current_gnat)
+
+ write_list_start "Available gnat compilers:"
+
+ if [[ -n ${compilers[@]} ]] ; then
+ local i
+ for (( i = 0 ; i < ${#compilers[@]} ; i = i + 1 )) ; do
+ linkversion=${compilers[${i}]}
+
+ [[ $linkversion == $active ]] && \
+ compilers[${i}]="${compilers[${i}]} $(highlight '*' )"
+ done
+ write_numbered_list "${compilers[@]}"
+
+ # now the libs
+ libs=( $(find_all_libs) )
+ write_list_start "Installed libs:"
+ for (( i = 0 ; i < ${#libs[@]} ; i = i + 1 )) ; do
+ [ -f ${SPECSDIR}/${libs[$i]}/${active} ] && \
+ libs[${i}]="${libs[${i}]} $(highlight '*' )"
+ done
+ write_numbered_list "${libs[@]}"
+ else
+ write_kv_list_entry "(none found)" ""
+ fi
+}
+
+
+### set action ###
+
+describe_set() {
+ echo "Set active gnat compiler"
+}
+
+# The set action. Parameters:
+# $1 - name of profile to set, obligatory, passed by eselect
+# $2 - optional, name of env file to generate. Used from gnat.eclass.
+do_set() {
+ if [[ -z ${1} ]] ; then
+ # no parameter
+ die -q "You didn't tell me which gnat to use"
+ fi
+
+ local toset=$(get_name_from_list $1)
+ if [[ ${toset} == "(not-found)" ]] ; then
+ die -q "I don't recognise the selection"
+ fi
+
+ # the action!
+ # in this implementation simply create an appropriate env file
+ local active=$(get_current_gnat)
+ if [[ -z ${2} ]] ; then
+ local envfile="${ENVDIR}/${MARKER}${toset}"
+
+ # now we need to remove an old env file, which is guaranteed to
+ # be unique by get_current_gnat above
+ if [[ -n ${active} ]] ; then
+ unset_env ${active}
+ fi
+ # just for a good measure remove the one we are going to write
+ unset_env ${toset}
+ else
+ local envfile="$2"
+ fi
+
+ generate_envFile ${toset} ${envfile}
+
+ # force update environment
+ # should be replaced with "do_action env update" when #172472 gets resolved
+ env-update &> /dev/null
+}
+
+
+
+### update action ###
+#
+# This action regenerates the /etc/env.d file for the current profile. Basically
+# the same as set, only it does not take any parameters. It should be called from ebuilds
+# installing Ada libs or in the pkg_postrm in gnatbuild.eclass, to clean up the
+# profile if last gnat in SLOT was removed.
+
+describe_update() {
+ echo "Update active gnat profile picking up new libs."
+}
+
+do_update() {
+ local toset=$(get_current_gnat)
+ local envfile="${ENVDIR}/${MARKER}${toset}"
+ # now check whether to update or unset the profile
+ if $(profile_is_valid ${toset}); then
+ generate_envFile ${toset} ${envfile}
+ else
+ unset_env ${toset}
+ fi
+ do_action env update &> /dev/null
+}
+
+### unset action ###
+
+describe_unset() {
+ echo "Remove settings for currently active gnat"
+}
+
+do_unset() {
+ local active=$(get_current_gnat)
+ # check whether we have any profile set before removing anything..
+ if [[ -n ${active} ]] ; then
+ unset_env ${active}
+ do_action env update &> /dev/null
+ fi
+}
diff --git a/app-eselect/eselect-gnat/files/gnat.eselect-1.5 b/app-eselect/eselect-gnat/files/gnat.eselect-1.5
new file mode 100644
index 000000000000..fa312feccbbe
--- /dev/null
+++ b/app-eselect/eselect-gnat/files/gnat.eselect-1.5
@@ -0,0 +1,225 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+DESCRIPTION="Manage the installed gnat compilers"
+MAINTAINER="ada@gentoo.org"
+SVN_DATE='$Date: 2015/03/31 16:48:57 $'
+VERSION=$(svn_date_to_version "${SVN_DATE}" )
+
+# "inheriting" common stuff
+# this crude sourcing has to stay the way it is, as common code
+# cannot be part of some eclass (bug #192505)
+. /usr/share/gnat/lib/gnat-common.bash
+
+
+### Phylosophy
+# Each gnat installs a "specs" file named ${ARCH}-${PN}-${SLOT} under ${SPECSDIR}
+# Each lib creates a dir with its name under ${SPECSDIR} and populates it with
+# similar specs files (same name scheme)
+# Recognizing gnat specs from lib specs is then eazy - test entry for being a
+# dir, then just check what gnat profiles are installed for each lib..
+# doset then creates env file that combines settings for gnat and for the
+# corresponding profile of each installed lib..
+
+
+### Helpers
+
+# return *the* name of the active profile, checking that we do not have multiple
+# env files.
+# There can be only one!
+get_current_gnat() {
+ local profiles=( $(get_env_list) )
+
+ if [ ${profiles[@]} == "${MARKER}*" ]; then exit; fi
+
+ if (( 1 == ${#profiles[@]} )); then
+ local active=${profiles[0]#${MARKER}}
+ else
+ die -q "${ENVDIR} contains multiple gnat profiles, please cleanup!"
+ fi
+
+ echo ${active}
+# disabling this check, as we want to use get_current_gnat with empty profile
+# as an indication that last gnat in SLOT was removed
+# if [ -f ${SPECSDIR}/${active} ]; then
+# echo ${active}
+# else
+# die -q "the active env.d profile does not correspond to any installed gnat!"
+# fi
+}
+
+# validity check that was removed from get_current_gnat, in case we need it
+# somewhere..
+# Arguments:
+# $1 - name of the gnat profiel to check
+profile_is_valid() {
+ if [[ -n $1 ]] ; then
+ [[ -f ${SPECSDIR}/$1 ]] || return 1
+ fi
+}
+
+# check if the passed arg represents the installed gnat and return it or
+# not_found
+# takes args:
+# $1 - list ID to check
+get_name_from_list() {
+ compiler=$1
+
+ compilers=( $(find_all_compilers) )
+ for (( i = 0 ; i < ${#compilers[@]} ; i = i + 1 )) ; do
+ if [[ ${compilers[$i]} == ${compiler} ]] ; then
+ echo ${compiler}
+ return
+ fi
+ done
+
+ echo "(not-found)"
+}
+
+
+# removes env files (for compiler and libs)
+# params:
+# $1: the name of profile for which to remove env file
+unset_env() {
+ rm -f ${ENVDIR}/${MARKER}$1 &> /dev/null
+}
+
+
+### show action ###
+
+describe_show() {
+ echo "Show the active gnat compiler/profile and installed libs"
+}
+
+do_show() {
+ active=$(get_current_gnat)
+ if $(profile_is_valid ${active}); then
+ write_list_start "Current gnat version:"
+ if [[ -n ${active} ]] ; then
+ write_kv_list_entry "$active" ""
+ libs=( $(find_libs4profile ${active}) )
+ write_list_start "Active libs:"
+ write_numbered_list "${libs[@]}"
+ else
+ write_kv_list_entry "(none set)" ""
+ fi
+ else
+ write_error_msg "The active profile in ${ENVDIR} is not valid! Please set a valid profile!"
+ fi
+}
+
+### list action ###
+
+describe_list() {
+ echo "List installed gnat compilers and libs"
+}
+
+do_list() {
+ compilers=( $(find_all_compilers ) )
+ active=$(get_current_gnat)
+
+ write_list_start "Available gnat compilers:"
+
+ local i
+ for (( i = 0 ; i < ${#compilers[@]} ; i = i + 1 )) ; do
+ linkversion=${compilers[${i}]}
+
+ [[ $linkversion == $active ]] && \
+ compilers[${i}]=$(highlight_marker "${compilers[${i}]}")
+ done
+ write_numbered_list -m "(none)" "${compilers[@]}"
+
+ # now the libs
+ libs=( $(find_all_libs) )
+ write_list_start "Installed libs:"
+ for (( i = 0 ; i < ${#libs[@]} ; i = i + 1 )) ; do
+ [ -f ${SPECSDIR}/${libs[$i]}/${active} ] && \
+ libs[${i}]=$(highlight_marker "${libs[${i}]}")
+ done
+ write_numbered_list -m "(no libs)" "${libs[@]}"
+}
+
+
+### set action ###
+
+describe_set() {
+ echo "Set active gnat compiler"
+}
+
+# The set action. Parameters:
+# $1 - name of profile to set, obligatory, passed by eselect
+# $2 - optional, name of env file to generate. Used from gnat.eclass.
+do_set() {
+ if [[ -z ${1} ]] ; then
+ # no parameter
+ die -q "You didn't tell me which gnat to use"
+ fi
+
+ local toset=$(get_name_from_list $1)
+ if [[ ${toset} == "(not-found)" ]] ; then
+ die -q "I don't recognise the selection"
+ fi
+
+ # the action!
+ # in this implementation simply create an appropriate env file
+ local active=$(get_current_gnat)
+ if [[ -z ${2} ]] ; then
+ local envfile="${ENVDIR}/${MARKER}${toset}"
+
+ # now we need to remove an old env file, which is guaranteed to
+ # be unique by get_current_gnat above
+ if [[ -n ${active} ]] ; then
+ unset_env ${active}
+ fi
+ # just for a good measure remove the one we are going to write
+ unset_env ${toset}
+ else
+ local envfile="$2"
+ fi
+
+ generate_envFile ${toset} ${envfile}
+
+ # force update environment
+ # should be replaced with "do_action env update" when #172472 gets resolved
+ env-update &> /dev/null
+}
+
+
+
+### update action ###
+#
+# This action regenerates the /etc/env.d file for the current profile. Basically
+# the same as set, only it does not take any parameters. It should be called from ebuilds
+# installing Ada libs or in the pkg_postrm in gnatbuild.eclass, to clean up the
+# profile if last gnat in SLOT was removed.
+
+describe_update() {
+ echo "Update active gnat profile picking up new libs."
+}
+
+do_update() {
+ local toset=$(get_current_gnat)
+ local envfile="${ENVDIR}/${MARKER}${toset}"
+ # now check whether to update or unset the profile
+ if $(profile_is_valid ${toset}); then
+ generate_envFile ${toset} ${envfile}
+ else
+ unset_env ${toset}
+ fi
+ do_action env update &> /dev/null
+}
+
+### unset action ###
+
+describe_unset() {
+ echo "Remove settings for currently active gnat"
+}
+
+do_unset() {
+ local active=$(get_current_gnat)
+ # check whether we have any profile set before removing anything..
+ if [[ -n ${active} ]] ; then
+ unset_env ${active}
+ do_action env update &> /dev/null
+ fi
+}
diff --git a/app-eselect/eselect-gnat/metadata.xml b/app-eselect/eselect-gnat/metadata.xml
new file mode 100644
index 000000000000..70aa7cdf2d3f
--- /dev/null
+++ b/app-eselect/eselect-gnat/metadata.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<!--maintainer-needed-->
+<longdescription>The eselect module for the supported gnat compilers.</longdescription>
+</pkgmetadata>