05-binutils 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. # Build script for binutils.
  2. #
  3. # Copyright (c) 2014-2021 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.35.2
  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/binutils-export-demangle.h.patch"
  24. patch -Np1 -i "${worktree}/patches/binutils/binutils-no-config-h-check.patch"
  25. patch -Np1 -i "${worktree}/patches/binutils/binutils-gold-warn-unsupported.patch"
  26. patch -Np1 -i "${worktree}/patches/binutils/binutils-use-long-long.patch"
  27. #patch -Np1 -i "${worktree}/patches/binutils/branch-updates.diff"
  28. # Build in a separate directory
  29. rm -rf ../binutils-build
  30. mkdir ../binutils-build
  31. cd ../binutils-build
  32. # Import and export toolchain variables
  33. . "${worktree}/stages/env.d/cross-staticenv"
  34. ../binutils-${version}/configure \
  35. AR="$AR" AS="$AS" LD="$LD" RANLIB="$RANLIB" READELF="$READELF" STRIP="$STRIP" \
  36. CC="$BTCC" CXX="$BTCXX" \
  37. CFLAGS="$BTCFLAGS" CXXFLAGS="$BTCXXFLAGS" LDFLAGS="$BTLDFLAGS" \
  38. --prefix=/tools \
  39. --libdir=/tools/lib${libSuffix} \
  40. --build=$host \
  41. --host=$target \
  42. --target=$target \
  43. --enable-deterministic-archives \
  44. --enable-relro \
  45. --enable-threads=auto \
  46. --enable-default-hash-style=gnu \
  47. --enable-64-bit-bfd \
  48. --enable-install-libiberty \
  49. --disable-compressed-debug-sections \
  50. --disable-nls \
  51. --disable-werror \
  52. --disable-ppl-version-check \
  53. --disable-cloog-version-check \
  54. --with-lib-path=/tools/lib \
  55. $multilib_options
  56. make -j${jobs} MAKEINFO="true"
  57. make -j${jobs} MAKEINFO="true" install
  58. # Make a new ld(1) containing another search path,
  59. # this is handled by "20-toolchain" (called from musl's recipe)
  60. make -C ld clean
  61. make -C ld LIB_PATH=/usr/lib${libSuffix}:/lib
  62. cp -f ld/ld-new /tools/bin
  63. # Unset some imported variables from file
  64. unset AR AS LD RANLIB READELF STRIP
  65. cd -- "$TMPDIR"
  66. cleanup()
  67. {
  68. rm -rf binutils-${version} binutils-build
  69. }