summaryrefslogtreecommitdiff
blob: 11b135834a7e195195891a33937edf5bc3b222e8 (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
# Copyright 1999-2004 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-im/jabberd/jabberd-2.0.ebuild,v 1.6 2004/06/19 03:08:56 weeve Exp $

inherit eutils

MY_PV="2.0s2"
S="${WORKDIR}/${PN}-${MY_PV}"

DESCRIPTION="Open Source Jabber Server"
HOMEPAGE="http://www.jabber.org"
SRC_URI="http://www.jabberstudio.org/files/jabberd2/${PN}-${MY_PV}.tar.gz"

SLOT="1"
LICENSE="GPL-2"
KEYWORDS="~x86 ~ppc ~sparc"
IUSE="ldap ipv6 mysql postgres pam berkdb"

DEPEND="!net-im/jabber-server
	>=dev-libs/openssl-0.9.6i
	ldap? ( >=net-nds/openldap-2.1 )
	berkdb? ( >=sys-libs/db-4.1.25 )
	mysql? ( dev-db/mysql )
	postgres? ( dev-db/postgresql )"

pkg_setup() {
	if ! use postgres && ! use mysql && ! use berkdb;  then
		eerror
		eerror "For this version of jabberd you must have"
		eerror "at least one of 'mysql', 'postgres' and/or 'berkdb'"
		eerror "in the USE variable in /etc/make.conf."
		eerror
		die "Look at the error message above."
	fi
}

src_unpack() {
	unpack ${PN}-${MY_PV}.tar.gz
	cd ${S}/sx
	epatch ${FILESDIR}/xml-stream-patch-00
}

src_compile() {
	storage="fs"
	authreg="anon"

	if use db; then
		storage="${storage} db"
		authreg="${authreg} db"
	fi
	if use mysql; then
		storage="${storage} mysql"
		authreg="${authreg} mysql"
	fi
	if use postgres; then
		storage="${myconf} pgsql"
		authreg="${authreg} pgsql"
	fi
	if use pam; then
		authreg="${authreg} pam"
	fi
	if use ldap; then
		authreg="${authreg} ldap"
	fi

	if use ipv6; then
		enables="${enables} --enable-ipv6"
	fi

	cd ${S}


	./configure --prefix=/usr \
		--sysconfdir=/etc \
		--localstatedir=/var \
		--infodir=/usr/share/info \
		--mandir=/usr/share/man \
		--enable-debug \
		--enable-storage="${storage}" \
		--enable-authreg="${authreg}" \
		${enables} || die
	make || die

}

src_install() {
	make DESTDIR=${D} install || die

	exeinto /etc/jabberd
	dodir /var/jabberd
	dodir /var/jabberd/pid
	dodir /var/jabberd/log
	dodir /var/jabberd/db
	touch ${D}/var/jabberd/log/c2s.log
	touch ${D}/var/jabberd/log/resolver.log
	touch ${D}/var/jabberd/log/router.log
	touch ${D}/var/jabberd/log/s2s.log
	touch ${D}/var/jabberd/log/sm.log
	doexe ${FILESDIR}/self-cert.sh
	insinto /etc/conf.d ; newins ${FILESDIR}/jabber-conf.d jabber
	exeinto /etc/init.d ; newexe ${FILESDIR}/jabber.rc6-r7 jabber

	dodoc AUTHORS PROTOCOL README

	docinto tools ; dodoc tools/db-setup.mysql tools/db-setup.pgsql tools/migrate.pl tools/pipe-auth.pl

	local test_group=`grep ^jabber: /etc/group | cut -d: -f1`
	if [ -z $test_group ]
	then
		enewgroup jabber
	fi

	local test_user=`grep ^jabber: /etc/passwd | cut -d: -f1`
	if [ -z $test_user ]
	then
		enewuser jabber -1 /bin/false /var/spool/jabber jabber
	fi

	fowners jabber:jabber /etc/jabberd
	fowners jabber:jabber /etc/jabberd/c2s.xml
	fowners jabber:jabber /etc/jabberd/c2s.xml.dist
	fowners jabber:jabber /etc/jabberd/jabberd.cfg
	fowners jabber:jabber /etc/jabberd/jabberd.cfg.dist
	fowners jabber:jabber /etc/jabberd/resolver.xml
	fowners jabber:jabber /etc/jabberd/resolver.xml.dist
	fowners jabber:jabber /etc/jabberd/router-users.xml
	fowners jabber:jabber /etc/jabberd/router-users.xml.dist
	fowners jabber:jabber /etc/jabberd/router.xml
	fowners jabber:jabber /etc/jabberd/router.xml.dist
	fowners jabber:jabber /etc/jabberd/s2s.xml
	fowners jabber:jabber /etc/jabberd/s2s.xml.dist
	fowners jabber:jabber /etc/jabberd/self-cert.sh
	fowners jabber:jabber /etc/jabberd/sm.xml
	fowners jabber:jabber /etc/jabberd/sm.xml.dist
	fowners jabber:jabber /etc/jabberd/templates

	fowners jabber:jabber /var/jabberd
	fowners jabber:jabber /var/jabberd/db
	fowners jabber:jabber /var/jabberd/log
	fowners jabber:jabber /var/jabberd/pid
	fowners jabber:jabber /var/jabberd/log/c2s.log
	fowners jabber:jabber /var/jabberd/log/resolver.log
	fowners jabber:jabber /var/jabberd/log/router.log
	fowners jabber:jabber /var/jabberd/log/s2s.log
	fowners jabber:jabber /var/jabberd/log/sm.log
	fperms 660 /etc/jabberd/c2s.xml
	fperms 660 /etc/jabberd/c2s.xml.dist
	fperms 660 /etc/jabberd/jabberd.cfg
	fperms 660 /etc/jabberd/jabberd.cfg.dist
	fperms 660 /etc/jabberd/resolver.xml
	fperms 660 /etc/jabberd/resolver.xml.dist
	fperms 660 /etc/jabberd/router-users.xml
	fperms 660 /etc/jabberd/router-users.xml.dist
	fperms 660 /etc/jabberd/router.xml
	fperms 660 /etc/jabberd/router.xml.dist
	fperms 660 /etc/jabberd/s2s.xml
	fperms 660 /etc/jabberd/s2s.xml.dist
	fperms 760 /etc/jabberd/self-cert.sh
	fperms 660 /etc/jabberd/sm.xml
	fperms 660 /etc/jabberd/sm.xml.dist
	fperms 660 /etc/jabberd/templates
	fperms o-rwx /usr/bin/jabberd
}

pkg_postinst() {

	einfo
	einfo "Change 'localhost' to your server's domainname in the"
	einfo "/etc/jabberd/*.xml configs first"
	einfo "Server admins should be added to the "jabber" group"
	if use ssl; then
		einfo
		einfo "To enable SSL connections, execute /etc/jabberd/self-cert.sh"
		einfo
	fi
}