recipe 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. # Build recipe for binutils.
  2. #
  3. # Copyright (c) 2015-2018 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.31.1
  18. release=4
  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. patch -Np1 -i "${worktree}/patches/binutils/136_bfd_pic.patch"
  48. # Create a separate build directory
  49. rm -rf ../binutils-build
  50. mkdir ../binutils-build
  51. cd ../binutils-build
  52. # Set sane permissions
  53. chmod -R u+w,go-w,a+rX-s .
  54. ../${program}-${version}/configure \
  55. CFLAGS="$QICFLAGS" CXXFLAGS="$QICXXFLAGS" LDFLAGS="$QILDFLAGS" \
  56. $configure_args \
  57. $multilib_options \
  58. --libdir=/usr/lib${libSuffix} \
  59. --mandir=$mandir \
  60. --infodir=$infodir \
  61. --with-docdir=$docsdir \
  62. --enable-deterministic-archives \
  63. --enable-shared \
  64. --enable-gold=yes \
  65. --enable-ld=default \
  66. --enable-relro \
  67. --enable-lto \
  68. --enable-nls \
  69. --enable-plugins \
  70. --enable-threads \
  71. --enable-64-bit-bfd \
  72. --enable-targets=i386-efi-pe,x86_64-pep \
  73. --enable-install-libiberty \
  74. --disable-werror \
  75. --disable-compressed-debug-sections \
  76. --with-system-zlib \
  77. --build=$MACHTYPE
  78. make -j${jobs} tooldir=/usr/${MACHTYPE}
  79. #make -k check
  80. make -j${jobs} tooldir=/usr/${MACHTYPE} DESTDIR="$destdir" install-strip
  81. # Back to srcdir
  82. cd .. && cd "$srcdir"
  83. # Replace hard-links with relative soft-links for the package size
  84. (
  85. cd "${destdir}/usr/bin" && \
  86. rm -f ld ; ln -sf ld.bfd ld
  87. )
  88. (
  89. cd "${destdir}/usr/${MACHTYPE}/bin" && \
  90. for file in *
  91. do
  92. if test -x "../../bin/$file"
  93. then
  94. rm -f "$file" && ln -s "../../bin/$file" .
  95. fi
  96. done
  97. )
  98. # Compress info documents deleting index file for the package
  99. if test -d "${destdir}/$infodir"
  100. then
  101. rm -f "${destdir}/${infodir}/dir"
  102. lzip -9 "${destdir}/${infodir}"/*
  103. fi
  104. # Compress man pages
  105. if test -d "${destdir}/$mandir"
  106. then
  107. lzip -9 "${destdir}/${mandir}"/man?/*
  108. fi
  109. # Copy documentation
  110. mkdir -p "${destdir}${docsdir}"
  111. cp -p $docs "${destdir}${docsdir}/"
  112. # Delete temporary build directory
  113. cd -- "$TMPDIR"
  114. if test -d ./binutils-build
  115. then
  116. rm -rf ./binutils-build
  117. fi
  118. }