PKGBUILD 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. # Maintainer: David P. <megver83@parabola.nu>
  2. _target=sh-elf
  3. pkgname=$_target-gcc
  4. pkgver=11.2.0
  5. _islver=0.24
  6. pkgrel=1
  7. #_snapshot=8-20210107
  8. pkgdesc='The GNU Compiler Collection - cross compiler for SuperH (bare-metal) target'
  9. arch=(x86_64 i686 armv7h)
  10. url='http://gcc.gnu.org/'
  11. license=(GPL LGPL FDL)
  12. depends=($_target-binutils libmpc zlib)
  13. makedepends=(gmp mpfr $_target-newlib)
  14. optdepends=("$_target-newlib: Standard C library ($_target target)")
  15. options=(!emptydirs !strip)
  16. source=(https://gcc.gnu.org/pub/gcc/releases/gcc-$pkgver/gcc-$pkgver.tar.xz{,.sig}
  17. #https://gcc.gnu.org/pub/gcc/snapshots/$_snapshot/gcc-$_snapshot.tar.xz
  18. https://libisl.sourceforge.io/isl-$_islver.tar.bz2)
  19. sha512sums=('d53a0a966230895c54f01aea38696f818817b505f1e2bfa65e508753fcd01b2aedb4a61434f41f3a2ddbbd9f41384b96153c684ded3f0fa97c82758d9de5c7cf'
  20. 'SKIP'
  21. 'aab3bddbda96b801d0f56d2869f943157aad52a6f6e6a61745edd740234c635c38231af20bc3f1a08d416a5e973a90e18249078ed8e4ae2f1d5de57658738e95')
  22. validpgpkeys=(33C235A34C46AA3FFB293709A328C3A2C3C45C06 # Jakub Jelinek <jakub@redhat.com>
  23. 13975A70E63C361C73AE69EF6EEB81F8981C74C7) # Richard Guenther <richard.guenther@gmail.com>
  24. if [ -n "$_snapshot" ]; then
  25. _basedir=gcc-$_snapshot
  26. else
  27. _basedir=gcc-$pkgver
  28. fi
  29. prepare() {
  30. cd $_basedir
  31. # link isl for in-tree builds
  32. ln -sf ../isl-$_islver isl
  33. echo $pkgver > gcc/BASE-VER
  34. # hack! - some configure tests for header files using "$CPP $CPPFLAGS"
  35. sed -i "/ac_cpp=/s/\$CPPFLAGS/\$CPPFLAGS -O2/" "$srcdir"/$_basedir/{libiberty,gcc}/configure
  36. mkdir $srcdir/gcc-build
  37. }
  38. build() {
  39. cd gcc-build
  40. # using -pipe causes spurious test-suite failures
  41. # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48565
  42. CFLAGS=${CFLAGS/-pipe/}
  43. CXXFLAGS=${CXXFLAGS/-pipe/}
  44. if [ "$CARCH" = i686 ]; then
  45. # using -Werror=format-security causes i686 build to fail
  46. CXXFLAGS+=' -Wno-error=format-security'
  47. fi
  48. $srcdir/$_basedir/configure \
  49. --target=$_target \
  50. --prefix=/usr \
  51. --libexecdir=/usr/lib \
  52. --with-sysroot=/usr/$_target \
  53. --with-native-system-header-dir=/include \
  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. --with-gnu-as \
  68. --with-gnu-ld \
  69. --with-system-zlib \
  70. --with-newlib \
  71. --with-python-dir=share/gcc-$_target \
  72. --with-gmp \
  73. --with-mpfr \
  74. --with-mpc \
  75. --with-isl \
  76. --with-libelf \
  77. --enable-gnu-indirect-function
  78. make
  79. }
  80. package() {
  81. make -C gcc-build DESTDIR="$pkgdir" install-gcc install-target-{libgcc,libstdc++-v3}
  82. # strip target binaries
  83. find "$pkgdir"/usr/lib/gcc/$_target/ "$pkgdir"/usr/$_target/lib \
  84. -type f -and \( -name \*.a -or -name \*.o \) \
  85. -exec $_target-objcopy -R .comment -R .note -R .debug_info -R .debug_aranges \
  86. -R .debug_pubnames -R .debug_pubtypes -R .debug_abbrev -R .debug_line \
  87. -R .debug_str -R .debug_ranges -R .debug_loc '{}' \;
  88. # strip host binaries
  89. find "$pkgdir/usr/bin/" "$pkgdir/usr/lib/gcc/$_target/" -type f \
  90. -and \( -executable \) -exec strip '{}' \;
  91. # Remove files that conflict with host gcc package
  92. rm -r "$pkgdir/usr/share/"{man/man7,info}
  93. }