Gentoo Archives: gentoo-dev

From: Alfredo Tupone <tupone@g.o>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] Ada eclass support for gcc_12.2.0
Date: Thu, 15 Sep 2022 07:07:49
Message-Id: 20220915090740.4ca61498@alfredo.tupone.it
1 I would like to share the incoming changes to ada eclass to add support
2 to sys-devel/gcc-12.2.0
3
4 One change is to not depend on gcc SLOT like for gnat the dependency in
5 on dev-lang/gnat-gpl SLOT, as gcc slot is 12 but the eclass need to
6 point to (eg.) gnatbind-12.2.0. Maybe in the future we could add
7 SUBSLOT to gcc.
8
9 So the dependency now is against gcc-12.2.0*
10
11 The other changes are trivial
12
13 Alfredo
14
15 diff --git a/eclass/ada.eclass b/eclass/ada.eclass
16 index 0bf3dcfe41cc..e6027e38393b 100644
17 --- a/eclass/ada.eclass
18 +++ b/eclass/ada.eclass
19 @@ -46,58 +46,61 @@ EXPORT_FUNCTIONS pkg_setup
20 # The dependency string is conditional on ADA_TARGET.
21 #
22 # Example use:
23 # @CODE
24 # RDEPEND="${ADA_DEPS}
25 # dev-foo/mydep"
26 # DEPEND="${RDEPEND}"
27 # @CODE
28 #
29
30 # @ECLASS_VARIABLE: _ADA_ALL_IMPLS
31 # @INTERNAL
32 # @DESCRIPTION:
33 # All supported Ada implementations, most preferred last.
34 _ADA_ALL_IMPLS=(
35 - gnat_2020 gnat_2021
36 + gnat_2020 gnat_2021 gcc_12_2_0
37 )
38 readonly _ADA_ALL_IMPLS
39
40
41 # @FUNCTION: _ada_impl_supported
42 # @USAGE: <impl>
43 # @INTERNAL
44 # @DESCRIPTION:
45 # Check whether the implementation <impl> (ADA_COMPAT-form)
46 # is still supported.
47 #
48 # Returns 0 if the implementation is valid and supported. If it is
49 # unsupported, returns 1 -- and the caller should ignore the entry.
50 # If it is invalid, dies with an appopriate error messages.
51 _ada_impl_supported() {
52 debug-print-function ${FUNCNAME} "${@}"
53
54 [[ ${#} -eq 1 ]] || die "${FUNCNAME}: takes exactly 1 argument (impl)."
55
56 local impl=${1}
57
58 # keep in sync with _ADA_ALL_IMPLS!
59 # (not using that list because inline patterns shall be faster)
60 case "${impl}" in
61 gnat_202[01])
62 return 0
63 ;;
64 + gcc_12_2_0)
65 + return 0
66 + ;;
67 *)
68 [[ ${ADA_COMPAT_NO_STRICT} ]] && return 1
69 die "Invalid implementation in ADA_COMPAT: ${impl}"
70 esac
71 }
72
73 # @FUNCTION: _ada_set_impls
74 # @INTERNAL
75 # @DESCRIPTION:
76 # Check ADA_COMPAT for well-formedness and validity, then set
77 # two global variables:
78 #
79 # - _ADA_SUPPORTED_IMPLS containing valid implementations supported
80 # by the ebuild (ADA_COMPAT - dead implementations),
81 #
82 @@ -169,50 +172,58 @@ _ada_set_impls() {
83 # the current one will be obtained from ${EADA}.
84 #
85 # The variables which can be exported are: GCC, EADA, GNATMAKE.
86 # They are described more completely in the eclass
87 # variable documentation.
88 ada_export() {
89 debug-print-function ${FUNCNAME} "${@}"
90
91 local impl var
92
93 case "${1}" in
94 gnat_202[01])
95 impl=${1}
96 shift
97 ;;
98 + gcc_12_2_0)
99 + impl=${1}
100 + shift
101 + ;;
102 *)
103 impl=${EADA}
104 if [[ -z ${impl} ]]; then
105 die "ada_export called without a ada implementation and EADA is unset"
106 fi
107 ;;
108 esac
109 debug-print "${FUNCNAME}: implementation: ${impl}"
110
111 local gcc_pv
112 local slot
113 case "${impl}" in
114 gnat_2020)
115 gcc_pv=9.3.1
116 slot=9.3.1
117 ;;
118 gnat_2021)
119 gcc_pv=10.3.1
120 slot=10
121 ;;
122 + gcc_12_2_0)
123 + gcc_pv=12.2.0
124 + slot=12
125 + ;;
126 *)
127 gcc_pv="9.9.9"
128 slot=9.9.9
129 ;;
130 esac
131
132 for var; do
133 case "${var}" in
134 EADA)
135 export EADA=${impl}
136 debug-print "${FUNCNAME}: EADA = ${EADA}"
137 ;;
138 GCC)
139 export GCC=${EPREFIX}/usr/bin/gcc-${gcc_pv}
140 debug-print "${FUNCNAME}: GCC = ${GCC}"
141 @@ -234,31 +245,38 @@ ada_export() {
142 debug-print "${FUNCNAME}: GNATMAKE = ${GNATMAKE}"
143 ;;
144 GNATLS)
145 export GNATLS=${EPREFIX}/usr/bin/gnatls-${gcc_pv}
146 debug-print "${FUNCNAME}: GNATLS = ${GNATLS}"
147 ;;
148 GNATPREP)
149 export GNATPREP=${EPREFIX}/usr/bin/gnatprep-${gcc_pv}
150 debug-print "${FUNCNAME}: GNATPREP = ${GNATPREP}"
151 ;;
152 GNATCHOP)
153 export GNATCHOP=${EPREFIX}/usr/bin/gnatchop-${gcc_pv}
154 debug-print "${FUNCNAME}: GNATCHOP = ${GNATCHOP}"
155 ;;
156 ADA_PKG_DEP)
157 - ADA_PKG_DEP="dev-lang/gnat-gpl:${slot}[ada]"
158 + case "${impl}" in
159 + gnat_202[01])
160 + ADA_PKG_DEP="dev-lang/gnat-gpl:${slot}[ada]"
161 + ;;
162 + *)
163 + ADA_PKG_DEP="=sys-devel/gcc-${gcc_pv}*[ada]"
164 + ;;
165 + esac
166
167 # use-dep
168 if [[ ${ADA_REQ_USE} ]]; then
169 ADA_PKG_DEP+=[${ADA_REQ_USE}]
170 fi
171
172 export ADA_PKG_DEP
173 debug-print "${FUNCNAME}: ADA_PKG_DEP = ${ADA_PKG_DEP}"
174 ;;
175 *)
176 die "ada_export: unknown variable ${var}"
177 esac
178 done
179 }