summaryrefslogtreecommitdiff
path: root/multimedia/motion/Makefile
blob: 6fdbf32aac2950f3eddd16e8fdaa88f136a61e19 (plain) (blame)
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# Created by: Angel Carpintero <ack@telefonica.net>
# $FreeBSD$

PORTNAME=	motion
PORTVERSION=	3.2.12
PORTREVISION=	1
CATEGORIES=	multimedia
MASTER_SITES=	SF/${PORTNAME}/${PORTNAME}%20-%20${PORTVERSION:R}/${PORTVERSION}

MAINTAINER=	c.petrik.sosa@gmail.com
COMMENT=	Motion detection application

LICENSE=	GPLv2

LIB_DEPENDS=	jpeg:${PORTSDIR}/graphics/jpeg

OPTIONS_DEFINE=	FFMPEG MYSQL PGSQL DOCS EXAMPLES
OPTIONS_SINGLE=	VIDEO
OPTIONS_SINGLE_VIDEO=	BKTR PWCBSD
OPTIONS_DEFAULT=	BKTR FFMPEG
VIDEO_DESC=	Video capture driver. Choose one of BKTR or PWCBSD
BKTR_DESC=	BKTR based TV capture cards
PWCBSD_DESC=	PWCBSD based Webcams

USE_GMAKE=	yes
USE_AUTOTOOLS=	autoconf

CPPFLAGS+=	-I${LOCALBASE}/include
LDFLAGS+=	-L${LOCALBASE}/lib

MAN1=		motion.1
PORTDOCS=	CHANGELOG CREDITS README README.FreeBSD \
		motion_guide.html
PORTEXAMPLES=	motion-dist.conf thread1.conf thread2.conf \
		thread3.conf thread4.conf

NO_STAGE=	yes
.include <bsd.port.options.mk>

.if ${PORT_OPTIONS:MBKTR}
CONFIGURE_ARGS+=--with-bktr
CFLAGS+=	-DWITHOUT_V4L
.else
CONFIGURE_ARGS+=--without-bktr
.endif

.if ${PORT_OPTIONS:MPWCBSD}
BUILD_DEPENDS+=	v4l_compat>=1.0.20060801:${PORTSDIR}/multimedia/v4l_compat
RUN_DEPENDS+=	/boot/modules/pwc.ko:${PORTSDIR}/multimedia/pwcbsd
CONFIGURE_ARGS+=--with-pwcbsd
CFLAGS+=	-DWITHOUT_V4L
.else
CONFIGURE_ARGS+=--without-pwcbsd
.endif

CONFIGURE_ARGS+=--without-linuxthreads

.if ${PORT_OPTIONS:MFFMPEG}
LIB_DEPENDS+=	avformat:${PORTSDIR}/multimedia/ffmpeg
CONFIGURE_ARGS+=--with-ffmpeg=${LOCALBASE}
.else
CONFIGURE_ARGS+=--without-ffmpeg
.endif

.if ${PORT_OPTIONS:MMYSQL}
USE_MYSQL=	yes
CONFIGURE_ARGS+=--with-mysql-lib=${LOCALBASE}/lib/mysql \
		--with-mysql-include=${LOCALBASE}/include/mysql
.else
CONFIGURE_ARGS+=--without-mysql
.endif

.if ${PORT_OPTIONS:MPGSQL}
USE_PGSQL=	yes
CONFIGURE_ARGS+=--with-pgsql-lib=${LOCALBASE}/lib \
		--with-pgsql-include=${LOCALBASE}/include
.else
CONFIGURE_ARGS+=--without-pgsql
.endif

.include <bsd.port.pre.mk>

.if ${ARCH} == "ia64" || ${ARCH} == "powerpc" || ${ARCH} == "sparc64"
BROKEN=		Does not compile on ia64, powerpc, or sparc64
.endif

post-patch:
	@${REINPLACE_CMD} -e \
		's|/usr/local|${LOCALBASE}|g' ${WRKSRC}/configure.in
# Resolve name collision with jpeg-8
	@${REINPLACE_CMD} -e \
		's|jpeg_mem_dest|local_jpeg_mem_dest|' ${WRKSRC}/picture.c

do-install:
	${INSTALL_PROGRAM} ${WRKSRC}/motion ${PREFIX}/bin
	${INSTALL_MAN} ${WRKSRC}/motion.1 ${MANPREFIX}/man/man1
	${INSTALL_SCRIPT} ${WRKSRC}/motion.init-FreeBSD.sh \
		${PREFIX}/etc/rc.d/motion
	${INSTALL_DATA} ${WRKSRC}/motion-dist.conf \
		${PREFIX}/etc/motion.conf.sample
.if !exists(${PREFIX}/etc/motion.conf)
	${INSTALL_DATA} ${PREFIX}/etc/motion.conf.sample \
		${PREFIX}/etc/motion.conf
.endif
.if ${PORT_OPTIONS:MDOCS}
	@${MKDIR} ${DOCSDIR}
.for f in ${PORTDOCS}
	${INSTALL_DATA} ${WRKSRC}/${f} ${DOCSDIR}
.endfor
.endif
.if ${PORT_OPTIONS:MEXAMPLES}
	@${MKDIR} ${EXAMPLESDIR}
.for f in ${PORTEXAMPLES}
	${INSTALL_DATA} ${WRKSRC}/${f} ${EXAMPLESDIR}
.endfor
.endif

.include <bsd.port.post.mk>