# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-dotnet/log4net/log4net-1.2.10-r3.ebuild,v 1.2 2009/10/21 15:56:38 maekke Exp $

EAPI=2

inherit eutils mono versionator

PV_MAJOR=$(get_version_component_range 1-2)

DESCRIPTION="tool to help the programmer output log statements to a variety of output targets."
HOMEPAGE="http://logging.apache.org/log4net/"
SRC_URI="http://archive.apache.org/dist/incubator/log4net/${PV}/incubating-log4net-${PV}.zip"

LICENSE="Apache-2.0"
SLOT="0"
KEYWORDS="amd64 x86"
IUSE=""

RDEPEND=">=dev-lang/mono-2.0"
DEPEND="${RDEPEND}
	app-arch/unzip
	dev-dotnet/nant"

src_prepare() {
	edos2unix *.txt
	rm -rf bin/
	ln -s "${FILESDIR}"/log4net.snk log4net.snk
}

src_compile() {
	# ASF recommend using nant to build log4net
	nant -buildfile:log4net.build compile-all
}

src_install() {
	egacinstall bin/mono/2.0/release/log4net.dll
	egacinstall bin/mono/1.0/release/log4net.dll
	dodir /usr/$(get_libdir)/pkgconfig
	sed -e "s:@VERSION@:${PV}:" \
		-e "s:@LIBDIR@:$(get_libdir):" \
		-e "s:@NET_VERSION@:2.0:" \
		"${FILESDIR}"/${PN}.pc.in-r1 > "${D}"/usr/$(get_libdir)/pkgconfig/${PN}-${PV}.pc
	dosym ${PN}-${PV}.pc /usr/$(get_libdir)/pkgconfig/${PN}-${PV_MAJOR}.pc
	dosym ${PN}-${PV}.pc /usr/$(get_libdir)/pkgconfig/${PN}.pc

	dodoc README.txt NOTICE.txt LICENSE.txt
}