summaryrefslogtreecommitdiff
path: root/cross/mips64el-unknown-linux-gnu-binutils
diff options
context:
space:
mode:
authorNicolás Reynolds <fauno@endefensadelsl.org>2014-02-18 01:56:34 +0000
committerNicolás Reynolds <fauno@endefensadelsl.org>2014-02-18 01:56:34 +0000
commit8185891e28635bdb83fdf4ba4391030912dae596 (patch)
tree66a946535bdd228514750233b2cc99dd1866ff64 /cross/mips64el-unknown-linux-gnu-binutils
parent60a11f87366fdfbd114cdc91ff813518858e5f8d (diff)
Tue Feb 18 01:56:27 UTC 2014
Diffstat (limited to 'cross/mips64el-unknown-linux-gnu-binutils')
-rw-r--r--cross/mips64el-unknown-linux-gnu-binutils/PKGBUILD129
1 files changed, 129 insertions, 0 deletions
diff --git a/cross/mips64el-unknown-linux-gnu-binutils/PKGBUILD b/cross/mips64el-unknown-linux-gnu-binutils/PKGBUILD
new file mode 100644
index 000000000..463c53e74
--- /dev/null
+++ b/cross/mips64el-unknown-linux-gnu-binutils/PKGBUILD
@@ -0,0 +1,129 @@
+# $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}"
+
+unset CFLAGS CXXFLAGS LDFLAGS
+
+pkgname=${_target}-binutils
+pkgver=2.22
+pkgrel=5
+_date=20120323
+pkgdesc="A set of programs to assemble and manipulate binary and object files for the MIPS architecture"
+arch=('i686' 'x86_64')
+url="http://www.gnu.org/software/binutils/"
+license=('GPL')
+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}
+ 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/
+
+ # 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
+
+ # put $target-* binaries into /usr/bin
+ mkdir -p ${pkgdir}/usr/bin
+ mv -v ${pkgdir}/${_sysroot}/usr/bin/${_target}-* ${pkgdir}/usr/bin/
+
+}