source: trunk/dports/www/apache2/Portfile @ 87969

Last change on this file since 87969 was 86366, checked in by ryandesign@…, 8 years ago

apache2: fix arch handling broken by r86196; see #31750

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