logo

live-bootstrap

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

pass1.sh (2754B)


  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 -r Modules/_ctypes/libffi
  11. rm Python/importlib.h
  12. rm Modules/_ssl_data.h # Breaks _ssl module, but it fails anyways
  13. mv Lib/plat-generic .
  14. rm -r Lib/plat-*
  15. mv plat-generic Lib/
  16. grep generated -r . -l | grep encodings | xargs rm
  17. # Regenerate encodings
  18. mkdir Tools/unicode/in Tools/unicode/out
  19. mv ../CP437.TXT Tools/unicode/in/
  20. pushd Tools/unicode
  21. python -B gencodec.py in/ ../../Lib/encodings/
  22. popd
  23. # Regenerate clinic
  24. find . -name "*.c" -or -name "*.h" | \
  25. xargs grep 'clinic input' -l | \
  26. xargs -L 1 python -B Tools/clinic/clinic.py
  27. # Regenerate unicode
  28. rm Modules/unicodedata_db.h Modules/unicodename_db.h Objects/unicodetype_db.h
  29. mv ../*.txt ../*.zip .
  30. python -B Tools/unicode/makeunicodedata.py
  31. # Regenerate sre_constants.h
  32. rm Modules/sre_constants.h
  33. cp Lib/sre_constants.py .
  34. python -B sre_constants.py
  35. mv sre_constants.h Modules/
  36. # Regenerate autoconf
  37. autoreconf-2.71 -fi
  38. }
  39. src_configure() {
  40. MACHDEP=linux ac_sys_system=Linux \
  41. CFLAGS="-U__DATE__ -U__TIME__" \
  42. LDFLAGS="-L${LIBDIR}" \
  43. ./configure \
  44. --build=i386-unknown-linux-musl \
  45. --host=i386-unknown-linux-musl \
  46. --prefix="${PREFIX}" \
  47. --libdir="${LIBDIR}" \
  48. --with-system-ffi
  49. }
  50. src_compile() {
  51. # Build pgen
  52. PYTHONDONTWRITEBYTECODE=1 make -j1 Parser/pgen
  53. # Regen graminit.c and graminit.h
  54. PYTHONDONTWRITEBYTECODE=1 make -j1 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. cp token.py _token.py
  60. python -B symbol.py
  61. python -B keyword.py
  62. python -B token.py
  63. # Now build the main program
  64. PYTHONDONTWRITEBYTECODE=1 make -j1 CFLAGS="-U__DATE__ -U__TIME__"
  65. }
  66. src_install() {
  67. default
  68. ln --symbolic --relative "${DESTDIR}${LIBDIR}/python3.4/lib-dynload" "${DESTDIR}${PREFIX}/lib/python3.4/lib-dynload"
  69. ln --symbolic --relative "${DESTDIR}${PREFIX}/bin/python3.4" "${DESTDIR}${PREFIX}/bin/python"
  70. # Remove non-reproducible .pyc/o files
  71. find "${DESTDIR}" -name "*.pyc" -delete
  72. find "${DESTDIR}" -name "*.pyo" -delete
  73. # This file is not reproducible and I don't care to fix it
  74. rm "${DESTDIR}/${PREFIX}/lib/python3.4/lib2to3/"{Pattern,}"Grammar3.4.10.final.0.pickle"
  75. }