1 |
commit: c9bbaa6c2f305d2428549b5c07c4d71877938f70 |
2 |
Author: Sam James <sam <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri May 13 01:05:07 2022 +0000 |
4 |
Commit: Sam James <sam <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri May 13 02:49:47 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c9bbaa6c |
7 |
|
8 |
toolchain.eclass: start work on eclassdocs |
9 |
|
10 |
Signed-off-by: Sam James <sam <AT> gentoo.org> |
11 |
|
12 |
eclass/toolchain.eclass | 60 ++++++++++++++++++++++++++++++++++++++++++++----- |
13 |
1 file changed, 54 insertions(+), 6 deletions(-) |
14 |
|
15 |
diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass |
16 |
index 0bc6bb821ab0..12959958c587 100644 |
17 |
--- a/eclass/toolchain.eclass |
18 |
+++ b/eclass/toolchain.eclass |
19 |
@@ -55,32 +55,76 @@ is_crosscompile() { |
20 |
[[ ${CHOST} != ${CTARGET} ]] |
21 |
} |
22 |
|
23 |
-# General purpose version check. Without a second arg matches up to minor version (x.x.x) |
24 |
+# @FUNCTION: tc_version_is_at_least |
25 |
+# @USAGE: ver1 [ver2] |
26 |
+# @DESCRIPTION: |
27 |
+# General purpose version check. Without a second argument, matches |
28 |
+# up to minor version (x.x.x). |
29 |
tc_version_is_at_least() { |
30 |
ver_test "${2:-${GCC_RELEASE_VER}}" -ge "$1" |
31 |
} |
32 |
|
33 |
-# General purpose version range check |
34 |
+# @FUNCTION: tc_version_is_between |
35 |
+# @USAGE: ver1 ver2 |
36 |
+# @DESCRIPTION: |
37 |
+# General purpose version range check. |
38 |
# Note that it matches up to but NOT including the second version |
39 |
tc_version_is_between() { |
40 |
tc_version_is_at_least "${1}" && ! tc_version_is_at_least "${2}" |
41 |
} |
42 |
|
43 |
+# @ECLASS_VARIABLE: TOOLCHAIN_GCC_PV |
44 |
+# @DEFAULT_UNSET |
45 |
+# @DESCRIPTION: |
46 |
+# Used to override GCC version. Useful for e.g. live ebuilds or snapshots. |
47 |
+# Defaults to ${PV}. |
48 |
+ |
49 |
+# @ECLASS_VARIABLE: GCC_PV |
50 |
+# @INTERNAL |
51 |
+# @DESCRIPTION: |
52 |
+# Internal variable representing (spoofed) GCC version. |
53 |
GCC_PV=${TOOLCHAIN_GCC_PV:-${PV}} |
54 |
+ |
55 |
+# @ECLASS_VARIABLE: GCC_PVR |
56 |
+# @INTERNAL |
57 |
+# @DESCRIPTION: |
58 |
+# Full GCC version including revision. |
59 |
GCC_PVR=${GCC_PV} |
60 |
[[ ${PR} != "r0" ]] && GCC_PVR=${GCC_PVR}-${PR} |
61 |
|
62 |
+# @ECLASS_VARIABLE: GCC_RELEASE_VER |
63 |
+# @INTERNAL |
64 |
+# @DESCRIPTION: |
65 |
# GCC_RELEASE_VER must always match 'gcc/BASE-VER' value. |
66 |
# It's an internal representation of gcc version used for: |
67 |
# - versioned paths on disk |
68 |
# - 'gcc -dumpversion' output. Must always match <digit>.<digit>.<digit>. |
69 |
GCC_RELEASE_VER=$(ver_cut 1-3 ${GCC_PV}) |
70 |
|
71 |
+# @ECLASS_VARIABLE: GCC_BRANCH_VER |
72 |
+# @INTERNAL |
73 |
+# @DESCRIPTION: |
74 |
+# GCC branch version. |
75 |
GCC_BRANCH_VER=$(ver_cut 1-2 ${GCC_PV}) |
76 |
+# @ECLASS_VARIABLE: GCCMAJOR |
77 |
+# @INTERNAL |
78 |
+# @DESCRIPTION: |
79 |
+# Major GCC version. |
80 |
GCCMAJOR=$(ver_cut 1 ${GCC_PV}) |
81 |
+# @ECLASS_VARIABLE: GCCMINOR |
82 |
+# @INTERNAL |
83 |
+# @DESCRIPTION: |
84 |
+# Minor GCC version. |
85 |
GCCMINOR=$(ver_cut 2 ${GCC_PV}) |
86 |
+# @ECLASS_VARIABLE: GCCMICRO |
87 |
+# @INTERNAL |
88 |
+# @DESCRIPTION: |
89 |
+# GCC micro version. |
90 |
GCCMICRO=$(ver_cut 3 ${GCC_PV}) |
91 |
|
92 |
+# @ECLASS_VARIABLE: GCC_CONFIG_VER |
93 |
+# @INTERNAL |
94 |
+# @DESCRIPTION: |
95 |
# Ideally this variable should allow for custom gentoo versioning |
96 |
# of binary and gcc-config names not directly tied to upstream |
97 |
# versioning. In practice it's hard to untangle from gcc/BASE-VER |
98 |
@@ -92,13 +136,13 @@ GCC_CONFIG_VER=${GCC_RELEASE_VER} |
99 |
# 1.2.3_pYYYYMMDD (or 1.2.3_preYYYYMMDD for unreleased major versions): weekly snapshots |
100 |
# 1.2.3_rcYYYYMMDD: release candidates |
101 |
if [[ ${GCC_PV} == *_pre* ]] ; then |
102 |
- # weekly snapshots |
103 |
+ # Weekly snapshots |
104 |
SNAPSHOT=${GCCMAJOR}-${GCC_PV##*_pre} |
105 |
elif [[ ${GCC_PV} == *_p* ]] ; then |
106 |
- # weekly snapshots |
107 |
+ # Weekly snapshots |
108 |
SNAPSHOT=${GCCMAJOR}-${GCC_PV##*_p} |
109 |
elif [[ ${GCC_PV} == *_rc* ]] ; then |
110 |
- # release candidates |
111 |
+ # Release candidates |
112 |
SNAPSHOT=${GCC_PV%_rc*}-RC-${GCC_PV##*_rc} |
113 |
fi |
114 |
|
115 |
@@ -272,6 +316,10 @@ PDEPEND=">=sys-devel/gcc-config-2.3" |
116 |
|
117 |
#---->> S + SRC_URI essentials <<---- |
118 |
|
119 |
+# @ECLASS_VARIABLE: TOOLCHAIN_SET_S |
120 |
+# @DESCRIPTION: |
121 |
+# Used to override value of S for snapshots and such. Mainly useful |
122 |
+# if needing to set GCC_TARBALL_SRC_URI. |
123 |
: ${TOOLCHAIN_SET_S:=yes} |
124 |
|
125 |
# Set the source directory depending on whether we're using |
126 |
@@ -328,7 +376,7 @@ gentoo_urls() { |
127 |
# PIE_VER |
128 |
# PIE_GCC_VER |
129 |
# These variables control patching in various updates for the logic |
130 |
-# controlling Position Independant Executables. PIE_VER is expected |
131 |
+# controlling Position Independent Executables. PIE_VER is expected |
132 |
# to be the version of this patch, and PIE_GCC_VER the gcc version of |
133 |
# the patch: |
134 |
# An example: |