logo

live-bootstrap

Mirror of <https://github.com/fosslinux/live-bootstrap>

pass2.sh (2826B)


  1. # SPDX-FileCopyrightText: 2022 fosslinux <fosslinux@aussies.space>
  2. #
  3. # SPDX-License-Identifier: GPL-3.0-or-later
  4. src_prepare() {
  5. default
  6. # Delete generated files
  7. rm Include/Python-ast.h Python/Python-ast.c
  8. rm Lib/stringprep.py
  9. rm Lib/pydoc_data/topics.py
  10. rm Misc/Vim/python.vim
  11. rm -r Modules/_ctypes/libffi
  12. mv Lib/plat-generic .
  13. rm -r Lib/plat-*
  14. mv plat-generic Lib/
  15. grep generated -r . -l | grep encodings | xargs rm
  16. # Regenerate encodings
  17. mkdir Tools/unicode/in Tools/unicode/out
  18. mv ../CP437.TXT Tools/unicode/in/
  19. pushd Tools/unicode
  20. python -B gencodec.py in/ ../../Lib/encodings/
  21. popd
  22. # Regenerate unicode
  23. rm Modules/unicodedata_db.h Modules/unicodename_db.h Objects/unicodetype_db.h
  24. for f in UnicodeData CompositionExclusions EastAsianWidth DerivedCoreProperties DerivedNormalizationProps; do
  25. mv "../${f}-3.2.0.txt" .
  26. mv "../${f}-5.1.0.txt" "${f}.txt"
  27. done
  28. python -B Tools/unicode/makeunicodedata.py
  29. # Regenerate sre_constants.h
  30. rm Modules/sre_constants.h
  31. python2.5 Lib/sre_constants.py
  32. # Regenerate autoconf
  33. autoreconf-2.71 -fi
  34. }
  35. src_configure() {
  36. MACHDEP=linux ac_sys_system=Linux \
  37. CFLAGS="-U__DATE__ -U__TIME__" \
  38. LDFLAGS="-L${LIBDIR}" \
  39. ./configure \
  40. --prefix="${PREFIX}" \
  41. --libdir="${LIBDIR}" \
  42. --build=i386-unknown-linux-musl \
  43. --host=i386-unknown-linux-musl \
  44. --with-pydebug \
  45. --with-system-ffi \
  46. --enable-ipv6
  47. }
  48. src_compile() {
  49. # Temporarily break include cycle
  50. patch -Np1 -i graminit-regen.patch
  51. # Build pgen
  52. PYTHONDONTWRITEBYTECODE=1 make "${MAKEJOBS}" Parser/pgen
  53. # Regen graminit.c and graminit.h
  54. PYTHONDONTWRITEBYTECODE=1 make "${MAKEJOBS}" Include/graminit.h
  55. # Regenerate some Python scripts using the other regenerated files
  56. # Must move them out to avoid using Lib/ module files which are
  57. # incompatible with running version of Python
  58. cp Lib/{symbol,keyword,token}.py .
  59. python -B symbol.py
  60. python -B keyword.py
  61. python -B token.py
  62. # Undo change
  63. patch -Np1 -R -i graminit-regen.patch
  64. # Now build the main program
  65. PYTHONDONTWRITEBYTECODE=1 make "${MAKEJOBS}" CFLAGS="-U__DATE__ -U__TIME__"
  66. }
  67. src_install() {
  68. default
  69. ln --symbolic --relative "${DESTDIR}${LIBDIR}/python3.1/lib-dynload" "${DESTDIR}${PREFIX}/lib/python3.1/lib-dynload"
  70. ln --symbolic --relative "${DESTDIR}${PREFIX}/bin/python3.1" "${DESTDIR}${PREFIX}/bin/python"
  71. # Remove non-reproducible .pyc/o files
  72. find "${DESTDIR}" -name "*.pyc" -delete
  73. find "${DESTDIR}" -name "*.pyo" -delete
  74. # This file is not reproducible and I don't care to fix it
  75. rm "${DESTDIR}/${PREFIX}/lib/python3.1/lib2to3/"{Pattern,}"Grammar3.1.5.final.0.pickle"
  76. }