summaryrefslogtreecommitdiff
path: root/chat/jabberd2/Makefile
blob: a3ac668b7c7835350a2b5dc833b4c1d418730053 (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
# $NetBSD: Makefile,v 1.6 2004/07/14 00:25:11 xtraeme Exp $
#

DISTNAME=		jabberd-2.0s3
CATEGORIES=		chat
MASTER_SITES=		http://www.jabberstudio.org/files/jabberd2/

MAINTAINER=		xtraeme@NetBSD.org
HOMEPAGE=		http://jabberd.jabberstudio.org/2/
COMMENT=		Instant messaging server (version 2)

CONFLICTS=		jabberd-[0-9]*:../../chat/jabberd

USE_BUILDLINK3=		yes
USE_LIBTOOL=		yes
GNU_CONFIGURE=		yes
USE_PKGINSTALL=		yes

BUILDLINK_DEPENDS.openssl+=	openssl>=0.9.6b
BUILDLINK_TRANSFORM.db4=	-e "s,/db4/,/,g"

SUBST_CLASSES=		path
SUBST_STAGE.path=	post-patch
SUBST_FILES.path=	configure
SUBST_MESSAGE.path=	"Fixing configure script."
SUBST_SED.path=		-e "s,/usr/local,${PREFIX},g"			\
			-e "s,\$sysconfdir/jabberd,\$sysconfdir,g"

CONFIGURE_ARGS+=	--sysconfdir=${PKG_SYSCONFDIR}
CONFIGURE_ARGS+=	--disable-mysql
CONFIGURE_ARGS+=	--enable-pipe
CONFIGURE_ARGS+=	--enable-anon

REPLACE_PERL=		tools/*.pl

.include "../../mk/bsd.prefs.mk"

BUILD_DEFS+=	JABBERD_USER JABBERD_GROUP JABBERD_METHOD  \
		JABBERD_LOGDIR JABBERD_PIDDIR

PKG_SYSCONFSUBDIR=	jabberd
RCD_SCRIPTS=		jabberd c2s sm resolver router s2s
JABBERD_USER?=		jabberd
JABBERD_GROUP?=		jabberd
FILES_SUBST+=		JABBERD_USER=${JABBERD_USER}
FILES_SUBST+=		JABBERD_GROUP=${JABBERD_GROUP}
FILES_SUBST+=		JABBERD_PIDDIR=${JABBERD_PIDDIR}
FILES_SUBST+=		JABBERD_LOGDIR=${JABBERD_LOGDIR}
PKG_GROUPS=             ${JABBERD_GROUP}
PKG_USERS=              ${JABBERD_USER}:${JABBERD_GROUP}

BINDIR=			${PREFIX}/bin
EGDIR=			${PREFIX}/share/examples/jabberd
SUPPORT_FILES=          ${EGDIR}/jabberd.cfg ${PKG_SYSCONFDIR}/jabberd.cfg

FILES=			c2s.xml resolver.xml router.xml			\
			router-users.xml s2s.xml sm.xml
DBFILES=		db-setup.mysql db-setup.pgsql

.for f in ${FILES}
CONF_FILES+=		${EGDIR}/${f} ${PKG_SYSCONFDIR}/${f}
.endfor
CONF_FILES+=		${EGDIR}/roster.xml ${PKG_SYSCONFDIR}/roster.xml
.undef f

JABBERD_METHOD?=	mysql

.if !empty(JABBERD_METHOD:Mdb)
# # Directory to store the database files
JABBERD_DBDIR?=         ${VARBASE}/db/jabberd
BUILD_DEFS+=		JABBERD_DBDIR
CONFIGURE_ARGS+=	--enable-db
.  include "../../databases/db4/buildlink3.mk"
.elif !empty(JABBERD_METHOD:Mmysql)
CONFIGURE_ARGS+=	--enable-mysql
.  include "../../databases/mysql4-client/buildlink3.mk"
.elif !empty(JABBERD_METHOD:Mpgsql)
CONFIGURE_ARGS+=	--enable-pgsql
.  include "../../databases/postgresql74-lib/buildlink3.mk"
.elif !empty(JABBERD_METHOD:Mldap)
CONFIGURE_ARGS+=	--enable-ldap
.  include "../../databases/openldap/buildlink3.mk"
.elif !empty(JABBERD_METHOD:Mpam)
CONFIGURE_ARGS+=	--enable-pam
.  include "../../security/PAM/buildlink3.mk"
.endif

.for f in ${JABBERD_LOGDIR} ${JABBERD_DBDIR} ${JABBERD_PIDDIR}
OWN_DIRS_PERMS+=	${f} ${JABBERD_USER} ${JABBERD_GROUP} 770
.endfor
.undef f

post-extract:
.for f in jabberd.cfg ${FILES}
	@${MV} ${WRKSRC}/etc/${f}.dist.in ${WRKSRC}/etc/${f}.in
.endfor
.undef f

pre-configure:
.for f in ${FILES} jabberd.cfg
	@${SED}								\
		-e "s|@PKG_SYSCONFDIR@|${PKG_SYSCONFDIR}|g"		\
		-e "s|@PIDDIR@|${JABBERD_PIDDIR}|g"			\
		-e "s|@LOGDIR@|${JABBERD_LOGDIR}|g"			\
		-e "s|@SSLCERTS@|${SSLCERTS}|g"				\
		-e "s|@BINDIR@|${PREFIX}/bin|g"				\
		-e "s|@DBDIR@|${JABBERD_DBDIR}|g"			\
		${WRKSRC}/etc/${f}.in > ${WRKSRC}/etc/${f}
.endfor
.undef f

post-install:
	${INSTALL_DATA_DIR} ${EGDIR}
	${INSTALL_DATA} ${WRKSRC}/etc/templates/roster.xml.dist.in	\
	    ${EGDIR}/roster.xml
	${INSTALL_SCRIPT} ${WRKSRC}/tools/pipe-auth.pl ${BINDIR}
	${INSTALL_SCRIPT} ${WRKSRC}/tools/migrate.pl ${BINDIR}
.for f in ${DBFILES}
	${INSTALL_DATA} ${WRKSRC}/tools/${f} ${EGDIR}
.endfor
.undef f
.for f in jabberd.cfg ${FILES}
	${INSTALL_DATA} ${WRKSRC}/etc/${f} ${EGDIR}
.endfor
.undef f

.include "../../converters/libiconv/buildlink3.mk"
.include "../../devel/libidn/buildlink3.mk"
.include "../../security/openssl/buildlink3.mk"
.include "../../mk/bsd.pkg.mk"