summaryrefslogtreecommitdiff
blob: 7594bd00e808fe3a31f084b8434dd4addd62929c (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
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

JAVA_PKG_IUSE="doc source"

ESVN_REPO_URI="https://svn.tigase.org/reps/${PN}/trunk"

inherit subversion java-pkg-2 eutils

DESCRIPTION="Tigase XMPP server"
HOMEPAGE="http://www.tigase.org"

LICENSE="GPL-3"
SLOT="0"
KEYWORDS=""
IUSE=""

DEPEND=">=dev-java/ant-1.7
	>=dev-java/tigase-xmltools-3.0
	>=dev-java/tigase-utils-3.1
	>=virtual/jdk-1.6.0"

RDEPEND=">=dev-java/tigase-xmltools-3.0
	>=dev-java/tigase-utils-3.1
	>=virtual/jre-1.6.0"

src_unpack() {
	subversion_src_unpack
	cd "${S}"
	ant clean-all

	EPATCH_OPTIONS="--ignore-whitespace"

	#Edit classpaths for ant to fit gentoo way
	epatch "${FILESDIR}/classpaths.patch"

	sed -i -e "s:libs=libs:xmltoolsjar=$(java-pkg_getjar tigase-xmltools
	tigase-xmltools.jar)\nutilsjar=$(java-pkg_getjar tigase-utils tigase-utils.jar):" \
		build.properties || die "Failed to patch build properties with correct jar locations"

	#Make default config more gentoo'ish
	epatch "${FILESDIR}/default_config.patch"
}

src_compile() {
	ant jar || die "Compile failed"
	if use doc; then
		ant docs || die "Docs failed"
	fi
}

src_install() {
	java-pkg_dojar jars/*.jar

	use doc && java-pkg_dojavadoc docs/api
	use source && java-pkg_dosrc src/main/java/

	newconfd "${FILESDIR}/conf_d_tigase" tigase || die "newconfd failed"
	newinitd "${FILESDIR}/init_d_tigase" tigase || die "newinitd failed"

	insinto /etc
	doins "${FILESDIR}/tigase.properties" || die "doins failed"

	insinto /var/lib/tigase/certificates
	insopts -m0600
	doins certs/* || die "doins failed"

	dodir /var/log/tigase
	touch "${D}/var/log/tigase/tigase.log"
}

pkg_preinst() {
	enewgroup tigase
	enewuser tigase -1 -1 /dev/null tigase

	fowners -R tigase:tigase /var/lib/tigase
	fowners -R tigase:tigase /var/log/tigase
}

pkg_postinst() {
	einfo "Remember to change config file and conf.d file to your needs."
	einfo "Config file is default generated by server is not present."
	einfo
}