Diff python-3.12.0 with a python-3.12.0_beta4_p2

/usr/portage/dev-lang/python/python-3.12.0_beta4_p2.ebuild 2023-10-09 14:52:29.472368350 +0300
1 1
# Copyright 1999-2023 Gentoo Authors
2 2
# Distributed under the terms of the GNU General Public License v2
3 3

  
4
EAPI="8"
4
EAPI="7"
5 5
WANT_LIBTOOL="none"
6 6

  
7 7
inherit autotools check-reqs flag-o-matic multiprocessing pax-utils
8 8
inherit python-utils-r1 toolchain-funcs verify-sig
9 9

  
10
MY_PV=${PV/_rc/rc}
10
MY_PV=${PV/_beta/b}
11 11
MY_P="Python-${MY_PV%_p*}"
12 12
PYVER=$(ver_cut 1-2)
13 13
PATCHSET="python-gentoo-patches-${MY_PV}"
......
137 137
	eautoreconf
138 138
}
139 139

  
140
build_cbuild_python() {
141
	# Hack to workaround get_libdir not being able to handle CBUILD, bug #794181
142
	local cbuild_libdir=$(unset PKG_CONFIG_PATH ; $(tc-getBUILD_PKG_CONFIG) --keep-system-libs --libs-only-L libffi)
143

  
144
	# pass system CFLAGS & LDFLAGS as _NODIST, otherwise they'll get
145
	# propagated to sysconfig for built extensions
146
	#
147
	# -fno-lto to avoid bug #700012 (not like it matters for mini-CBUILD Python anyway)
148
	local -x CFLAGS_NODIST="${BUILD_CFLAGS} -fno-lto"
149
	local -x LDFLAGS_NODIST=${BUILD_LDFLAGS}
150
	local -x CFLAGS= LDFLAGS=
151
	local -x BUILD_CFLAGS="${CFLAGS_NODIST}"
152
	local -x BUILD_LDFLAGS=${LDFLAGS_NODIST}
153

  
154
	# We need to build our own Python on CBUILD first, and feed it in.
155
	# bug #847910
156
	local myeconfargs_cbuild=(
157
		"${myeconfargs[@]}"
158

  
159
		--prefix="${BROOT}"/usr
160
		--libdir="${cbuild_libdir:2}"
161

  
162
		# Avoid needing to load the right libpython.so.
163
		--disable-shared
164

  
165
		# As minimal as possible for the mini CBUILD Python
166
		# we build just for cross to satisfy --with-build-python.
167
		--without-lto
168
		--without-readline
169
		--disable-optimizations
170
	)
171

  
172
	mkdir "${WORKDIR}"/${P}-${CBUILD} || die
173
	pushd "${WORKDIR}"/${P}-${CBUILD} &> /dev/null || die
174

  
175
	# Avoid as many dependencies as possible for the cross build.
176
	mkdir Modules || die
177
	cat > Modules/Setup.local <<-EOF || die
178
		*disabled*
179
		nis
180
		_dbm _gdbm
181
		_sqlite3
182
		_hashlib _ssl
183
		_curses _curses_panel
184
		readline
185
		_tkinter
186
		pyexpat
187
		zlib
188
		# We disabled these for CBUILD because Python's setup.py can't handle locating
189
		# libdir correctly for cross. This should be rechecked for the pure Makefile approach,
190
		# and uncommented if needed.
191
		#_ctypes _crypt
192
	EOF
193

  
194
	ECONF_SOURCE="${S}" econf_build "${myeconfargs_cbuild[@]}"
195

  
196
	# Unfortunately, we do have to build this immediately, and
197
	# not in src_compile, because CHOST configure for Python
198
	# will check the existence of the --with-build-python value
199
	# immediately.
200
	emake
201
	popd &> /dev/null || die
202
}
203

  
204 140
src_configure() {
205 141
	local disable
206 142
	# disable automagic bluetooth headers detection
......
290 226
		$(use_with readline readline "$(usex libedit editline readline)")
291 227
		$(use_with valgrind)
292 228
	)
293
	# Force-disable modules we don't want built.
294
	# See Modules/Setup for docs on how this works. Setup.local contains our local deviations.
295
	cat > Modules/Setup.local <<-EOF || die
296
		*disabled*
297
		nis
298
		$(usev !gdbm '_gdbm _dbm')
299
		$(usev !sqlite '_sqlite3')
300
		$(usev !ssl '_hashlib _ssl')
301
		$(usev !ncurses '_curses _curses_panel')
302
		$(usev !readline 'readline')
303
		$(usev !tk '_tkinter')
304
	EOF
305 229

  
306 230
	# disable implicit optimization/debugging flags
307 231
	local -x OPT=
