source: trunk/dports/www/apache2/Portfile

Last change on this file was 152906, checked in by ctreleaven@…, 12 months ago

apache2: add support for packaging

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 7.2 KB
Line 
1# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
2# $Id: Portfile 152906 2016-09-20 12:45:22Z ryandesign@macports.org $
3
4PortSystem          1.0
5PortGroup           active_variants 1.1
6
7name                apache2
8version             2.2.31
9revision            2
10categories          www
11maintainers         ryandesign openmaintainer
12license             Apache-2
13description         The extremely popular second version of the Apache http server
14long_description \
15    Apache is an HTTP server designed as a plug-in replacement for \
16    the NCSA server version 1.3 (or 1.4). It fixes numerous bugs in \
17    the NCSA server and includes many frequently requested new \
18    features, and has an API which allows it to be extended to meet \
19    users' needs more easily.
20homepage            http://httpd.apache.org/
21platforms           darwin freebsd openbsd
22
23master_sites        apache:httpd
24distname            httpd-${version}
25use_bzip2           yes
26use_parallel_build  yes
27
28checksums           rmd160  5b073f5f556c74e19eba8e40faa5c5fa308e018a \
29                    sha256  f32f9d19f535dac63b06cb55dfc023b40dcd28196b785f79f9346779e22f26ac
30
31depends_lib         port:apr \
32                    port:apr-util \
33                    port:expat \
34                    path:lib/libssl.dylib:openssl \
35                    port:pcre \
36                    port:perl5 \
37                    port:zlib
38
39# Both apache and apache2 want to install dbmmanage.1 and other manpages.
40conflicts           apache thttpd
41
42patchfiles          patch-docs-cgi-examples-printenv.diff \
43                    libtool-tag.diff
44
45post-patch {
46    reinplace "s|@PREFIX@|${prefix}|g" ${worksrcpath}/docs/cgi-examples/printenv
47    reinplace -E "s/(User|Group) daemon/\\1 www/" ${worksrcpath}/docs/conf/httpd.conf.in
48}
49
50platform darwin {
51    post-patch {
52        # Customize userdir naming to match darwin
53        reinplace "s|/home/|/Users/|g" ${worksrcpath}/docs/conf/extra/httpd-userdir.conf.in
54        reinplace "s|public_html|Sites|g" ${worksrcpath}/docs/conf/extra/httpd-userdir.conf.in
55    }
56
57    # HFS can be case insensitive, so protect for this as in
58    # http://docs.info.apple.com/article.html?artnum=300422
59    patchfiles-append   patch-httpd.conf.in-sensitive-files.diff
60}
61
62platform darwin 9 {
63    post-extract {
64        reinplace "s|-export-symbols-regex ssl_module||g" ${worksrcpath}/configure
65    }
66}
67
68configure.pre_args --prefix=${prefix}/${name}
69configure.args     --with-apr=${prefix}/bin/apr-1-config \
70                   --with-apr-util=${prefix}/bin/apu-1-config \
71                   --libdir=${prefix}/lib \
72                   --with-expat=${prefix} \
73                   --with-pcre=${prefix} \
74                   --with-z=${prefix} \
75                   --mandir=${prefix}/share/man \
76                   --enable-mods-shared=all \
77                   --enable-authn-alias=shared \
78                   --enable-ssl \
79                   --with-ssl=${prefix} \
80                   --enable-cache \
81                   --enable-disk_cache \
82                   --enable-file_cache \
83                   --enable-mem_cache \
84                   --enable-deflate \
85                   --enable-proxy \
86                   --enable-proxy-connect \
87                   --enable-proxy-http \
88                   --enable-proxy-ftp
89
90post-configure {
91    # Setting DYLD_FALLBACK_LIBRARY_PATH instead of DYLD_LIBRARY_PATH
92    # avoids issues with library collisions (bug #3013)
93    reinplace "s|DYLD_LIBRARY_PATH|DYLD_FALLBACK_LIBRARY_PATH|g" \
94        ${worksrcpath}/support/envvars-std
95}
96
97post-build {
98    reinplace -E {s| -arch [a-z0-9_]+||g} \
99        ${worksrcpath}/config.nice \
100        ${worksrcpath}/build/config_vars.mk
101    if {[tbool configure.ccache]} {
102        reinplace -E {s|ccache ||g} \
103            ${worksrcpath}/config.nice \
104            ${worksrcpath}/build/config_vars.mk
105    }
106}
107
108destroot.violate_mtree yes
109
110post-destroot {
111    set confDir ${destroot}${prefix}/${name}/conf
112    delete ${destroot}${prefix}/${name}/bin/envvars \
113                ${confDir}/httpd.conf \
114                {*}[glob -directory ${confDir}/extra *.conf]
115
116    move ${destroot}${prefix}/${name}/htdocs/index.html ${destroot}${prefix}/${name}/htdocs/index.html.sample
117
118    destroot.keepdirs ${destroot}${prefix}/${name}/logs \
119                      ${confDir}/extra
120
121    # fix libtool path
122    reinplace "s|/${name}/build/libtool|/share/apr-1/build/libtool|g" \
123        ${destroot}${prefix}/${name}/build/config_vars.mk
124
125    set docdir ${prefix}/share/doc/apache-${version}
126    xinstall -d ${destroot}${docdir}
127    xinstall -m 0644 -W ${worksrcpath} ABOUT_APACHE CHANGES LICENSE NOTICE README \
128        README.platforms ROADMAP VERSIONING ${destroot}${docdir}
129}
130
131post-activate {
132    set confDir ${prefix}/${name}/conf
133    # Copy into place sample or default versions of files user is likely to modify
134    if {![file exists ${prefix}/${name}/htdocs/index.html]} {
135        file copy ${prefix}/${name}/htdocs/index.html.sample ${prefix}/${name}/htdocs/index.html
136    }
137    if {![file exists ${prefix}/${name}/bin/envvars]} {
138        xinstall -m 755 ${prefix}/${name}/bin/envvars-std ${prefix}/${name}/bin/envvars
139    }
140    if {![file exists ${confDir}/httpd.conf]} {
141        file copy ${confDir}/original/httpd.conf ${confDir}/httpd.conf
142    }
143    foreach f [glob -tails -directory ${confDir}/original/extra *.conf] {
144        if {![file exists ${confDir}/extra/${f}]} {
145            file copy ${confDir}/original/extra/${f} ${confDir}/extra/${f}
146        }
147    }
148}
149
150platform openbsd {
151    build.env-append "LD_LIBRARY_PATH=${prefix}/lib"
152}
153
154variant openldap description {Enable LDAP support through OpenLDAP} {
155    configure.args-append --enable-ldap --enable-authnz-ldap
156    depends_lib-append port:openldap
157    require_active_variants apr-util openldap
158}
159
160variant preforkmpm conflicts workermpm eventmpm description {Use prefork MPM} {
161    configure.args-append --with-mpm=prefork
162}
163
164variant workermpm conflicts preforkmpm eventmpm description {Use worker MPM} {
165    configure.args-append --with-mpm=worker
166}
167
168variant eventmpm conflicts preforkmpm workermpm description {Use event MPM (experimental)} {
169    configure.args-append --with-mpm=event
170}
171
172if {![variant_isset workermpm] && ![variant_isset eventmpm]} {
173    default_variants +preforkmpm
174}
175
176startupitem.create    yes
177startupitem.start    \
178"\[ -x ${prefix}/${name}/bin/apachectl \] && ${prefix}/${name}/bin/apachectl start > /dev/null"
179startupitem.stop    \
180"\[ -r ${prefix}/${name}/logs/httpd.pid \] && ${prefix}/${name}/bin/apachectl stop > /dev/null"
181startupitem.restart    \
182"${prefix}/${name}/bin/apachectl restart > /dev/null"
183
184if {[info exists pkg.asroot]} {
185        pkg.asroot      yes
186}
187
188pre-pkg {
189    if {![info exists pkg.asroot]} {
190        ui_error "Packaging ${name} ${version} requires MacPorts 2.3.5 or greater (pkg.asroot support)"
191        return -code error "Incompatible MacPorts version"
192    }
193
194    # at this point the destroot has been pruned and bin doesn't exist
195    xinstall -d -m 0755 ${destroot}${prefix}/bin
196    # apache2 needs daemondo; ram a copy into the destroot so it will be packaged
197    xinstall -m 0755 ${prefix}/bin/daemondo ${destroot}${prefix}/bin/
198}
199
200livecheck.type  regex
201livecheck.url   ${homepage}download.cgi
202livecheck.regex httpd-(2\.2\.\[0-9.\]+)${extract.suffix}
Note: See TracBrowser for help on using the repository browser.