summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2024-10-01 02:45:16 +0100
committerSam James <sam@gentoo.org>2024-10-01 02:45:45 +0100
commit7a6f738a6e505b65bf7d9032810adccc419e9467 (patch)
treeb1b71c28d080c2ee20a55c7406865827008e827b
parentdev-lang/ada-bootstrap: fix deps (diff)
downloadgentoo-7a6f738a6e505b65bf7d9032810adccc419e9467.tar.gz
gentoo-7a6f738a6e505b65bf7d9032810adccc419e9467.tar.bz2
gentoo-7a6f738a6e505b65bf7d9032810adccc419e9467.zip
toolchain.eclass: further adaptations to dev-lang/ada-bootstrap
This needs prettifying, which I'll do shortly. Signed-off-by: Sam James <sam@gentoo.org>
-rw-r--r--eclass/toolchain.eclass42
1 files changed, 31 insertions, 11 deletions
diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index 648e67b9493b..f52ff0e6bb60 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -840,6 +840,7 @@ toolchain_setup_ada() {
local ada_bootstrap
local ada_candidate
+ local ada_bootstrap_type
# GNAT can usually be built using the last major version and
# the current version, at least.
#
@@ -852,6 +853,7 @@ toolchain_setup_ada() {
ebegin "Testing sys-devel/gcc:${ada_candidate} for Ada"
if has_version -b "sys-devel/gcc:${ada_candidate}[ada(-)]" ; then
ada_bootstrap=${ada_candidate}
+ ada_bootstrap_type=gcc
eend 0
break
@@ -863,16 +865,15 @@ toolchain_setup_ada() {
if ver_test ${ada_bootstrap} -gt ${PV} || [[ -z ${ada_bootstrap} ]] ; then
ebegin "Testing fallback dev-lang/ada-bootstrap for Ada"
if has_version -b "<dev-lang/ada-bootstrap-${SLOT}" ; then
- local latest_ada_bootstrap=$(best_version -b "<dev-lang/ada-bootstrap-${SLOT}")
- latest_ada_bootstrap="${latest_ada_bootstrap#dev-lang/ada-bootstrap-}"
- latest_ada_bootstrap=$(ver_cut 1 ${latest_ada_bootstrap})
- ada_bootstrap=${latest_ada_bootstrap}
-
# TODO: Figure out ada-bootstrap versioning/slots
- export PATH="${BROOT}/usr/lib/ada-bootstrap/bin:${PATH}"
+
+ #local latest_ada_bootstrap=$(best_version -b "<dev-lang/ada-bootstrap-${SLOT}")
+ #latest_ada_bootstrap="${latest_ada_bootstrap#dev-lang/ada-bootstrap-}"
+ #latest_ada_bootstrap=$(ver_cut 1 ${latest_ada_bootstrap})
+ ada_bootstrap="10"
+ ada_bootstrap_type=ada-bootstrap
eend 0
- break
else
eend 1
fi
@@ -883,6 +884,7 @@ toolchain_setup_ada() {
ebegin "Testing fallback dev-lang/gnat-gpl for Ada"
if has_version -b "dev-lang/gnat-gpl" ; then
ada_bootstrap=10
+ ada_bootstrap=gcc
eend 0
else
eend 1
@@ -910,7 +912,7 @@ toolchain_setup_ada() {
@ada:
%{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}} \
%{!S:%{!c:%e-c or -S required for Ada}} \
- ${BROOT}/usr/libexec/gcc/${CBUILD}/${ada_bootstrap}/gnat1 %{I*} %{k8:-gnatk8} %{!Q:-quiet} \
+ ${gnat1_path} %{I*} %{k8:-gnatk8} %{!Q:-quiet} \
%{nostdinc*} %{nostdlib*} \
%{fcompare-debug-second:-gnatd_A} \
%{O*} %{W*} %{w} %{p} %{pg:-p} \
@@ -943,11 +945,19 @@ toolchain_setup_ada() {
%{gnatc*|gnats*: -o %j} %{-param*}
EOF
+ # XXX: Hack for now
+ if [[ ${ada_bootstrap_type} == ada-bootstrap ]] ; then
+ sed -i \
+ -e "s:\${gnat1_path}:${BROOT}/usr/lib/ada-bootstrap/libexec/gcc/x86_64-pc-linux-gnu/10/gnat1:" \
+ "${T}"/ada.spec || die
+ fi
+
# Easier to substitute these values in rather than escape
# lots of bits above in heredoc.
sed -i \
-e "s:\${BROOT}:${BROOT}:" \
-e "s:\${CBUILD}:${CBUILD}:" \
+ -e "s:\${gnat1_path}:${BROOT}/usr/libexec/gcc/${CBUILD}/${ada_bootstrap}/gnat1:" \
-e "s:\${ada_bootstrap}:${ada_bootstrap}:" \
"${T}"/ada.spec || die
@@ -955,7 +965,13 @@ toolchain_setup_ada() {
# won't work for us as the stage1 compiler doesn't necessarily
# have Ada support. Substitute the Ada compiler we found earlier.
local adalib
- adalib=$(${CBUILD}-gcc-${ada_bootstrap} -print-libgcc-file-name || die "Finding adalib dir failed")
+ if [[ ${ada_bootstrap_type} == ada-bootstrap ]] ; then
+ old_path="${PATH}"
+ export PATH="${BROOT}/usr/lib/ada-bootstrap/bin:${PATH}"
+ adalib=$(${BROOT}/usr/lib/ada-bootstrap/bin/${CBUILD}-gcc -print-libgcc-file-name || die "Finding adalib dir failed")
+ else
+ adalib=$(${CBUILD}-gcc-${ada_bootstrap} -print-libgcc-file-name || die "Finding adalib dir failed")
+ fi
adalib="${adalib%/*}/adalib"
sed -i \
-e "s:adalib=.*:adalib=${adalib}:" \
@@ -966,16 +982,20 @@ toolchain_setup_ada() {
mkdir "${T}"/ada-wrappers || die
local tool
for tool in gnat{,bind,chop,clean,kr,link,ls,make,name,prep} ; do
+ if [[ ${ada_bootstrap_type} == ada-bootstrap ]] ; then
+ ln -s "${BROOT}"/usr/lib/ada-bootstrap/bin/${tool} "${T}"/ada-wrappers/${CBUILD}-${tool}-${ada_bootstrap} || die
+ fi
+
cat <<-EOF > "${T}"/ada-wrappers/${tool} || die
#!/bin/sh
exec $(type -P ${CBUILD}-${tool}-${ada_bootstrap}) -specs=${T}/ada.spec "\$@"
EOF
chmod +x "${T}"/ada-wrappers/${tool} || die
- export "${tool^^}"=${CBUILD}-${tool}-${ada_bootstrap}
+ export "${tool^^}"="${T}"/ada-wrappers/${tool}
done
- export PATH="${T}/ada-wrappers:${PATH}"
+ export PATH="${T}/ada-wrappers:${old_path}"
export CC="$(tc-getCC) -specs=${T}/ada.spec"
}