# $Id: Portfile,v 1.1 2006/03/06 20:39:55 mww Exp $

PortSystem 1.0

name			mipsel-linux-gcc34
version			3.4.4
categories		cross
platforms		darwin
maintainers		mww@opendarwin.org
description		gcc cross compiler for mips-linux with uClib
long_description	${description}

homepage		http://mipsel-linux-gcc34.sourceforge.net/
master_sites	gnu:/gcc/gcc-${version}
distname		gcc-${version}
checksums		sha1 dbe5935c04f799c77b49d6806f9d7db6d9b5cd35
use_bzip2		yes

dist_subdir		gcc

patchfiles		100-uclibc-conf.patch 200-uclibc-locale.patch \
				300-libstdc++-pic.patch 601-gcc34-arm-ldm.patch \
				602-sdk-libstdc++-includes.patch 700-pr15068-fix.patch \
				800-arm-bigendian.patch 810-arm-bigendian-uclibc.patch \
				arm-softfloat.patch.conditional

depends_lib		port:mipsel-linux-binutils port:mipsel-linux-uclib-headers

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

patch.pre_args	-p1

configure.env	AR_FOR_TARGET=${cprefix}/${target}/bin/ar \
				AS_FOR_TARGET=${cprefix}/${target}/bin/as \
				LD_FOR_TARGET=${cprefix}/${target}/bin/ld \
				NM_FOR_TARGET=${cprefix}/${target}/bin/nm \
				RANLIB_FOR_TARGET=${cprefix}/{target}/bin/ranlib \
				PATH=${cprefix}/bin:$env(PATH)

configure.pre_args	--prefix=${cprefix}/
configure.args	--target=${target} \
				--enable-languages=c \
				--disable-shared \
				--with-sysroot=${cprefix}/uclibc \
				--disable-__cxa_atexit \
				--enable-target-optspace \
				--with-gnu-ld \
				--disable-nls \
				--enable-multilib \
				--with-float=soft

build.env		${configure.env}

destroot.env	${configure.env}
post-destroot {
	file delete -force ${destroot}${cprefix}/info ${destroot}${cprefix}/man
	foreach b {gcc cpp} {
		system "cd ${destroot}${cprefid}/mipsel-linux-uclibc/bin \
			&& ln -s ../../bin/${target}-${b} ${b}"
	}
}

platform darwin 8 {
	configure.env-append CC=/usr/bin/gcc-4.0 CPP=/usr/bin/cpp-4.0 CXX=/usr/bin/g++-4.0
}

platform darwin powerpc {
	configure.args-append	--host=powerpc-apple-darwin \
		--build=powerpc-apple-darwin
}

