summaryrefslogtreecommitdiff
path: root/www/bigbluebutton/Makefile
blob: d9bf32875078d189fc7bfa8741ec9ff921378cad (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
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# Created by: alex.deiter@gmail.com
# $FreeBSD$

PORTNAME=	bigbluebutton
PORTVERSION=	0.71
PORTREVISION=	8
CATEGORIES=	www java
MASTER_SITES=	http://bigbluebutton.org/downloads/${PORTVERSION}/ \
		http://bigbluebutton.org/downloads/0.70/:2 \
		http://bigbluebutton.org/downloads/0.64/blank/:3
DISTFILES=	bigbluebutton.tar.gz freeswitch-config.tar.gz \
		nginx-bigbluebutton.conf bbb_extensions.conf:2 \
		bbb_sip.conf:2 red5-0.9.1.tar.gz:2 \
		blank-slide.swf:3 blank-thumb.png:3
EXTRACT_ONLY=	bigbluebutton.tar.gz red5-0.9.1.tar.gz freeswitch-config.tar.gz

MAINTAINER=	alex.deiter@gmail.com
COMMENT=	Web conferencing system for distance education

BUILD_DEPENDS=	${LOCALBASE}/bin/pdf2swf:graphics/swftools \
		${LOCALBASE}/bin/convert:graphics/ImageMagick6 \
		${LOCALBASE}/etc/rc.d/activemq:net/activemq \
		${LOCALBASE}/sbin/nginx:www/nginx \
		${LOCALBASE}/etc/rc.d/tomcat6:www/tomcat6 \
		${LOCALBASE}/etc/rc.d/red5:www/red5
RUN_DEPENDS:=	${BUILD_DEPENDS}

MANUAL_PACKAGE_BUILD=	requires www/tomcat6 with HTTP_PORT=8080

USES=		dos2unix
DOS2UNIX_REGEX=	.+\.(conf|jsp|properties|xml)$

USE_JAVA=	yes
JAVA_EXTRACT=	yes
NO_BUILD=	yes
DIST_SUBDIR=	${PORTNAME}
USE_RC_SUBR=	openoffice
SOFFICEBIN?=	${PREFIX}/bin/openoffice-4.0.1
RED5_HOME?=	${PREFIX}/red5
RED5_LOGS?=	${RED5_HOME}/log
RED5_USER?=	www
RED5_GROUP?=	${RED5_USER}
TOMCAT_HOME?=	${PREFIX}/apache-tomcat-6.0
TOMCAT_LOGS?=	${TOMCAT_HOME}/logs
TOMCAT_USER?=	www
TOMCAT_GROUP?=	${TOMCAT_USER}
FS_USER?=	freeswitch
FS_GROUP?=	${FS_USER}
WWWROOT?=	${WWWDIR:S|/${PORTNAME}$||}

OPTIONS_DEFINE=	KONFERENCE OPENOFFICE
OPTIONS_DEFAULT=	KONFERENCE
KONFERENCE_DESC=	konference Asterisk module
OPENOFFICE_DESC=	Include OpenOffice support

PLIST_SUB+=	RED5_HOME=${RED5_HOME:S,^${PREFIX}/,,} \
		RED5_USER=${RED5_USER} \
		RED5_GROUP=${RED5_GROUP} \
		TOMCAT_HOME=${TOMCAT_HOME:S,^${PREFIX}/,,} \
		TOMCAT_USER=${TOMCAT_USER} \
		TOMCAT_GROUP=${TOMCAT_GROUP} \
		WWWROOT=${WWWROOT:S,^${PREFIX}/,,}

SUB_LIST+=	PORTNAME=${PORTNAME} \
		SOFFICEBIN=${SOFFICEBIN} \
		RED5_HOME=${RED5_HOME} \
		RED5_LOGS=${RED5_LOGS} \
		RED5_USER=${RED5_USER} \
		RED5_GROUP=${RED5_GROUP} \
		TOMCAT_HOME=${TOMCAT_HOME} \
		TOMCAT_LOGS=${TOMCAT_LOGS} \
		TOMCAT_USER=${TOMCAT_USER} \
		TOMCAT_GROUP=${TOMCAT_GROUP} \
		FREESWITCH_USER=${FS_USER} \
		FREESWITCH_GROUP=${FS_GROUP} \
		WWWROOT=${WWWROOT} \
		WWWDIR=${WWWDIR}

SUB_FILES=	pkg-message openoffice nginx.conf-dist bbb-conf

.include <bsd.port.options.mk>

.if  ${PORT_OPTIONS:MKONFERENCE}
BUILD_DEPENDS+=${LOCALBASE}/lib/asterisk/modules/app_konference.so:net/appkonference
.endif
.if ${PORT_OPTIONS:MOPENOFFICE}
BUILD_DEPENDS+=	${LOCALBASE}/bin/openoffice-4.0.1:editors/openoffice-4
.endif

post-extract:
	@${MKDIR} ${WRKSRC}
.for f in bbb_extensions.conf bbb_sip.conf nginx-bigbluebutton.conf
	@${INSTALL_DATA} ${_DISTDIR}/${f} ${WRKSRC}
.endfor
.for f in bbb-default bigbluebutton-webapps client deskshare sip video
	@cd ${WRKSRC} && ${TAR} xf ../${f}${EXTRACT_SUFX}
.endfor
	@cd ${WRKDIR} && ${MV} conf red5-0.9.1 ${WRKSRC}
	@cd ${WRKSRC}/client && ${MV} client/* . && ${RMDIR} client
	@${MKDIR} ${WRKSRC}/bigbluebutton-tomcat
	@cd ${WRKSRC}/bigbluebutton-tomcat && ${JAR} xf \
		${WRKDIR}/bigbluebutton.war
	@cd ${WRKSRC} && ${FIND} . -name .gitignore -delete

post-patch:
	@${RM} ${WRKSRC}/deskshare/WEB-INF/deskshare.conf.orig
	@${FIND} ${WRKSRC} -type f -name '*.orig' -execdir ${SH} -c \
		'f={} && ${MV} $${f%.orig} $${f%.orig}-dist && ${RM} $$f' ';'

pre-install:
.for d in RED5_HOME TOMCAT_HOME
	@if [ ! -d "${${d}}/webapps" ]; then \
		${ECHO_MSG} ""; \
		${ECHO_MSG} "Path ${${d}}/webapps not found"; \
		${ECHO_MSG} "Please check and set correct ${d} variable in make env"; \
		${ECHO_MSG} ""; \
		${FALSE}; \
	fi
.endfor
	@if ! ${GREP} -q 'Connector\ port=\"8080\"\ protocol=\"HTTP\/1\.1\"\ *$$' \
		${TOMCAT_HOME}/conf/server.xml; then \
		${ECHO_MSG} ""; \
		${ECHO_MSG} "Please reinstall www/tomcat6 port with HTTP_PORT=8080"; \
		${ECHO_MSG} ""; \
		${FALSE}; \
	fi

do-install:
	@${MKDIR} ${STAGEDIR}${DATADIR} ${STAGEDIR}${WWWDIR}
	${INSTALL_SCRIPT} ${WRKDIR}/bbb-conf ${STAGEDIR}${PREFIX}/bin
	@(cd ${STAGEDIR}${DATADIR} && ${MKDIR} asterisk blank freeswitch nginx)
	${INSTALL_DATA} ${FILESDIR}/nopdfmark.ps ${STAGEDIR}${DATADIR}/blank
	(cd ${_DISTDIR} && ${INSTALL_DATA} blank-slide.swf blank-thumb.png \
		${STAGEDIR}${DATADIR}/blank)
	(cd ${WRKSRC} && ${INSTALL_DATA} bbb_*.conf-dist \
		${STAGEDIR}${DATADIR}/asterisk)
	${INSTALL_DATA} ${WRKSRC}/nginx-bigbluebutton.conf-dist \
		${WRKDIR}/nginx.conf-dist ${STAGEDIR}${DATADIR}/nginx
	(cd ${WRKSRC} && ${COPYTREE_SHARE} conf ${STAGEDIR}${DATADIR}/freeswitch)
	@${MKDIR} ${STAGEDIR}${TOMCAT_HOME}/webapps/bigbluebutton
	(cd ${WRKSRC}/bigbluebutton-tomcat && ${COPYTREE_SHARE} . \
		${STAGEDIR}${TOMCAT_HOME}/webapps/bigbluebutton)
	(cd ${WRKSRC} && ${COPYTREE_SHARE} bigbluebutton-default \
		${STAGEDIR}${WWWROOT})
	(cd ${WRKSRC} && ${COPYTREE_SHARE} client ${STAGEDIR}${WWWDIR})
	(cd ${WRKSRC} && ${COPYTREE_SHARE} 'bigbluebutton deskshare sip video' \
		${STAGEDIR}${RED5_HOME}/webapps)
	@${MKDIR} ${STAGEDIR}${RED5_HOME}/lib
	(cd ${WRKSRC}/red5-0.9.1/lib && ${INSTALL_DATA} aopalliance-1.0.jar \
		spring-aop-3.0.0.jar ${STAGEDIR}${RED5_HOME}/lib)

.include <bsd.port.mk>