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

PortSystem 1.0

name			mipsel-linux-kernel-headers
version			2.4.30
categories		cross
platforms		darwin
maintainers		mww@opendarwin.org
description		Linux kernel headers for mips-linux cross development
long_description	${description}

homepage		http://www.kernel.org/
master_sites	http://www.de.kernel.org/pub/linux/kernel/v2.4/
distname		linux-${version}
checksums		sha1 280768f529d018af44ced85b7c9d221d536ca1d7
use_bzip2		yes

dist_subdir		linux

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

extract.post_args	"| tar -xf - ${distname}/include ${distname}/Makefile \
				${distname}/Rules.make ${distname}/arch/mips/Makefile \
				${distname}/scripts ${distname}/arch/mips/config*.in \
				${distname}/*/*/Config.in ${distname}/*/Config.in"
post-extract {
	file copy ${filespath}/config ${worksrcpath}/.config
}

patch {
	reinplace "s/@expr length/@-expr length/" ${worksrcpath}/Makefile
}

use_configure	no

build.target	oldconfig
build.args		ARCH=mips

destroot {
	xinstall -m 755 -d ${destroot}${cprefix}/include/
	file copy ${worksrcpath} ${destroot}${cprefix}/include/
	system "cd ${destroot}${cprefix}/include/ && ln -s ${distname} linux"
}
