logo

live-bootstrap

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

pass1.sh (2649B)


  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. rm Python/importlib.h
  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 unicode
  24. rm Modules/unicodedata_db.h Modules/unicodename_db.h Objects/unicodetype_db.h
  25. mv ../*.txt ../*.zip .
  26. python -B Tools/unicode/makeunicodedata.py
  27. # Regenerate sre_constants.h
  28. rm Modules/sre_constants.h
  29. cp Lib/sre_constants.py .
  30. python -B sre_constants.py
  31. # Regenerate _ssl_data.h
  32. python -B Tools/ssl/make_ssl_data.py /usr/include/openssl Modules/_ssl_data.h
  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. }
  47. src_compile() {
  48. # Build pgen
  49. PYTHONDONTWRITEBYTECODE=1 make "${MAKEJOBS}" Parser/pgen
  50. # Regen graminit.c and graminit.h
  51. PYTHONDONTWRITEBYTECODE=1 make "${MAKEJOBS}" Include/graminit.h
  52. # Regenerate some Python scripts using the other regenerated files
  53. # Must move them out to avoid using Lib/ module files which are
  54. # incompatible with running version of Python
  55. cp Lib/{symbol,keyword,token}.py .
  56. cp token.py _token.py
  57. python -B symbol.py
  58. python -B keyword.py
  59. python -B token.py
  60. # Now build the main program
  61. PYTHONDONTWRITEBYTECODE=1 make -j1 CFLAGS="-U__DATE__ -U__TIME__"
  62. }
  63. src_install() {
  64. default
  65. ln --symbolic --relative "${DESTDIR}${LIBDIR}/python3.3/lib-dynload" "${DESTDIR}${PREFIX}/lib/python3.3/lib-dynload"
  66. ln --symbolic --relative "${DESTDIR}${PREFIX}/bin/python3.3" "${DESTDIR}${PREFIX}/bin/python"
  67. # Remove non-reproducible .pyc/o files
  68. find "${DESTDIR}" -name "*.pyc" -delete
  69. find "${DESTDIR}" -name "*.pyo" -delete
  70. # This file is not reproducible and I don't care to fix it
  71. rm "${DESTDIR}/${PREFIX}/lib/python3.3/lib2to3/"{Pattern,}"Grammar3.3.7.final.0.pickle"
  72. }