# $Id: Portfile 86425 2011-10-25 16:13:08Z jmr@macports.org $

PortSystem 1.0

name			mipsel-linux-binutils
version			2.16.1
revision		3
categories		cross
license			GPL-2+
platforms		darwin
maintainers		nomaintainer
description		FSF Binutils for mipsel-linux cross development
long_description	${description}

homepage		http://mipsel-linux-binutils.sourceforge.net/
master_sites	http://ftp.gnu.org/gnu/binutils/
distname		binutils-${version}
checksums		sha1 5c80fd5657da47efc16a63fdd93ef7395319fbbf
use_bzip2		yes
dist_subdir		binutils
patchfiles		100-uclibc-conf.patch 110-uclibc-libtool-conf.patch \
				300-001_ld_makefile_patch.patch \
				300-006_better_file_error.patch \
				300-012_check_ldrunpath_length.patch \
				702-binutils-skip-comments.patch \
				spacepad.diff

set target		mipsel-linux-uclibc
set cprefix		${prefix}/cross/${target}

patch.pre_args	-p1

# checking size of long... configure: error: cannot determine a size for long
universal_variant	no

configure.pre_args --prefix=${cprefix}
configure.args	--target=${target} \
				--disable-werror \
				--disable-nls \
				--enable-multilib \
				--with-float=soft

platform darwin {
	if {$build_arch == "i386"} {
		configure.args-append --build=i686-apple-darwin${os.major} \
							  --host=i686-apple-darwin${os.major}
	} else {
		configure.args-append --build=${build_arch}-apple-darwin${os.major} \
							  --host=${build_arch}-apple-darwin${os.major}
	}
}

destroot.violate_mtree yes

post-destroot {
	file delete -force ${destroot}${cprefix}/info ${destroot}${cprefix}/man
	foreach f [glob -directory "${destroot}${cprefix}/lib" libiberty.a */libiberty.a] {
        file delete $f
    }
}
