logo

live-bootstrap

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

pass1.sh (2275B)


  1. # SPDX-FileCopyrightText: 2022 fosslinux <fosslinux@aussies.space>
  2. #
  3. # SPDX-License-Identifier: GPL-3.0-or-later
  4. src_prepare() {
  5. default
  6. # Remove broken file
  7. rm Lib/test/test_pep263.py
  8. # Delete generated files
  9. rm Modules/glmodule.c
  10. rm Include/Python-ast.h Python/Python-ast.c
  11. rm Lib/stringprep.py
  12. rm Misc/Vim/python.vim
  13. mv Lib/plat-generic .
  14. rm -r Lib/plat-*
  15. rm -r Modules/_ctypes/libffi
  16. mv plat-generic Lib/
  17. grep generated -r . -l | grep encodings | xargs rm
  18. # Regenerate unicode
  19. rm Modules/unicodedata_db.h Modules/unicodename_db.h Objects/unicodetype_db.h
  20. for f in UnicodeData CompositionExclusions EastAsianWidth; do
  21. mv "../${f}-3.2.0.txt" .
  22. mv "../${f}-4.1.0.txt" "${f}.txt"
  23. done
  24. python Tools/unicode/makeunicodedata.py
  25. # Regenerate sre_constants.h
  26. rm Modules/sre_constants.h
  27. python Lib/sre_constants.py
  28. # Regen ast module
  29. rm Lib/compiler/ast.py
  30. pushd Tools/compiler
  31. python astgen.py > ../../Lib/compiler/ast.py
  32. popd
  33. # Regenerate autoconf
  34. autoreconf-2.71 -fi
  35. }
  36. src_configure() {
  37. MACHDEP=linux ac_sys_system=Linux \
  38. CFLAGS="-U__DATE__ -U__TIME__" \
  39. LDFLAGS="-L${LIBDIR}" \
  40. ./configure \
  41. --build=i386-unknown-linux-musl \
  42. --host=i386-unknown-linux-musl \
  43. --prefix="${PREFIX}" \
  44. --libdir="${LIBDIR}" \
  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. make "${MAKEJOBS}" Parser/pgen
  53. # Regen graminit.c and graminit.h
  54. 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 symbol.py
  60. python keyword.py
  61. python token.py
  62. # Undo change
  63. patch -Np1 -R -i graminit-regen.patch
  64. # Now build the main program
  65. make "${MAKEJOBS}" CFLAGS="-U__DATE__ -U__TIME__"
  66. }
  67. src_install() {
  68. default
  69. # Remove non-reproducible .pyc/o files
  70. find "${DESTDIR}" -name "*.pyc" -delete
  71. find "${DESTDIR}" -name "*.pyo" -delete
  72. }