Ticket #17678: Portfile.my

File Portfile.my, 16.6 KB (added by dbuldakov@…, 15 years ago)

php5 with apache20 portfile

Line 
1# $Id: Portfile 43386 2008-12-10 08:04:10Z ryandesign@macports.org $
2
3PortSystem              1.0
4
5name                    php5
6epoch                   1
7version                 5.2.8
8categories              www lang php
9maintainers             ryandesign jwa
10homepage                http://www.php.net/
11distname                php-${version}
12use_bzip2               yes
13platforms               darwin freebsd
14use_parallel_build      yes
15
16description \
17    PHP: Hypertext Preprocessor
18
19long_description \
20    PHP is a widely-used general-purpose scripting language \
21    that is especially suited for developing web sites, but can also \
22    be used for command-line scripting.
23
24master_sites \
25    ${homepage}distributions/ \
26    http://it.php.net/distributions/ \
27    http://fi.php.net/distributions/ \
28    http://de.php.net/distributions/ \
29    http://gr.php.net/distributions/ \
30    http://fr.php.net/distributions/ \
31    http://es.php.net/distributions/ \
32    http://se.php.net/distributions/
33
34checksums \
35    md5     8760a833cf10433d3e72271ab0d0eccf \
36    sha1    d285636144e0a4aa61195793634807e763c63dc3 \
37    rmd160  d38fe5d918c335089a027600a93d950f417a7e98
38
39depends_build \
40    port:pkgconfig \
41    port:autoconf213
42
43depends_lib \
44    port:libtool \
45    port:libxml2 \
46    port:libxslt \
47    port:openssl \
48    port:zlib \
49    port:bzip2 \
50    port:libiconv \
51    port:expat \
52    port:gettext \
53    port:tiff \
54    port:mhash \
55    port:libmcrypt \
56    port:curl \
57    port:pcre \
58    port:jpeg \
59    port:libpng \
60    port:freetype
61
62patchfiles \
63    patch-bind.diff
64
65use_autoconf            yes
66autoconf.cmd            ${prefix}/bin/autoconf213
67
68configure.args \
69    --mandir=${prefix}/share/man \
70    --infodir=${prefix}/share/info \
71    --with-config-file-path=${prefix}/etc \
72    --enable-calendar \
73    --with-iconv=${prefix} \
74    --enable-exif \
75    --enable-ftp \
76    --enable-wddx\
77    --with-zlib=${prefix} \
78    --with-bz2=${prefix} \
79    --without-mysql \
80    --without-sqlite \
81    --without-pdo-sqlite \
82    --with-libxml-dir=${prefix} \
83    --with-gettext=${prefix} \
84    --with-xml \
85    --with-libexpat-dir=${prefix} \
86    --with-xmlrpc \
87    --enable-soap \
88    --enable-bcmath \
89    --enable-mbstring \
90    --enable-dba \
91    --enable-zip \
92    --with-openssl=${prefix} \
93    --with-mhash=${prefix} \
94    --with-mcrypt=${prefix} \
95    --with-mime-magic \
96    --with-xsl=${prefix} \
97    --with-curl=${prefix} \
98    --with-pcre-regex=${prefix} \
99    --with-gd \
100    --with-jpeg-dir=${prefix} \
101    --with-png-dir=${prefix} \
102    --enable-gd-native-ttf \
103    --without-pear \
104    --with-freetype-dir=${prefix}
105
106platform darwin 6 {
107    depends_lib-append \
108        lib:libdl:dlcompat
109    configure.env-append \
110        LIBS=-ldl
111    configure.cppflags-append \
112        "-no-cpp-precomp -DBIND_8_COMPAT"
113}
114
115platform darwin 7 {
116    configure.env-append \
117        LIBS=-ldl
118    configure.cppflags-append \
119        "-no-cpp-precomp"
120}
121
122platform macosx {
123    configure.args-append \
124        --with-ldap=/usr \
125        --with-kerberos=/usr \
126        --with-iodbc=/usr
127}
128
129variant no_web conflicts apache apache2 apache20 fastcgi description {Don't include any web server support} {}
130
131# Build an Apache 1 module. On Mac OS X, it uses Apple's provided Apache 1 server.
132# On other platforms, the MacPorts apache port is used. Keep the options here
133# in sync with those in the relevant part of the post-destroot phase.
134variant apache conflicts apache2 apache20 no_web description {Add Apache 1 web server module} {
135    if { ! [variant_isset macosx] } {
136        depends_lib-append \
137            path:sbin/apxs:apache
138        configure.args-append \
139            --with-apxs=${prefix}/sbin/apxs
140    } else {
141        destroot.violate_mtree yes
142        configure.args-append \
143            --with-apxs=/usr/sbin/apxs
144    }
145}
146
147# Build an Apache 2.0 module. Keep the options here in sync with those in the
148# relevant part of the post-destroot phase.
149variant apache20 conflicts apache apache2 no_web description {Add Apache 2.2 web server module (default)} {
150    pre-fetch {
151        if {[string match "*libmysqlclient_r.la*" [exec pkg-config --libs apr-util-1]]} {
152            return -code error "${name} +apache20 can't be built while apr-util is installed with the +mysql5 variant. Deactivate or uninstall apr-util, reinstall apr-util without the +mysql5 variant, then clean ${name} and try installing it again."
153        }
154    }
155    destroot.violate_mtree yes
156    depends_lib-append \
157        port:apache20
158    configure.args-append \
159        --with-apxs2=${prefix}/apache20/bin/apxs
160}
161
162# Build an Apache 2.2 module. Keep the options here in sync with those in the
163# relevant part of the post-destroot phase.
164variant apache2 conflicts apache no_web description {Add Apache 2.2 web server module (default)} {
165    pre-fetch {
166        if {[string match "*libmysqlclient_r.la*" [exec pkg-config --libs apr-util-1]]} {
167            return -code error "${name} +apache2 can't be built while apr-util is installed with the +mysql5 variant. Deactivate or uninstall apr-util, reinstall apr-util without the +mysql5 variant, then clean ${name} and try installing it again."
168        }
169    }
170    destroot.violate_mtree yes
171    depends_lib-append \
172        path:apache2/bin/apxs:apache2
173    configure.args-append \
174        --with-apxs2=${prefix}/apache2/bin/apxs
175}
176
177# Build a FastCGI binary. Keep the options here in sync with those in the
178# relevant part of the post-destroot phase.
179variant fastcgi conflicts no_web description {Add FastCGI web server binary} {
180    if { ![variant_isset apache] && ![variant_isset apache20] && ![variant_isset apache2] } {
181        configure.args-append \
182            --enable-fastcgi \
183            --enable-force-cgi-redirect
184    }
185}
186
187variant gmp description {Add GNU MP functions} {
188    depends_lib-append \
189        port:gmp
190    configure.args-append \
191        --with-gmp=${prefix}
192}
193
194variant dbase description {Add dBase file format support} {
195    configure.args-append \
196        --enable-dbase
197}
198
199# Add IMAP support. See:
200# http://www.php.net/imap
201variant imap description {enable operation with IMAP protocol} {
202    depends_lib-append \
203        port:cclient
204    configure.args-append \
205        --with-imap=${prefix} \
206        --with-imap-ssl=${prefix}
207}
208
209variant pspell description {Add pspell spell-checking functions} {
210    depends_lib-append \
211        port:aspell
212    configure.args-append \
213        --with-pspell=${prefix}
214}
215
216# Add Tidy support. See:
217# http://www.php.net/tidy
218variant tidy description {add Tidy support} {
219    depends_lib-append \
220        port:tidy
221    configure.args-append \
222        --with-tidy=${prefix}
223}
224
225variant mssql description {add support for MS-SQL server} {
226    depends_lib-append \
227        port:freetds
228    configure.args-append \
229        --with-mssql=${prefix}
230   
231    # See http://bugs.php.net/bug.php?id=44991
232    post-patch {
233        reinplace "s|tds.h|sybdb.h|g"               ${worksrcpath}/ext/mssql/config.m4
234        reinplace "s|libtds.a|libsybdb.a|g"         ${worksrcpath}/ext/mssql/config.m4
235        reinplace "s|libtds.so|libsybdb.dylib|g"    ${worksrcpath}/ext/mssql/config.m4
236    }
237}
238
239variant snmp conflicts macports_snmp description {use Apple snmp} {
240    # This compiles PHP5 with SNMP linked against Apple's included NET-SNMP.
241    configure.args-append \
242        --with-snmp=/usr
243}
244
245variant macports_snmp conflicts snmp description {use MacPorts snmp} {
246    # This compiles PHP with SNMP linked against MacPorts' NET-SNMP.
247    depends_lib-append \
248        port:net-snmp
249    configure.args-append \
250        --with-snmp=${prefix}
251}
252
253variant mysql3 conflicts mysql4 mysql5 description {build MySQL 3 support} {
254    depends_lib-append \
255        port:mysql3
256    configure.args-delete \
257        --without-mysql
258    configure.args-append \
259        --with-mysql=${prefix} \
260        --with-pdo-mysql=${prefix}
261}
262
263variant mysql4 conflicts mysql3 mysql5 description {build MySQL 4 support} {
264    depends_lib-append \
265        port:mysql4
266    configure.args-delete \
267        --without-mysql
268    configure.args-append \
269        --with-mysql=${prefix} \
270        --with-pdo-mysql=${prefix}
271}
272
273variant mysql5 conflicts mysql3 mysql4 description {build MySQL 5 support} {
274    depends_lib-append \
275        path:bin/mysql_config5:mysql5
276    configure.args-delete \
277        --without-mysql
278    configure.args-append \
279        --with-mysql=${workpath}/mysql5 \
280        --with-pdo-mysql=${prefix}/bin/mysql_config5 \
281        --with-mysql-sock=${prefix}/var/run/mysql5/mysqld.sock \
282        --with-mysqli=${prefix}/bin/mysql_config5
283    post-extract {
284        file mkdir "${workpath}/mysql5"
285        file link -symbolic "${workpath}/mysql5/lib" "${prefix}/lib/mysql5"
286        file link -symbolic "${workpath}/mysql5/include" "${prefix}/include/mysql5"
287    }
288}
289
290variant oracle description {Add Oracle oci8 database functions with the Oracle Instant Client} {
291    depends_lib-append \
292        port:oracle-instantclient
293    configure.args-append \
294        --with-oci8=instantclient,${prefix}/lib/oracle
295}
296
297variant postgresql82 conflicts postgresql83 description {provide postgresql82 support} {
298    depends_lib-append \
299        port:postgresql82
300    configure.args-append \
301        --with-pgsql=${prefix}/lib/postgresql82/bin \
302        --with-pdo-pgsql=${prefix}/lib/postgresql82/bin
303}
304
305variant postgresql83 conflicts postgresql82 description {provide postgresql83 support} {
306    depends_lib-append \
307        port:postgresql83
308    configure.args-append \
309        --with-pgsql=${prefix}/lib/postgresql83/bin \
310        --with-pdo-pgsql=${prefix}/lib/postgresql83/bin
311}
312
313# add sqlite support
314# note that standard sqlite support uses the built-in sqlite2 libraries
315# while pdo sqlite support uses the sqlite3 libraries from the sqlite3 port
316variant sqlite description {build sqlite support} {
317    depends_lib-append \
318        port:sqlite3
319    configure.args-delete \
320        --without-sqlite \
321        --without-pdo-sqlite
322    configure.args-append \
323        --with-sqlite \
324        --with-pdo-sqlite=${prefix} \
325        --enable-sqlite-utf8
326}
327
328# add semaphore, shared memory and IPC functions; see http://www.php.net/sem
329variant ipc description {build IPC support} {
330    configure.args-append \
331        --enable-shmop \
332        --enable-sysvsem \
333        --enable-sysvshm \
334        --enable-sysvmsg
335}
336
337# add process control functions; see http://www.php.net/pcntl
338variant pcntl description {provide process control} {
339    configure.args-append \
340        --enable-pcntl
341}
342
343if {![variant_isset apache] && ![variant_isset apache20] && ![variant_isset apache2] && ![variant_isset fastcgi] && ![variant_isset no_web]} {
344    default_variants +apache2
345}
346
347variant pear description {add pear stuff} {
348    configure.args-delete \
349        --without-pear
350    configure.args-append \
351        --with-pear=${prefix}/lib/php
352    destroot.target-append \
353        install-pear
354    destroot.args-append \
355        PHP_PEAR_INSTALL_DIR=${prefix}/lib/php
356    post-destroot {
357        #nuke pear-stuff in ${destroot}
358        system "cd ${destroot} && rm -rf .channels .depdb .depdblock .filemap .lock"
359       
360        system "if \[ -f ${prefix}/lib/php/.depdblock \]; then rm -f ${destroot}${prefix}/lib/php/.depdblock; fi"
361        system "if \[ -f ${prefix}/lib/php/.depdb \]; then rm -f ${destroot}${prefix}/lib/php/.depdb; fi"
362        system "if \[ -f ${prefix}/lib/php/.filemap \]; then rm -f ${destroot}${prefix}/lib/php/.filemap; fi"
363        system "if \[ -f ${prefix}/lib/php/.lock \]; then rm -f ${destroot}${prefix}/lib/php/.lock; fi"
364        system "if \[ -d ${prefix}/lib/php/.channels \]; then rm -rf ${destroot}${prefix}/lib/php/.channels; fi"
365    }
366}
367
368variant readline description {Add GNU readline functions} {
369    depends_lib-append \
370        port:readline
371    configure.args-append \
372        --with-readline=${prefix}
373}
374
375variant sockets description {Add socket communication functions} {
376    # Note: This extension will be moved to the PECL repository and will no longer be bundled with PHP as of PHP 5.3.0.
377    # This variant should be removed when the port is upgraded to PHP 5.3.0.
378    configure.args-append \
379        --enable-sockets
380}
381
382variant t1lib description {Add PostScript Type 1 font support with t1lib} {
383    depends_lib-append \
384        port:t1lib
385    configure.args-append \
386        --with-t1lib=${prefix} \
387}
388
389destroot.args \
390    INSTALL_ROOT=${destroot}
391
392destroot.target \
393    install-cli install-build install-headers install-programs
394
395post-destroot {
396    # Copy the Apache 1 module.
397    if { [variant_isset apache] } {
398        xinstall -m 755 -d ${destroot}${prefix}/libexec/apache \
399            ${destroot}${prefix}/etc/apache/extras-conf
400        xinstall -m 755 ${worksrcpath}/libs/libphp5.so ${destroot}${prefix}/libexec/apache/
401        xinstall -m 755 -c ${filespath}/mod_php.conf ${destroot}$prefix/etc/apache/extras-conf
402    }
403
404    # Copy the Apache 2.0 module.
405    if { [variant_isset apache20] } {
406        xinstall -m 755 -d ${destroot}${prefix}/apache20/modules \
407            ${destroot}${prefix}/apache20/conf/extras-conf
408        xinstall -m 755 ${worksrcpath}/libs/libphp5.so ${destroot}${prefix}/apache20/modules/
409        xinstall -m 755 -c ${filespath}/mod_php.conf ${destroot}${prefix}/apache20/conf/extras-conf
410    }
411   
412    # Copy the Apache 2.2 module.
413    if { [variant_isset apache2] } {
414        xinstall -m 755 -d ${destroot}${prefix}/apache2/modules \
415            ${destroot}${prefix}/apache2/conf/extras-conf
416        xinstall -m 755 ${worksrcpath}/libs/libphp5.so ${destroot}${prefix}/apache2/modules/
417        xinstall -m 755 -c ${filespath}/mod_php.conf ${destroot}${prefix}/apache2/conf/extras-conf
418    }
419   
420    if { [variant_isset fastcgi] } {
421        # If we've built an Apache module (any version) then the FastCGI binary
422        # will not have been built, so we need to run through the whole process
423        # again and build just the FastCGI binary. Keep the options here in sync
424        # with the options specified in the apache and apache2 variants.
425        if { [variant_isset apache] } {
426            if { ![variant_isset macosx] } {
427                configure.args-delete \
428                    --with-apxs=${prefix}/sbin/apxs
429            } else {
430                configure.args-delete \
431                    --with-apxs=/usr/sbin/apxs
432            }
433        }
434        if { [variant_isset apache2] } {
435            configure.args-delete \
436                --with-apxs2=${prefix}/apache2/bin/apxs
437        }
438       
439        if { [variant_isset apache20] } {
440            configure.args-delete \
441                --with-apxs2=${prefix}/apache20/bin/apxs
442        }
443        # Run the build again to get the FastCGI binary. Keep the options here
444        # in sync with those in the fastcgi variant.
445        if { [variant_isset apache] || [variant_isset apache20] || [variant_isset apache2] } {
446            configure.args-append \
447                --enable-fastcgi \
448                --enable-force-cgi-redirect
449            ui_msg "$UI_PREFIX Configuring ${name} again for fastcgi"
450            command_exec configure
451            ui_msg "$UI_PREFIX Building ${name} again for fastcgi"
452            command_exec build
453            ui_msg "$UI_PREFIX Staging ${name} fastcgi into destroot"
454        }
455       
456        # Copy the FastCGI binary to the bin dir under a new name so it doesn't
457        # conflict with the cli version.
458        xinstall -m 755 ${worksrcpath}/sapi/cgi/php-cgi ${destroot}${prefix}/bin
459    }
460   
461    #file rename ${destroot}${prefix}/etc/pear.conf ${destroot}${prefix}/etc/pear.conf.sample
462   
463    # Copy the default php.ini files.
464    xinstall -m 755 -d ${destroot}${prefix}/etc
465    xinstall -m 755 ${workpath}/${worksrcdir}/php.ini-dist ${destroot}${prefix}/etc/php.ini-dist
466    xinstall -m 755 ${workpath}/${worksrcdir}/php.ini-recommended ${destroot}${prefix}/etc/php.ini-recommended
467}
468
469post-install {
470    ui_msg "\nIf this is your first install, you might want"
471   
472    if { [variant_isset apache] } {
473        ui_msg " * enable php in apache :\n"
474       
475        ui_msg "cd ${prefix}/libexec/apache"
476        ui_msg "${prefix}/apache/bin/apxs -a -e -n \"php5\" libphp5.so\n"
477        ui_msg "* copy  ${prefix}/etc/php.ini-dist to  ${prefix}/etc/php.ini"
478    }
479   
480    if { [variant_isset apache20] } {
481        ui_msg "cd ${prefix}/apache20/modules"
482        ui_msg "${prefix}/apache20/bin/apxs -a -e -n \"php5\" libphp5.so\n"
483        ui_msg "* copy  ${prefix}/etc/php.ini-dist to  ${prefix}/etc/php.ini"
484    }
485   
486    if { [variant_isset apache2] } {
487        ui_msg "cd ${prefix}/apache2/modules"
488        ui_msg "${prefix}/apache2/bin/apxs -a -e -n \"php5\" libphp5.so\n"
489        ui_msg "* copy  ${prefix}/etc/php.ini-dist to  ${prefix}/etc/php.ini"
490    }
491   
492    #ui_msg "* copy  ${prefix}/etc/pear.conf.sample to  ${prefix}/etc/pear.conf"
493}
494
495test.run                yes
496
497livecheck.check         regex
498livecheck.url           ${homepage}downloads.php
499livecheck.regex         get/php-(5\\.\[0-9.\]+)\\.tar