1 # Copyright 1999-2011 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
5 # Help manage the horde project http://www.horde.org/
7 # Author: Mike Frysinger <vapier@gentoo.org>
8 # CVS additions by Chris Aniszczyk <zx@mea-culpa.net>
9 # SNAP additions by Jonathan Polansky <jpolansky@lsit.ucsb.edu>
11 # This eclass provides generic functions to make the writing of horde
12 # ebuilds fairly trivial since there are many horde applications and
13 # they all share the same basic install process.
16 # This variable tracks whether the user is using a snapshot version
19 # You set this via the ebuild to whatever branch you wish to grab a
20 # snapshot of. Typically this is 'HEAD' or 'RELENG'.
23 # This variable tracks whether the user is using a cvs version
26 [[ ${PN} != ${PN/-cvs} ]] && inherit cvs
30 EXPORT_FUNCTIONS pkg_setup src_unpack src_install pkg_postinst
32 [[ -z ${HORDE_PN} ]] && HORDE_PN="${PN/horde-}"
33 [[ -z ${HORDE_MAJ} ]] && HORDE_MAJ=""
37 if [[ ${PN} != ${PN/-cvs} ]] ; then
39 HORDE_PN=${HORDE_PN/-cvs}
41 ECVS_SERVER="anoncvs.horde.org:/repository"
42 ECVS_MODULE="${HORDE_PN}"
43 ECVS_TOP_DIR="${PORTAGE_ACTUAL_DISTDIR-${DISTDIR}}/cvs-src/${PN}"
48 S=${WORKDIR}/${HORDE_PN}
50 elif [[ ${PN} != ${PN/-snap} ]] ; then
52 EHORDE_SNAP_BRANCH=${EHORDE_SNAP_BRANCH:-HEAD}
53 SNAP_PV=${PV:0:4}-${PV:4:2}-${PV:6:2}
55 HORDE_PN=${HORDE_PN/-snap}
57 SRC_URI="http://ftp.horde.org/pub/snaps/${SNAP_PV}/${HORDE_PN}-${EHORDE_SNAP_BRANCH}-${SNAP_PV}.tar.gz"
58 S=${WORKDIR}/${HORDE_PN}
61 SRC_URI="http://ftp.horde.org/pub/${HORDE_PN}/${HORDE_PN}${HORDE_MAJ}-${PV/_/-}.tar.gz"
62 S=${WORKDIR}/${HORDE_PN}${HORDE_MAJ}-${PV/_/-}
64 HOMEPAGE="http://www.horde.org/${HORDE_PN}"
68 # INSTALL_DIR is used by webapp.eclass when USE=-vhosts
70 [[ ${HORDE_PN} != "horde" && ${HORDE_PN} != "horde-groupware" && ${HORDE_PN} != "horde-webmail" ]] && INSTALL_DIR="${INSTALL_DIR}/${HORDE_PN}"
72 HORDE_APPLICATIONS="${HORDE_APPLICATIONS} ."
77 if [[ ! -z ${HORDE_PHP_FEATURES} ]] ; then
79 if [[ ${HORDE_PHP_FEATURES:0:2} = "-o" ]] ; then
81 HORDE_PHP_FEATURES=${HORDE_PHP_FEATURES:2}
83 if ! built_with_use ${param} dev-lang/php ${HORDE_PHP_FEATURES} ; then
85 if [[ ${param} == "-o" ]] ; then
86 eerror "You MUST re-emerge php with at least one of"
88 eerror "You MUST re-emerge php with all of"
90 eerror "the following options in your USE:"
91 eerror " ${HORDE_PHP_FEATURES}"
92 die "current php install cannot support ${HORDE_PN}"
98 if [[ ${EHORDE_CVS} = "true" ]] ; then
105 [[ -n ${EHORDE_PATCHES} ]] && epatch ${EHORDE_PATCHES}
107 for APP in ${HORDE_APPLICATIONS}
109 [[ -f ${APP}/test.php ]] && chmod 000 ${APP}/test.php
113 horde_src_install() {
116 local destdir=${MY_HTDOCSDIR}
118 # Work-around when dealing with CVS sources
119 [[ ${EHORDE_CVS} = "true" ]] && cd ${HORDE_PN}
121 # Install docs and then delete them (except for CREDITS which
122 # many horde apps include in their help page #121003)
124 mv docs/CREDITS "${T}"/
125 rm -rf COPYING LICENSE README docs/*
126 mv "${T}"/CREDITS docs/
129 cp -r . "${D}"/${destdir}/ || die "install files"
131 for APP in ${HORDE_APPLICATIONS}
133 for DISTFILE in ${APP}/config/*.dist
135 if [[ -f ${DISTFILE/.dist/} ]] ; then
136 webapp_configfile "${MY_HTDOCSDIR}"/${DISTFILE/.dist/}
139 if [[ -f ${APP}/config/conf.php ]] ; then
140 webapp_serverowned "${MY_HTDOCSDIR}"/${APP}/config/conf.php
141 webapp_configfile "${MY_HTDOCSDIR}"/${APP}/config/conf.php
145 [[ -n ${HORDE_RECONFIG} ]] && webapp_hook_script ${HORDE_RECONFIG}
146 [[ -n ${HORDE_POSTINST} ]] && webapp_postinst_txt en ${HORDE_POSTINST}
151 horde_pkg_postinst() {
152 if [ -e ${ROOT}/usr/share/doc/${PF}/INSTALL* ] ; then
153 elog "Please read the INSTALL file in /usr/share/doc/${PF}."
156 einfo "Before this package will work, you have to setup the configuration files."
157 einfo "Please review the config/ subdirectory of ${HORDE_PN} in the webroot."
159 if [ -e ${ROOT}/usr/share/doc/${PF}/SECURITY* ] ; then
161 ewarn "Users are HIGHLY recommended to consult the SECURITY guide in"
162 ewarn "/usr/share/doc/${PF} before going into production with Horde."
165 if [[ ${HORDE_PN} != "horde" && ${HORDE_PN} != "horde-groupware" && ${HORDE_PN} != "horde-webmail" ]] ; then
167 ewarn "Make sure ${HORDE_PN} is accounted for in Horde's root"
168 ewarn " config/registry.php"
171 if [[ ${EHORDE_CVS} = "true" ]] ; then
173 ewarn "Use these CVS versions at your own risk."
174 ewarn "They tend to break things when working with the non CVS versions of horde."
179 ewarn "When installing Horde into a vhost dir, you will need to use the"
180 ewarn "-d option so that it is installed into the proper location."