PKGBUILD 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339
  1. # $Id$
  2. # Maintainer: Bartłomiej Piotrowski <bpiotrowski@archlinux.org>
  3. # Contributor: Allan McRae <allan@archlinux.org>
  4. # toolchain build order: linux-api-headers->glibc->binutils->gcc->binutils->glibc
  5. # NOTE: libtool requires rebuilt with each new gcc version
  6. # ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
  7. # - removed ada packages
  8. # - removed gnat (ada stuff) from gcc packaging
  9. # - disabled make check, too much stress, kills plugs :(
  10. # - specifid build host, disabled distcc
  11. # - replaced bugurl with our GitHub issue page
  12. # - patch to disable LDRD/STRD instructions on ARMv5
  13. noautobuild=1
  14. pkgname=(gcc gcc-libs gcc-fortran gcc-objc gcc-go)
  15. pkgver=9.1.0
  16. _majorver=${pkgver:0:1}
  17. _islver=0.21
  18. pkgrel=1
  19. pkgdesc='The GNU Compiler Collection'
  20. arch=(x86_64 armv7h)
  21. license=(GPL LGPL FDL custom)
  22. url='https://gcc.gnu.org'
  23. makedepends=(binutils libmpc doxygen python subversion)
  24. checkdepends=(dejagnu inetutils)
  25. options=(!emptydirs !distcc)
  26. #source=(https://sources.archlinux.org/other/gcc/gcc-${pkgver/+/-}.tar.xz{,.sig}
  27. source=(https://ftp.gnu.org/gnu/gcc/gcc-$pkgver/gcc-$pkgver.tar.xz{,.sig}
  28. #source=(gcc::svn://gcc.gnu.org/svn/gcc/branches/gcc-${_majorver}-branch
  29. http://isl.gforge.inria.fr/isl-${_islver}.tar.xz
  30. c89 c99
  31. bz90397.patch
  32. bz90949.patch
  33. 0001-ARMv5-disable-LDRD-STRD.patch)
  34. validpgpkeys=(F3691687D867B81B51CE07D9BBE43771487328A9 # bpiotrowski@archlinux.org
  35. 86CFFCA918CF3AF47147588051E8B148A9999C34 # evangelos@foutrelis.com
  36. 13975A70E63C361C73AE69EF6EEB81F8981C74C7 # richard.guenther@gmail.com
  37. 33C235A34C46AA3FFB293709A328C3A2C3C45C06) # Jakub Jelinek <jakub@redhat.com>
  38. sha256sums=('79a66834e96a6050d8fe78db2c3b32fb285b230b855d0a66288235bc04b327a0'
  39. 'SKIP'
  40. '777058852a3db9500954361e294881214f6ecd4b594c00da5eee974cd6a54960'
  41. 'de48736f6e4153f03d0a5d38ceb6c6fdb7f054e8f47ddd6af0a3dbf14f27b931'
  42. '2513c6d9984dd0a2058557bf00f06d8d5181734e41dcfe07be7ed86f2959622a'
  43. 'cc20d05bcc6cb35bf0944b391f0b0380af375f2a8a03ce1cd67835884bc41fac'
  44. 'c860819e730faf1621e1286ebe3a0179df6e25182b81a9ca0a3db02633982a14'
  45. '31e24baa9eee826d7d77dbcf8f1a6a44c92f771e52d21677acb8d76fac7ae204')
  46. _svnrev=264010
  47. _svnurl=svn://gcc.gnu.org/svn/gcc/branches/gcc-${_majorver}-branch
  48. _libdir=usr/lib/gcc/$CHOST/${pkgver%%+*}
  49. snapshot() {
  50. svn export -r${_svnrev} ${_svnurl} gcc-r${_svnrev}
  51. local datestamp basever _pkgver
  52. basever=$(< gcc-r${_svnrev}/gcc/BASE-VER)
  53. datestamp=$(< gcc-r${_svnrev}/gcc/DATESTAMP)
  54. _pkgver=${basever}-${datestamp}
  55. mv gcc-r${_svnrev} gcc-${_pkgver}
  56. tar cf - gcc-${_pkgver} | xz > gcc-${_pkgver}.tar.xz
  57. rm -rf gcc-${_pkgver}
  58. gpg -b gcc-${_pkgver}.tar.xz
  59. scp gcc-${_pkgver}.tar.xz{,.sig} sources.archlinux.org:/srv/ftp/other/gcc/
  60. echo
  61. echo "pkgver=${_pkgver/-/+}"
  62. }
  63. prepare() {
  64. [[ ! -d gcc ]] && ln -s gcc-${pkgver/+/-} gcc
  65. cd gcc
  66. # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90397
  67. patch -p0 -i "$srcdir/bz90397.patch"
  68. # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90949
  69. patch -p0 -i "$srcdir/bz90949.patch"
  70. # link isl for in-tree build
  71. ln -s ../isl-${_islver} isl
  72. # Do not run fixincludes
  73. sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in
  74. # Arch Linux installs x86_64 libraries /lib
  75. [[ $CARCH == "x86_64" ]] && sed -i '/m64=/s/lib64/lib/' gcc/config/i386/t-linux64
  76. # Arch Linux ARM installs aarch64 libraries /lib
  77. [[ $CARCH == "aarch64" ]] && sed -i '/lp64=/s/lib64/lib/' gcc/config/aarch64/t-aarch64-linux
  78. # hack! - some configure tests for header files using "$CPP $CPPFLAGS"
  79. sed -i "/ac_cpp=/s/\$CPPFLAGS/\$CPPFLAGS -O2/" {libiberty,gcc}/configure
  80. # ALARM: Specify build host types, triplet patch
  81. [[ $CARCH == "arm" ]] && CONFIGFLAG="--host=armv5tel-unknown-linux-gnueabi --build=armv5tel-unknown-linux-gnueabi --with-arch=armv5te --with-float=soft"
  82. [[ $CARCH == "armv6h" ]] && CONFIGFLAG="--host=armv6l-unknown-linux-gnueabihf --build=armv6l-unknown-linux-gnueabihf --with-arch=armv6 --with-float=hard --with-fpu=vfp"
  83. [[ $CARCH == "armv7h" ]] && CONFIGFLAG="--host=armv7l-unknown-linux-gnueabihf --build=armv7l-unknown-linux-gnueabihf --with-arch=armv7-a --with-float=hard --with-fpu=vfpv3-d16"
  84. [[ $CARCH == "aarch64" ]] && CONFIGFLAG="--host=aarch64-unknown-linux-gnu --build=aarch64-unknown-linux-gnu --with-arch=armv8-a --enable-fix-cortex-a53-835769 --enable-fix-cortex-a53-843419"
  85. mkdir -p "$srcdir/gcc-build"
  86. # Disable LDRD/STRD on ARMv5 (64-bit alignment issues)
  87. if patch --dry-run -sp1 -i ../0001-ARMv5-disable-LDRD-STRD.patch
  88. then
  89. patch -p1 -i ../0001-ARMv5-disable-LDRD-STRD.patch
  90. fi
  91. }
  92. build() {
  93. cd gcc-build
  94. # using -pipe causes spurious test-suite failures
  95. # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48565
  96. CFLAGS=${CFLAGS/-pipe/}
  97. CXXFLAGS=${CXXFLAGS/-pipe/}
  98. "$srcdir/gcc/configure" --prefix=/usr \
  99. --libdir=/usr/lib \
  100. --libexecdir=/usr/lib \
  101. --mandir=/usr/share/man \
  102. --infodir=/usr/share/info \
  103. --with-bugurl=https://github.com/archlinuxarm/PKGBUILDs/issues \
  104. --enable-languages=c,c++,fortran,go,lto,objc,obj-c++ \
  105. --enable-shared \
  106. --enable-threads=posix \
  107. --with-system-zlib \
  108. --with-isl \
  109. --enable-__cxa_atexit \
  110. --disable-libunwind-exceptions \
  111. --enable-clocale=gnu \
  112. --disable-libstdcxx-pch \
  113. --disable-libssp \
  114. --enable-gnu-unique-object \
  115. --enable-linker-build-id \
  116. --enable-lto \
  117. --enable-plugin \
  118. --enable-install-libiberty \
  119. --with-linker-hash-style=gnu \
  120. --enable-gnu-indirect-function \
  121. --disable-multilib \
  122. --disable-werror \
  123. --enable-checking=release \
  124. --enable-default-pie \
  125. --enable-default-ssp \
  126. $CONFIGFLAG
  127. make
  128. # make documentation
  129. make -C $CHOST/libstdc++-v3/doc doc-man-doxygen
  130. }
  131. check() {
  132. cd gcc-build
  133. # do not abort on error as some are "expected"
  134. make -k check || true
  135. "$srcdir/gcc/contrib/test_summary"
  136. }
  137. package_gcc-libs() {
  138. pkgdesc='Runtime libraries shipped by GCC'
  139. groups=(base)
  140. depends=('glibc>=2.27')
  141. options+=(!strip)
  142. provides=(libgo.so libgfortran.so libubsan.so libasan.so
  143. liblsan.so)
  144. if [[ $CARCH == "aarch64" ]]; then
  145. provides+=(libtsan.so)
  146. fi
  147. cd gcc-build
  148. make -C $CHOST/libgcc DESTDIR="$pkgdir" install-shared
  149. rm -f "$pkgdir/$_libdir/libgcc_eh.a"
  150. for lib in libatomic \
  151. libgfortran \
  152. libgo \
  153. libgomp \
  154. libitm \
  155. libquadmath \
  156. libsanitizer/{a,l,ub}san \
  157. libstdc++-v3/src \
  158. libvtv; do
  159. make -C $CHOST/$lib DESTDIR="$pkgdir" install-toolexeclibLTLIBRARIES
  160. done
  161. if [[ $CARCH == "x86_64" || $CARCH == "aarch64" ]]; then
  162. make -C $CHOST/libsanitizer/tsan DESTDIR="$pkgdir" install-toolexeclibLTLIBRARIES
  163. fi
  164. make -C $CHOST/libobjc DESTDIR="$pkgdir" install-libs
  165. make -C $CHOST/libstdc++-v3/po DESTDIR="$pkgdir" install
  166. for lib in libgomp \
  167. libitm \
  168. libquadmath; do
  169. make -C $CHOST/$lib DESTDIR="$pkgdir" install-info
  170. done
  171. # Install Runtime Library Exception
  172. install -Dm644 "$srcdir/gcc/COPYING.RUNTIME" \
  173. "$pkgdir/usr/share/licenses/gcc-libs/RUNTIME.LIBRARY.EXCEPTION"
  174. }
  175. package_gcc() {
  176. pkgdesc="The GNU Compiler Collection - C and C++ frontends"
  177. depends=("gcc-libs=$pkgver-$pkgrel" 'binutils>=2.28' libmpc)
  178. groups=('base-devel')
  179. options+=(staticlibs)
  180. cd gcc-build
  181. make -C gcc DESTDIR="$pkgdir" install-driver install-cpp install-gcc-ar \
  182. c++.install-common install-headers install-plugin install-lto-wrapper
  183. install -m755 -t "$pkgdir/usr/bin/" gcc/gcov{,-tool}
  184. install -m755 -t "$pkgdir/${_libdir}/" gcc/{cc1,cc1plus,collect2,lto1}
  185. make -C $CHOST/libgcc DESTDIR="$pkgdir" install
  186. rm -f "$pkgdir"/usr/lib/libgcc_s.so*
  187. make -C $CHOST/libstdc++-v3/src DESTDIR="$pkgdir" install
  188. make -C $CHOST/libstdc++-v3/include DESTDIR="$pkgdir" install
  189. make -C $CHOST/libstdc++-v3/libsupc++ DESTDIR="$pkgdir" install
  190. make -C $CHOST/libstdc++-v3/python DESTDIR="$pkgdir" install
  191. make DESTDIR="$pkgdir" install-libcc1
  192. install -d "$pkgdir/usr/share/gdb/auto-load/usr/lib"
  193. mv "$pkgdir"/usr/lib/libstdc++.so.6.*-gdb.py \
  194. "$pkgdir/usr/share/gdb/auto-load/usr/lib/"
  195. rm "$pkgdir"/usr/lib/libstdc++.so*
  196. make DESTDIR="$pkgdir" install-fixincludes
  197. make -C gcc DESTDIR="$pkgdir" install-mkheaders
  198. make -C lto-plugin DESTDIR="$pkgdir" install
  199. install -dm755 "$pkgdir"/usr/lib/bfd-plugins/
  200. ln -s /${_libdir}/liblto_plugin.so \
  201. "$pkgdir/usr/lib/bfd-plugins/"
  202. make -C $CHOST/libgomp DESTDIR="$pkgdir" install-nodist_{libsubinclude,toolexeclib}HEADERS
  203. make -C $CHOST/libitm DESTDIR="$pkgdir" install-nodist_toolexeclibHEADERS
  204. make -C $CHOST/libquadmath DESTDIR="$pkgdir" install-nodist_libsubincludeHEADERS
  205. make -C $CHOST/libsanitizer DESTDIR="$pkgdir" install-nodist_{saninclude,toolexeclib}HEADERS
  206. make -C $CHOST/libsanitizer/asan DESTDIR="$pkgdir" install-nodist_toolexeclibHEADERS
  207. if [[ $CARCH == "aarch64" ]]; then
  208. make -C $CHOST/libsanitizer/tsan DESTDIR="$pkgdir" install-nodist_toolexeclibHEADERS
  209. fi
  210. make -C $CHOST/libsanitizer/lsan DESTDIR="$pkgdir" install-nodist_toolexeclibHEADERS
  211. make -C libiberty DESTDIR="$pkgdir" install
  212. install -m644 libiberty/pic/libiberty.a "$pkgdir/usr/lib"
  213. make -C gcc DESTDIR="$pkgdir" install-man install-info
  214. rm "$pkgdir"/usr/share/man/man1/{gccgo,gfortran}.1
  215. rm "$pkgdir"/usr/share/info/{gccgo,gfortran}.info
  216. make -C libcpp DESTDIR="$pkgdir" install
  217. make -C gcc DESTDIR="$pkgdir" install-po
  218. # many packages expect this symlink
  219. ln -s gcc "$pkgdir"/usr/bin/cc
  220. # POSIX conformance launcher scripts for c89 and c99
  221. install -Dm755 "$srcdir/c89" "$pkgdir/usr/bin/c89"
  222. install -Dm755 "$srcdir/c99" "$pkgdir/usr/bin/c99"
  223. # install the libstdc++ man pages
  224. make -C $CHOST/libstdc++-v3/doc DESTDIR="$pkgdir" doc-install-man
  225. # byte-compile python libraries
  226. python -m compileall "$pkgdir/usr/share/gcc-${pkgver%%+*}/"
  227. python -O -m compileall "$pkgdir/usr/share/gcc-${pkgver%%+*}/"
  228. # Install Runtime Library Exception
  229. install -d "$pkgdir/usr/share/licenses/$pkgname/"
  230. ln -s /usr/share/licenses/gcc-libs/RUNTIME.LIBRARY.EXCEPTION \
  231. "$pkgdir/usr/share/licenses/$pkgname/"
  232. }
  233. package_gcc-fortran() {
  234. pkgdesc='Fortran front-end for GCC'
  235. depends=("gcc=$pkgver-$pkgrel")
  236. cd gcc-build
  237. make -C $CHOST/libgfortran DESTDIR="$pkgdir" install-cafexeclibLTLIBRARIES \
  238. install-{toolexeclibDATA,nodist_fincludeHEADERS}
  239. make -C $CHOST/libgomp DESTDIR="$pkgdir" install-nodist_fincludeHEADERS
  240. make -C gcc DESTDIR="$pkgdir" fortran.install-{common,man,info}
  241. install -Dm755 gcc/f951 "$pkgdir/${_libdir}/f951"
  242. ln -s gfortran "$pkgdir/usr/bin/f95"
  243. # Install Runtime Library Exception
  244. install -d "$pkgdir/usr/share/licenses/$pkgname/"
  245. ln -s /usr/share/licenses/gcc-libs/RUNTIME.LIBRARY.EXCEPTION \
  246. "$pkgdir/usr/share/licenses/$pkgname/"
  247. }
  248. package_gcc-objc() {
  249. pkgdesc='Objective-C front-end for GCC'
  250. depends=("gcc=$pkgver-$pkgrel")
  251. cd gcc-build
  252. make DESTDIR="$pkgdir" -C $CHOST/libobjc install-headers
  253. install -dm755 "$pkgdir/${_libdir}"
  254. install -m755 gcc/cc1obj{,plus} "$pkgdir/${_libdir}/"
  255. # Install Runtime Library Exception
  256. install -d "$pkgdir/usr/share/licenses/$pkgname/"
  257. ln -s /usr/share/licenses/gcc-libs/RUNTIME.LIBRARY.EXCEPTION \
  258. "$pkgdir/usr/share/licenses/$pkgname/"
  259. }
  260. package_gcc-go() {
  261. pkgdesc='Go front-end for GCC'
  262. depends=("gcc=$pkgver-$pkgrel")
  263. provides=("go=1.12.2")
  264. conflicts=(go)
  265. cd gcc-build
  266. make -C $CHOST/libgo DESTDIR="$pkgdir" install-exec-am
  267. make DESTDIR="$pkgdir" install-gotools
  268. make -C gcc DESTDIR="$pkgdir" go.install-{common,man,info}
  269. rm -f "$pkgdir"/usr/lib/libgo.so*
  270. install -Dm755 gcc/go1 "$pkgdir/${_libdir}/go1"
  271. # Install Runtime Library Exception
  272. install -d "$pkgdir/usr/share/licenses/$pkgname/"
  273. ln -s /usr/share/licenses/gcc-libs/RUNTIME.LIBRARY.EXCEPTION \
  274. "$pkgdir/usr/share/licenses/$pkgname/"
  275. }