diff options
Diffstat (limited to 'cross/cross-gcc/PKGBUILD')
-rw-r--r-- | cross/cross-gcc/PKGBUILD | 274 |
1 files changed, 115 insertions, 159 deletions
diff --git a/cross/cross-gcc/PKGBUILD b/cross/cross-gcc/PKGBUILD index edb2715c7..0436dc773 100644 --- a/cross/cross-gcc/PKGBUILD +++ b/cross/cross-gcc/PKGBUILD @@ -1,5 +1,5 @@ -# Maintainer (Arch): Allan McRae <allan@archlinux.org> -# Maintainer: Márcio Silva <coadde@hyperbola.info> +# Contributor: Márcio Silva <coadde@hyperbola.info> +# Maintainer: David P. <megver83@parabola.nu> # toolchain build order: {kernel}-api-headers->glibc->binutils->gcc->binutils->glibc @@ -68,184 +68,140 @@ # < : experimental support. (future) #-------------------------------------------------------------------------------- -# options +# Tips for build(): #-------------------------------------------------------------------------------- - -# Hardware architecture: - -# options: "same", "x86_64", "i686", "armv7l" or "xtensa" -_arch_target=armv7l - -# OS target: - -# system: <os> or <kernel>-<os> -# options: "gnu", "linux-gnu", "linux-gnueabihf" or "elf" -_os_target=linux-gnueabihf - -#-------------------------------------------------------------------------------- -# variables -#-------------------------------------------------------------------------------- - -# set the default values if it's not added -[[ -z $_arch_target ]] && _arch_target=same -[[ -z $_os_target ]] && _os_target=linux-gnu - -# set the value on _arch variable -if [[ $_arch_target == same ]]; then - _arch=$CARCH -else - _arch=$_arch_target -fi - -# set the value on _target variable -if [[ $_arch == i686 ]]; then - _target=$_arch-pc-$_os_target -else - _target=$_arch-unknown-$_os_target -fi - -#-------------------------------------------------------------------------------- - -_pkgname=gcc -pkgname=$_target-$_pkgname -pkgver=6.2.1 -_pkgverpatch=$pkgver -_pkgver=6 -_islver=0.16.1 +# * If builing without "--disable-multilib" make sure to have "--with-python-dir=share/gcc-$_target" +# +# * When building using `make' instead of `make all-gcc' append "--with-sysroot=/usr/$_target" and +# "--with-native-system-header-dir=/include". You'll also have to build and add a libc implementation +# in makedepends as $_target-<libc> (e.g. $_target-newlib or $_target-glibc) + +# Toolchain triplet: <_arch>-<machine>-<_os_target> +# <machine> is generally optional and uneeded +_target=x86_64-pc-linux-gnu + +# This are some options for names. Change $_target_name in pkgdesc according to the target architecture +case ${_target%%-*} in + arm*) _target_name=ARM + ;; + aarch64*) _target_name=ARM64 + ;; + xtensa) _target_name=Xtensa + ;; + sh*) _target_name=SuperH + ;; + powerpc*) _target_name=PowerPC + ;; + riscv*) _target_name=RISC-V + ;; + mips*) _target_name=MIPS + ;; + i686) _target_name=x86 + ;; + *) _target_name=${_target%%-*} + ;; +esac + +pkgname=$_target-gcc +_pkgver=7.3.0 +pkgver=$_pkgver+20180426 +_islver=0.19 pkgrel=1 -_commit=c2103c17 -pkgdesc="The GNU Compiler Collection" +_snapshot=${pkgver:0:1}-${pkgver##$_pkgver+} +pkgdesc="The GNU Compiler Collection - cross compiler for $_target_name target" arch=('i686' 'x86_64' 'armv7h' 'aarch64' 'mips64el') -license=('GPL' 'LGPL' 'FDL' 'custom') -url="http://$_pkgname.gnu.org" -makedepends=('binutils>=2.26' 'libmpc' 'doxygen' 'git') -checkdepends=('dejagnu' 'inetutils') -options=('!emptydirs') -source=(git://$_pkgname.gnu.org/git/$_pkgname.git#commit=${_commit} - http://isl.gforge.inria.fr/isl-${_islver}.tar.bz2 - https://repo.parabola.nu/other/$_pkgname/$_pkgverpatch/$_pkgname-xtensa.patch - mips-kfreebsd-gnu.patch) -md5sums=('SKIP' - 'ac1f25a0677912952718a51f5bc20f32' - '5e0f13db1555fd3f70da9642ab180386' - '43282cddb2080b1180f7b76d3a8a832c') - -# gcc-6.0 forces a changed triplet - need to address in pacman/devtools -[[ $CARCH == "x86_64" ]] && CHOST=x86_64-pc-linux-gnu - -_libdir="usr/lib/$_pkgname/$_target/$pkgver" +url='http://gcc.gnu.org/' +license=(GPL LGPL FDL) +depends=($_target-binutils libmpc zlib) +makedepends=(gmp mpfr) +#optdepends=("$_target-newlib: Standard C library ($_target target)") # Uncomment if building --with-newlib support +options=(!emptydirs !strip) +source=(#https://gcc.gnu.org/pub/gcc/releases/gcc-$_pkgver/gcc-$_pkgver.tar.bz2 + https://gcc.gnu.org/pub/gcc/snapshots/$_snapshot/gcc-$_snapshot.tar.xz + http://isl.gforge.inria.fr/isl-$_islver.tar.bz2) +sha512sums=('7b2c99e12b654b70d630499b00518121276b55673002f3eab02ffa79b24160170bcf0cac4aeee0c07101377fb48adb882d9c4a24ea479305aa10b8c7ab1642d7' + '08f4db964d9e02ec8aa9779378ed76e0ddf1d56f81f87664dbf787555ce496cdc87e836f8a51ae137f45e648c604870cce07ee45919eafb549e404afb8f27083') + +if [ -n "$_snapshot" ]; then + _basedir=gcc-$_snapshot +else + _basedir=gcc-$_pkgver +fi prepare() { - cd ${srcdir}/${_pkgname} + cd $_basedir - # link isl for in-tree build - ln -s ../isl-${_islver} isl + # link isl for in-tree builds + ln -sf ../isl-$_islver isl - # Do not run fixincludes - sed -i 's@\./fixinc\.sh@-c true@' $_pkgname/Makefile.in + echo $_pkgver > gcc/BASE-VER - # Parabola installs x86_64 libraries /lib - [[ $CARCH == "x86_64" ]] && sed -i '/m64=/s/lib64/lib/' $_pkgname/config/i386/t-linux64 + # Do not run fixincludes + sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in # hack! - some configure tests for header files using "$CPP $CPPFLAGS" - sed -i "/ac_cpp=/s/\$CPPFLAGS/\$CPPFLAGS -O2/" {libiberty,$_pkgname}/configure + sed -i "/ac_cpp=/s/\$CPPFLAGS/\$CPPFLAGS -O2/" "$srcdir"/$_basedir/{libiberty,gcc}/configure - # open-ath9k-htc-firmware patch - [[ $_target == xtensa-unknown-elf ]] && patch -p1 -i ${srcdir}/$_pkgname-xtensa.patch - - # mips patch on kfreebsd-gnu - [[ $_target == mips64el-unknown-kfreebsd-gnu ]] && \ - patch -p1 -i ${srcdir}/mips-kfreebsd-gnu.patch - - mkdir ${srcdir}/$_pkgname-build + mkdir $srcdir/build-gcc } build() { - cd ${srcdir}/$_pkgname-build + cd build-gcc # using -pipe causes spurious test-suite failures # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48565 CFLAGS=${CFLAGS/-pipe/} CXXFLAGS=${CXXFLAGS/-pipe/} - ${srcdir}/${_pkgname}/configure --prefix=/usr \ - --libdir=/usr/lib --libexecdir=/usr/lib \ - --mandir=/usr/share/man \ - --with-bugurl=https://labs.parabola.nu/ \ - --enable-languages=c,c++,lto \ - --enable-shared --enable-threads=posix --enable-libmpx \ - --with-system-zlib --with-isl --enable-__cxa_atexit \ - --disable-libunwind-exceptions --enable-clocale=gnu \ - --disable-libstdcxx-pch --disable-libssp \ - --enable-gnu-unique-object --enable-linker-build-id \ - --enable-lto --enable-plugin --enable-install-libiberty \ - --with-linker-hash-style=gnu --enable-gnu-indirect-function \ - --disable-multilib --disable-werror \ - --enable-checking=release --disable-nls \ - --target=$_target - make all-$_pkgname + $srcdir/$_basedir/configure \ + --target=$_target \ + --prefix=/usr \ + --libexecdir=/usr/lib \ + --enable-languages=c,c++ \ + --enable-plugins \ + --enable-shared \ + --disable-decimal-float \ + --disable-libffi \ + --disable-libgomp \ + --disable-libmudflap \ + --disable-libquadmath \ + --disable-libssp \ + --disable-libstdcxx-pch \ + --disable-nls \ + --disable-threads \ + --disable-tls \ + --disable-multilib \ + --with-gnu-as \ + --with-gnu-ld \ + --with-system-zlib \ + --with-gmp \ + --with-mpfr \ + --with-mpc \ + --with-isl \ + --with-libelf \ + --enable-gnu-indirect-function \ + --with-pkgversion='Parabola Repository' \ + --with-bugurl='https://labs.parabola.nu/' + + make $MAKEFLAGS all-gcc } package() { - pkgdesc="The GNU Compiler Collection - C and C++ frontends" - depends=("$_target-binutils>=2.26" 'libmpc') - groups=('cross-devel') - options=('staticlibs') - - cd ${srcdir}/$_pkgname-build - - make -C $_pkgname DESTDIR=${pkgdir} install-driver install-cpp install-$_pkgname-ar \ - c++.install-common install-headers install-plugin install-lto-wrapper - - install -m755 $_pkgname/gcov $pkgdir/usr/bin/$_target-gcov - install -m755 -t $pkgdir/${_libdir}/ $_pkgname/{cc1,cc1plus,collect2,lto1} - - make DESTDIR=${pkgdir} install-fixincludes - make -C $_pkgname DESTDIR=${pkgdir} install-mkheaders - make -C lto-plugin DESTDIR=${pkgdir} install - - make -C $_pkgname DESTDIR=${pkgdir} install-man - - make -C libcpp DESTDIR=${pkgdir} install - make -C $_pkgname DESTDIR=${pkgdir} install-po - - # many packages expect this symlink - ln -s $_target-$_pkgname ${pkgdir}/usr/bin/$_target-cc - - # POSIX conformance launcher scripts for c89 and c99 - cat > $pkgdir/usr/bin/$_target-c89 <<"EOF" -#!/bin/sh -fl="-std=c89" -for opt; do - case "$opt" in - -ansi|-std=c89|-std=iso9899:1990) fl="";; - -std=*) echo "`basename $0` called with non ANSI/ISO C option $opt" >&2 - exit 1;; - esac -done -exec gcc $fl ${1+"$@"} -EOF -sed -i "s|exec gcc|exec $_target-gcc|" $pkgdir/usr/bin/$_target-c89 - - cat > $pkgdir/usr/bin/$_target-c99 <<"EOF" -#!/bin/sh -fl="-std=c99" -for opt; do - case "$opt" in - -std=c99|-std=iso9899:1999) fl="";; - -std=*) echo "`basename $0` called with non ISO C99 option $opt" >&2 - exit 1;; - esac -done -exec gcc $fl ${1+"$@"} -EOF -sed -i "s|exec gcc|exec $_target-gcc|" $pkgdir/usr/bin/$_target-c99 - - chmod 755 $pkgdir/usr/bin/$_target-c{8,9}9 - - # Remove man documents that conflict with host version - rm -rf ${pkgdir}/usr/share/man/man7 - - # Remove unused dirs - rmdir ${pkgdir}/usr/{include,share/info} + cd build-gcc + + make DESTDIR="$pkgdir" install-gcc + + # strip target binaries + find "$pkgdir"/usr/lib/gcc/$_target/ -type f -and \( -name \*.a -or -name \*.o \) -exec $_target-objcopy -R .comment -R .note -R .debug_info -R .debug_aranges -R .debug_pubnames -R .debug_pubtypes -R .debug_abbrev -R .debug_line -R .debug_str -R .debug_ranges -R .debug_loc '{}' \; + # Use the following instead if building with `make' on build() + #find "$pkgdir"/usr/lib/gcc/$_target/$_pkgver "$pkgdir"/usr/$_target/lib -type f -and \( -name \*.a -or -name \*.o \) -exec $_target-objcopy -R .comment -R .note -R .debug_info -R .debug_aranges -R .debug_pubnames -R .debug_pubtypes -R .debug_abbrev -R .debug_line -R .debug_str -R .debug_ranges -R .debug_loc '{}' \; + + # strip host binaries + find "$pkgdir"/usr/bin/ "$pkgdir"/usr/lib/gcc/$_target/ -type f -and \( -executable \) -exec strip '{}' \; + + # Remove files that conflict with host gcc package + rm -r "$pkgdir"/usr/share/man/man7 + rm -r "$pkgdir"/usr/share/info + # Add the following if building with `make' on build() + #rm "$pkgdir"/usr/lib/libcc1.* } |