PKGBUILD 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. # Contributor: Márcio Silva <coadde@hyperbola.info>
  2. # Maintainer: David P. <megver83@parabola.nu>
  3. # toolchain build order: {kernel}-api-headers->glibc->binutils->gcc->binutils->glibc
  4. # toolchain (for cross-compiler) build order:
  5. # {kernel}-api-headers(host system)->glibc(host system)
  6. # ->binutils(host system)->gcc(host system)->binutils(host system)->glibc(host system)
  7. # ->binutils(cross)->gcc(cross)
  8. # ->kernel-api-headers(target system)->glibc(target system)
  9. # ->binutils(target system)->gcc(target system)->binutils(target system)
  10. # ->glibc(target system)
  11. # NOTE: libtool requires rebuilt with each new gcc version
  12. #--------------------------------------------------------------------------------
  13. # cross-compile table
  14. #--------------------------------------------------------------------------------
  15. # +-------------+-------------+-----------------------------------------------------------------------------------------------------+-----------+---------+
  16. # | -march | CARCH | CTARGET (_CTARGET) | Multilib | QEMU |
  17. # +-------------+-------------+-------------+-----------+---------------------------------------------------------------------------+-----------+---------+
  18. # | _march | CARCH | _arch | <machine> | _os_target (GNU/*) | _multilib | - |
  19. # +-------------+-------------+-------------+-----------+---------------------------------------------------------------------------+-----------+---------+
  20. # | x86_64 | x86_64 | x86_64 | unknown | {linux,kfreebsd,kopenbsd,knetbsd,kdragonflybsd,kopensolaris}-gnu|elf | yes | bin/sys |
  21. # | i[3-7]86 | i[3-7]86 | i[3-7]86 | pc | gnu|{linux,kfreebsd,kopenbsd,knetbsd,kopensolaris}-gnu|elf | no | bin/sys |
  22. # | armv8-a | aarch64 | aarch64 | unknown | {linux,kfreebsd,knetbsd}-gnu|elf | no | bin/sys |
  23. # | armv8-a | aarch64_be | aarch64_be | unknown | {linux,kfreebsd,knetbsd}-gnu|elf | no | bin/sys |
  24. # | armv7-a | armv7h | armv7l | unknown | {linux,kfreebsd,kopenbsd,knetbsd,kopensolaris}-gnueabihf|elf | no | bin/sys |
  25. # | armv6 | armv6h | armv6l | unknown | {linux,kfreebsd,kopenbsd,knetbsd,kopensolaris}-gnueabihf|elf | no | bin/sys |
  26. # | armv5te | arm | armv5tel | unknown | {linux,kfreebsd,kopenbsd,knetbsd,kopensolaris}-gnueabi | no | bin/sys |
  27. # | * | arm | arm | unknown | eabi | no | bin/sys |
  28. # | arm | armeb | armeb | unknown | {linux,kfreebsd,kopenbsd,knetbsd}-gnueabi|eabi | no | bin |
  29. # | mips64el | mips64el | mips64el | unknown | {linux,kfreebsd,kopenbsd,knetbsd}-gnu|elf | no | bin/sys |
  30. # | mips64 | mips64 | mips64 | unknown | {linux,kfreebsd,kopenbsd,knetbsd}-gnu|elf | no | bin/sys |
  31. # | * | mipsel | mipsel | unknown | {linux,kfreebsd,kopenbsd,knetbsd}-gnu|elf | no | bin/sys |
  32. # | * | mips | mips | unknown | {linux,kfreebsd,kopenbsd,knetbsd}-gnu|elf | no | bin/sys |
  33. #v| powerpc64 | powerpc64 | powerpc64 | unknown | {linux,kfreebsd,kopenbsd,knetbsd}-gnu{,eabi}|{elf,eabi} | no | bin/sys |x|eabi
  34. #x| powerpc64le | powerpc64le | powerpc64le | unknown | {linux,kfreebsd,kopenbsd,knetbsd}-gnu{,eabi}|{elf,eabi} | no | bin |
  35. # | powerpc | powerpc | powerpc | unknown | {linux,kfreebsd,kopenbsd,knetbsd}-gnu{,eabi}|{elf,eabi} | no | bin/sys |
  36. # | powerpcle | powerpcle | powerpcle | unknown | {linux,kfreebsd,kopenbsd,knetbsd}-gnu{,eabi}|{elf,eabi} | no | - |
  37. # | - | spu | spu | unknown | elf | no | - |
  38. # | - | sh64 | sh64 | unknown | {linux,kopenbsd,knetbsd}-gnu|elf | no | - |
  39. # | - | sh64le | sh64le | unknown | {linux,kopenbsd,knetbsd}-gnu|elf | no | - |
  40. # | - | sh4 | sh4 | unknown | {linux,kopenbsd,knetbsd}-gnu|elf | no | bin/sys |
  41. # | - | sh4le | sh4le | unknown | {linux,kopenbsd,knetbsd}-gnu|elf | no | bin/sys |
  42. # | - | sh | sh | unknown | {linux,kopenbsd,knetbsd}-gnu|elf | no | - @ |
  43. # | - | shle | shle | unknown | {linux,kopenbsd,knetbsd}-gnu|elf | no | - @ |
  44. # | - | m68k | m68k | unknown | gnu|{linux,knetbsd}-gnu|elf | no | bin/sys |
  45. # | - | avr | avr | unknown | linux-gnu|elf | no | - |
  46. # | - | xtensa | xtensa | unknown | linux-gnu|elf | no | sys |
  47. # | - | lm32 | lm32 | unknown | linux-gnu|elf | no | sys |
  48. # | - | or32 | or32 | unknown | linux-gnu|elf | no | bin/sys |x|linux-gnu
  49. # +-------------+-------------+-------------+-----------+---------------------------------------------------------------------------+-----------+---------+
  50. # For "Wine, Darling and DOSBox"
  51. # +-------------+-------------+-------------+-----------+---------------------------------------------------------------------------+-----------+---------+
  52. # | x86_64 | x86_64 | x86_64 | unknown | mingw64(Wine)|darwin | yes | bin/sys |
  53. # | i[3-7]86 | i[3-7]86 | i[3-7]86 | pc | mingw32(Wine)|msdosdjgpp(DOSBox)|darwin | no | bin/sys |
  54. # | armv7-a | armv7h | armv7l | unknown | mingw-arm(Wine)|darwin | no | bin/sys |
  55. # | powerpc | powerpc | powerpc | unknown | darwin | no | bin/sys |
  56. # +-------------+-------------+-------------+-----------+---------------------------------------------------------------------------+-----------+---------+
  57. # opt : Multilib is optional
  58. # * : Any supported by architecture.
  59. # - : None.
  60. # @ : bin/sys (Only sh4 and sh4l support)
  61. # < : experimental support. (future)
  62. #--------------------------------------------------------------------------------
  63. # Choosing the correct pkgdesc
  64. #--------------------------------------------------------------------------------
  65. # You must know wether your toolchain is a bare-metal one, if it's specifically for big-endian or
  66. # little-endian order and know its full name, if possible. Here are some useful tips:
  67. #
  68. # * If the toolchain has no operating system (see the toolchain triplet, <_os_target>), then it's a
  69. # bare-metal toolchain, in which case you have to specify it in the pkgdesc
  70. #
  71. # * Do a bit of research in forums, wikis and documents about the target you plan to build, a good
  72. # idea is to see the description that other distros put (e.g. Debian) if they have the same toolchain
  73. #
  74. # Example: arm-linux-gnueabi-{gcc,binutils,$etc}
  75. # This toolchain has GNU/Linux as OS, so it's not a bare-metal one. It's for armel, which
  76. # stands for "ARM EABI little-endian", but the gnueabi part means it uses the GNU EABI. You can find
  77. # that info in Debian's gcc-arm-linux-gnueabi and a couple of FLOSS and programmers community forums.
  78. # Toolchain triplet: <_arch>-<machine>-<_os_target>
  79. # <machine> is generally optional and uneeded
  80. _target=x86_64-pc-linux-gnu
  81. # This are some options for names. Change $_target_name in pkgdesc according to the target architecture
  82. case ${_target%%-*} in
  83. arm*) _target_name=ARM
  84. ;;
  85. aarch64*) _target_name=ARM64
  86. ;;
  87. xtensa) _target_name=Xtensa
  88. ;;
  89. sh*) _target_name=SuperH
  90. ;;
  91. powerpc*) _target_name=PowerPC
  92. ;;
  93. riscv*) _target_name=RISC-V
  94. ;;
  95. mips*) _target_name=MIPS
  96. ;;
  97. i686) _target_name=x86
  98. ;;
  99. *) _target_name=${_target%%-*}
  100. ;;
  101. esac
  102. pkgname=$_target-binutils
  103. pkgver=2.34
  104. pkgrel=1
  105. pkgdesc="A set of programs to assemble and manipulate binary and object files for the $_target_name target"
  106. arch=('i686' 'x86_64' 'armv7h' 'aarch64' 'mips64el')
  107. url='https://www.gnu.org/software/binutils/'
  108. license=(GPL)
  109. depends=(zlib)
  110. source=(https://ftp.gnu.org/gnu/binutils/binutils-$pkgver.tar.bz2{,.sig})
  111. sha512sums=('f47e7304e102c7bbc97958a08093e27796b9051d1567ce4fbb723d39ef3e29efa325ee14a1bdcc462a925a7f9bbbc9aee28294c6dc23850f371030f3835a8067'
  112. 'SKIP')
  113. validpgpkeys=('EAF1C276A747E9ED86210CBAC3126D3B4AE55E93' # Tristan Gingold <gingold@adacore.com>
  114. '3A24BC1E8FB409FA9F14371813FCEF89DD9E3C4F') # Nick Clifton (Chief Binutils Maintainer) <nickc@redhat.com>
  115. prepare() {
  116. cd binutils-$pkgver
  117. sed -i "/ac_cpp=/s/\$CPPFLAGS/\$CPPFLAGS -O2/" libiberty/configure
  118. }
  119. build() {
  120. cd binutils-$pkgver
  121. if [ "${CARCH}" != "i686" ]; then
  122. # enabling gold linker at i686 makes the install fail
  123. enable_gold='--enable-gold'
  124. fi
  125. ./configure --target=$_target \
  126. --with-sysroot=/usr/$_target \
  127. --prefix=/usr \
  128. --disable-multilib \
  129. --with-gnu-as \
  130. --with-gnu-ld \
  131. --disable-nls \
  132. --enable-ld=default \
  133. $enable_gold \
  134. --enable-plugins \
  135. --enable-deterministic-archives
  136. make
  137. }
  138. check() {
  139. cd binutils-$pkgver
  140. # unset LDFLAGS as testsuite makes assumptions about which ones are active
  141. # do not abort on errors - manually check log files
  142. make LDFLAGS="" -k check || true
  143. }
  144. package() {
  145. cd binutils-$pkgver
  146. make DESTDIR="$pkgdir" install
  147. # Remove file conflicting with host binutils and manpages for MS Windows tools
  148. rm "$pkgdir"/usr/share/man/man1/$_target-{dlltool,windres,windmc}*
  149. # Remove info documents that conflict with host version
  150. rm -r "$pkgdir"/usr/share/info
  151. }