aboutsummaryrefslogtreecommitdiffstats
path: root/www/apache20/Makefile.modules.3rd
blob: 9e3a5700c2e51da78768608b1324a4d3e7b6c3e6 (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
# Third party modules hack
#
# $FreeBSD$
#
# Author: Clement Laforet <clement@FreeBSD.org>
# If you have questions, please contact me.
#

.ifdef(USE_APACHE)
.error USE_APACHE and Makefile.modules.3rd can't be used together.
.endif

APXS?=      ${LOCALBASE}/sbin/apxs
MODULENAME?=    ${PORTNAME}
SHORTMODNAME?=  ${MODULENAME:S/mod_//}
SRC_FILE?=  ${MODULENAME}.c
OVERRIDABLE_VARS=   SRC_FILE MODULENAME SHORTMODNAME WRKSRC \
            PKGNAMESUFFIX

.if exists(${LOCALBASE}/include/apache2/http_core.h)
WITH_APACHE2=   YES
.   if defined (WANT_APACHE)
.     if ${WANT_APACHE} == 13
IGNORE=     "This module require apache13 and you have apache2 installed"
.     endif
.   endif
.elif exists(${LOCALBASE}/include/apache/http_core.h)
WITH_APACHE13=  YES
.   if defined (WANT_APACHE)
.     if ${WANT_APACHE} == 2
IGNORE=     "This module require apache2 and you have apache13 installed"
.     endif
.   endif
.   ifdef(WITH_APACHE2)
.error You have `WITH_APACHE2' variable defined either in environment or in make(1) argumentsm. but apache13 is installed Please undefine and try again.
.   endif
.endif

.if defined (WANT_APACHE)
.  if ${WANT_APACHE} == 13
WITH_APACHE13=      YES
.  elif ${WANT_APACHE} == 2
WITH_APACHE2=       YES
.  else
IGNORE=     "Unknown apache version"
.  endif
.endif

.if defined(WITH_APACHE2)
AP_BUILDEXT=    la
PLIST_SUB+= APACHEMODDIR="libexec/apache2"
APACHE_PORT=    www/apache2
AP_VER=     2
.else
AP_BUILDEXT=    so
PLIST_SUB+= APACHEMODDIR="libexec/apache"
APACHE_PORT?=   www/apache13
AP_VER=     13
.endif

.for VAR in ${OVERRIDABLE_VARS}
.   if defined(AP${AP_VER}_${VAR})
${VAR}= ${AP${AP_VER}_${VAR}}
.   endif
.endfor

BUILD_DEPENDS+= ${APXS}:${PORTSDIR}/${APACHE_PORT}
RUN_DEPENDS+=   ${APXS}:${PORTSDIR}/${APACHE_PORT}
PLIST_SUB+= AP_NAME="${SHORTMODNAME}"
PLIST_SUB+= AP_MODULE="${MODULENAME}.so"
.if defined(AP_GENPLIST)
PLIST?=     ${WRKDIR}/ap-plist
.endif

.if defined(AP_INC)
AP_EXTRAS+= -I ${AP_INC}
.endif
.if defined(AP_LIB)
AP_EXTRAS+= -L ${AP_LIB}
.endif

.if defined(AP_FAST_BUILD)

ap-gen-plist:
.if defined(AP_GENPLIST)
    @${ECHO} "===>  Generating apache plist"
    @${ECHO} "@unexec %D/sbin/apxs -e -A -n %%AP_NAME%% %D/%%APACHEMODDIR%%/%%AP_MODULE%%" > ${PLIST}
    @${ECHO} "%%APACHEMODDIR%%/%%AP_MODULE%%" >> ${PLIST}
    @${ECHO} "@exec %D/sbin/apxs -e -A -n %%AP_NAME%% %D/%F" >> ${PLIST}
.else
    @${DO_NADA}
.endif
do-build: ap-gen-plist
    @cd ${WRKSRC} && ${APXS} -c ${AP_EXTRAS} -o ${MODULENAME}.${AP_BUILDEXT} ${SRC_FILE}

do-install:
    @${APXS} -i -A -n ${SHORTMODNAME} ${WRKSRC}/${MODULENAME}.${AP_BUILDEXT}
.endif