308 232

  
309 233
	if tc-is-cross-compiler ; then
310
		build_cbuild_python
234
		# Hack to workaround get_libdir not being able to handle CBUILD, bug #794181
235
		local cbuild_libdir=$(unset PKG_CONFIG_PATH ; $(tc-getBUILD_PKG_CONFIG) --keep-system-libs --libs-only-L libffi)
236

  
237
		# pass system CFLAGS & LDFLAGS as _NODIST, otherwise they'll get
238
		# propagated to sysconfig for built extensions
239
		#
240
		# -fno-lto to avoid bug #700012 (not like it matters for mini-CBUILD Python anyway)
241
		local -x CFLAGS_NODIST="${BUILD_CFLAGS} -fno-lto"
242
		local -x LDFLAGS_NODIST=${BUILD_LDFLAGS}
243
		local -x CFLAGS= LDFLAGS=
244
		local -x BUILD_CFLAGS="${CFLAGS_NODIST}"
245
		local -x BUILD_LDFLAGS=${LDFLAGS_NODIST}
246

  
247
		# We need to build our own Python on CBUILD first, and feed it in.
248
		# bug #847910
249
		local myeconfargs_cbuild=(
250
			"${myeconfargs[@]}"
251

  
252
			--libdir="${cbuild_libdir:2}"
253

  
254
			# Avoid needing to load the right libpython.so.
255
			--disable-shared
256

  
257
			# As minimal as possible for the mini CBUILD Python
258
			# we build just for cross to satisfy --with-build-python.
259
			--without-lto
260
			--without-readline
261
			--disable-optimizations
262
		)
263

  
311 264
		myeconfargs+=(
312 265
			# Point the imminent CHOST build to the Python we just
313 266
			# built for CBUILD.
314 267
			--with-build-python="${WORKDIR}"/${P}-${CBUILD}/python
315 268
		)
269

  
270
		mkdir "${WORKDIR}"/${P}-${CBUILD} || die
271
		pushd "${WORKDIR}"/${P}-${CBUILD} &> /dev/null || die
272
		# We disable _ctypes and _crypt for CBUILD because Python's setup.py can't handle locating
273
		# libdir correctly for cross.
274
		PYTHON_DISABLE_MODULES="${PYTHON_DISABLE_MODULES} _ctypes _crypt" \
275
			ECONF_SOURCE="${S}" econf_build "${myeconfargs_cbuild[@]}"
276

  
277
		# Avoid as many dependencies as possible for the cross build.
278
		cat >> Makefile <<-EOF || die
279
			MODULE_NIS_STATE=disabled
280
			MODULE__DBM_STATE=disabled
281
			MODULE__GDBM_STATE=disabled
282
			MODULE__DBM_STATE=disabled
283
			MODULE__SQLITE3_STATE=disabled
284
			MODULE__HASHLIB_STATE=disabled
285
			MODULE__SSL_STATE=disabled
286
			MODULE__CURSES_STATE=disabled
287
			MODULE__CURSES_PANEL_STATE=disabled
288
			MODULE_READLINE_STATE=disabled
289
			MODULE__TKINTER_STATE=disabled
290
			MODULE_PYEXPAT_STATE=disabled
291
			MODULE_ZLIB_STATE=disabled
292
		EOF
293

  
294
		# Unfortunately, we do have to build this immediately, and
295
		# not in src_compile, because CHOST configure for Python
296
		# will check the existence of the --with-build-python value
297
		# immediately.
298
		PYTHON_DISABLE_MODULES="${PYTHON_DISABLE_MODULES} _ctypes _crypt" emake
299
		popd &> /dev/null || die
316 300
	fi
317 301

  
318 302
	# pass system CFLAGS & LDFLAGS as _NODIST, otherwise they'll get
......
334 318
		die "Broken sem_open function (bug 496328)"
335 319
	fi
336 320

  
321
	# force-disable modules we don't want built
322
	local disable_modules=( NIS )
323
	use gdbm || disable_modules+=( _GDBM _DBM )
324
	use sqlite || disable_modules+=( _SQLITE3 )
325
	use ssl || disable_modules+=( _HASHLIB _SSL )
326
	use ncurses || disable_modules+=( _CURSES _CURSES_PANEL )
327
	use readline || disable_modules+=( READLINE )
328
	use tk || disable_modules+=( _TKINTER )
329

  
330
	local mod
331
	for mod in "${disable_modules[@]}"; do
332
		echo "MODULE_${mod}_STATE=disabled"
333
	done >> Makefile || die
334

  
337 335
	# install epython.py as part of stdlib
338 336
	echo "EPYTHON='python${PYVER}'" > Lib/epython.py || die
339 337
}
Thank you!