summaryrefslogtreecommitdiff
blob: c93f9623c0fefc5d9a91430b466bda79e64bb242 (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
# 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-1.4.3-r2.ebuild,v 1.5 2004/04/27 21:56:50 agriffis Exp $

inherit eutils

S="${WORKDIR}/jabberd-${PV}"
DESCRIPTION="Open Source Jabber Server"
HOMEPAGE="http://www.jabber.org"
SRC_URI="http://jabberd.jabberstudio.org/1.4/dist/jabberd-${PV}.tar.gz
	ldap? ( http://www.jabberstudio.org/files/xdb_ldap/xdb_ldap-1.0.tar.gz )"

SLOT="0"
LICENSE="GPL-2"
KEYWORDS="~x86"

DEPEND="!net-im/jabber-server
	=dev-libs/pth-1.4.0
	ssl? ( >=dev-libs/openssl-0.9.6i )
	ldap? ( =net-nds/openldap-2* )"

PDEPEND="msn? ( net-im/msn-transport )
		 oscar? ( net-im/aim-transport )
		 yahoo? ( net-im/yahoo-transport )
		 icq? ( net-im/jit )"

src_unpack() {
	unpack jabberd-${PV}.tar.gz
	cd ${S}
	use ldap	&& unpack xdb_ldap-1.0.tar.gz
	epatch ${FILESDIR}/multiple-xml-patch-00
	mv jabber.xml multiple.xml
}

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"
	use ipv6 && myconf="${myconf} --enable-ipv6"

	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 ldap; then
		cd ${S}/xdb_ldap/src
		make all || die
	fi
}

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

	exeinto /usr/sbin
	doexe jabberd/jabberd
	insinto /usr/lib/jabberd
	doins platform-settings
	doins jsm/jsm.so
	doins xdb_file/xdb_file.so
	doins pthsock/pthsock_client.so
	doins dnsrv/dnsrv.so
	doins dialback/dialback.so
	if [ `use ldap` ]; then
		insinto /etc/jabber
		doins xdb_ldap/jabber.schema
		doins xdb_ldap/slapd.conf
		doins config/xdb-ldap.xml
		insinto /usr/lib/jabberd
		doins xdb_ldap/src/xdb_ldap.so
	fi
	insinto /etc/jabber
	doins multiple.xml
	exeinto /etc/jabber
	doexe ${FILESDIR}/self-cert.sh

	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

	dodoc README UPGRADE ${FILESDIR}/README.Gentoo

	fowners jabber:jabber /etc/jabber
	fowners jabber:jabber /usr/sbin/jabberd
	fowners jabber:jabber /var/log/jabber
	fowners jabber:jabber /var/log/jabber/error.log
	fowners jabber:jabber /var/log/jabber/record.log
	fowners jabber:jabber /var/spool/jabber

	fperms o-rwx /etc/jabber
	fperms o-rwx /usr/sbin/jabberd
	fperms o-rwx /var/log/jabber
	fperms o-rwx /var/log/jabber/error.log
	fperms o-rwx /var/log/jabber/record.log
	fperms o-rwx /var/spool/jabber
	fperms u+rwx /usr/sbin/jabberd

	fperms g-x /etc/jabber
	fperms g-x /usr/sbin/jabberd
	fperms g-x /var/log/jabber
	fperms g-x /var/log/jabber/error.log
	fperms g-x /var/log/jabber/record.log
	fperms g-x /var/spool/jabber

	fperms g+rw /etc/jabber
	fperms g+rw /usr/sbin/jabberd
	fperms g+rw /var/log/jabber
	fperms g+rw /var/log/jabber/error.log
	fperms g+rw /var/log/jabber/record.log
	fperms g+rw /var/spool/jabber
	fperms u+xs /usr/sbin/jabberd

	#Install header files for transports to use
	cd ${S}/jabberd
	tar cf - `find . -name \*.h` | (cd ${D}/usr/include/jabberd ; tar xvf -)
	assert "Failed to install header files to /usr/include/jabberd"
}

pkg_postinst() {

	einfo
	einfo "Change 'localhost' to your server's domainname in the"
	einfo "/etc/jabber/*.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/jabber/self-cert.sh"
	fi
	if [ `use ldap` ]; then
		einfo
		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
	einfo
	einfo "The various IM transports for jabber are now separate packages,"
	einfo "which you will need to install separately if you want them:"
	einfo "net-im/jit - ICQ transport (You can use aim-transport for icq but JIT is better)"
	einfo "net-im/msn-transport - MSN transport (USE=msn)"
	einfo "net-im/jud - Jabber User Directory"
	einfo "net-im/yahoo-transport - Yahoo IM system (USE=yahoo)"
	einfo "net-im/aim-transport - AOL transport (USE=oscar)"
	einfo "net-im/mu-conference - Jabber multi user conference"
	einfo
	einfo "Please read /usr/share/doc/${PF}/README.Gentoo.gz"
	einfo
}