PKGBUILD 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. # Maintainer: David P. <megver83@parabola.nu>
  2. _target=xtensa-elf
  3. pkgname=$_target-gcc
  4. pkgver=12.2.0
  5. pkgrel=1
  6. #_snapshot=8-20210107
  7. pkgdesc='The GNU Compiler Collection - cross compiler for Xtensa (bare-metal) target'
  8. arch=(x86_64 i686 armv7h)
  9. url='http://gcc.gnu.org/'
  10. license=(GPL LGPL FDL)
  11. depends=($_target-binutils libmpc zlib libisl zstd)
  12. makedepends=(gmp mpfr)
  13. options=(!emptydirs !strip !lto)
  14. source=(https://gcc.gnu.org/pub/gcc/releases/gcc-$pkgver/gcc-$pkgver.tar.xz{,.sig}
  15. #https://gcc.gnu.org/pub/gcc/snapshots/$_snapshot/gcc-$_snapshot.tar.xz
  16. gcc.patch)
  17. sha512sums=('e9e857bd81bf7a370307d6848c81b2f5403db8c7b5207f54bce3f3faac3bde63445684092c2bc1a2427cddb6f7746496d9fbbef05fbbd77f2810b2998f1f9173'
  18. 'SKIP'
  19. '7637408259cef4b14a2f41690bbc769ad0dc6cf4d1c782405526aeb58f68193269af6882b23fb57c3521174e45709ed2d54f0af1f835646e70a3bfd9f626aad9')
  20. validpgpkeys=(D3A93CAD751C2AF4F8C7AD516C35B99309B5FA62 # Jakub Jelinek <jakub@redhat.com>
  21. 33C235A34C46AA3FFB293709A328C3A2C3C45C06 # Jakub Jelinek <jakub@redhat.com>
  22. 13975A70E63C361C73AE69EF6EEB81F8981C74C7) # Richard Guenther <richard.guenther@gmail.com>
  23. if [ -n "$_snapshot" ]; then
  24. _basedir=gcc-$_snapshot
  25. else
  26. _basedir=gcc-$pkgver
  27. fi
  28. prepare() {
  29. cd $_basedir
  30. # https://github.com/qca/open-ath9k-htc-firmware/tree/master/local/patches
  31. patch -Np1 -i ../gcc.patch
  32. echo $pkgver > gcc/BASE-VER
  33. mkdir $srcdir/gcc-build
  34. }
  35. build() {
  36. cd gcc-build
  37. # using -pipe causes spurious test-suite failures
  38. # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48565
  39. CFLAGS=${CFLAGS/-pipe/}
  40. CXXFLAGS=${CXXFLAGS/-pipe/}
  41. # Credits @allanmcrae
  42. # https://github.com/allanmcrae/toolchain/blob/f18604d70c5933c31b51a320978711e4e6791cf1/gcc/PKGBUILD
  43. # TODO: properly deal with the build issues resulting from this
  44. CFLAGS=${CFLAGS/-Werror=format-security/}
  45. CXXFLAGS=${CXXFLAGS/-Werror=format-security/}
  46. if [ "$CARCH" = i686 ]; then
  47. # using -Werror=format-security causes i686 build to fail
  48. CXXFLAGS+=' -Wno-error=format-security'
  49. fi
  50. $srcdir/$_basedir/configure \
  51. --target=$_target \
  52. --prefix=/usr \
  53. --libexecdir=/usr/lib \
  54. --enable-languages=c,c++ \
  55. --enable-plugins \
  56. --enable-shared \
  57. --disable-decimal-float \
  58. --disable-libffi \
  59. --disable-libgomp \
  60. --disable-libmudflap \
  61. --disable-libquadmath \
  62. --disable-libssp \
  63. --disable-libstdcxx-pch \
  64. --disable-nls \
  65. --disable-threads \
  66. --disable-tls \
  67. --disable-multilib \
  68. --with-gnu-as \
  69. --with-gnu-ld \
  70. --with-system-zlib \
  71. --with-gmp \
  72. --with-mpfr \
  73. --with-mpc \
  74. --with-isl \
  75. --with-libelf \
  76. --enable-gnu-indirect-function
  77. make all-gcc
  78. }
  79. package() {
  80. make -C gcc-build DESTDIR="$pkgdir" install-gcc
  81. # strip target binaries
  82. find "$pkgdir"/usr/lib/gcc/$_target/ \
  83. -type f -and \( -name \*.a -or -name \*.o \) \
  84. -exec $_target-objcopy -R .comment -R .note -R .debug_info -R .debug_aranges \
  85. -R .debug_pubnames -R .debug_pubtypes -R .debug_abbrev -R .debug_line \
  86. -R .debug_str -R .debug_ranges -R .debug_loc '{}' \;
  87. # strip host binaries
  88. find "$pkgdir/usr/bin/" "$pkgdir/usr/lib/gcc/$_target/" -type f \
  89. -and \( -executable \) -exec strip '{}' \;
  90. # Remove files that conflict with host gcc package
  91. rm -r "$pkgdir/usr/share/"{man/man7,info}
  92. }