1PORTNAME=	lirc
2PORTVERSION=	0.9.0
3PORTREVISION=	9
4PORTEPOCH=	1
5CATEGORIES=	comms
6MASTER_SITES=	SF/${PORTNAME}/LIRC/${PORTVERSION}
7
8MAINTAINER=	ports@MidnightBSD.org
9COMMENT=	Linux Infrared Remote Control
10WWW=		https://www.lirc.org/
11
12LICENSE=	gpl2
13LICENSE_FILE=	${WRKSRC}/COPYING
14
15BUILD_DEPENDS=	${LOCALBASE}/include/linux/input.h:devel/evdev-proto
16
17USES=		autoreconf gmake libtool localbase python tar:bzip2 xorg
18USE_XORG=	sm x11 ice
19USE_CSTD=	gnu89
20INSTALL_TARGET=	install-strip
21USE_LDCONFIG=	yes
22
23GNU_CONFIGURE=	yes
24CONFIGURE_ARGS=	--enable-sandboxed --with-devdir=/var/run/lirc \
25		--sysconfdir=${PREFIX}/etc
26
27USE_RC_SUBR=	lircd
28PORTDOCS=	html images irxevent.keys lirc.css lirc.hwdb
29PORTEXAMPLES=	remotes
30SUB_FILES=	pkg-message lircd.conf
31
32OPTIONS_DEFINE=	MINIMAL DEBUG UARTLIRC DOCS EXAMPLES
33OPTIONS_DEFINE_i386=	SMODE2
34OPTIONS_DEFINE_amd64=	SMODE2
35OPTIONS_SUB=	yes
36
37MINIMAL_DESC=	Build with minimal dependencies
38UARTLIRC_DESC=	Install serial LIRC driver
39SMODE2_DESC=	Build smode2 (shows signal waveform), requires svgalib
40
41MINIMAL_LIB_DEPENDS_OFF=libftdi.so:devel/libftdi \
42			libirman.so:comms/libirman
43MINIMAL_CONFIGURE_OFF=	--with-driver=userspace
44MINIMAL_CONFIGURE_ON=	--with-driver=dvico
45
46DEBUG_CONFIGURE_ENABLE=	debug
47
48SMODE2_LIB_DEPENDS=	libvga.so:graphics/svgalib
49SMODE2_PLIST_FILES=	bin/smode2
50
51UARTLIRC_RUN_DEPENDS=	uartlirc>=0.3:comms/uartlirc
52
53post-patch:
54	@${REINPLACE_CMD} \
55		-e 's/`$${LIBUSB_CONFIG} --libs`/-lusb/' \
56		-e 's/`$${LIBUSB_CONFIG} --cflags`//' \
57		${WRKSRC}/configure.ac
58
59post-install:
60	${INSTALL_DATA} ${WRKDIR}/lircd.conf ${PREFIX}/etc/lircd.conf.sample
61	@${MKDIR} /var/run/lirc
62
63post-install-MINIMAL-on:
64	# bacause --with-driver is specified, it installs remotes/dvico/lircd.conf.fusionHDTV to etc/lircd/
65	# remove to not break the plist, but remote configs handling should probably be fixed...
66	@${RM} -r ${FAKE_DESTDIR}${PREFIX}/etc/lirc
67
68post-install-DOCS-on:
69	@(cd ${WRKSRC}/doc && ${COPYTREE_SHARE} "html images irxevent.keys lirc.css lirc.hwdb" ${FAKE_DESTDIR}${DOCSDIR}/)
70
71post-install-EXAMPLES-on:
72	@(cd ${WRKSRC} && ${COPYTREE_SHARE} remotes ${FAKE_DESTDIR}${EXAMPLESDIR}/)
73
74.include <bsd.port.mk>
75