aboutsummaryrefslogtreecommitdiffstats
path: root/www/suphp/Makefile
blob: a313cf454e54911db8fa312ef78520ea1779dd9e (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
# New ports collection makefile for:    suphp
# Date created:     15 September 2002
# Whom:         Clement Laforet <sheepkiller@cultdeadsheep.org>
#
# $FreeBSD$
#

PORTNAME=   suphp
PORTVERSION=    0.2.3
CATEGORIES= www
MASTER_SITES=   http://www.suphp.org/download/

MAINTAINER= sheepkiller@cultdeadsheep.org
COMMENT=    suPHP is a combination which provides a wrapper for PHP

BUILD_DEPENDS=  ${LOCALBASE}/sbin/apxs:${PORTSDIR}/www/apache13
RUN_DEPENDS=    ${LOCALBASE}/bin/php:${PORTSDIR}/lang/php4-cli

USE_REINPLACE=  yes

MAKE_ARGS+= APXS="${APXS}"
APXS?=      ${LOCALBASE}/sbin/apxs
WWW_USER?=  www
WWW_GROUP?= www
LOG_PATH?=  /var/log
PHP_PATH?=  ${LOCALBASE}/bin/php

.include <bsd.port.pre.mk>

.if exists(${LOCALBASE}/libexec/apache/libphp4.so)
IGNORE="suPHP conflicts with mod_php4. It works only with php4-cli"
.endif

pre-configure:
    @${ECHO}
    @${ECHO} "*-------------------------------------------------------------*"
    @${ECHO} " Options :"
    @${ECHO} "     - WWW_USER = Apache's User (default www)"
    @${ECHO} "     - Define CHECK_PATH, to enable suExec-like path checking"
    @${ECHO} "       (based on DocumentRoot directive)."
    @${ECHO} "     - LOG_PATH=/path/to/your/logs. Default /var/log/."
    @${ECHO} "     - PHP_PATH=/path/to/bin/php. Default ${LOCALBASE}/bin/php."
    @${ECHO} "*-------------------------------------------------------------*"
    @${ECHO}

do-configure:
    @${ECHO} "Setting User to : ${WWW_USER}"
    @${REINPLACE_CMD} -e 's!OPT_APACHE_USER "wwwrun"!OPT_APACHE_USER "${WWW_USER}"!' \
        ${WRKSRC}/config.h
    @${ECHO} "Setting Group to : ${WWW_GROUP}"
    @${REINPLACE_CMD} -e 's!OPT_APACHE_GROUP "wwwrun"!OPT_APACHE_GROUP "${WWW_USER}"!' \
        ${WRKSRC}/config.h
    @${ECHO} "Setting checkpath. (if enabled)"
.if !defined(CHECK_PATH)
    @${REINPLACE_CMD} -e 's!#define OPT_CHECKPATH!/*#define OPT_CHECKPATH*/!' \
        ${WRKSRC}/config.h
.endif
    @${ECHO} "Setting logs path"
    @${REINPLACE_CMD} -e 's,OPT_LOGFILE "/opt/apache/var/logs/suphp_log",OPT_LOGFILE "${LOG_PATH}/suphp_log",' \
        ${WRKSRC}/config.h
     @${ECHO} "Setting php path"
    @${REINPLACE_CMD} -e 's,OPT_PATH_TO_PHP "/usr/bin/php",OPT_PATH_TO_PHP "${PHP_PATH}",' \
        ${WRKSRC}/config.h
    @${ECHO} "Setting suphp path in mod_suphp"
    @${REINPLACE_CMD} -e "s,/usr/sbin/suphp,${PREFIX}/sbin/suphp," ${WRKSRC}/apache/mod_suphp.c

post-build:
    @(cd ${WRKSRC}/apache && ${APXS} -c mod_suphp.c) 

post-install:
    @(cd ${WRKSRC}/apache && ${APXS} -i -a -n suphp ${WRKSRC}/apache/mod_suphp.so)
.if !defined(NOPORTDOCS)
    @${MKDIR} ${DOCSDIR} ${DOCSDIR}/apache ${DOCSDIR}/de-doc ${DOCSDIR}/de-doc/apache
    ${INSTALL_DATA} ${WRKSRC}/README ${DOCSDIR}
    ${INSTALL_DATA} ${WRKSRC}/INSTALL ${DOCSDIR}
    ${INSTALL_DATA} ${WRKSRC}/LICENSE ${DOCSDIR}
    ${INSTALL_DATA} ${WRKSRC}/apache/CONFIG ${DOCSDIR}/apache
    ${INSTALL_DATA} ${WRKSRC}/apache/README ${DOCSDIR}/apache
    ${INSTALL_DATA} ${WRKSRC}/apache/INSTALL ${DOCSDIR}/apache
    ${INSTALL_DATA} ${WRKSRC}/apache/LICENSE ${DOCSDIR}/apache
    ${INSTALL_DATA} -d ${WRKSRC}/de-doc/ ${DOCSDIR}
    ${INSTALL_DATA} ${WRKSRC}/de-doc/README.de ${DOCSDIR}/de-doc/
    ${INSTALL_DATA} ${WRKSRC}/de-doc/INSTALL.de ${DOCSDIR}/de-doc/
    ${INSTALL_DATA} ${WRKSRC}/de-doc/apache/README.de ${DOCSDIR}/de-doc/apache
    ${INSTALL_DATA} ${WRKSRC}/de-doc/apache/INSTALL.de ${DOCSDIR}/de-doc/apache
    ${INSTALL_DATA} ${WRKSRC}/de-doc/apache/CONFIG.de ${DOCSDIR}/de-doc/apache
.endif
    @${CAT} ${PKGMESSAGE}

.include <bsd.port.post.mk>