Gentoo Archives: gentoo-dev

From: James Le Cuirot <chewi@g.o>
To: gentoo-dev <gentoo-dev@l.g.o>
Cc: James Le Cuirot <chewi@g.o>
Subject: [gentoo-dev] [PATCH 11/12] distutils-r1.eclass: Fix cross-compiling
Date: Thu, 03 Jan 2019 21:44:26
Message-Id: 20190103213924.22835-12-chewi@gentoo.org
In Reply to: [gentoo-dev] [PATCH] Eclass changes for cross-compiling Python modules by James Le Cuirot
1 Following the changes in python-utils-r1.eclass, Python is now needed
2 in both BDEPEND and DEPEND.
3
4 As distutils does not call our eclass helpers, we need to pass the
5 correct include and library directories in setup.cfg. Unfortunately it
6 is still hardcoded to add -I/usr/include/pythonX.X and -L/usr/lib but
7 these appear after the SYSROOT paths so the build succeeds anyway. If
8 a missing header or library were to cause it to fall back to the build
9 host paths then it would most likely fail but it does not matter as it
10 would have failed either way.
11
12 Closes: https://bugs.gentoo.org/648652
13 Signed-off-by: James Le Cuirot <chewi@g.o>
14 ---
15 eclass/distutils-r1.eclass | 22 ++++++++++++++++------
16 1 file changed, 16 insertions(+), 6 deletions(-)
17
18 diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
19 index fa7a3ab5c12b..ff7792f11a87 100644
20 --- a/eclass/distutils-r1.eclass
21 +++ b/eclass/distutils-r1.eclass
22 @@ -1,4 +1,4 @@
23 -# Copyright 1999-2018 Gentoo Foundation
24 +# Copyright 1999-2019 Gentoo Authors
25 # Distributed under the terms of the GNU General Public License v2
26
27 # @ECLASS: distutils-r1.eclass
28 @@ -99,11 +99,8 @@ if [[ ! ${_DISTUTILS_R1} ]]; then
29
30 if [[ ! ${DISTUTILS_OPTIONAL} ]]; then
31 RDEPEND=${PYTHON_DEPS}
32 - if [[ ${EAPI} != [56] ]]; then
33 - BDEPEND=${PYTHON_DEPS}
34 - else
35 - DEPEND=${PYTHON_DEPS}
36 - fi
37 + DEPEND=${PYTHON_DEPS}
38 + [[ ${EAPI} != [56] ]] && BDEPEND=${PYTHON_DEPS}
39 REQUIRED_USE=${PYTHON_REQUIRED_USE}
40 fi
41
42 @@ -407,8 +404,21 @@ _distutils-r1_create_setup_cfg() {
43 # setuptools like to create .egg files for install --home.
44 [bdist_egg]
45 dist-dir = ${BUILD_DIR}/dist
46 +
47 + # this is needed when cross-compiling
48 + [build_ext]
49 _EOF_
50
51 + if [[ ${EPYTHON} != jython* ]]; then
52 + echo "include-dirs = $(python_get_includedir)" \
53 + >> "${HOME}"/.pydistutils.cfg || die
54 + fi
55 +
56 + if [[ ${EPYTHON} == python* ]]; then
57 + echo "library-dirs = $(dirname $(python_get_library_path))" \
58 + >> "${HOME}"/.pydistutils.cfg || die
59 + fi
60 +
61 # we can't refer to ${D} before src_install()
62 if [[ ${EBUILD_PHASE} == install ]]; then
63 cat >> "${HOME}"/.pydistutils.cfg <<-_EOF_ || die
64 --
65 2.19.2