# $Id: Portfile,v 1.1 2006/03/06 20:41:26 mww Exp $

PortSystem 1.0

name			mipsel-linux-uclib
version			0.9.27
categories		cross
platforms		darwin
maintainers		mww@opendarwin.org
description		uClib library for mipsel-linux cross development
long_description	${description}

homepage		http://www.uclibc.org/
master_sites	http://www.uclibc.org/downloads/
distname		uClibc-${version}
checksums		sha1 e0de53949998253e25e6b946b564062babb723b4
use_bzip2		yes

patchfiles		patch-Makefile 100-gcc4_fix.patch \
				110-inet6_hosts_resolve.patch 120-more_standard_math.patch

dist_subdir		uclib

depends_build	port:coreutils
depends_lib		port:mipsel-linux-binutils port:mipsel-linux-gcc34

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

extract.post_args	"| tar -xf - --exclude '.cvsignore'"

post-extract {
	file copy ${filespath}/config.mips ${worksrcpath}/.config
}

patch.pre_args	-p1
post-patch {
	reinplace "s|.*UCLIBC_HAS_LFS.*|UCLIBC_HAS_LFS=n|g" ${worksrcpath}/.config
	reinplace "s|.*UCLIBC_HAS_WCHAR.*|UCLIBC_HAS_WCHAR=y|g" ${worksrcpath}/.config
	reinplace "s|^KERNEL_SOURCE=.*|KERNEL_SOURCE=${prefix}/cross/mipsel-linux-uclibc/include/linux/|g" \
		${worksrcpath}/.config
}

use_configure	no

build.env		PATH=${cprefix}/bin:$env(PATH)
build.args		PREFIX= DEVEL_PREFIX=/ RUNTIME_PREFIX=/ \
				HOSTCC=/usr/bin/gcc CROSS=${target}-
build.target	all

pre-destroot {
	xinstall -m 755 -d ${destroot}${cprefix}/uclibc/usr/lib
}
destroot.target	install_runtime install_dev
destroot.args	PREFIX=${destroot}${cprefix}/uclibc DEVEL_PREFIX=/usr/ \
				RUNTIME_PREFIX=/ HOSTCC=gcc
destroot.destdir
post-destroot {
	file delete -force ${destroot}${cprefix}/uclibc/usr/include
}

