recipe 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. # Build recipe for binutils.
  2. #
  3. # Copyright (c) 2015-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. program=binutils
  17. version=2.34
  18. release=2
  19. # Set 'outdir' for a nice and well-organized output directory
  20. outdir="${outdir}/${arch}/devel"
  21. tarname=${program}-${version}.tar.lz
  22. # Remote source(s)
  23. fetch=http://ftp.gnu.org/gnu/binutils/$tarname
  24. description="
  25. The GNU binary utilities.
  26. Binutils is a collection of programming tools for the manipulation
  27. of object code in various object file formats. These tools consist
  28. of the GNU linker (ld), the GNU assembler (as) and the profiler
  29. (gprof). There is also a collection of other binary tools like
  30. the disassembler (objdump).
  31. "
  32. homepage=http://www.gnu.org/software/binutils
  33. license="GPLv2+, GPLv3+, LGPLv2, LGPLv3"
  34. # Source documentation
  35. docs="COPYING* README"
  36. docsdir="${docdir}/${program}-${version}"
  37. # System-dependent
  38. MACHTYPE="$(cc -dumpmachine)"
  39. build()
  40. {
  41. set -e
  42. unpack "${tardir}/$tarname"
  43. cd "$srcdir"
  44. # Set sane permissions
  45. chmod -R u+w,go-w,a+rX-s .
  46. patch -Np1 -i "${worktree}/patches/binutils/branch-updates.diff"
  47. # Create a separate build directory
  48. rm -rf ../binutils-build
  49. mkdir ../binutils-build
  50. cd ../binutils-build
  51. # Set sane permissions
  52. chmod -R u+w,go-w,a+rX-s .
  53. # To pass extra options to binutils according to the architecture
  54. case $arch in
  55. i?86 | x86_64*)
  56. binutils_targets="--enable-targets=i386-efi-pe,x86_64-pep"
  57. ;;
  58. esac
  59. ../${program}-${version}/configure \
  60. CFLAGS="$QICFLAGS" CXXFLAGS="$QICXXFLAGS" LDFLAGS="$QILDFLAGS" \
  61. $configure_args \
  62. $multilib_options \
  63. --libdir=/usr/lib${libSuffix} \
  64. --mandir=$mandir \
  65. --infodir=$infodir \
  66. --with-docdir=$docsdir \
  67. --enable-deterministic-archives \
  68. --enable-shared \
  69. --enable-gold=yes \
  70. --enable-ld=default \
  71. --enable-threads=auto \
  72. --enable-relro \
  73. --enable-lto \
  74. --enable-nls \
  75. --enable-plugins \
  76. --enable-64-bit-bfd \
  77. --enable-install-libiberty \
  78. --enable-initfini-array \
  79. --disable-werror \
  80. --disable-separate-code \
  81. --disable-compressed-debug-sections \
  82. --with-system-zlib \
  83. --build=$MACHTYPE \
  84. $binutils_targets
  85. unset binutils_targets
  86. make -j${jobs} tooldir=/usr/${MACHTYPE}
  87. #make -k check
  88. make -j${jobs} tooldir=/usr/${MACHTYPE} DESTDIR="$destdir" install-strip
  89. # Back to srcdir
  90. cd .. && cd "$srcdir"
  91. # Replace hard-links with relative soft-links for the package size
  92. (
  93. cd "${destdir}/usr/bin" && \
  94. rm -f ld ; ln -sf ld.bfd ld
  95. )
  96. (
  97. cd "${destdir}/usr/${MACHTYPE}/bin" && \
  98. for file in *
  99. do
  100. if test -x "../../bin/$file"
  101. then
  102. rm -f "$file" && ln -s "../../bin/$file" .
  103. fi
  104. done
  105. )
  106. # Compress info documents deleting index file for the package
  107. if test -d "${destdir}/$infodir"
  108. then
  109. rm -f "${destdir}/${infodir}/dir"
  110. lzip -9 "${destdir}/${infodir}"/*
  111. fi
  112. # Compress man pages
  113. if test -d "${destdir}/$mandir"
  114. then
  115. lzip -9 "${destdir}/${mandir}"/man?/*
  116. fi
  117. # Copy documentation
  118. mkdir -p "${destdir}${docsdir}"
  119. cp -p $docs "${destdir}${docsdir}/"
  120. # Delete temporary build directory
  121. cd -- "$TMPDIR"
  122. if test -d ./binutils-build
  123. then
  124. rm -rf ./binutils-build
  125. fi
  126. }