# $Id: PKGBUILD 205571 2014-02-07 22:40:19Z allan $ # Maintainer: Allan McRae # Maintainer: Márcio Silva (Parabola) # toolchain build order: # {kernel}-api-headers->glibc->binutils->gcc->binutils->glibc # toolchain (for cross-compiler) build order: # {kernel}-api-headers(host system)->glibc(host system) # ->binutils(host system)->gcc(host system)->binutils(host system)->glibc(host system) # ->binutils(cross)->gcc(cross) # ->kernel-api-headers(target system)->glibc(target system) # ->binutils(target system)->gcc(target system)->binutils(target system) # ->glibc(target system) # NOTE: libtool requires rebuilt with each new gcc version #-------------------------------------------------------------------------------- # cross-compile table #-------------------------------------------------------------------------------- # +-------------+-------------+-----------------------------------------------------------------------------------------------------+-----------+---------+ # | -march | CARCH | CTARGET (_CTARGET) | Multilib | QEMU | # +-------------+-------------+-------------+-----------+---------------------------------------------------------------------------+-----------+---------+ # | _march | CARCH | _arch | | _os_target (GNU/*) | _multilib | - | # +-------------+-------------+-------------+-----------+---------------------------------------------------------------------------+-----------+---------+ # | mips64el | mips64el | mips64el | unknown | {linux,kfreebsd,kopenbsd,knetbsd}-gnu|elf | opt | bin/sys | # | mips64 | mips64 | mips64 | unknown | {linux,kfreebsd,kopenbsd,knetbsd}-gnu|elf | opt | bin/sys | # | * | mipsel | mipsel | unknown | {linux,kfreebsd,kopenbsd,knetbsd}-gnu|elf | no | bin/sys | # | * | mips | mips | unknown | {linux,kfreebsd,kopenbsd,knetbsd}-gnu|elf | no | bin/sys | # | x86_64 | x86_64 | x86_64 | unknown | gnu<|{linux,kfreebsd,kopenbsd,knetbsd,kdragonflybsd,kopensolaris}-gnu|elf | yes | bin/sys | # | i[3-7]86 | i[3-7]86 | i[3-7]86 | pc | gnu|{linux,kfreebsd,kopenbsd,knetbsd,kdragonflybsd,kopensolaris}-gnu|elf | no | bin/sys | # | armv8-a | aarch64 | aarch64 | unknown | {linux,kfreebsd,kopenbsd,knetbsd,kopensolaris}-gnu|elf | yes | - | # | armv8-a | aarch64_be | aarch64_be | unknown | {linux,kfreebsd,kopenbsd,knetbsd,kopensolaris}-gnu|elf | yes | - | # | armv7-a | armv7h | armv7l | unknown | {linux,kfreebsd,kopenbsd,knetbsd,kopensolaris}-gnueabihf|elf | no | bin/sys | # | armv6 | armv6h | armv6l | unknown | {linux,kfreebsd,kopenbsd,knetbsd,kopensolaris}-gnueabihf|elf | no | bin/sys | # | armv5te | arm | armv5tel | unknown | {linux,kfreebsd,kopenbsd,knetbsd,kopensolaris}-gnueabi | no | bin/sys | # | * | arm | arm | unknown | eabi | no | bin/sys | # | arm | armeb | armeb | unknown | {linux,kfreebsd,kopenbsd,knetbsd}-gnueabi|eabi | no | bin | # | sparc64 | sparc64 | sparc64 | unknown | {linux,kfreebsd,kopenbsd,knetbsd,kopensolaris}-gnu | opt | bin/sys | # | sparc | sparc | sparc | unknown | {linux,kopenbsd,knetbsd,kopensolaris}-gnu | no | bin/sys | # | - | ia64 | ia64 | unknown | {linux,kfreebsd,kopenbsd,knetbsd}-gnu | yes | - | # | - | s390 | s390 | ibm | linux-gnu | no | - | # | - | s390x | s390x | ibm | linux-gnu | no | bin/sys | #v| powerpc64 | powerpc64 | powerpc64 | unknown | {linux,kfreebsd,kopenbsd,knetbsd}-gnu{,eabi}|{elf,eabi} | opt | bin/sys |x|eabi #x| powerpc64le | powerpc64le | powerpc64le | unknown | {linux,kfreebsd,kopenbsd,knetbsd}-gnu{,eabi}|{elf,eabi} | opt | - | # | powerpc | powerpc | powerpc | unknown | {linux,kfreebsd,kopenbsd,knetbsd}-gnu{,eabi}|{elf,eabi} | no | bin/sys | # | powerpcle | powerpcle | powerpcle | unknown | {linux,kfreebsd,kopenbsd,knetbsd}-gnu{,eabi}|{elf,eabi} | no | - | # | - | spu | spu | unknown | elf | no | - | # | - | sh64 | sh64 | unknown | {linux,kopenbsd,knetbsd}-gnu|elf | opt | - | # | - | sh64le | sh64le | unknown | {linux,kopenbsd,knetbsd}-gnu|elf | opt | - | # | - | sh4 | sh4 | unknown | {linux,kopenbsd,knetbsd}-gnu|elf | no | bin/sys | # | - | sh4le | sh4le | unknown | {linux,kopenbsd,knetbsd}-gnu|elf | no | bin/sys | # | - | sh | sh | unknown | {linux,kopenbsd,knetbsd}-gnu|elf | no | - @ | # | - | shle | shle | unknown | {linux,kopenbsd,knetbsd}-gnu|elf | no | - @ | # | - | xtensa | xtensa | unknown | elf | no | sys | # | * | avr | avr | unknown | elf | no | - | # | * | m68k | m68k | unknown | gnu|{linux,kopenbsd,knetbsd}-gnu|elf | no | bin/sys | # | - | lm32 | lm32 | unknown | linux-gnu|elf | no | sys | # | - | or32 | or32 | unknown | linux-gnu<|elf< | no | bin/sys |x|linux-gnu # +-------------+-------------+-------------+-----------+---------------------------------------------------------------------------+-----------+---------+ # For "Wine" # +-------------+-------------+-------------+-----------+---------------------------------------------------------------------------+-----------+---------+ #i| * | x86_64 | x86_64 | unknown | mingw64 | yes | bin/sys | #i| * | i[3-7]86 | i[3-7]86 | unknown | mingw32 | no | bin/sys | #?| * | aarch64 | aarch64 | unknown | ??? | yes | - | #?| * | aarch64_be | aarch64_be | unknown | ??? | yes | - | #?| * | armv7h | armv7l | unknown | ??? | no | bin/sys | #?| * | armv6h | armv6l | unknown | ??? | no | bin/sys | #?| * | arm | armv5tel | unknown | ??? | no | bin/sys | #?| * | armeb | armeb | unknown | ??? | no | bin | # +-------------+-------------+-------------+-----------+---------------------------------------------------------------------------+-----------+---------+ # For "DOSBox" # +-------------+-------------+-------------+-----------+---------------------------------------------------------------------------+-----------+---------+ #i| * | i386 | i386 | pc | msdosdjgpp | no | bin/sys | # +-------------+-------------+-------------+-----------+---------------------------------------------------------------------------+-----------+---------+ # opt : Multilib is optional # * : Any supported by architecture. # - : None. # @ : bin/sys (Only sh4 and sh4l support) # < : experimental support. (future) #-------------------------------------------------------------------------------- # options #-------------------------------------------------------------------------------- # Hardware architecture: # options: "same", "mips64el", "x86_64", "i686" or "xtensa" _arch_target=xtensa # OS target: # system: or - # options: "gnu", "linux-gnu", "kfreebsd-gnu" or "elf" _os_target=elf #-------------------------------------------------------------------------------- # 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=binutils pkgname=$_target-$_pkgname pkgver=2.24 pkgrel=7.2 pkgdesc="A set of programs to assemble and manipulate binary and object files" arch=('i686' 'x86_64' 'mips64el') url="http://www.gnu.org/software/$_pkgname/" license=('GPL') groups=('cross-devel') depends=('glibc>=2.20' 'zlib') checkdepends=('dejagnu' 'bc') provides=("$_pkgname=$pkgver") conflicts=("$_pkgname") install=$_pkgname.install source=(ftp://ftp.gnu.org/gnu/$_pkgname/$_pkgname-${pkgver}.tar.bz2{,.sig} $_pkgname-2.24-lto-testsuite.patch $_pkgname-2.24-gold-testsuite-plugin.patch $_pkgname-2.24-shared-pie.patch $_pkgname-xtensa.patch::https://raw.githubusercontent.com/qca/open-ath9k-htc-firmware/1.3.2/local/patches/$_pkgname.patch) md5sums=('e0f71a7b2ddab0f8612336ac81d9636b' 'SKIP' 'e68a1f221545f082baa5bd417cd077af' 'e46bbb03abaa5db58c12247644dc4857' 'ec59461c4febab9cfe1c1ef33326bc50' '7077126d96e9a755a0eaddb5505efe68') validpgpkeys=('EAF1C276A747E9ED86210CBAC3126D3B4AE55E93') prepare() { cd ${srcdir}/$_pkgname-${pkgver} # hack! - libiberty configure tests for header files using "$CPP $CPPFLAGS" sed -i "/ac_cpp=/s/\$CPPFLAGS/\$CPPFLAGS -O2/" libiberty/configure # fix lto testsuite with gcc-4.9 - commits b35d44f1 and 37a6ac44 patch -p1 -i $srcdir/$_pkgname-2.24-lto-testsuite.patch # fix gold testsuite with gcc-4.9 - commit ae447ddd patch -p1 -i $srcdir/$_pkgname-2.24-gold-testsuite-plugin.patch # fix issues with -static -fPIE -pie - commit 4199e3b8 patch -p1 -i $srcdir/$_pkgname-2.24-shared-pie.patch # open-ath9k-htc-firmware patch on xtensa-unknown-elf [[ $_target == xtensa-unknown-elf ]] && patch -p1 -i ${srcdir}/$_pkgname-xtensa.patch mkdir ${srcdir}/$_pkgname-build } build() { cd ${srcdir}/$_pkgname-build if [[ $_target == xtensa-unknown-elf ]]; then ${srcdir}/$_pkgname-${pkgver}/configure --prefix=/usr \ --with-lib-path=/usr/lib:/usr/local/lib \ --with-bugurl=https://labs.parabola.nu/ \ --enable-shared --disable-nls \ --disable-werror --disable-multilib --target=$_target --program-prefix=$_target- else ${srcdir}/$_pkgname-${pkgver}/configure --prefix=/usr \ --with-lib-path=/usr/lib:/usr/local/lib \ --with-bugurl=https://labs.parabola.nu/ \ --enable-threads --enable-shared --with-pic \ --enable-ld=default --enable-gold --enable-plugins \ --disable-werror --target=$_target --program-prefix=$_target- fi # check the host environment and makes sure all the necessary tools are available make configure-host make tooldir=/usr } check() { cd ${srcdir}/$_pkgname-build # unset LDFLAGS as testsuite makes assumptions about which ones are active # ignore failures in gold testsuite... # do not abort on errors - manually check log files make -k LDFLAGS="" check || true } package() { cd ${srcdir}/$_pkgname-build make prefix=${pkgdir}/usr tooldir=${pkgdir}/usr install # link files for bin in addr2line c++filt dwp elfedit gprof ld{,.bfd,.gold} readelf size strings; do ln -s $_target-$bin $pkgdir/usr/bin/$bin; done if [[ $CHOST != $_target ]]; then for include in $(ls -1 $pkgdir/usr/$CHOST/$_target/include); do install -d $pkgdir/usr/include && ln -s $include $pkgdir/usr/include/$include; done for lib in $(ls -1 $pkgdir/usr/$CHOST/$_target/lib); do ln -s $lib $pkgdir/usr/lib/$lib; done fi for man in $(ls -1 $pkgdir/usr/share/man/man1); do ln -s $man $pkgdir/usr/share/man/man1/${man#$_target-}; done }