summaryrefslogtreecommitdiff
blob: c3d8c13824e2894c60276c1cb90e8a366f6e34b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-libs/libevent/libevent-1.1a.ebuild,v 1.9 2006/03/09 23:48:19 vapier Exp $

DESCRIPTION="A library to execute a function when a specific event occurs on a file descriptor"
HOMEPAGE="http://monkey.org/~provos/libevent/"
SRC_URI="http://monkey.org/~provos/${P}.tar.gz"

LICENSE="BSD"
SLOT="0"
KEYWORDS="alpha amd64 ~arm hppa ia64 ~mips ppc ppc64 ~s390 sparc x86"
IUSE=""

pkg_setup() {
	prevver=$(best_version ${CATEGORY}/${PN})
}

src_unpack() {
	unpack ${A}
	cd ${S}
	# don't waste time building tests/samples
	sed -i 's|^\(SUBDIRS =.*\)sample test\(.*\)$|\1\2|' Makefile.in || \
		die "sed Makefile.in failed"
}

src_test() {
	einfo "Building tests"
	cd test
	make test || die "failed to build tests"

	einfo "Running tests"
	./test.sh > ${T}/tests
	cat ${T}/tests
	grep FAILED ${T}/tests &>/dev/null && die "1 or more tests failed"
}

src_install() {
	make DESTDIR="${D}" install || die "make install failed"
	dodoc README
}

pkg_postinst() {
	local ver="${prevver##*/}"
	if [[ -n "${ver}" ]] && [[ ${ver//[a-zA-Z-]} != "${PV//[a-zA-Z]}" ]] ; then
		ewarn
		ewarn "You will need to run revdep-rebuild (included with app-portage/gentoolkit)"
		ewarn "to rebuild all packages that were built with libevent-1.0x."
		ewarn
		ewarn "Run the following to see which packages will be rebuilt:"
		ewarn "    revdep-rebuild --library ${ver}.so.1 -p"
		ewarn
		ewarn "If you are satisfied with the output, re-run without the '-p' to rebuild."
		ewarn
	fi
	unset prevver
}