summaryrefslogtreecommitdiff
path: root/irc/ratbox-services/Makefile
blob: afee68d6faeba85db4aaca3623181c144e757626 (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
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
# Created by: Shaun Amott <shaun@inerd.com>
# $FreeBSD$

PORTNAME=	ratbox-services
PORTVERSION=	1.2.3
PORTREVISION=	2
CATEGORIES=	irc
MASTER_SITES=	http://services.ratbox.org/download/		\
		http://services.ratbox.org/download/old/
EXTRACT_SUFX=	.tgz

MAINTAINER=	moggie@elasticmind.net
COMMENT=	Highly configurable services package for use with ircd-ratbox

USE_RC_SUBR=	ratbox-services

USERS=		ircservices
GROUPS=		${USERS}

LOGDIR?=	/var/log
RUNDIR?=	/var/run
DBDIR?=		/var/db/${PORTNAME}
PERL?=		${LOCALBASE}/bin/perl
USES=		libtool pkgconfig perl5
SUB_FILES=	pkg-message pkg-install
PLIST_SUB=	LOGDIR=${LOGDIR} RUNDIR=${RUNDIR} DBDIR=${DBDIR} PERL=${PERL}
SUB_LIST=	LOGDIR=${LOGDIR} RUNDIR=${RUNDIR} DBDIR=${DBDIR} PERL=${PERL}

USE_PERL5=	build
GNU_CONFIGURE=	yes
CPPFLAGS+=	-I${LOCALBASE}/include
LDFLAGS+=	-L${LOCALBASE}/lib
LIB_DEPENDS+=	libpcre.so:${PORTSDIR}/devel/pcre
CONFIGURE_ARGS+=--prefix=${PREFIX}		\
		--sysconfdir=${PREFIX}/etc/	\
		--with-logdir=${LOGDIR}		\
		--with-rundir=${RUNDIR}		\
		--without-sqlitebuild		\
		--enable-pcre=${PREFIX}

PORTDOCS=	operguide.txt userintro.txt whats-new-1.2.txt
MAKE_JOBS_UNSAFE=yes

#-- Options ------------------------------------------------------------

OPTIONS_DEFINE=	NICKSERV CHANSERV USERSERV OPERSERV ALIS JUPESERV OPERBOT GLOBALMSG \
		BANSERV WATCHSERV MEMOSERV
OPTIONS_DEFAULT=	NICKSERV CHANSERV USERSERV OPERSERV ALIS JUPESERV OPERBOT GLOBALMSG \
			BANSERV WATCHSERV MEMOSERV SQLITE
OPTIONS_MULTI=	DB
OPTIONS_MULTI_DB=	MYSQL PGSQL SQLITE
NICKSERV_DESC=	nickname registration service
CHANSERV_DESC=	channel registration service
USERSERV_DESC=	user service
OPERSERV_DESC=	oper service
ALIS_DESC=	advanced listing service
JUPESERV_DESC=	jupe service
OPERBOT_DESC=	operbot service
GLOBALMSG_DESC=	global messaging service
BANSERV_DESC=	ban service
WATCHSERV_DESC=	command watching service
MEMOSERV_DESC=	memo services

#----------------------------------------------------------------------

.include <bsd.port.options.mk>

.if ! ${PORT_OPTIONS:MNICKSERV}
CONFIGURE_ARGS+=	--disable-nickserv
.endif

.if ! ${PORT_OPTIONS:MCHANSERV}
CONFIGURE_ARGS+=	--disable-chanserv
.endif

.if ! ${PORT_OPTIONS:MUSERSERV}
CONFIGURE_ARGS+=	--disable-userserv
.endif

.if ! ${PORT_OPTIONS:MOPERSERV}
CONFIGURE_ARGS+=	--disable-operserv
.endif

.if ! ${PORT_OPTIONS:MALIS}
CONFIGURE_ARGS+=	--disable-alis
.endif

.if ! ${PORT_OPTIONS:MJUPESERV}
CONFIGURE_ARGS+=	--disable-jupeserv
.endif

.if ! ${PORT_OPTIONS:MOPERBOT}
CONFIGURE_ARGS+=	--disable-operbot
.endif

.if ! ${PORT_OPTIONS:MGLOBALMSG}
CONFIGURE_ARGS+=	--disable-global
.endif

.if ! ${PORT_OPTIONS:MBANSERV}
CONFIGURE_ARGS+=	--disable-banserv
.endif

.if ! ${PORT_OPTIONS:MWATCHSERV}
CONFIGURE_ARGS+=	--disable-watchserv
.endif

.if ! ${PORT_OPTIONS:MMEMOSERV}
CONFIGURE_ARGS+=	--disable-memoserv
.endif

.if ${PORT_OPTIONS:MSQLITE}
USE_SQLITE=		3
CONFIGURE_ARGS+=	--enable-sqlite3=${LOCALBASE}
.endif

.if ${PORT_OPTIONS:MMYSQL}
USE_MYSQL=		yes
CONFIGURE_ARGS+=	--enable-mysql=${LOCALBASE}
.endif

.if ${PORT_OPTIONS:MPGSQL}
USE_PGSQL=		yes
CONFIGURE_ARGS+=	--enable-pgsql=${LOCALBASE}
.endif

#-- User Configuration -------------------------------------------------

.if defined(NICKLEN)
CONFIGURE_ARGS+=	--with-nicklen=${NICKLEN}
.endif

.if defined(TOPICLEN)
CONFIGURE_ARGS+=	--with-topiclen=${TOPICLEN}
.endif

.if defined(USERREGLEN)
CONFIGURE_ARGS+=	--with-userreglen=${USERREGLEN}
.endif

#-----------------------------------------------------------------------

pre-configure:
	@${ECHO_MSG} ""
	@${ECHO_MSG} "This port has additional options:"
	@${ECHO_MSG} "    NICKLEN     [default 9, max 50]    - Max nick length on server"
	@${ECHO_MSG} "    TOPICLEN    [default 160, max 390] - Max topic length"
	@${ECHO_MSG} "    USERREGLEN  [default 10]           - Max registered username"
	@${ECHO_MSG} "                                         length on services"
	@${ECHO_MSG} ""
	@${ECHO_MSG} "THESE SHOULD BE CONSISTENT WITH YOUR IRCD-RATBOX SERVER/NETWORK!"
	@${ECHO_MSG} ""
	@${ECHO_MSG} "Press CTRL+C now if you wish to set them."
	@${ECHO_MSG} ""

post-patch:
	@${REINPLACE_CMD} -e "s#-O[02]##g" ${WRKSRC}/configure
	@${REINPLACE_CMD} -E -e "s|(LIBS=.*)-lsqlite3(.*)|\1\`pkg-config --static --libs sqlite3\`\2|" \
		-e "s|(.*DB_LIBS=.*)-lsqlite3(.*)|\1\`pkg-config --static --libs sqlite3\`\2|" \
		${WRKSRC}/configure

	@${REINPLACE_CMD} -e "s#%%DBDIR%%#${DBDIR}#g" ${WRKSRC}/include/config.h
	@${REINPLACE_CMD} -e "s#%%PREFIX%%#${PREFIX}#g"		\
			${WRKSRC}/tools/generate-schema.pl	\
			${WRKSRC}/tools/dbupgrade.pl

pre-install:
	${MKDIR} ${STAGEDIR}${DATADIR}/help

post-install:
	${MKDIR} ${STAGEDIR}${DBDIR}
	${MKDIR} ${STAGEDIR}${DOCSDIR}
	cd ${WRKSRC}/doc && ${INSTALL_DATA} ${PORTDOCS} ${STAGEDIR}${DOCSDIR}
	${INSTALL_DATA} ${WRKSRC}/INSTALL.mysql ${STAGEDIR}${DOCSDIR}/INSTALL.mysql
	${INSTALL_DATA} ${WRKSRC}/INSTALL.pgsql ${STAGEDIR}${DOCSDIR}/INSTALL.pgsql
	${INSTALL_DATA} ${WRKSRC}/INSTALL.sqlite ${STAGEDIR}${DOCSDIR}/INSTALL.sqlite
	${INSTALL_DATA} ${WRKSRC}/UPGRADING ${STAGEDIR}${DOCSDIR}/UPGRADING
	${INSTALL_DATA} ${WRKSRC}/DBMOVE ${STAGEDIR}${DOCSDIR}/DBMOVE

	${MKDIR} ${STAGEDIR}${DATADIR}
		(cd ${WRKSRC}/tools/ &&	\
		${COPYTREE_SHARE} . ${STAGEDIR}${DATADIR} "! -name dbupgrade.pl.bak	\
						! -name dbupgrade.pl.orig	\
						! -name generate-schema.pl.bak	\
						! -name generate-schema.pl.orig")

	${INSTALL_PROGRAM} ${WRKSRC}/src/ratbox-services ${STAGEDIR}${PREFIX}/sbin/
	${INSTALL_DATA} ${WRKSRC}/doc/example.conf ${STAGEDIR}${PREFIX}/etc/ratbox-services.conf.sample

.include <bsd.port.mk>