Diff python-3.12.0_rc2_p1 with a python-3.12.0_rc2_p1-r1

/usr/portage/dev-lang/python/python-3.12.0_rc2_p1-r1.ebuild 2023-10-09 14:52:29.472368350 +0300
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

  
140 204
src_configure() {
141 205
	local disable
142 206
	# disable automagic bluetooth headers detection
......
226 290
		$(use_with readline readline "$(usex libedit editline readline)")
227 291
		$(use_with valgrind)
228 292
	)
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
229 305

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

  
233 309
	if tc-is-cross-compiler ; then
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
			--prefix="${BROOT}"/usr
253
			--libdir="${cbuild_libdir:2}"
254

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

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

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

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

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

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

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

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

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

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