# $Id: Portfile,v 1.1 2006/03/06 20:42:24 mww Exp $

PortSystem 1.0

name			mipsel-linux-uclib-headers
version			0.9.27
categories		cross
platforms		darwin
maintainers		mww@opendarwin.org
description		uClib headers 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		100-gcc4_fix.patch 110-inet6_hosts_resolve.patch \
				120-more_standard_math.patch

dist_subdir		uclib

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

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			{}

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

