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

inherit depend.apache gnustep-base

MY_PN="SOGo"
MY_PV="${PV/_/}.1"

DESCRIPTION="groupware server built around OpenGroupware.org and the SOPE application server"
HOMEPAGE="http://sogo.opengroupware.org/"
SRC_URI="http://www.inverse.ca/downloads/${MY_PN}/Sources/${MY_PN}-${MY_PV}.tar.gz"

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

DEPEND="gnustep-libs/sope"
RDEPEND="${DEPEND}
	dev-db/postgresql"
need_apache2

S=${WORKDIR}/${MY_PN}

pkg_setup() {
	gnustep-base_pkg_setup

	if ! built_with_use gnustep-libs/sope postgres; then
		eerror "SOGo needs gnustep-libs/sope with USE=postgres enabled"
		die "gnustep-libs/sope compiled without USE=postgres"
	fi
}


src_unpack() {
	gnustep-base_src_unpack

	# Fix for missing include
	epatch "${FILESDIR}"/${PN}-foundation_include.patch
}


src_compile() {
	# Do not use standard src_compile, as ./configure is not standard
	egnustep_env
	./configure
	egnustep_make
}

src_install() {
	gnustep-base_src_install

	# Apache configuration file
	dodir "${APACHE_MODULES_CONFDIR}"
	cat <<EOF >"${D}/${APACHE_MODULES_CONFDIR}"/47_sogo.conf
<IfDefine SOPE>
LoadModule ngobjweb_module modules/mod_ngobjweb.so

Alias /sogo.woa/WebServerResources/ \
	${GNUSTEP_SYSTEM_LIBRARY}/SOGo-0.9/WebServerResources/
Alias /SOGo.woa/WebServerResources/ \
	${GNUSTEP_SYSTEM_LIBRARY}/SOGo-0.9/WebServerResources/

AliasMatch /SOGo/so/ControlPanel/Products/(.*)/Resources/(.*) \
	${GNUSTEP_SYSTEM_LIBRARY}/SOGo-0.9/\$1.SOGo/Resources/\$2

<LocationMatch "^/SOGo*">
	AddDefaultCharset UTF-8
	SetHandler ngobjweb-adaptor
	SetAppPort 20000
	Allow from 127.0.0.1
</LocationMatch>

<LocationMatch "^/SOGo/so/ControlPanel/Products/.*UI/Resources/.*png">
	SetHandler default-handler
</LocationMatch>

<LocationMatch "^/SOGo/so/ControlPanel/Products/.*UI/Resources/.*gif">
	SetHandler default-handler
</LocationMatch>

<LocationMatch "^/SOGo/so/ControlPanel/Products/.*UI/Resources/.*css">
	SetHandler default-handler
</LocationMatch>

<LocationMatch "^/SOGo/so/ControlPanel/Products/.*UI/Resources/.*js">
	SetHandler default-handler
</LocationMatch>

</IfDefine>
EOF

	# Init script
	newinitd "${FILESDIR}"/sogo.initd sogo \
		|| die "Init script installation failed"
}

pkg_preinst() {
	enewuser sogo -1 /bin/bash /var/lib/sogo
}

pkg_postinst() {
	gnustep-base_pkg_postinst

	elog "Do not forget to enable the sope module in /etc/apache2/httpd.conf"
	elog "Now follow the steps from the SOGo documentation:"
	elog "http://www.inverse.ca/contributions/sogo/documentation.html#c803"
	elog "The default port configured for sogo is 20000 (from 47_sogo.conf)"
	elog "The sogo user home directory is /var/lib/sogo"
	elog ""
	elog "Then you can start/stop sogo with /etc/init.d/sogo"
}