logo

live-bootstrap

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

pass1.sh (2841B)


  1. # SPDX-FileCopyrightText: 2023 fosslinux <fosslinux@aussies.space>
  2. #
  3. # SPDX-License-Identifier: GPL-3.0-or-later
  4. src_prepare() {
  5. default
  6. # Remove vendored zlib
  7. rm -r zlib/
  8. # Regen gperf file (because GCC's make rules suck)
  9. rm gcc/cp/cfns.h
  10. # (taken directly from gcc/cp/Make-lang.in)
  11. gperf -o -C -E -k '1-6,$' -j1 -D -N 'libc_name_p' -L C++ \
  12. gcc/cp/cfns.gperf --output-file gcc/cp/cfns.h
  13. # Regenerate autogen stuff
  14. autogen Makefile.def
  15. pushd fixincludes
  16. ./genfixes
  17. popd
  18. # Regenerate autotools
  19. # configure
  20. find . -name configure | sed 's:/configure::' | while read d; do
  21. pushd "${d}"
  22. AUTOMAKE=automake-1.15 ACLOCAL=aclocal-1.15 autoreconf-2.69 -fiv
  23. popd
  24. done
  25. # Because GCC is stupid, copy depcomp back in
  26. cp "${PREFIX}/share/automake-1.15/depcomp" .
  27. # Makefile.in only
  28. BACK="${PWD}"
  29. find . -type d \
  30. -exec test -e "{}/Makefile.am" -a ! -e "{}/configure" \; \
  31. -print | while read d; do
  32. d="$(readlink -f "${d}")"
  33. cd "${d}"
  34. # Find the appropriate configure script for automake
  35. while [ ! -e configure ]; do
  36. cd ..
  37. done
  38. automake-1.15 -fai "${d}/Makefile"
  39. cd "${BACK}"
  40. done
  41. # Remove bison generated files
  42. rm intl/plural.c
  43. # Remove flex generated files
  44. rm gcc/gengtype-lex.c
  45. # Remove unused generated files
  46. rm -r libgfortran/generated
  47. # intl/ Makefile is a bit broken because of new gettext
  48. sed -i 's/@USE_INCLUDED_LIBINTL@/no/' intl/Makefile.in
  49. # Regenerate crc table in libiberty/crc32.c
  50. pushd libiberty
  51. sed -n -e '38,65p' crc32.c > crcgen.c
  52. gcc -o crcgen crcgen.c
  53. head -n 69 crc32.c > crc32.c.new
  54. ./crcgen >> crc32.c.new
  55. tail -n +138 crc32.c >> crc32.c.new
  56. mv crc32.c.new crc32.c
  57. popd
  58. # Remove docs/translation
  59. find . -name "*.gmo" -delete
  60. find . -name "*.info" -delete
  61. }
  62. src_configure() {
  63. mkdir build
  64. cd build
  65. # std=gnu11 is the default for GCC10, so that is what it makes most
  66. # sense to build with. (default, std=gnu90 is too outdated).
  67. # For this GCC, we only build one stage, as extra is superfluous,
  68. # since we build GCC 12 straight after.
  69. CFLAGS="-std=gnu11" \
  70. LDFLAGS="-static" \
  71. ../configure \
  72. --prefix="${PREFIX}" \
  73. --libdir="${LIBDIR}" \
  74. --build=i386-unknown-linux-musl \
  75. --target=i386-unknown-linux-musl \
  76. --host=i386-unknown-linux-musl \
  77. --disable-bootstrap \
  78. --enable-static \
  79. --program-transform-name= \
  80. --enable-languages=c,c++ \
  81. --with-system-zlib \
  82. --disable-sjlj-exceptions \
  83. --disable-multilib \
  84. --enable-threads=posix \
  85. --disable-libsanitizer \
  86. --disable-libssp
  87. }