summaryrefslogtreecommitdiff
blob: 10ad17348f219874676eef79880389138e69d2a0 (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
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/eclass/horde.eclass,v 1.33 2006/03/09 23:35:52 vapier Exp $
#
# Help manage the horde project http://www.horde.org/
#
# Author: Mike Frysinger <vapier@gentoo.org>
# CVS additions by Chris Aniszczyk <zx@mea-culpa.net>
# SNAP additions by Jonathan Polansky <jpolansky@lsit.ucsb.edu>
#
# This eclass provides generic functions to make the writing of horde
# ebuilds fairly trivial since there are many horde applications and
# they all share the same basic install process.

# EHORDE_SNAP
# This variable tracks whether the user is using a snapshot version
#
# EHORDE_SNAP_BRANCH
# You set this via the ebuild to whatever branch you wish to grab a
# snapshot of.  Typically this is 'HEAD' or 'RELENG'.
#
# EHORDE_CVS
# This variable tracks whether the user is using a cvs version

inherit eutils

EXPORT_FUNCTIONS pkg_setup src_unpack src_install pkg_postinst

[[ -z ${HORDE_PN} ]] && HORDE_PN="${PN/-kolab}" && HORDE_PN="${HORDE_PN/horde-}"
[[ -z ${HORDE_MAJ} ]] && HORDE_MAJ=""

SRC_DATE="${PV:0:4}-${PV:4:2}-${PV:6:2}"

SRC_URI="http://build.pardus.de/downloads/${HORDE_PN}-HEAD-${SRC_DATE}.tar.gz"
S=${WORKDIR}/${HORDE_PN}
HOMEPAGE="http://www.horde.org/${HORDE_PN}"

LICENSE="LGPL-2"
SLOT="0"

# INSTALL_DIR is used by webapp.eclass when USE=-vhosts
INSTALL_DIR="/horde"
[[ ${HORDE_PN} != "horde" ]] && INSTALL_DIR="${INSTALL_DIR}/${HORDE_PN}"

horde-kolab-r2_pkg_setup() {

	if [[ ! -z ${HORDE_PHP_FEATURES} ]] ; then
		local param
		if [[ ${HORDE_PHP_FEATURES:0:2} = "-o" ]] ; then
			param="-o"
			HORDE_PHP_FEATURES=${HORDE_PHP_FEATURES:2}
		fi
		if ! built_with_use ${param} dev-lang/php ${HORDE_PHP_FEATURES} ; then
			echo
			if [[ ${param} == "-o" ]] ; then
				eerror "You MUST re-emerge php with at least one of"
			else
				eerror "You MUST re-emerge php with all of"
			fi
			eerror "the following options in your USE:"
			eerror " ${HORDE_PHP_FEATURES}"
			die "current php install cannot support ${HORDE_PN}"
		fi
	fi
}

horde-kolab-r2_src_unpack() {
	unpack ${A}

	cd "${S}"
	[[ -f test.php ]] && chmod 000 test.php
	[[ -n ${EHORDE_PATCHES} ]] && epatch ${EHORDE_PATCHES}

	cd config

	for f in *.dist; do cp $f `basename $f .dist`; done

	if [[ -n ${HORDE_KOLAB_CONFIG} ]]; then
		for FILE in ${HORDE_KOLAB_CONFIG}
		do
			cp ${FILESDIR}/${FILE} ${FILE/_${P}.config/}
		done
	fi

	cd ..
}

horde-kolab-r2_src_install() {

	local destdir=/var/www/kolab/htdocs/horde
	[[ ${HORDE_PN} != "horde" ]] && destdir=/var/www/kolab/htdocs/horde/${HORDE_PN}
	[[ -n ${HORDE_BASEDIR} ]] && destdir=/var/www/kolab/htdocs/horde${HORDE_BASEDIR}

	# Install docs and then delete them (except for CREDITS which
	# many horde apps include in their help page #121003)
	dodoc README docs/*
	mv docs/CREDITS "${T}"/
	rm -rf COPYING LICENSE README docs/*
	mv "${T}"/CREDITS docs/

	dodir ${destdir}
	cp -r . ${D}/${destdir}/ || die "install files"

	chown -R apache\: ${D}/${destdir}/config

	if [[ -n ${HORDE_KOLAB_TEMPLATES} ]]; then
		dodir /etc/kolab/templates
		for TEMPLATE in ${HORDE_KOLAB_TEMPLATES}
		do
			cp ${FILESDIR}/${TEMPLATE} ${D}/etc/kolab/templates/${TEMPLATE/-${PV}/}
		done
	fi

}

horde-kolab-r2_pkg_postinst() {
	if [[ -e ${ROOT}/usr/share/doc/${PF}/INSTALL.gz ]] ; then
		einfo "Please read /usr/share/doc/${PF}/INSTALL.gz"
	fi
	if [[ -n ${HORDE_KOLAB_TEMPLATES} ]]; then
		einfo
		einfo "This package adds configuration templates into /etc/kolab/templates."
		elog  "After installing/updating this package you MUST run kolabconf!"
	fi
}