Gentoo Archives: gentoo-dev

From: Arfrever Frehtes Taifersar Arahesis <Arfrever@g.o>
To: Gentoo Development <gentoo-dev@l.g.o>
Subject: [gentoo-dev] Support for multiple ABIs (for Python modules etc.)
Date: Sat, 25 Jul 2009 10:27:33
Message-Id: 200907251228.49800.Arfrever@gentoo.org
1 I would like to present the plan of support for multiple ABIs. It should be sufficient for
2 Python modules and might be also appropriate for some other ABI types (e.g. for Ruby modules).
3
4 1. Portage will support repository-specific, profile-independent ${REPOSITORY}/profiles/settings
5 configuration files (filename can be changed). They will set some variables (similarly to
6 make.defaults files). These variables shouldn't be overrideable by profiles, eclasses, ebuilds
7 or by user's configuration files (e.g. /etc/portage/*). For future compatibility these files
8 could also support lists/indexed arrays and dictionaries/associative arrays/maps.
9
10 2. ${REPOSITORY}/profiles/settings will set ABI_TYPES and ${ABI_TYPE^^}_ABI_SUPPORTED_VALUES variables.
11 ABI_TYPES defines supported ABI types. ${ABI_TYPE^^}_ABI_SUPPORTED_VALUES defines supported ABIs
12 for given ABI type.
13
14 Example (${REPOSITORY}/profiles/settings):
15 ABI_TYPES="python ruby ..."
16 PYTHON_ABI_SUPPORTED_VALUES="2.4 2.5 2.6 3.0 3.1"
17 RUBY_ABI_SUPPORTED_VALUES="1.8 1.9"
18
19 3. make.defaults files will support ${ABI_TYPE^^}_ABI_FORCED_VALUES/${ABI_TYPE^^}_ABI_MASKED_VALUES
20 variables to force/mask specific ABIs in given profiles.
21
22 Example (make.defaults):
23 PYTHON_ABI_MASKED_VALUES="2.4 2.5"
24 PYTHON_ABI_FORCED_VALUES="3.1"
25
26 4. For convenience of developers ABI dependencies will be able to be specified in explicit and
27 slightly implicit way. Ebuilds/eclasses, which support multiple ABIs, will set USED_ABI_TYPES.
28 Ebuilds/eclasses will be able to set RESTRICT_${ABI_TYPE^^}_ABIS variables which will support
29 '*' wildcard. USED_ABI_TYPES and RESTRICT_${ABI_TYPE^^}_ABIS variables should be cumulative
30 (across eclasses and ebuild).
31
32 Example (ebuild):
33 USED_ABI_TYPES="python"
34 # This package doesn't work yet with Python 2.6 and 3.*
35 RESTRICT_PYTHON_ABIS="2.6 3*"
36
37 4.1. Implicitly specified ABI dependencies. During calculation of dependencies of given package,
38 Portage will verify if all dependencies, which use given ABI type, have been built with enabled
39 support for these ABIs, which are enabled for given package.
40
41 Example (ebuild):
42 # dev-python/bsddb3
43 USED_ABI_TYPES="python"
44 RDEPEND=">=sys-libs/db-4.6"
45 DEPEND="${RDEPEND}
46 dev-python/setuptools
47 doc? ( dev-python/sphinx )"
48
49 Assuming that dev-python/setuptools and dev-python/sphinx set USED_ABI_TYPES="python",
50 Portage will verify that, when user runs `USE_PYTHON="2.5 2.6" emerge dev-python/bsddb3`,
51 dev-python/setuptools and dev-python/sphinx (when USE="doc" is enabled) are built with
52 enabled support for at least "2.5" and "2.6" Python ABIs. If they are already installed
53 without support for e.g. "2.5" Python ABI, Portage will print appropriate error message
54 (similarly to unsatisfied USE dependencies) and exit.
55
56 4.2. Explicitly specified ABI dependencies. {,P,R}DEPEND variables will support specifying
57 ABI dependencies in explicit way. {,P,R}DEPEND variables will also support ABI conditionals.
58 I suggest using {ABI_type[comma-delimited values]} syntax, but it can be changed.
59
60 Example (ebuild):
61 DEPEND="category/package1{python[2.5,2.6],ruby[-1.8]}"
62 RDEPEND="{python[2.6]}? ( category/package2 )
63
64 Example (python.eclass):
65 DEPEND="
66 {python[2.4]}? ( dev-lang/python:2.4 )
67 {python[2.5]}? ( dev-lang/python:2.5 )
68 {python[2.6]}? ( dev-lang/python:2.6 )
69 {python[3.0]}? ( dev-lang/python:3.0 )
70 {python[3.1]}? ( dev-lang/python:3.1 )
71 "
72 RDEPEND="${RDEPEND}"
73
74 5. 18th line of metadata cache files will contain the list of ABI types and values supported
75 (i.e. not restricted by RESTRICT_${ABI_TYPE^^}_ABIS variables) by given package.
76
77 Example (18th line of metadata cache file):
78 python[2.5,2.6,3.0,3.1] ruby[1.8,1.9]
79
80 Every change to ${REPOSITORY}/profiles/settings should probably invalidate whole metadata
81 cache of given repository.
82
83 6. Portage will support USE_${ABI_TYPE^^} variables in /etc/make.conf to specify which ABIs
84 should be enabled.
85
86 Example (/etc/make.conf):
87 USE_PYTHON="2.5 2.6 3.1"
88 USE_RUBY="1.8 1.9"
89
90 7. Portage will set ${ABI_TYPE^^}_ABIS variables in ebuild environment. ${ABI_TYPE^^}_ABIS
91 should contain ABIs forced by ${ABI_TYPE^^}_ABI_FORCED_VALUES and these ABIs enabled by user
92 in /etc/make.conf by USE_${ABI_TYPE^^} which aren't masked by ${ABI_TYPE^^}_ABI_MASKED_VALUES.
93
94 Example (ebuild):
95 src_compile() {
96 for abi in ${PYTHON_ABIS}; do
97 emake PYTHON=$(get_PYTHON ${abi})
98 done
99 }
100
101 Ebuilds/eclasses should implicitly enable support for one ("default") ABI, when user hasn't
102 set appropriate USE_${ABI_TYPE^^} variable. For example Python modules would use ABI of
103 /usr/bin/python.
104
105 8. Portage will store the list of supported ABIs in /var/db/pkg/${CATEGORY}/${PF}/SUPPORTED_ABIS
106 and the list of enabled ABIs in /var/db/pkg/${CATEGORY}/${PF}/ABIS.
107
108 Example (/var/db/pkg/${CATEGORY}/${PF}/SUPPORTED_ABIS):
109 python[2.4,2.5,2.6,3.0,3.1] ruby[1.8,1.9]
110
111 Example (/var/db/pkg/${CATEGORY}/${PF}/ABIS):
112 python[2.6,3.1] ruby[1.9]
113
114 Names/syntax of specific variables etc. can be changed. Please write constructive comments.
115
116 --
117 Arfrever Frehtes Taifersar Arahesis

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies

Subject Author
Re: [gentoo-dev] Support for multiple ABIs (for Python modules etc.) Arfrever Frehtes Taifersar Arahesis <Arfrever@g.o>
Re: [gentoo-dev] Support for multiple ABIs (for Python modules etc.) "Marijn Schouten (hkBst)" <hkBst@g.o>
Re: [gentoo-dev] Support for multiple ABIs (for Python modules etc.) Ciaran McCreesh <ciaran.mccreesh@××××××××××.com>