### this file is sourced not run
PKGVER=3.11.4
PKGARCH=x86_64

PYTHON_VER=${PKGVER%.*}

# source: LFS 11.3 updated to BLFS SVN r890
TARBALL=Python-$PKGVER.tar.xz
MD5SUM=fb7f7eae520285788449d569e45b6718
SRC_URL=https://www.python.org/ftp/python/3.11.4/$TARBALL
#BUNDLE=fatdog-base-11.3.tar
#SRC_URL=http://distro.ibiblio.org/fatdog/source/900/$BUNDLE

SLACKREQ='libreadline'
SLACKDESC="python3: python3 $PKGVER (Build-system Python)
python3: 
python3: The Python 3 package contains the Python development environment. It 
python3: is useful for object-oriented programming, writing scripts, 
python3: prototyping large programs, or developing entire applications.
python3: 
python3: https://www.python.org/
python3: 
python3: 
python3:
python3: 
"

### override download for LFS sources bundle
# $1-src-dir $2-tarball 
#pkg_download() {
#	echo downloading $BUNDLE for $TARBALL
#	wget -P $1 $SRC_URL
#	tar -xf $1/$BUNDLE --strip-components=1 -C $1 
#	rm $1/$BUNDLE
#}

### default pkg_prepare
### default pkg_package

### build
pkg_build() {
	cd /tmp/Python* &&

	# This is a drop-in replacement for python3-base.
	# The recipe is identical to python3-base except:
	# a) we enable optimisation, and
	# b) due to its location, a lot more libs will be built and used.
	CONFFLAGS="$CONFFLAGS   \
		--enable-shared     \
		--disable-test-modules \
		--with-system-expat \
		--with-system-ffi   \
		--with-readline     \
		--with-ensurepip=install  \
		--with-platlibdir=$LIBDIR \
	" &&
	# --enable-optimizations # this takes forever
	# --without-ensurepip    # build without pip3
	pkg_build_autoconf &&

	# LFS 11.3 suppress warning and urge to upgrade pip3
	cat > /etc/pip.conf << EOF &&
[global]
root-user-action = ignore
disable-pip-version-check = true
EOF

	pkg_build_slackdesc &&

	# multilib (CBLS)
	# headers
	mv -v /usr/include/python${PYTHON_VER}/pyconfig{,-64}.h &&
	install -m644 /tmp/pkg/pyconfig.h /usr/include/python${PYTHON_VER} &&

	# symlinks are adjustded in python3-multilib package
	true
}
