summaryrefslogtreecommitdiff
blob: 9ee4402a27249a7018729dd4949131b90f2e2a75 (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
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/media-video/motion/motion-3.2.4.ebuild,v 1.6 2007/04/28 11:52:11 tove Exp $

inherit eutils

DESCRIPTION="Motion is a video motion detector with tracking-support for webcams."
HOMEPAGE="http://www.lavrsen.dk/twiki/bin/view/Motion/WebHome"
SRC_URI="mirror://sourceforge/${PN}/${P}.tar.gz"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~alpha amd64 ~ppc ~x86"
IUSE="ffmpeg mysql postgres v4l"
DEPEND="virtual/libc
		sys-libs/zlib
		media-libs/jpeg
		ffmpeg? ( media-video/ffmpeg )
		mysql? ( virtual/mysql )
		postgres? ( dev-db/postgresql )"

src_compile() {
	epatch "${FILESDIR}/${P}-ffmpeg-compat.patch"
	econf \
	  $(use_with v4l) \
	  $(use_with mysql) \
	  $(use_with postgres pgsql) \
	  $(use_with ffmpeg) \
	|| die "econfigure failed"

	emake || die "emake failed"
}

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

	# install init-script
	newinitd "${FILESDIR}"/motion.init motion

	# copy configuration file
	cp "${D}"/etc/motion-dist.conf "${D}"/etc/motion.conf

	# cleanup unused files 
	cd "${D}"/usr/share/doc/${P}/examples/
	rm motion.init-Debian motion.init-RH motion.init-FreeBSD.sh
}

pkg_postinst() {
	ewarn "You need to setup /etc/motion.conf before running"
	ewarn "motion for the first time."
	elog "Examples are available at /usr/share/doc/${P}/examples"
	elog
	elog "You can install motion detection as a service, use:"
	elog "rc-update add motion default"
}