aboutsummaryrefslogtreecommitdiffstats
path: root/www/horde2/Makefile
blob: bae5f3814725e4895970ba8731c33f1d2b82e593 (plain) (blame)
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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
# Ports collection makefile for:  horde2
# Date created:           Sun Oct 07, 2001
# Whom:               Thierry Thomas (<thierry@thomas.as>)
#
# $FreeBSD$
#

PORTNAME=   horde
PORTVERSION=    2.2.3
PORTREVISION=   2
CATEGORIES= www
MASTER_SITES=   ftp://ftp.horde.org/pub/horde/              \
        ftp://ftp.au.horde.org/pub/horde/           \
        ftp://ftp.es.horde.org/pub/horde/           \
        ftp://ftp.it.horde.org/pub/mirror/horde.org/horde/  \
        ftp://ftp.nl.horde.org/mirror/horde-ftp/pub/horde/  \
        ftp://ftp.pt.horde.org/pub/horde-ftp/horde/

MAINTAINER= thierry@pompo.net
COMMENT=    A common code-base used by Horde applications, written in PHP

#-----------------------------------------------------------------------
# You may define these options:
#
# - WITHOUT_SUPPORTED_DB: if you run a database not in the ports tree;
#
#-----------------------------------------------------------------------

LIB_DEPENDS+=   intl.5:${PORTSDIR}/devel/gettext
.if !defined(WITHOUT_MCAL)
LIB_DEPENDS+=   mcal.0:${PORTSDIR}/misc/libmcal
.endif
# Remark: pear-XML_sql2xml is included, but never used.
RUN_DEPENDS=    ${PEARDIR}/Date.php:${PORTSDIR}/devel/pear-Date         \
        ${PEARDIR}/HTML/Common.php:${PORTSDIR}/devel/pear-HTML_Common   \
        ${PEARDIR}/Log.php:${PORTSDIR}/sysutils/pear-Log        \
        ${PEARDIR}/Mail/mime.php:${PORTSDIR}/mail/pear-Mail_Mime

IS_INTERACTIVE= 'need to build php4 with XML support.'
NO_BUILD=   yes
USE_REINPLACE=  yes

LDD=        /usr/bin/ldd

REINPLACE_ARGS= -i.beforeHorde
DOCS=       COPYING README docs/CHANGES docs/CODING_STANDARDS \
        docs/CONTRIBUTING docs/CREDITS docs/HACKING docs/INSTALL \
        docs/TRANSLATIONS
CONFFILE=   horde.php html.php lang.php mime_drivers.php mime_mapping.php \
        motd.php prefs.php registry.php
SUB_DIRS=   config graphics lib locale po scripts templates util

LHORDEDIR?= www/horde
LHORDESBIN?=    sbin

PLIST_SUB=  HORDEDIR=${LHORDEDIR} HORDESBIN=${LHORDESBIN}

HORDEDIR=   ${PREFIX}/${LHORDEDIR}
HORDESBIN=  ${PREFIX}/${LHORDESBIN}
CONFDIR=    ${HORDEDIR}/config

APACHE_CONF=    ${APACHE_CNFDIR}/httpd.conf
PEARDIR?=   ${LOCALBASE}/share/pear
.if defined(WITH_APACHE2)
APACHE_CNFDIR=  ${LOCALBASE}/etc/apache2
MOD_DIR=    libexec/apache2
.else
APACHE_CNFDIR=  ${LOCALBASE}/etc/apache
MOD_DIR=    libexec/apache
.endif
PHPSO=      ${LOCALBASE}/${MOD_DIR}/libphp4.so
HORDE_INC=  ${PREFIX}/etc/horde
LOG_FILE?=  /var/log/horde.log

pre-everything::
    @${ECHO_MSG} ""
    @${ECHO_MSG} "If you plan to install IMP, it is better to configure"
    @${ECHO_MSG} "PHP with IMAP / IMAP-SSL, OpenLDAP, OpenSSL, mcrypt, XML,"
    @${ECHO_MSG} "FTP, gettext, zlib, MCAL and a database (like MySQL or"
    @${ECHO_MSG} "PostgreSQL)."
    @${ECHO_MSG} "For Japanese language, please enable mbstring."
    @${ECHO_MSG} ""

pre-install:
    @if [ -f ${HORDEDIR}/index.php3 ]; then \
        ${ECHO_MSG} "" ; \
        ${ECHO_MSG} "Please deinstall the port www/horde." ; \
        ${ECHO_MSG} "" ; \
        ${FALSE} ; \
    fi
    @if ! ${LDD} ${PHPSO} | ${GREP} -q -e "libxml2.so"; then \
        ${ECHO_MSG} "" ; \
        ${ECHO_MSG} "Please configure PHP with DOM XML support." ; \
        ${ECHO_MSG} "" ; \
        ${FALSE} ; \
    fi
    @if ! ${LDD} ${PHPSO} | ${GREP} -q -e "libintl.so"; then \
        ${ECHO_MSG} "" ; \
        ${ECHO_MSG} "Please configure PHP with gettext support." ; \
        ${ECHO_MSG} "" ; \
        ${FALSE} ; \
    fi
