summaryrefslogtreecommitdiff
path: root/cross/mips64el-unknown-linux-gnu-binutils
diff options
context:
space:
mode:
authorNicolás Reynolds <apoyosis@correo.inta.gob.ar>2012-04-17 20:37:01 -0300
committerNicolás Reynolds <apoyosis@correo.inta.gob.ar>2012-04-17 20:37:01 -0300
commit76480b6b18868754fc95ff41d02885898c54367f (patch)
treeb3c9945f331f2cadd2be8a7dba5b2097c519998f /cross/mips64el-unknown-linux-gnu-binutils
parent7a97ab610eea972771b91f51cb180f0f195b4da3 (diff)
Updating the cross toolchain for mips64el
Added patches from upstream and diff'ed with them. Binutils and linux-libre-api-headers are already built. GCC Core builts but `mips64el-unknown-linux-gnu-gcc -v dummy.c` fails because of missing -EL on i686-pc-linux-gnu-as. Exporting mips64el-...-binutils to the PATH solves the problem but mips64el-...-ld fails with missing crt*. No idea why target gcc decides to use the host as instead of the target one, since the PKGBUILD hasn't fundamentally changed.
Diffstat (limited to 'cross/mips64el-unknown-linux-gnu-binutils')
-rw-r--r--cross/mips64el-unknown-linux-gnu-binutils/PKGBUILD137
1 files changed, 108 insertions, 29 deletions
diff --git a/cross/mips64el-unknown-linux-gnu-binutils/PKGBUILD b/cross/mips64el-unknown-linux-gnu-binutils/PKGBUILD
index dd426fad7..463c53e74 100644
--- a/cross/mips64el-unknown-linux-gnu-binutils/PKGBUILD
+++ b/cross/mips64el-unknown-linux-gnu-binutils/PKGBUILD
@@ -1,5 +1,7 @@
-# Contributor: Vojtech Horky <vojta . horky at-symbol seznam . cz>
+# $Id: PKGBUILD 155399 2012-04-03 11:09:56Z allan $
+# Maintainer: Allan McRae <allan@archlinux.org>
+# toolchain build order: linux-api-headers->glibc->binutils->gcc->binutils->glibc
_pkgname=binutils
_target="mips64el-unknown-linux-gnu"
_sysroot="/usr/${_target}"
@@ -8,43 +10,120 @@ unset CFLAGS CXXFLAGS LDFLAGS
pkgname=${_target}-binutils
pkgver=2.22
-pkgrel=1
+pkgrel=5
+_date=20120323
pkgdesc="A set of programs to assemble and manipulate binary and object files for the MIPS architecture"
-url="http://www.gnu.org/software/binutils/"
arch=('i686' 'x86_64')
+url="http://www.gnu.org/software/binutils/"
license=('GPL')
-depends=('zlib')
-provices=("cross-${pkgname}")
-source=("ftp://ftp.gnu.org/gnu/binutils/${_pkgname}-${pkgver}.tar.bz2")
-md5sums=('ee0f10756c84979622b992a4a61ea3f5')
+groups=("${_target}-base-devel")
+depends=('glibc>=2.15' 'zlib')
+checkdepends=('dejagnu')
+options=('!libtool' '!distcc' '!ccache')
+provides=("cross-${pkgname}")
+source=(ftp://ftp.archlinux.org/other/${_pkgname}/${_pkgname}-${pkgver}_${_date}.tar.bz2)
+md5sums=('de2ac4298732827f8af706fc24020330')
+
+mksource() {
+ mkdir ${_pkgname}-${_date}
+ cd ${_pkgname}-${_date}
+ export _TAG=binutils-2_22-branch
+ export 'CVSROOT=:pserver:anoncvs@sourceware.org:/cvs/src'
+ cvs -z9 co -r $_TAG binutils || return 1
+ mv src binutils
+ tar -cvjf ../binutils-${pkgver}_${_date}.tar.bz2 binutils/*
+}
build() {
- cd ${srcdir}/${_pkgname}-${pkgver}
-
- CFLAGS=" -pipe "\
- CXXFLAGS=" -pipe "\
- ./configure --build=${CHOST} \
- --host=${CHOST} \
- --target=${_target} \
- --prefix=/usr \
- --disable-nls \
- --disable-multilib \
- --disable-werror \
- --enable-ld=yes \
- --enable-gold=no \
- --with-sysroot=${_sysroot}
-
- make
+ cd ${srcdir}
+ mkdir binutils-build && cd binutils-build
+
+ [[ $CARCH == "x86_64" ]] && CONFIGFLAG="--enable-64-bit-bfd --disable-multilib"
+ [[ $CARCH == "mips64el" ]] && CONFIGFLAG="--disable-multilib --disable-werror"
+
+ msg2 "Adding cross-toolchain flags"
+ CONFIGFLAG+=" --build=${CHOST} --host=${CHOST} --target=${_target} --with-sysroot=${_sysroot}"
+
+ CFLAGS=" -pipe " \
+ CXXFLAGS=" -pipe " \
+ ${srcdir}/binutils/configure --prefix=/usr \
+ --enable-ld=default --enable-gold \
+ --enable-plugins --enable-threads \
+ --disable-shared $CONFIGFLAG
+# CFLAGS=" -pipe "\
+# CXXFLAGS=" -pipe "\
+# ${srcdir}/binutils/configure --build=${CHOST} \
+# --host=${CHOST} \
+# --target=${_target} \
+# --prefix=/usr \
+# --disable-nls \
+# --disable-multilib \
+# --disable-werror \
+# --enable-ld=yes \
+# --enable-gold=no \
+# --with-sysroot=${_sysroot}
+
+ # check the host environment and makes sure all the necessary tools are available
+ msg2 "Configuring host"
+ make configure-host
+
+ msg2 "Make"
+ make tooldir=${pkgdir}/${_sysroot}/usr
+
+ msg2 "Make libiberty"
+ # Rebuild libiberty.a with -fPIC
+ cp -a libiberty libiberty-pic
+ make -C libiberty-pic clean
+ make CFLAGS="$CFLAGS -fPIC" -C libiberty-pic
+
+ msg2 "Make BFD"
+ # Rebuild libbfd.a with -fPIC
+ # hidden visability prevent 3rd party shared libraries exporting bfd non-stable API
+ cp -a bfd bfd-pic
+ make -C bfd-pic clean
+ make CFLAGS="$CFLAGS -fPIC -fvisibility=hidden" -C bfd-pic
+
+ msg2 "Make opcodes"
+ # Rebuild libopcodes.a with -fPIC
+ cp -a opcodes opcodes-pic
+ make -C opcodes-pic clean
+ make CFLAGS="$CFLAGS -fPIC" -C opcodes-pic
+}
+
+check() {
+ cd ${srcdir}/binutils-build
+
+ # do not abort on errors - manually check log files
+ make -k -j1 check || true
}
package() {
+ cd ${srcdir}/binutils-build
+ make prefix=${pkgdir}/${_sysroot}/usr tooldir=${pkgdir}/${_sysroot}/usr install
+
+ # Create include dir so gcc-core doesn't complain
+ mkdir -p ${pkgdir}${_sysroot}/usr/include
+
+ # Add some useful headers
+ install -m644 ${srcdir}/binutils/include/libiberty.h ${pkgdir}/${_sysroot}/usr/include/
+ install -m644 ${srcdir}/binutils/include/demangle.h ${pkgdir}/${_sysroot}/usr/include/
+
+ # install libraries rebuilt with -fPIC
+ install -m644 libiberty-pic/libiberty.a ${pkgdir}/${_sysroot}/usr/lib
+ install -m644 bfd-pic/libbfd.a ${pkgdir}/${_sysroot}/usr/lib
+ install -m644 opcodes/libopcodes.a ${pkgdir}/${_sysroot}/usr/lib
+
+ # Remove man pages
+ rm -fv ${pkgdir}/usr/share/
- cd ${srcdir}/${_pkgname}-${pkgver}
-
- make DESTDIR=${pkgdir} install
+ # Remove these symlinks, they are not ABI stable.
+ # Programs should compile static to the .a file.
+ rm -fv ${pkgdir}/${_sysroot}/usr/lib/lib{bfd,opcodes}.so
+ echo "INPUT ( /${_sysroot}/usr/lib/libbfd.a -liberty -lz )" >${pkgdir}/${_sysroot}/usr/lib/libbfd.so
+ echo "INPUT ( /${_sysroot}/usr/lib/libopcodes.a -lbfd )" >${pkgdir}/${_sysroot}/usr/lib/libopcodes.so
- rm -r ${pkgdir}/usr/{lib,share}
+ # put $target-* binaries into /usr/bin
+ mkdir -p ${pkgdir}/usr/bin
+ mv -v ${pkgdir}/${_sysroot}/usr/bin/${_target}-* ${pkgdir}/usr/bin/
-# Create include dir so gcc-core doesn't complain
- mkdir -p ${pkgdir}${_sysroot}/usr/include
}