From 72fc7c1bbcf983d4778811e5d68bfc8a85873a74 Mon Sep 17 00:00:00 2001 From: Sam James Date: Tue, 7 Jun 2022 10:29:59 +0100 Subject: dev-lang/python: use --with-build-python for cross builds for 3.11 Tested with sparc64-unknown-linux-gnu. Closes: https://bugs.gentoo.org/847910 Signed-off-by: Sam James --- dev-lang/python/python-3.11.0_beta3.ebuild | 51 +++++++++++++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) (limited to 'dev-lang') diff --git a/dev-lang/python/python-3.11.0_beta3.ebuild b/dev-lang/python/python-3.11.0_beta3.ebuild index 155e017bf32a..628ac16dde42 100644 --- a/dev-lang/python/python-3.11.0_beta3.ebuild +++ b/dev-lang/python/python-3.11.0_beta3.ebuild @@ -144,7 +144,8 @@ src_configure() { fi # Export CXX so it ends up in /usr/lib/python3.X/config/Makefile. - tc-export CXX + # PKG_CONFIG needed for cross. + tc-export CXX PKG_CONFIG # Fix implicit declarations on cross and prefix builds. Bug #674070. use ncurses && append-cppflags -I"${ESYSROOT}"/usr/include/ncursesw @@ -203,6 +204,54 @@ src_configure() { local -x LDFLAGS_NODIST=${LDFLAGS} local -x CFLAGS= LDFLAGS= + if tc-is-cross-compiler ; then + # We need to build our own Python on CBUILD first, and feed it in. + # bug #847910 + local myeconfargs_cbuild=( + "${myeconfargs[@]}" + + # As minimal as possible for the mini CBUILD Python + # we build just for cross, to satisfy --with-build-python. + --without-lto + --without-readline + --disable-optimizations + ) + + myeconfargs+=( + # Point the imminent CHOST build to the Python we just + # built for CBUILD. + --with-build-python="${WORKDIR}"/${P}-${CBUILD}/python + ) + + mkdir "${WORKDIR}"/${P}-${CBUILD} || die + pushd "${WORKDIR}"/${P}-${CBUILD} &> /dev/null || die + ECONF_SOURCE="${S}" econf_build "${myeconfargs_cbuild[@]}" + + # Avoid as many dependencies as possible for the cross build. + cat >> Makefile <<-EOF || die + MODULE_NIS=disabled + MODULE__DBM=disabled + MODULE__GDBM=disabled + MODULE__DBM=disabled + MODULE__SQLITE3=disabled + MODULE__HASHLIB=disabled + MODULE__SSL=disabled + MODULE__CURSES=disabled + MODULE__CURSES_PANEL=disabled + MODULE_READLINE=disabled + MODULE__TKINTER=disabled + MODULE_PYEXPAT=disabled + MODULE_ZLIB=disabled + EOF + + # Unfortunately, we do have to build this immediately, and + # not in src_compile, because CHOST configure for Python + # will check the existence of the --with-build-python value + # immediately. + emake + popd &> /dev/null || die + fi + econf "${myeconfargs[@]}" if grep -q "#define POSIX_SEMAPHORES_NOT_ENABLED 1" pyconfig.h; then -- cgit v1.2.3-65-gdbad