05-binutils 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. # Build script for binutils.
  2. #
  3. # Copyright (c) 2014-2022 Matias Fonzo, <selk@dragora.org>.
  4. #
  5. # Licensed under the Apache License, Version 2.0 (the "License");
  6. # you may not use this file except in compliance with the License.
  7. # You may obtain a copy of the License at
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  11. # Unless required by applicable law or agreed to in writing, software
  12. # distributed under the License is distributed on an "AS IS" BASIS,
  13. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. # See the License for the specific language governing permissions and
  15. # limitations under the License.
  16. version=2.38.20220801_dc2474e7d20
  17. cd -- "$TMPDIR"
  18. rm -rf binutils-${version}
  19. unpack "${worktree}/sources/binutils-${version}.tar.lz"
  20. # Build instructions
  21. cd binutils-${version}
  22. # Apply patches from Fedora (Nick Clifton)
  23. patch -Np1 -i "${worktree}/patches/binutils/2.38/binutils-export-demangle.h.patch"
  24. patch -Np1 -i "${worktree}/patches/binutils/2.38/binutils-no-config-h-check.patch"
  25. patch -Np1 -i "${worktree}/patches/binutils/2.38/binutils-filename-in-error-messages.patch"
  26. patch -Np1 -i "${worktree}/patches/binutils/2.38/binutils-revert-PLT-elision.patch"
  27. patch -Np1 -i "${worktree}/patches/binutils/2.38/binutils-readelf-other-sym-info.patch"
  28. patch -Np1 -i "${worktree}/patches/binutils/2.38/binutils-2.27-aarch64-ifunc.patch"
  29. patch -Np1 -i "${worktree}/patches/binutils/2.38/binutils-do-not-link-with-static-libstdc++.patch"
  30. patch -Np1 -i "${worktree}/patches/binutils/2.38/binutils-special-sections-in-groups.patch"
  31. patch -Np1 -i "${worktree}/patches/binutils/2.38/binutils-gold-mismatched-section-flags.patch"
  32. patch -Np1 -i "${worktree}/patches/binutils/2.38/binutils-CVE-2019-1010204.patch"
  33. patch -Np1 -i "${worktree}/patches/binutils/2.38/binutils-gold-warn-unsupported.patch"
  34. patch -Np1 -i "${worktree}/patches/binutils/2.38/binutils-use-long-long.patch"
  35. patch -Np1 -i "${worktree}/patches/binutils/2.38/binutils-gold-i386-gnu-property-notes.patch"
  36. patch -Np1 -i "${worktree}/patches/binutils/2.38/binutils-autoconf-version.patch"
  37. patch -Np1 -i "${worktree}/patches/binutils/2.38/gcc12-libtool-no-rpath.patch"
  38. patch -Np1 -i "${worktree}/patches/binutils/2.38/binutils-section-type.patch"
  39. patch -Np1 -i "${worktree}/patches/binutils/2.38/binutils-gas-loc-view.patch"
  40. patch -Np1 -i "${worktree}/patches/binutils/2.38/binutils-do-not-use-debuginfod.patch"
  41. # Build in a separate directory
  42. rm -rf ../binutils-build
  43. mkdir ../binutils-build
  44. cd ../binutils-build
  45. # Import and export toolchain variables
  46. . "${worktree}/stages/env.d/cross-staticenv"
  47. ../binutils-${version}/configure \
  48. AR="$AR" AS="$AS" LD="$LD" RANLIB="$RANLIB" READELF="$READELF" STRIP="$STRIP" \
  49. CC="$BTCC" CXX="$BTCXX" \
  50. CFLAGS="$BTCFLAGS" CXXFLAGS="$BTCXXFLAGS" LDFLAGS="$BTLDFLAGS" \
  51. --prefix=/tools \
  52. --libdir=/tools/lib${libSuffix} \
  53. --build=$host \
  54. --host=$target \
  55. --target=$target \
  56. --enable-deterministic-archives \
  57. --enable-separate-code \
  58. --enable-relro \
  59. --enable-threads=auto \
  60. --enable-default-hash-style=gnu \
  61. --enable-64-bit-bfd \
  62. --enable-install-libiberty \
  63. --disable-compressed-debug-sections \
  64. --disable-generate-build-notes \
  65. --disable-nls \
  66. --disable-werror \
  67. --disable-ppl-version-check \
  68. --disable-cloog-version-check \
  69. --disable-gprofng \
  70. --disable-gdb \
  71. --with-mmap \
  72. --with-lib-path=/tools/lib \
  73. --with-pic \
  74. $multilib_options
  75. make -j${jobs} V=1 MAKEINFO="true"
  76. make -j${jobs} V=1 MAKEINFO="true" install
  77. # Make a new ld(1) containing another search path,
  78. # this is handled by "20-toolchain" (called from musl's recipe)
  79. make -C ld clean
  80. make -C ld LIB_PATH=/usr/lib${libSuffix}:/lib
  81. cp -f ld/ld-new /tools/bin
  82. # Unset some imported variables from file
  83. unset AR AS LD RANLIB READELF STRIP
  84. cd -- "$TMPDIR"
  85. cleanup()
  86. {
  87. rm -rf binutils-${version} binutils-build
  88. }