summaryrefslogtreecommitdiffstats
path: root/www/otrs/Makefile
blob: 7d4df976e711afe0336ed36ba62984d261888565 (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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
# Created by: Sergey Skvortsov <skv@protey.ru>
# $FreeBSD$

PORTNAME=	otrs
PORTVERSION=	3.3.11
CATEGORIES=	www
MASTER_SITES=	http://ftp.otrs.org/pub/otrs/ \
		ftp://ftp.samurai.com/pub/otrs/ \
		http://ftp.gwdg.de/pub/misc/otrs/ \
		http://mirror.xaranet.de/otrs/

MAINTAINER=	m.tsatsenko@gmail.com
COMMENT=	Open Ticket Request System

LICENSE=	GPLv3

BUILD_DEPENDS=	p5-DBI>=0:${PORTSDIR}/databases/p5-DBI \
		p5-Crypt-PasswdMD5>=0:${PORTSDIR}/security/p5-Crypt-PasswdMD5 \
		p5-Digest-SHA>=0:${PORTSDIR}/security/p5-Digest-SHA \
		p5-MIME-Tools>=5.427:${PORTSDIR}/mail/p5-MIME-Tools \
		p5-libwww>=0:${PORTSDIR}/www/p5-libwww \
		p5-Net-DNS>=0.66:${PORTSDIR}/dns/p5-Net-DNS \
		p5-CSS-Minifier-XS>=0:${PORTSDIR}/textproc/p5-CSS-Minifier-XS \
		p5-JavaScript-Minifier-XS>=0:${PORTSDIR}/textproc/p5-JavaScript-Minifier-XS \
		p5-TimeDate>=0:${PORTSDIR}/devel/p5-TimeDate \
		p5-Sys-Hostname-Long>=0:${PORTSDIR}/sysutils/p5-Sys-Hostname-Long \
		p5-Proc-Daemon>=0:${PORTSDIR}/devel/p5-Proc-Daemon \
		p5-JSON-XS>=0:${PORTSDIR}/converters/p5-JSON-XS \
		p5-XML-Parser>=0:${PORTSDIR}/textproc/p5-XML-Parser \
		p5-IO-Interactive>=0:${PORTSDIR}/devel/p5-IO-Interactive \
		p5-Email-Valid>=0:${PORTSDIR}/mail/p5-Email-Valid \
		p5-JSON>=0:${PORTSDIR}/converters/p5-JSON \
		p5-YAML>=0:${PORTSDIR}/textproc/p5-YAML \
		p5-Date-Pcalc>=0:${PORTSDIR}/devel/p5-Date-Pcalc \
		p5-Text-CSV>=0:${PORTSDIR}/textproc/p5-Text-CSV \
		p5-XML-FeedPP>=0:${PORTSDIR}/textproc/p5-XML-FeedPP \
		p5-YAML-LibYAML>=0:${PORTSDIR}/textproc/p5-YAML-LibYAML \
		p5-JavaScript-Minifier>=0:${PORTSDIR}/textproc/p5-JavaScript-Minifier \
		p5-CSS-Minifier>=0:${PORTSDIR}/textproc/p5-CSS-Minifier \
		p5-SOAP-Lite>=0:${PORTSDIR}/net/p5-SOAP-Lite \
		p5-Class-Inspector>=0:${PORTSDIR}/devel/p5-Class-Inspector \
		p5-Mozilla-CA>=0:${PORTSDIR}/www/p5-Mozilla-CA

RUN_DEPENDS:=	${BUILD_DEPENDS}

USES=		shebangfix perl5 tar:bzip2
SHEBANG_FILES=	bin/cgi-bin/*.pl bin/fcgi-bin/*.pl bin/*.pl \
		scripts/auto_build/*.pl scripts/tools/*.pl scripts/*.pl

OPTIONS_DEFINE=		MYSQL PGSQL REPORTS_MODULES SMTP POP3 IMAP LDAP PDF \
			GNUPG DOCS APACHE
OPTIONS_DEFAULT=	MYSQL REPORTS_MODULES SMTP POP3 IMAP PDF ASPELL APACHE
OPTIONS_RADIO=		SPELL
OPTIONS_RADIO_SPELL=	ASPELL ISPELL

IMAP_DESC=		Fetch email via IMAP
POP3_DESC=		Fetch email via POP3
SMTP_DESC=		Send email via SMTP
REPORTS_MODULES_DESC=	Reports support
APACHE_DESC=		Apache and www/mod_perl2 support

OTRSDIR=	${PREFIX}/otrs
USERS=		${PORTNAME}
GROUPS=		${USERS} www

SUB_FILES=	pkg-message
SUB_LIST=	OTRS_USER=${USERS} OTRS_GROUP=${USERS} WWWOWN=${WWWOWN}
PKGMESSAGE=	${WRKDIR}/pkg-message

ROOT_DIRS_LIST=	Kernel bin scripts doc
BIN_DIRS_LIST=	"" cgi-bin fcgi-bin
PM_DIRS_LIST=	Kernel Kernel/Config Kernel/Config/Files Kernel/Language \
		Modules Kernel/Output/HTML Kernel/Output/HTML/Lite \
		Kernel/Output/HTML/Standard System System/Auth System/AuthSession \
		System/Crypt System/CustomerAuth System/CustomerUser \
		System/CustomerUser/ System/
DOCS_DIRS_LIST=	"" manual/en
DOCS_FILES_LIST=	C[A-Z]* INSTALL.md RE* UPGRADING.md

SCRIPTS_DIRS_LIST=	"" database/update test tools
CRON_SCRIPTS=	${STAGEDIR}${OTRSDIR}/var/cron/
CLEAN_FILES=	scripts/suse* scripts/redhat* \
		var/httpd/htdocs/js/thirdparty/ckeditor-4.0/_source \
		var/httpd/htdocs/skins/Agent/*/img/source

PLIST_SUB+=	VER_CKEDITOR="4.4.5" OTRS_USER=${USERS} WWWOWN=${WWWOWN}

PGSQL_RUN_DEPENDS+=	p5-DBD-Pg>=0:${PORTSDIR}/databases/p5-DBD-Pg
PGSQL_USES=		pgsql

.include <bsd.port.pre.mk>

.if ${PORT_OPTIONS:MMYSQL}
RUN_DEPENDS+=	p5-DBD-mysql>=0:${PORTSDIR}/databases/p5-DBD-mysql
USE_MYSQL=	yes
.endif

.if ${PORT_OPTIONS:MAPACHE}
USE_APACHE_RUN=	22+
RUN_DEPENDS+=	${APACHE_PKGNAMEPREFIX}mod_perl2>=2.0.5:${PORTSDIR}/www/mod_perl2 \
		p5-Apache-DBI>0:${PORTSDIR}/www/p5-Apache-DBI
.endif

.if ${PORT_OPTIONS:MREPORTS_MODULES}
RUN_DEPENDS+=	p5-GD>=0:${PORTSDIR}/graphics/p5-GD \
		p5-GD-Graph>=0:${PORTSDIR}/graphics/p5-GD-Graph \
		p5-GD-TextUtil>=0:${PORTSDIR}/graphics/p5-GD-TextUtil
.endif

.if ${PORT_OPTIONS:MSMTP}
RUN_DEPENDS+=	p5-Authen-SASL>=0:${PORTSDIR}/security/p5-Authen-SASL \
		p5-Net-SSLGlue>=0:${PORTSDIR}/security/p5-Net-SSLGlue
.endif

.if ${PORT_OPTIONS:MPOP3}
RUN_DEPENDS+=	p5-IO-Socket-SSL>=0:${PORTSDIR}/security/p5-IO-Socket-SSL \
		p5-Net-SSLGlue>=0:${PORTSDIR}/security/p5-Net-SSLGlue
.endif

.if ${PORT_OPTIONS:MIMAP}
RUN_DEPENDS+=	p5-Mail-IMAPClient>=0:${PORTSDIR}/mail/p5-Mail-IMAPClient
.endif

.if ${PORT_OPTIONS:MLDAP}
RUN_DEPENDS+=	p5-perl-ldap>=0:${PORTSDIR}/net/p5-perl-ldap
.endif

.if ${PORT_OPTIONS:MPDF}
RUN_DEPENDS+=	p5-PDF-API2>=0.57:${PORTSDIR}/textproc/p5-PDF-API2
.endif

.if ${PORT_OPTIONS:MISPELL}
RUN_DEPENDS+=	ispell:${PORTSDIR}/textproc/aspell-ispell
.endif

.if ${PORT_OPTIONS:MASPELL}
RUN_DEPENDS+=	aspell:${PORTSDIR}/textproc/aspell
.endif

.if ${PORT_OPTIONS:MGNUPG}
RUN_DEPENDS+=	gpg:${PORTSDIR}/security/gnupg1
.endif

post-patch:
	@${FIND} ${WRKSRC} -name "*.pm" | \
		${XARGS} ${REINPLACE_CMD} -i '' \
      			-e 's|Digest::SHA::PurePerl|Digest::SHA|g'
	@${FIND} ${WRKSRC} -name "*.orig" -delete
	@${RM} -rf ${WRKSRC}/Kernel/cpan-lib/ \
		${CLEAN_FILES:S!^!${WRKSRC}/!}
	#shebang file only gets the first instance of /usr/bin/perl
	@${REINPLACE_CMD} -i '' -e "s|/usr/bin/perl|${LOCALBASE}/bin/perl|g" \
		${WRKSRC}/bin/otrs.CreateApacheStartupFile.pl

do-build:
	@${FIND} ${WRKSRC}/Kernel -type d | ${XARGS} ${CHMOD} 0755
	@${FIND} ${WRKSRC}/Kernel -type f | ${XARGS} ${CHMOD} ${SHAREMODE}
	@${FIND} ${WRKSRC} -type f | ${XARGS} ${SED} -i '' \
		-e "s=/opt/=${PREFIX}/=g;s=wwwrun=${WWWOWN}=g;"
.if ${PORT_OPTIONS:MISPELL}
	@${FIND} ${WRKSRC} -type f | ${XARGS} ${SED} -i '' \
		-e "s=/usr/bin/ispell=${PREFIX}/bin/ispell=g"
.endif
.if ${PORT_OPTIONS:MASPELL}
	@${FIND} ${WRKSRC} -type f | ${XARGS} ${SED} -i '' \
		-e "s=/usr/bin/ispell=${PREFIX}/bin/aspell=g"
.endif
.if ${PORT_OPTIONS:MGNUPG}
	@${FIND} ${WRKSRC} -type f | ${XARGS} ${SED} -i '' \
		-e "s=/usr/bin/gpg=${PREFIX}/bin/gpg=g"
.endif

do-install:
.for D in ${ROOT_DIRS_LIST:S!^!${OTRSDIR}/!} ${BIN_DIRS_LIST:S!^!${OTRSDIR}/bin/!} ${SCRIPTS_DIRS_LIST:S!^!${OTRSDIR}/scripts/!}
	${MKDIR} ${STAGEDIR}${D}
.endfor
	${INSTALL_DATA} ${WRKSRC}/.*.dist ${STAGEDIR}${OTRSDIR}/
	${INSTALL_DATA} ${WRKSRC}/RELEASE ${STAGEDIR}${OTRSDIR}/
	${INSTALL_DATA} ${WRKSRC}/ARCHIVE ${STAGEDIR}${OTRSDIR}/
.for D in ${BIN_DIRS_LIST}
	${INSTALL_SCRIPT} ${WRKSRC}/bin/${D}/*.* ${STAGEDIR}${OTRSDIR}/bin/${D}/
.endfor
	(cd ${WRKSRC} && ${PAX} -r -w Kernel var ${STAGEDIR}${OTRSDIR})
	${CHOWN} -R ${SHAREOWN}:${SHAREGRP} ${STAGEDIR}${OTRSDIR}/Kernel
	${INSTALL_SCRIPT} ${WRKSRC}/scripts/*.[ps][lh] ${STAGEDIR}${OTRSDIR}/scripts/
	${INSTALL_DATA} ${WRKSRC}/scripts/apache* \
		${WRKSRC}/scripts/*.sql ${STAGEDIR}${OTRSDIR}/scripts/
	${INSTALL_DATA} ${WRKSRC}/scripts/database/update/*.* ${STAGEDIR}${OTRSDIR}/scripts/database/update/
	${INSTALL_DATA} ${WRKSRC}/scripts/database/*.* ${STAGEDIR}${OTRSDIR}/scripts/database/
	${INSTALL_SCRIPT} ${WRKSRC}/scripts/test/*.t ${STAGEDIR}${OTRSDIR}/scripts/test/
	${INSTALL_SCRIPT} ${WRKSRC}/scripts/tools/*.pl ${STAGEDIR}${OTRSDIR}/scripts/tools/
.if ${PORT_OPTIONS:MDOCS}
	${ECHO_MSG} "===>   Installing documentation for ${PKGNAME}"
.for D in ${DOCS_DIRS_LIST:S!^!${DOCSDIR}/!}
	${MKDIR} ${STAGEDIR}${D}
.endfor
	${INSTALL_DATA} ${DOCS_FILES_LIST:S!^!${WRKSRC}/!} ${STAGEDIR}${DOCSDIR}/
.for D in ${DOCS_DIRS_LIST}
	${INSTALL_DATA} ${WRKSRC}/doc/${D}/*.* ${STAGEDIR}${DOCSDIR}/${D}/
.endfor
.endif
	${FIND} ${CRON_SCRIPTS} -type f -name *.dist | ${SED} -e "p;s/\.dist//" | ${XARGS} -n2 ${MV}
	${MKDIR} ${STAGEDIR}${PREFIX}/${PORTNAME}/var/article
	${MKDIR} ${STAGEDIR}${PREFIX}/${PORTNAME}/var/httpd/htdocs/js/js-cache/
	${MKDIR} ${STAGEDIR}${PREFIX}/${PORTNAME}/var/tmp

x-generate-plist:
	(${PORTSDIR}/Tools/scripts/plist -d -m ${MTREE_FILE} ${PREFIX} \
	| ${SED} -E '\
		s=share/doc/${PORTNAME}=%%DOCSDIR%%=; \
	')> temp-pkg-plist

.include <bsd.port.post.mk>
OpenPOWER on IntegriCloud