# N.B.: database dependencies are binded with mod_php#, not with Horde
.if !defined(WITHOUT_SUPPORTED_DB)
    @if ! ${LDD} ${PHPSO} | ${GREP} -q -e "libmysqlclient" ; then \
     if ! ${LDD} ${PHPSO} | ${GREP} -q -e "libpq.so" ; then \
      if ! ${LDD} ${PHPSO} | ${GREP} -q -e "libsybdb.so" ; then \
       if ! ${LDD} ${PHPSO} | ${GREP} -q -e "libct.so" ; then \
        ${ECHO_MSG} "" ; \
        ${ECHO_MSG} "Please configure PHP with a database support." ; \
        ${ECHO_MSG} "MySQL, PostgreSQL and Sybase (CTLIB or DBLIB)" ; \
        ${ECHO_MSG} "can be used with PHP AND Horde." ; \
        ${ECHO_MSG} "" ; \
        ${ECHO_MSG} "(If everything will run on this machine, do not" ; \
        ${ECHO_MSG} " forget to install the database server-side!)" ; \
        ${ECHO_MSG} "" ; \
        ${FALSE} ; \
       fi ; \
      fi ; \
     fi ; \
    fi
.endif

post-patch:
    @${RM} ${WRKSRC}/po/translation.php.orig
    @${RM} ${WRKSRC}/lib/Horde.php.orig
    @${RM} ${WRKSRC}/scripts/db/README.orig
    @${RM} ${WRKSRC}/scripts/set_perms.sh.orig
    @${RM} ${WRKSRC}/config/horde.php.dist.orig
    @${RM} ${WRKSRC}/config/registry.php.dist.orig
    @${RM} ${WRKSRC}/config/mime_drivers.php.dist.orig

do-install:
    @${MKDIR}  ${HORDEDIR}
.for REP in ${SUB_DIRS}
    @${CP} -Rp ${WRKSRC}/${REP} ${HORDEDIR}
.endfor
    @${CP} -p  ${WRKSRC}/*.php ${HORDEDIR}
    @if [ ! -f ${CONFDIR}/horde.php ]; then \
        ${CP} ${CONFDIR}/horde.php.dist ${CONFDIR}/horde.php ; \
        ${REINPLACE_CMD} -e "s:/tmp/horde.log:${LOG_FILE}:g" ${CONFDIR}/horde.php ; \
        ${RM} ${CONFDIR}/horde.php.beforeHorde ; \
    fi
    @${REINPLACE_CMD} -e "s:/etc/mpasswd:${LOCALBASE}/etc/mpasswd:g" \
        ${HORDEDIR}/lib/Auth/mcal.php
    @${RM} ${HORDEDIR}/lib/Auth/mcal.php.beforeHorde
.for FILE in ${CONFFILE}
    @if [ ! -f ${CONFDIR}/${FILE} ]; then \
      ${CP} ${CONFDIR}/${FILE}.dist ${CONFDIR}/${FILE} ; \
    fi
.endfor
    @${REINPLACE_CMD} -e "s:%%LOCALBASE%%:${LOCALBASE}:" ${CONFDIR}/mime_drivers.php
    @${RM} ${CONFDIR}/mime_drivers.php.beforeHorde
    @${CP} ${WRKSRC}/scripts/set_perms.sh ${HORDESBIN}/horde_set_perms.sh
    @${REINPLACE_CMD} -e "s:UPDATED_BY_THE_PORT:${HORDEDIR}/:g" \
        ${HORDESBIN}/horde_set_perms.sh
    @${RM} ${HORDESBIN}/horde_set_perms.sh.beforeHorde
    @${CHMOD} u+x ${HORDESBIN}/horde_set_perms.sh
    @(if [ -f ${APACHE_CONF} ] ; then \
        ${MKDIR} ${HORDE_INC} ; \
        ${CP} -p ${FILESDIR}/httpd.conf.horde ${HORDE_INC} ; \
        ${REINPLACE_CMD} -e "s:/home/httpd/html/horde:${HORDEDIR}:g ; \
            s:/home/httpd/phplib:${PEARDIR}:g" ${HORDE_INC}/httpd.conf.horde ; \
        ${RM} ${HORDE_INC}/httpd.conf.horde.beforeHorde ; \
        ${ECHO_MSG} "===> Updating ${APACHE_CONF}..." ; \
        ${REINPLACE_CMD} -e "s:php_value auto_prepend_file:# php_value auto_prepend_file:g ; \
            s:${HORDEDIR}/phplib:${PEARDIR}:g" ${APACHE_CONF} ; \
        ${ECHO_CMD} "# Horde's include directory" >> ${APACHE_CONF} ; \
        ${ECHO_CMD} "Include ${HORDE_INC}" >> ${APACHE_CONF} ; \
    fi)
    @${CHOWN} -R www:www ${HORDEDIR}
    @${CHMOD} -R o-rwx ${CONFDIR}
    @${TOUCH} ${LOG_FILE}
    @${CHOWN} www:www ${LOG_FILE}
.if !defined(NOPORTDOCS)
    @${MKDIR} ${DOCSDIR}
.for FILE in ${DOCS}
    @${INSTALL_DATA} ${WRKSRC}/${FILE} ${DOCSDIR}
.endfor
    @${REINPLACE_CMD} -e "s:/usr/local/apache/htdocs:${PREFIX}/www:g" ${DOCSDIR}/INSTALL
    @${RM} ${DOCSDIR}/INSTALL.beforeHorde
    @${ECHO_MSG} "===> Documentation installed in ${DOCSDIR}."
.endif

post-install:
    @${ECHO}
    @${CAT} ${PKGMESSAGE} | ${SED} -e \
    "s:%%HORDEDIR%%:${HORDEDIR}:g;s:%%APACHE_CONF%%:${APACHE_CONF}:g;s:%%HORDESBIN%%:${HORDESBIN}:g"
    @${ECHO}

.include <bsd.port.mk>