summaryrefslogtreecommitdiff
blob: b9c115679cadd0339cfa8441d3a37be10dcc749d (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
214
215
216
217
218
219
220
221
222
223
224
# Copyright 1999-2003 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-im/jabber-server/jabber-server-1.4.2-r4.ebuild,v 1.4 2003/11/18 20:57:43 luke-jr Exp $

S="${WORKDIR}/jabber-${PV}"
DESCRIPTION="Open Source Jabber Server & JUD,MUC,AIM,MSN,ICQ and Yahoo transports"
HOMEPAGE="http://www.jabber.org"
SRC_URI="http://jabberd.jabberstudio.org/downloads/jabber-${PV}.tar.gz
	!j-noaim? ( mirror://gentoo/aim-transport-stable-20030314.tar.gz
	http://ftp.newaol.com/aim/win95/Install_AIM.exe )
	!j-nomsn? ( http://msn-transport.jabberstudio.org/msn-transport-1.2.8pre5.tar.gz )
	!j-noyahoo? (http://yahoo-transport.jabberstudio.org/yahoo-t-2.1.1.tar.gz )
	!j-nomuconf? ( http://www.jabberstudio.org/files/mu-conference/mu-conference-0.5.1.tar.gz )
	ldap? ( http://www.jabberstudio.org/files/xdb_ldap/xdb_ldap-1.0.tar.gz )
	!j-nojud? ( http://download.jabber.org/dists/1.4/final/jud-0.4.tar.gz )"
#mirror://gentoo/Install_AIM_3.5.1670.exe

SLOT="0"
LICENSE="GPL-2"
KEYWORDS="x86"
IUSE="ssl ldap"
# Internal USE flags that I do not really want to advertise ...
IUSE="${IUSE} j-nomsn j-noaim j-noyahoo j-nomuconf j-nojud"

DEPEND="=dev-libs/pth-1.4.0
	!j-noyahoo? ( =dev-libs/glib-1.2* !=sys-libs/glibc-2.3.1 )
	ssl? ( >=dev-libs/openssl-0.9.6i )
	ldap? ( =net-nds/openldap-2* )
	!j-nomsn? ( !=sys-libs/glibc-2.3.1 net-ftp/curl )
	!j-noaim? ( !=sys-libs/glibc-2.3.1 )
	!j-nomuconf ? ( !=sys-libs/glibc-2.3.1 )
	!j-nojud ? ( !=sys-libs/glibc-2.3.1 )"

src_unpack() {
	unpack jabber-${PV}.tar.gz
	cd ${S}
	epatch ${FILESDIR}/mio_ssl.c.patch
	if ! use j-nomsn; then
		unpack msn-transport-1.2.8pre5.tar.gz
		cd msn-transport*
		epatch ${FILESDIR}/msn-configure-patch-00
		cd ..
	fi
	use j-noyahoo	|| unpack yahoo-t-2.1.1.tar.gz
	use j-nojud	|| unpack jud-0.4.tar.gz
	use ldap	&& unpack xdb_ldap-1.0.tar.gz
	if ! use j-nomuconf; then
		unpack mu-conference-0.5.1.tar.gz
		mv ${S}/mu-conference-0.5.1 ${S}/mu-conference
	fi
	if ! use j-noaim; then
		unpack aim-transport-stable-20030314.tar.gz
		mv ${S}/aim-transport-stable-20030314 ${S}/aim-transport
		cd ${S}/aim-transport
		cp ${DISTDIR}/Install_AIM.exe .
	fi

	mkdir ${S}/config -p
	cd ${S}/config
	tar -xjf ${FILESDIR}/config-1.4.2-r4.tbz2
}

src_compile() {
	# These can cause problems with certain configure scripts used...
	unset LC_ALL LC_CTYPE


	local myconf
	cd ${S}
	use ssl && myconf="--enable-ssl"

	mv jabberd/jabberd.c jabberd/jabberd.c.orig
	sed 's:pstrdup(jabberd__runtime,HOME):"/var/spool/jabber":' jabberd/jabberd.c.orig > jabberd/jabberd.c
	rm -f jabberd/jabberd.c.orig
	./configure ${myconf} || die
	make || die

	if ! use j-noaim; then
	        cd ${S}/aim-transport
		./configure || die
	        make || die
		make install
	fi

	if ! use j-nomsn; then
		cd ${S}/msn-transport*
		./configure --with-jabberd=${S}/jabberd || die
		make || die
	fi

	if ! use j-nomuconf; then
		cd ${S}/mu-conference
		make || die
	fi

	if ! use j-nojud; then
		cd ${S}/jud-0.4
		make || die
	fi

	if ! use j-noyahoo; then
		cd ${S}/yahoo-transport-2
		make || die
	fi

	if use ldap; then
		cd ${S}/xdb_ldap/src
		make all || die
	fi
}

src_install() {
	exeinto /etc/init.d ; newexe ${FILESDIR}/jabber.rc6-r3 jabber
	dodir /usr/sbin /etc/jabber /usr/lib/jabber /var/log/jabber
	touch ${D}/var/log/jabber/error.log
	touch ${D}/var/log/jabber/record.log
	dodir /var/spool/jabber
	touch ${D}/var/spool/jabber/.keep
	dodir /var/run

	cp ${S}/jabberd/jabberd ${D}/usr/sbin/
	if ! use j-noaim; then
		cp ${S}/aim-transport/src/aimtrans.so ${D}/usr/lib/jabber/
		cp ${S}/aim-transport/Install_AIM.exe ${D}/usr/lib/jabber/
		cp ${S}/config/aimtrans.xml ${D}/etc/jabber/
		cp ${S}/config/icqtrans.xml ${D}/etc/jabber/
	fi
	if ! use j-nomsn; then
		cp ${S}/msn-transport*/src/msntrans.so ${D}/usr/lib/jabber/
		cp ${S}/config/msntrans.xml ${D}/etc/jabber/
	fi
	if ! use j-nomuconf; then
		cp ${S}/mu-conference/src/mu-conference.so ${D}/usr/lib/jabber/
		cp ${S}/config/muctrans.xml ${D}/etc/jabber/
	fi
	if ! use j-nojud; then
		cp ${S}/jud-0.4/jud.so ${D}/usr/lib/jabber/
		cp ${S}/jud-0.4/README ${D}/etc/jabber/jud.README
	fi
	if ! use j-noyahoo; then
		cp ${S}/yahoo-transport-2/yahoo-transport.so ${D}/usr/lib/jabber/
		cp ${S}/config/yahootrans.xml ${D}/etc/jabber/
	fi
	cp ${S}/jsm/jsm.so ${D}/usr/lib/jabber/
	cp ${S}/xdb_file/xdb_file.so ${D}/usr/lib/jabber/
	cp ${S}/pthsock/pthsock_client.so ${D}/usr/lib/jabber/
	cp ${S}/dnsrv/dnsrv.so ${D}/usr/lib/jabber/
	cp ${S}/dialback/dialback.so ${D}/usr/lib/jabber/
	if use ldap; then
		cp ${S}/xdb_ldap/jabber.schema ${D}/etc/jabber/
		cp ${S}/xdb_ldap/slapd.conf ${D}/etc/jabber/
		cp ${S}/xdb_ldap/src/xdb_ldap.so ${D}/usr/lib/jabber/
		cp ${S}/config/xdb-ldap.xml ${D}/etc/jabber/
	fi
	if use j-noaim; then
		grep -v 'aim data' ${S}/config/multiple.xml > ${S}/config/multiple.xml.new
		mv ${S}/config/multiple.xml.new ${S}/config/multiple.xml
	fi; if use j-nomsn; then
		grep -v 'msn data' ${S}/config/multiple.xml > ${S}/config/multiple.xml.new
		mv ${S}/config/multiple.xml.new ${S}/config/multiple.xml
	fi; if use j-noyahoo; then
		grep -v 'yahoo data' ${S}/config/multiple.xml > ${S}/config/multiple.xml.new
		mv ${S}/config/multiple.xml.new ${S}/config/multiple.xml
	fi; if use j-nomuconf; then
		grep -v 'muconf data' ${S}/config/multiple.xml > ${S}/config/multiple.xml.new
		mv ${S}/config/multiple.xml.new ${S}/config/multiple.xml
	fi; if use j-nojud; then
		grep -v 'jud data' ${S}/config/multiple.xml > ${S}/config/multiple.xml
		mv ${S}/config/multiple.xml.new ${S}/config/multiple.xml
	fi
	cp ${S}/config/multiple.xml ${D}/etc/jabber/
}

pkg_postinst() {
	local test_group=`grep ^jabber: /etc/group | cut -d: -f1`
	if [ -z $test_group ]
	then
		groupadd jabber
	fi

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

	chown jabber.jabber /etc/jabber
	chown jabber.jabber /usr/sbin/jabberd
	chown jabber.jabber /var/log/jabber -R
	chown jabber.jabber /var/spool/jabber -R
	chmod o-rwx /etc/jabber
	chmod o-rwx /usr/sbin/jabberd
	chmod o-rwx /var/log/jabber -R
	chmod o-rwx /var/spool/jabber -R
	chmod u+rwx /usr/sbin/jabberd
	chmod g-x /etc/jabber
	chmod g-x /usr/sbin/jabberd
	chmod g-x /var/log/jabber -R
	chmod g-x /var/spool/jabber -R
	chmod g+rw /etc/jabber
	chmod g+rw /usr/sbin/jabberd
	chmod g+rw /var/spool/jabber -R
	chmod g+rw /var/log/jabber -R
	chmod u+xs /usr/sbin/jabberd

	einfo "Change 'localhost' to your server's domainname in the"
	einfo "/etc/jabber/*.xml configs first"
	if use ssl >/dev/null; then
		einfo "To enable SSL connections, execute /etc/jabber/self-cert.sh"
	fi
	einfo "Server admins should be added to the "jabber" group"
	if use ldap >/dev/null; then
		einfo "In order to use the ldap backend, you need to copy"
		einfo "the file /etc/jabber/jabber.schema into the /etc/openldap/schemas"
		einfo "directory on your ldap server. You will also need to"
		einfo "include the schema in your slapd.conf file and retsart openldap."
		einfo "An example slapd.conf file is included in /etc/jabber."
		einfo "The xdb_ldap backend expects your ldap server to handle"
		einfo "StartTLS or run in ldaps mode."
	fi
	if ! use j-nojud >/dev/null; then
		einfo "To complete JUD configuration, read /etc/jabber/jud.README"
	fi
}