logo

live-bootstrap

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

pass1.sh (1851B)


  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 Modules/glmodule.c
  8. rm Modules/unicodedata_db.h Objects/unicodetype_db.h
  9. rm Modules/sre_constants.h
  10. mv Lib/plat-generic .
  11. rm -r Lib/plat-*
  12. mv plat-generic Lib/
  13. grep generated -r . -l | grep encodings | xargs rm
  14. # Disable sre and unicodedata modules
  15. sed -i "/^_sre/d" Modules/Setup.in
  16. sed -i "/^unicodedata/d" Modules/Setup.in
  17. # Patch
  18. patch -Np1 -i disable-unicode.patch
  19. # Regenerate autoconf
  20. autoreconf-2.71 -fi
  21. }
  22. src_configure() {
  23. MACHDEP=linux ac_sys_system=Linux \
  24. ./configure \
  25. --prefix="${PREFIX}" \
  26. --libdir="${LIBDIR}" \
  27. --with-wctype-functions
  28. }
  29. src_compile() {
  30. # Build pgen
  31. pushd Parser
  32. make -j1 pgen
  33. popd
  34. # Regen graminit.c and graminit.h
  35. pushd Grammar
  36. make -j1 graminit.c
  37. popd
  38. # Regenerate some Python scripts using the other regenerated files
  39. gcc -o keyword keyword.c
  40. gcc -o token token.c
  41. # This gets all of the grammar tokens
  42. grep -E '\{1, "[^"]+"' Python/graminit.c | ./keyword > Lib/keyword.py.new
  43. mv Lib/keyword.py.new Lib/keyword.py
  44. ./token Lib/symbol.py < Include/graminit.h > Lib/symbol.py.new
  45. mv Lib/symbol.py.new Lib/symbol.py
  46. # These get all of the #defines that have to be translated
  47. grep '#define[[:space:]][A-Z]*[[:space:]][[:space:]]*[0-9][0-9]*' Include/token.h | ./token Lib/token.py > Lib/token.py.new
  48. mv Lib/token.py.new Lib/token.py
  49. # Now build the main program
  50. make -j1
  51. }
  52. src_install() {
  53. mkdir -p "${DESTDIR}/usr"
  54. default
  55. # Remove non-reproducible .pyc/o files
  56. find "${DESTDIR}" -name "*.pyc" -delete
  57. find "${DESTDIR}" -name "*.pyo" -delete
  58. }