PKGBUILD 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. # Maintainer: David P. <megver83@parabola.nu>
  2. _target=arm-linux-gnueabi
  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 ARM GNU EABI little-endian 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. sha512sums=('e9e857bd81bf7a370307d6848c81b2f5403db8c7b5207f54bce3f3faac3bde63445684092c2bc1a2427cddb6f7746496d9fbbef05fbbd77f2810b2998f1f9173'
  17. 'SKIP')
  18. validpgpkeys=(D3A93CAD751C2AF4F8C7AD516C35B99309B5FA62 # Jakub Jelinek <jakub@redhat.com>
  19. 33C235A34C46AA3FFB293709A328C3A2C3C45C06 # Jakub Jelinek <jakub@redhat.com>
  20. 13975A70E63C361C73AE69EF6EEB81F8981C74C7) # Richard Guenther <richard.guenther@gmail.com>
  21. if [ -n "$_snapshot" ]; then
  22. _basedir=gcc-$_snapshot
  23. else
  24. _basedir=gcc-$pkgver
  25. fi
  26. prepare() {
  27. cd $_basedir
  28. echo $pkgver > gcc/BASE-VER
  29. mkdir $srcdir/gcc-build
  30. }
  31. build() {
  32. cd gcc-build
  33. # using -pipe causes spurious test-suite failures
  34. # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48565
  35. CFLAGS=${CFLAGS/-pipe/}
  36. CXXFLAGS=${CXXFLAGS/-pipe/}
  37. # Credits @allanmcrae
  38. # https://github.com/allanmcrae/toolchain/blob/f18604d70c5933c31b51a320978711e4e6791cf1/gcc/PKGBUILD
  39. # TODO: properly deal with the build issues resulting from this
  40. CFLAGS=${CFLAGS/-Werror=format-security/}
  41. CXXFLAGS=${CXXFLAGS/-Werror=format-security/}
  42. if [ "$CARCH" = i686 ]; then
  43. # using -Werror=format-security causes i686 build to fail
  44. CXXFLAGS+=' -Wno-error=format-security'
  45. fi
  46. $srcdir/$_basedir/configure \
  47. --target=$_target \
  48. --prefix=/usr \
  49. --libexecdir=/usr/lib \
  50. --enable-languages=c,c++ \
  51. --enable-plugins \
  52. --enable-shared \
  53. --disable-decimal-float \
  54. --disable-libffi \
  55. --disable-libgomp \
  56. --disable-libmudflap \
  57. --disable-libquadmath \
  58. --disable-libssp \
  59. --disable-libstdcxx-pch \
  60. --disable-nls \
  61. --disable-threads \
  62. --disable-tls \
  63. --disable-multilib \
  64. --with-gnu-as \
  65. --with-gnu-ld \
  66. --with-system-zlib \
  67. --with-gmp \
  68. --with-mpfr \
  69. --with-mpc \
  70. --with-isl \
  71. --with-libelf \
  72. --enable-gnu-indirect-function
  73. make all-gcc
  74. }
  75. package() {
  76. make -C gcc-build DESTDIR="$pkgdir" install-gcc
  77. # strip target binaries
  78. find "$pkgdir"/usr/lib/gcc/$_target/ \
  79. -type f -and \( -name \*.a -or -name \*.o \) \
  80. -exec $_target-objcopy -R .comment -R .note -R .debug_info -R .debug_aranges \
  81. -R .debug_pubnames -R .debug_pubtypes -R .debug_abbrev -R .debug_line \
  82. -R .debug_str -R .debug_ranges -R .debug_loc '{}' \;
  83. # strip host binaries
  84. find "$pkgdir/usr/bin/" "$pkgdir/usr/lib/gcc/$_target/" -type f \
  85. -and \( -executable \) -exec strip '{}' \;
  86. # Remove files that conflict with host gcc package
  87. rm -r "$pkgdir/usr/share/"{man/man7,info}
  88. }