01-binutils 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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
  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. patch -Np1 -i "${worktree}/patches/binutils/branch-updates.diff"
  42. # Build in a separate directory
  43. rm -rf ../binutils-build
  44. mkdir ../binutils-build
  45. cd ../binutils-build
  46. ../binutils-${version}/configure \
  47. AR="ar" AS="as" CC="$BTCC" CXX="$BTCXX" \
  48. CFLAGS="$BTCFLAGS" CXXFLAGS="$BTCXXFLAGS" LDFLAGS="$BTLDFLAGS" \
  49. --prefix="$crossdir" \
  50. --libdir="${crossdir}/lib${libSuffix}" \
  51. --host=$host \
  52. --target=$target \
  53. --enable-deterministic-archives \
  54. --enable-separate-code \
  55. --disable-compressed-debug-sections \
  56. --disable-generate-build-notes \
  57. --disable-werror \
  58. --disable-nls \
  59. --disable-ppl-version-check \
  60. --disable-cloog-version-check \
  61. --with-sysroot="${crossdir}/$target" \
  62. $multilib_options
  63. make -j${jobs} V=1 MAKEINFO="true"
  64. make -j${jobs} V=1 MAKEINFO="true" install
  65. cd -- "$TMPDIR"
  66. cleanup()
  67. {
  68. rm -rf binutils-${version} binutils-build
  69. }