aboutsummaryrefslogtreecommitdiffstats
path: root/www/horde/Makefile
blob: b2a2c57130bc24d28d64506bab0dab5d5ae1d15e (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:  horde
# Date created:           Sat Jul 07, 2001
# Whom:               Thierry Thomas (<thierry@thomas.as>)
# N.B.: parts of this ports come from the Horde's port by NetBSD (jlam@netbsd.org)
#
# $FreeBSD$
#

PORTNAME=   horde
PORTVERSION=    1.2.7
CATEGORIES= www
MASTER_SITES=   ftp://ftp.horde.org/pub/horde/tarballs/

MAINTAINER= thierry@pompo.net

#-----------------------------------------------------------------------
# You may define these options:
#
# - WITHOUT_SSL     : if you do not need Apache with mod_ssl;
#
# - WITH_PHP3       : if you do not need PHP4.
#
#-----------------------------------------------------------------------

.if !defined(WITHOUT_SSL)
RUN_DEPENDS+=   ${LOCALBASE}/libexec/apache/libssl.so:${PORTSDIR}/www/apache13-modssl
.endif
.if defined(WITH_PHP3)
RUN_DEPENDS+=   ${LOCALBASE}/libexec/apache/libphp3.so:${PORTSDIR}/www/mod_php3
.else
RUN_DEPENDS+=   ${LOCALBASE}/libexec/apache/libphp4.so:${PORTSDIR}/www/mod_php4
.endif

NO_BUILD=   yes
DOCS=       COPYING README docs/CHANGES docs/CREDITS docs/DATABASE \
        docs/HELP docs/INSTALL docs/SECURITY

LHORDEDIR?= www/horde
LPHPLIBDIR?=    www/horde/phplib
LHORDESBIN?=    sbin

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

HORDEDIR=   ${PREFIX}/${LHORDEDIR}
PHPLIBDIR=  ${PREFIX}/${LPHPLIBDIR}
HORDESBIN=  ${PREFIX}/${LHORDESBIN}

APACHE_CNFDIR?= ${LOCALBASE}/etc/apache
PHP_DIR?=   ${LOCALBASE}/etc
APACHE_CONF=    ${APACHE_CNFDIR}/httpd.conf
MIMETYPES=  ${APACHE_CNFDIR}/mime.types

.if defined(WITH_PHP3)
PHP_INI=    ${PHP_DIR}/php3.ini
.else
PHP_INI=    ${PHP_DIR}/php.ini
.endif

pre-everything::
.if !defined(WITHOUT_SSL)
    @${ECHO_MSG} ""
    @${ECHO_MSG} "Press CTRL-C and define WITHOUT_SSL"
    @${ECHO_MSG} " if you do not want to use Apache with SSL."
    @${ECHO_MSG} ""
.endif
    @${ECHO_MSG} ""
    @${ECHO_MSG} "If you plan to install IMP, it is better to configure"
    @${ECHO_MSG} "PHP with IMAP, OpenLDAP, OpenSSL,"
    @${ECHO_MSG} "and a database (like MySQL or PostgreSQL), and pspell."
    @${ECHO_MSG} ""
.if !defined(WITH_PHP3)
    @${ECHO_MSG} ""
    @${ECHO_MSG} "Press CTRL-C and define WITH_PHP3 if you want to use horde with PHP3."
    @${ECHO_MSG} ""
.endif

pre-install:
    @if [ -f ${HORDEDIR}/index.php ]; then \
        ${ECHO_MSG} "" ; \
        ${ECHO_MSG} "Please deinstall the port www/horde2." ; \
        ${ECHO_MSG} "" ; \
        ${FALSE} ; \
     fi

do-install:
    ${MKDIR}  ${HORDEDIR}
    ${MKDIR}  ${PHPLIBDIR}
    ${CP} -Rp ${WRKSRC}/config ${WRKSRC}/graphics ${WRKSRC}/lib ${HORDEDIR}
    ${CP} -Rp ${WRKSRC}/locale ${WRKSRC}/scripts ${WRKSRC}/templates ${HORDEDIR}
    ${CP} -p  ${WRKSRC}/phplib/* ${PHPLIBDIR}
    ${CP} -p  ${WRKSRC}/*.php3 ${HORDEDIR}
    ${CP} -p  ${WRKSRC}/install.sh ${HORDESBIN}/horde_setup.sh
    ${CP} -p  ${WRKSRC}/secure.sh  ${HORDESBIN}/horde_secure.sh
    ${PERL} -pi -e "s:chmod 444 :chmod 444 ${HORDEDIR}/:g" ${HORDESBIN}/horde_secure.sh
    ${PERL} -pi -e "s:chmod 000 :chmod 000 ${HORDEDIR}/:g" ${HORDESBIN}/horde_secure.sh
    ${PERL} -pi -e "s:-d imp:-d ${HORDEDIR}/imp:g" ${HORDESBIN}/horde_setup.sh
    ${PERL} -pi -e "s:config/horde:${HORDEDIR}/config/horde:g" ${HORDESBIN}/horde_setup.sh
    ${PERL} -pi -e "s:imp/config:${HORDEDIR}/imp/config:g" ${HORDESBIN}/horde_setup.sh
    ${PERL} -pi -e "s:chmod 444 :chmod 444 ${HORDEDIR}/:g" ${HORDESBIN}/horde_setup.sh
    ${CHMOD} u+x ${HORDESBIN}/horde_secure.sh
    ${CHMOD} u+x ${HORDESBIN}/horde_setup.sh
    ${PERL} -pi -e "s:go to the top level directory for your installation and run:run:g" ${HORDEDIR}/setup.php3
    ${PERL} -pi -e "s:sh ./install.sh:${HORDESBIN}/horde_setup.sh:g" ${HORDEDIR}/setup.php3
    ${PERL} -pi -e "s:sh ./install.sh:${HORDESBIN}/horde_setup.sh:g" ${HORDEDIR}/templates/index/horde_notconfigured.inc
    ${CP}     ${HORDEDIR}/config/horde.php3.dist ${HORDEDIR}/config/horde.php3
    ${CHMOD}  444 ${HORDEDIR}/config/horde.php3
    ${CHMOD}  444 ${HORDEDIR}/setup.php3
.if !defined(WITH_PHP3)
# Enabling execution of .php3, in case you only run php4
    @(if [ -f ${MIMETYPES} ] ; then \
        (if [ ! -f ${MIMETYPES}.beforeHorde ] ; then \
        ${ECHO} "===> Updating mime.types..." ; \
        ${CP} -p ${MIMETYPES} ${MIMETYPES}.beforeHorde ; \
        ${ECHO_CMD} "" >> ${MIMETYPES} ; \
        ${ECHO_CMD} "# Added by Horde to support php3" >> ${MIMETYPES} ; \
        (if ! ${GREP} -q x-httpd-php3 ${MIMETYPES} ; then \
            ${ECHO_CMD} "application/x-httpd-php        phtml pht php php3" >> ${MIMETYPES} ; \
            ${ECHO_CMD} "application/x-httpd-php3   php3.none" >> ${MIMETYPES} ; \
        fi) ; \
        ${ECHO_CMD} "# End of Horde's additions." >> ${MIMETYPES} ; \
        fi) ; \
    fi)
.endif
    @(if [ -f ${APACHE_CONF} ] ; then \
        (if [ ! -f ${APACHE_CONF}.beforeHorde ] ; then \
        ${ECHO} "===> Updating httpd.conf..." ; \
        ${CP} -p ${MASTERDIR}/httpd.conf.phplib ${WRKDIR}/httpd.conf.phplib ; \
        ${PERL} -pi -e "s:/home/httpd/html/horde:${HORDEDIR}:g" ${WRKDIR}/httpd.conf.phplib ; \
        ${PERL} -pi -e "s:/home/httpd/phplib:${PHPLIBDIR}:g" ${WRKDIR}/httpd.conf.phplib ; \
        ${CP} -p ${APACHE_CONF} ${APACHE_CONF}.beforeHorde ; \
        ${GREP} -qw 'phplib' ${APACHE_CONF} || ${CAT} ${WRKDIR}/httpd.conf.phplib >> ${APACHE_CONF} ; \
        fi) ; \
    fi)
    @if [ ! -f ${PHP_INI} ]; then \
        ${ECHO_MSG} "===> Creating ${PHP_INI} for PHP" ; \
        ${CP} ${PHP_INI}-dist ${PHP_INI} ; \
    fi
    @if ! ${GREP} -q -e '^upload_tmp_dir' ${PHP_INI} ; then \
        ${ECHO_MSG} "===> Configuring ${PHP_INI} for imp" ; \
        ${CP} -p ${PHP_INI} ${PHP_INI}.beforeHorde1 ; \
        ${PERL} -pi -e 's!;upload_tmp_dir =!upload_tmp_dir = /tmp!' ${PHP_INI} ; \
    fi
    ${CHOWN} -R www:www ${HORDEDIR}
.if !defined(NOPORTDOCS)
    ${MKDIR} ${DOCSDIR}
.for FILE in ${DOCS}
    ${INSTALL_DATA} ${WRKSRC}/${FILE} ${DOCSDIR}
.endfor
    @${ECHO} "Documentation installed in ${DOCSDIR}."
.endif

post-install:
    @${ECHO} "*****************************************************************"
    @${ECHO} "Horde has been installed in ${HORDEDIR} with your blank"
    @${ECHO} "configuration files."
    @${ECHO} ""
    @${ECHO} "If ${APACHE_CONF} has been updated,"
    @${ECHO} "you have to restart Apache."
    @${ECHO} ""
    @${ECHO} "In order to end Horde's configuration, please read the"
    @${ECHO} "file ${PHPLIBDIR}/README."
    @${ECHO} "If you want Horde to access a database, you have to"
    @${ECHO} "configure ${PHPLIBDIR}/local.inc"
    @${ECHO} "and ${PHPLIBDIR}/prepend.php3"
    @${ECHO} "and you'll have to run the appropriate scripts located in"
    @${ECHO} "${HORDEDIR}/scripts/database"
    @${ECHO} ""
    @${ECHO} "Horde is setup by default to access MySQL."
    @${ECHO} ""
    @${ECHO} "It is recommended that you change the password of the 'hordemgr'"
    @${ECHO} "user used to connect to the horde database.  For localhost"
    @${ECHO} "security, the file ${PHPLIBDIR}/local.inc"
    @${ECHO} "should be accessible only to the webserver process as it contains"
    @${ECHO} "the horde database password."
    @${ECHO} ""
    @${ECHO} "When everything is OK, you should be able to access Horde from"
    @${ECHO} "<URL:http://localhost/horde/>."
    @${ECHO} "(If <URL:http://localhost/horde/> does not run, but"
    @${ECHO} " <URL:http://localhost/horde/index.php3> is OK, then you have"
    @${ECHO} " to define index.php3 as a DirectoryIndex in ${APACHE_CONF}.)"
    @${ECHO} ""
    @${ECHO} "The configuration utitility is located at"
    @${ECHO} "<URL:http://localhost/horde/setup.php3>"
    @${ECHO} "and there is a testing script at"
    @${ECHO} "<URL:http://localhost/horde/test.php3>."
    @${ECHO} ""
    @${ECHO} "The scripts horde_setup.sh and horde_secure.sh have been installed"
    @${ECHO} "in ${HORDESBIN}."
    @${ECHO} "*****************************************************************"

.include <bsd.port.mk>