# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

inherit cvs

ECVS_USER="anoncvs"
ECVS_SERVER="cvs.erdgeist.org:/home/cvsroot"
ECVS_MODULE="opentracker"

DESCRIPTION="opentracker – An open and free bittorrent tracker"
HOMEPAGE="http://erdgeist.org/arts/software/opentracker/"

LICENSE="BEER-WARE"
SLOT="0"
KEYWORDS="~x86"
IUSE=""

RDEPEND=""
DEPEND="dev-libs/dietlibc
	>=dev-libs/libowfat-0.27"

S=${WORKDIR}/${ECVS_MODULE}

src_compile() {
	# fix use of FEATURES, so it's not mixed up with portage's FEATURES
	sed -i \
	-e "s|FEATURES|FEATUES_INTERNAL|g" \
	-e "s|PREFIX?=..|PREFIX?=/usr|g" \
	-e "s|LIBOWFAT_HEADERS=\$(PREFIX)/libowfat|LIBOWFAT_HEADERS=\$(PREFIX)/include/libowfat|g" \
	-e "s|-pthread|-lpthread|g" \
	-e "s|CC?=gcc|CC=diet gcc|g" \
	-e "s|BINDIR?=\$(PREFIX)/bin|BINDIR?=\$(DESTDIR)\$(PREFIX)/bin|g" \
	Makefile
	emake opentracker || die "emake failed"
}

src_install() {
	mkdir -p ${D}usr/bin
	emake install DESTDIR="${D}" || die "Install failed"
	dodoc README README_v6
}