logo

live-bootstrap

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

pass1.sh (3699B)


  1. # SPDX-FileCopyrightText: 2022 Dor Askayo <dor.askayo@gmail.com>
  2. # SPDX-FileCopyrightText: 2021 Andrius Štikonas <andrius@stikonas.eu>
  3. # SPDX-FileCopyrightText: 2021 Paul Dersey <pdersey@gmail.com>
  4. # SPDX-FileCopyrightText: 2023 fosslinux <fosslinux@aussies.space>
  5. #
  6. # SPDX-License-Identifier: GPL-3.0-or-later
  7. src_prepare() {
  8. default
  9. # Remove unused generated files
  10. rm etc/Makefile.in etc/configure
  11. rm zlib/aclocal.m4 zlib/configure
  12. # Remove gprofng
  13. rm -r gprofng
  14. # Regenerate autoconf
  15. for dir in bfd binutils gas gold gprof intl ld libctf libiberty libsframe opcodes; do
  16. cd $dir
  17. AUTOPOINT=true ACLOCAL=aclocal-1.15 AUTOMAKE=automake-1.15 autoreconf-2.69 -fi
  18. cd ..
  19. done
  20. ACLOCAL=aclocal-1.15 autoreconf-2.69 -fi
  21. # Regenerate directories with Makefile.am only
  22. pushd gold
  23. automake-1.15 -fai testsuite/Makefile
  24. popd
  25. # Rebuild bison files
  26. touch -- */*.y
  27. rm binutils/arparse.c binutils/arparse.h
  28. rm binutils/defparse.c binutils/defparse.h
  29. rm binutils/mcparse.c binutils/mcparse.h
  30. rm binutils/rcparse.c binutils/rcparse.h
  31. rm binutils/sysinfo.c binutils/sysinfo.h
  32. rm gas/config/bfin-parse.c gas/config/bfin-parse.h
  33. rm gas/config/loongarch-parse.c gas/config/loongarch-parse.h
  34. rm gas/config/m68k-parse.c gas/config/rl78-parse.c
  35. rm gas/config/rl78-parse.h gas/config/rx-parse.c
  36. rm gas/config/rx-parse.h gas/itbl-parse.c
  37. rm gas/itbl-parse.h gold/yyscript.c
  38. rm gold/yyscript.h intl/plural.c
  39. rm ld/deffilep.c ld/deffilep.h
  40. rm ld/ldgram.c ld/ldgram.h
  41. # Rebuild flex generated files
  42. touch -- */*.l */*/*.l
  43. rm binutils/arlex.c binutils/deflex.c binutils/syslex.c
  44. rm gas/config/bfin-lex.c gas/config/loongarch-lex.c gas/itbl-lex.c
  45. rm ld/ldlex.c
  46. # Remove prebuilt texinfo files
  47. find . -type f -name '*.info*' \
  48. -not -wholename './binutils/sysroff.info' \
  49. -delete
  50. # Remove pregenerated opcodes files
  51. rm opcodes/i386-init.h opcodes/i386-tbl.h opcodes/i386-mnem.h
  52. rm opcodes/ia64-asmtab.c
  53. rm opcodes/z8k-opc.h
  54. rm opcodes/aarch64-asm-2.c opcodes/aarch64-opc-2.c opcodes/aarch64-dis-2.c
  55. rm $(grep -l 'MACHINE GENERATED' opcodes/*.c opcodes/*.h)
  56. rm libiberty/functions.texi
  57. # Regenerate MeP sections
  58. ./bfd/mep-relocs.pl
  59. # Manpages
  60. find . -type f \( -name '*.1' -or -name '*.man' \) -delete
  61. }
  62. src_configure() {
  63. for dir in intl libctf libiberty libsframe opcodes bfd binutils gas gprof ld; do
  64. cd $dir
  65. ./configure \
  66. --disable-nls \
  67. --enable-install-libiberty \
  68. --enable-deterministic-archives \
  69. --with-system-zlib \
  70. --build=i386-unknown-linux-musl \
  71. --host=i386-unknown-linux-musl \
  72. --target=i386-unknown-linux-musl \
  73. --program-prefix="" \
  74. --prefix="${PREFIX}" \
  75. --libdir="${LIBDIR}" \
  76. --with-sysroot= \
  77. --srcdir=.
  78. cd ..
  79. done
  80. }
  81. src_compile() {
  82. make -C bfd headers
  83. for dir in libiberty libsframe bfd opcodes libctf binutils gas gprof ld; do
  84. make "${MAKEJOBS}" -C $dir tooldir=${PREFIX} CFLAGS="-std=c99"
  85. done
  86. }
  87. src_install() {
  88. for dir in libiberty bfd opcodes libctf libsframe binutils gas gprof ld; do
  89. make -C $dir tooldir=${PREFIX} DESTDIR="${DESTDIR}" install
  90. done
  91. # Create triplet symlinks
  92. pushd "${DESTDIR}${PREFIX}/bin"
  93. for f in *; do
  94. ln -s "${PREFIX}/bin/${f}" "i386-unknown-linux-musl-${f}"
  95. done
  96. popd
  97. # FIXME: Binutils' manpages dates are not reproducible
  98. rm -r "${DESTDIR}${PREFIX}/share/man"
  99. }