logo

live-bootstrap

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

pass1.sh (2567B)


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