live-bootstrap/steps/python-3.8.16/pass1.sh

71 lines
2.0 KiB
Bash
Raw Normal View History

2022-12-21 03:17:11 +00:00
# SPDX-FileCopyrightText: 2022 fosslinux <fosslinux@aussies.space>
#
# SPDX-License-Identifier: GPL-3.0-or-later
src_prepare() {
default
# Delete generated files that won't be regenerated
rm Lib/pydoc_data/topics.py
rm Modules/_ssl_data*.h # Breaks _ssl module, but it fails anyways
# Regenerate encodings
grep generated -r . -l | grep encodings | xargs rm
mkdir Tools/unicode/in Tools/unicode/out
mv ../CP437.TXT Tools/unicode/in/
pushd Tools/unicode
2024-01-24 03:42:29 +00:00
python -B gencodec.py in/ ../../Lib/encodings/
2022-12-21 03:17:11 +00:00
popd
# Regenerate unicode
rm Modules/unicodedata_db.h Modules/unicodename_db.h Objects/unicodetype_db.h
mv ../*.txt ../*.zip .
2024-01-24 03:42:29 +00:00
python -B Tools/unicode/makeunicodedata.py
2022-12-21 03:17:11 +00:00
# Regenerate sre_constants.h
rm Modules/sre_constants.h
cp Lib/sre_constants.py .
2024-01-24 03:42:29 +00:00
python -B sre_constants.py
2022-12-21 03:17:11 +00:00
rm sre_constants.py
mv sre_constants.h Modules/
# Regenerate stringprep
rm Lib/stringprep.py
2024-01-24 03:42:29 +00:00
python -B Tools/unicode/mkstringprep.py > Lib/stringprep.py
2022-12-21 03:17:11 +00:00
# Regenerate autoconf
autoreconf-2.71 -fi
}
src_configure() {
MACHDEP=linux ac_sys_system=Linux \
2022-12-21 03:17:11 +00:00
CPPFLAGS="-U__DATE__ -U__TIME__" \
LDFLAGS="-L${LIBDIR}" \
2024-01-24 03:42:29 +00:00
PYTHON_FOR_BUILD="python -B" \
2022-12-21 03:17:11 +00:00
./configure \
--build=i386-unknown-linux-musl \
--host=i386-unknown-linux-musl \
2022-12-21 03:17:11 +00:00
--prefix="${PREFIX}" \
--libdir="${LIBDIR}" \
2022-12-21 03:17:11 +00:00
--with-system-ffi
}
src_compile() {
# Regenerations
rm Modules/_blake2/blake2s_impl.c
2024-01-24 03:42:29 +00:00
PYTHONDONTWRITEBYTECODE=1 make "${MAKEJOBS}" regen-all
2022-12-21 03:17:11 +00:00
2024-01-24 03:42:29 +00:00
PYTHONDONTWRITEBYTECODE=1 make "${MAKEJOBS}" CPPFLAGS="-U__DATE__ -U__TIME__"
2022-12-21 03:17:11 +00:00
}
src_install() {
default
ln --symbolic --relative "${DESTDIR}${LIBDIR}/python3.8/lib-dynload" "${DESTDIR}${PREFIX}/lib/python3.8/lib-dynload"
ln --symbolic --relative "${DESTDIR}${PREFIX}/bin/python3.8" "${DESTDIR}${PREFIX}/bin/python"
2022-12-21 03:17:11 +00:00
# Remove non-reproducible .pyc/o files
find "${DESTDIR}" -name "*.pyc" -delete
find "${DESTDIR}" -name "*.pyo" -delete
}