04-binutils 2.1 KB

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