Ticket #35824: Portfile

File Portfile, 34.6 KB (added by ldl@…, 10 years ago)

Composite php portfile. Trying to reconcile Bradley and Ryan's work

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 93576 2012-05-27 11:20:41Z ryandesign@macports.org $
3
4PortSystem              1.0
5PortGroup               php 1.1
6
7name                    php
8revision                1
9categories              lang php www
10platforms               darwin freebsd
11maintainers             ryandesign jwa
12license                 PHP-3.01
13master_sites            php
14use_parallel_build      yes
15use_bzip2               yes
16livecheck.type          none
17
18description             PHP: Hypertext Preprocessor
19
20long_description        PHP is a widely-used general-purpose scripting \
21                        language that is especially suited for developing \
22                        web sites, but can also be used for command-line \
23                        scripting.
24
25# The list of PHP branches this port provides.
26php.branches            5.3 5.4
27
28# Fix for users specifying the subport name with the wrong case.
29set subport             [string tolower ${subport}]
30
31# Get rootname from subport.
32regexp {^php\d+-(.+)$} ${subport} -> php.rootname
33
34# Returns true if the subport is a SAPI, false otherwise (extension, stub port).
35proc is_sapi_subport {} {
36    global name subport php.rootname
37    if {${name} == ${subport}} {
38        return no
39    }
40    if {[regexp {^php\d+$} ${subport}]} {
41        return yes
42    }
43    return [expr {-1 != [lsearch -exact [list apache2handler cgi fpm] ${php.rootname}]}]
44}
45
46# Returns true if the subport is an extension, false otherwise (SAPI, stub port).
47proc is_extension_subport {} {
48    global name subport
49    if {${name} == ${subport}} {
50        return no
51    }
52    return [expr {![is_sapi_subport]}]
53}
54
55if {![is_extension_subport]} {
56    categories          lang www  # added by LDL from devel
57    homepage            http://www.php.net/
58}
59
60set subport_branch      [php.branch_from_subport]
61
62# Remember to increment revision of ${php}-eaccelerator when updating version of ${php}.
63switch ${subport_branch} {
64    5.3 {
65        version         5.3.28
66        use_bzip2       yes
67        set suhosin_available       yes
68        set suhosin_patch_version   5.3.9-0.9.10
69        set suhosin_patch           suhosin-patch-${suhosin_patch_version}.patch.gz
70        checksums       ${distname}${extract.suffix} \
71                        md5     56ff88934e068d142d6c0deefd1f396b \
72                        rmd160  e4910c0c365f39a5009807801bd5ee6e25be020d \
73                        sha256  0cac960c651c4fbb3d21cf2f2b279a06e21948fb35a0d1439b97296cac1d8513 \
74                        ${suhosin_patch} \
75                        rmd160  ce43921fd9b183b154713ecda98294f6c68d5f22 \
76                        sha256  4438caeab0a10c6c94aee9f7eaa703f5799f97d4e0579f43a947bb7314e38317
77    }
78    5.4 {
79#         epoch           1
80#         version         5.4.3
81#         set suhosin_available       no
82#         checksums       [suffix ${distname}] \
83#                         rmd160  a6c0ab078283a3499bf1d10ac2b6e67716fa2cba \
84#                         sha256  d7e0c987586b6554ee08e3b71cc2806ddd1b192451159083d861c132994bc1bd
85         epoch           1
86         version         5.4.24
87         use_bzip2       yes
88         set suhosin_available       no
89         checksums       ${distname}${extract.suffix} \
90                         md5     acef880cc808b85e216897ee88187ee1 \
91                         rmd160  8248a1314986b071de990f725fc802729ca97e3c \
92    }
93}
94
95# Iterate through branches in reverse order, so that the list of subports in
96# "port info" will show newer versions before older versions.
97set i [llength ${php.branches}]
98while {[incr i -1] >= 0} {
99
100set branch              [lindex ${php.branches} ${i}]
101set major               [lindex [split ${branch} .] 0]
102set php                 php[php.suffix_from_branch ${branch}]
103
104if {[regexp "^${php}" ${subport}]} {
105
106dist_subdir             php${major}
107
108if {[is_sapi_subport]} {
109   
110    depends_build       port:pkgconfig
111   
112    if {${subport} != ${php}} {
113        depends_lib     port:${php}
114    }
115   
116    depends_lib-append  path:bin/gsed:gsed \
117                        port:libiconv \
118                        port:libxml2 \
119                        port:bzip2 \
120                        port:mhash \
121                        port:pcre \
122                        port:zlib
123   
124    # Use -p1 to accommodate the Suhosin patch
125    patch.pre_args      -p1
126    patchfiles          patch-${php}-scripts-php-config.in.diff
127   
128    if {${configure.compiler} == "clang"} {
129        configure.compiler llvm-gcc-4.2
130    }
131   
132    set phpinidir       ${prefix}/etc/${php}
133    set extraphpinidir  ${prefix}/var/db/${php}
134   
135    configure.args      --mandir=${prefix}/share/man \
136                        --infodir=${prefix}/share/info \
137                        --program-suffix=[php.suffix_from_branch ${branch}] \
138                        --includedir=${prefix}/include/${php} \
139                        --libdir=${prefix}/lib/${php} \
140                        --with-config-file-path=${phpinidir} \
141                        --with-config-file-scan-dir=${extraphpinidir} \
142                        --disable-all \
143                        --enable-bcmath \
144                        --enable-ctype \
145                        --enable-dom \
146                        --enable-fileinfo \
147                        --enable-filter \
148                        --enable-hash \
149                        --enable-json \
150                        --enable-libxml \
151                        --enable-pdo \
152                        --enable-phar \
153                        --enable-session \
154                        --enable-simplexml \
155                        --enable-tokenizer \
156                        --enable-xml \
157                        --enable-xmlreader \
158                        --enable-xmlwriter \
159                        --with-bz2=${prefix} \
160                        --with-mhash=${prefix} \
161                        --with-pcre-regex=${prefix} \
162                        --with-libxml-dir=${prefix} \
163                        --with-zlib=${prefix} \
164                        --without-pear \
165                        --disable-cgi \
166                        --disable-cli \
167                        --disable-fpm
168   
169    # ${php}-mysql +mysqlnd needs mysqlnd support compiled into the SAPI
170    configure.env       PHP_MYSQLND_ENABLED=yes
171   
172    configure.universal_args-delete --disable-dependency-tracking
173   
174    test.run            yes
175   
176    destroot.args       INSTALL_ROOT=${destroot}
177   
178    variant debug description {Enable debug support (useful to analyze a PHP-related core dump)} {
179        configure.args-append   --enable-debug
180    }
181   
182    variant suhosin description {Add Suhosin patch} {
183        pre-fetch {
184            if {"darwin" == ${os.platform} && ${os.major} < 9} {
185                ui_error "The suhosin variant requires Mac OS X 10.5 or greater."
186                return -code error "incompatible Mac OS X version"
187            }
188            if {!${suhosin_available}} {
189                ui_error "There is no suhosin patch for PHP ${version} yet. Please check back later."
190            }
191            if {![file exists ${extraphpinidir}/suhosin.ini]} {
192                ui_msg "You may also be interested in the suhosin extension, a related but different piece of software. See the ${php}-suhosin port."
193            }
194            if {!${suhosin_available}} {
195                return -code error "unavailable variant"
196            }
197        }
198        patch_sites-append          http://download.suhosin.org/
199        if {${suhosin_available}} {
200            patchfiles-append       ${suhosin_patch}
201        }
202    }
203   
204    if {${subport} != ${php}} {
205        notes-append "If this is your first install, you need to enable ${subport} in your web server."
206    }
207   
208}
209
210}
211
212### CLI SAPI ###
213
214subport ${php} {
215    PortGroup               select 1.0
216   
217    depends_run             port:php_select
218   
219    select.group            php
220    select.file             ${filespath}/${subport}
221   
222    configure.args-delete   --disable-cli
223    configure.args-append   --enable-cli
224   
225    destroot.target         install-cli install-build install-headers install-programs
226   
227    destroot.keepdirs       ${destroot}${extraphpinidir}
228   
229    post-destroot {
230        # Copy the default php.ini files.
231        xinstall -m 755 -d ${destroot}${phpinidir}
232        xinstall -m 644 -W ${worksrcpath} \
233            php.ini-development \
234            php.ini-production \
235            ${destroot}${phpinidir}
236       
237        # Copy mysqlnd headers.
238        xinstall -d ${destroot}${prefix}/include/${php}/php/ext/mysqlnd
239        eval xinstall -m 644 [glob ${worksrcpath}/ext/mysqlnd/*.h] ${destroot}${prefix}/include/${php}/php/ext/mysqlnd
240    }
241   
242    # Include the readline extension http://www.php.net/readline directly in
243    # the PHP CLI SAPI because until PHP 6 the interactive mode "php -a" won't
244    # work with a separately built readline extension.
245    # https://bugs.php.net/bug.php?id=53878
246    # Users might prefer readline over libedit because only readline supports
247    # readline_list_history() (http://www.php.net/readline-list-history).
248    # On the other hand we want libedit to be the default because its license
249    # is compatible with PHP's which means PHP can be distributable.
250    variant libedit conflicts readline description {Build readline extension using libedit library} {
251        depends_lib-append      port:libedit
252        configure.args-append   --with-libedit=${prefix}
253    }
254    variant readline conflicts libedit description {Build readline extension using readline library} {
255        depends_lib-append      port:readline
256        configure.args-append   --with-readline=${prefix}
257    }
258    if {![variant_isset readline]} {
259        default_variants +libedit
260    }
261   
262    if {![file exists ${phpinidir}/php.ini]} {
263        notes-append "
264To customize ${php}, copy\
265${phpinidir}/php.ini-development (if this is a development server) or\
266${phpinidir}/php.ini-production (if this is a production server) to\
267${phpinidir}/php.ini and then make changes.
268"
269    } else {
270        notes-append "
271You may need to update your php.ini for any changes that have been made\
272in this version of ${php}. Compare ${phpinidir}/php.ini with\
273${phpinidir}/php.ini-development (if this is a development server) or\
274${phpinidir}/php.ini-production (if this is a production server).
275"
276    }
277   
278    # Enable livecheck for the two most recent PHP branches.
279    if {[vercmp ${branch} [lindex ${php.branches} end-1]] >= 0} {
280        livecheck.type      regex
281        livecheck.url       ${homepage}downloads.php
282        livecheck.regex     get/php-([strsed ${branch} {g/\\./\\./}](?:\\.\[0-9.\]+)*)\\.tar
283    }
284}
285
286### Apache 2 handler SAPI ###
287
288subport ${php}-apache2handler {
289    description             ${php} Apache 2 Handler SAPI
290   
291    long_description        ${description}
292   
293    homepage                http://www.php.net/install.unix.apache2
294   
295    depends_lib-append      port:apache24
296   
297    set apxs ${prefix}/apache2/bin/apxs
298    set confdir ${prefix}/apache2/conf
299    set moduledir ${prefix}/apache2/modules
300   
301    pre-configure {
302        # Checking for mod_cgi.so is a convenient way to verify apache2 is using its
303        # +preforkmpm variant. (+eventmpm and +workermpm instead provide mod_cgid.so.)
304        if {![file exists ${moduledir}/mod_cgi.so]} {
305            ui_error "To use ${subport}, apache2 must be installed with the +preforkmpm variant."
306            return -code error "incompatible apache2 installation"
307        }
308    }
309   
310    configure.args-append   --with-apxs2=${apxs}
311   
312    build.target            libs/libphp5.bundle
313   
314    destroot.violate_mtree  yes
315   
316    destroot {
317        xinstall -m 755 -d ${destroot}${moduledir} ${destroot}${confdir}/extra
318        xinstall -m 644 ${worksrcpath}/libs/libphp5.so ${destroot}${moduledir}/mod_${php}.so
319        xinstall -m 644 ${filespath}/mod_php.conf ${destroot}${confdir}/extra/mod_${php}.conf
320    }
321   
322    notes-append "
323
324To enable ${subport}, run:
325
326    cd ${moduledir}
327    sudo ${apxs} -a -e -n php${major} mod_${php}.so
328"
329}
330
331### CGI SAPI ###
332
333subport ${php}-cgi {
334    description             ${php} CGI SAPI
335   
336    long_description        ${description}
337   
338    homepage                http://www.php.net/install.unix.commandline
339   
340    configure.args-delete   --disable-cgi
341    configure.args-append   --enable-cgi
342   
343    if {[vercmp ${branch} 5.4] >= 0} {
344        build.target        cgi
345        destroot.target     install-cgi
346    } else {
347        destroot {
348            xinstall ${worksrcpath}/sapi/cgi/php-cgi ${destroot}${prefix}/bin/php-cgi[php.suffix_from_branch ${branch}]
349        }
350    }
351   
352}
353
354### FPM SAPI ###
355
356subport ${php}-fpm {
357    description             ${php} FPM SAPI
358   
359    long_description        ${description}
360   
361    homepage                http://www.php.net/install.fpm
362   
363    set fpmuser             nobody
364    set fpmgroup            nobody
365   
366    patchfiles-append       patch-${php}-sapi-fpm-php-fpm.conf.in.diff
367   
368    post-patch {
369        reinplace "s|@PHP@|${php}|g" ${worksrcpath}/sapi/fpm/php-fpm.conf.in
370    }
371   
372    configure.args-delete   --disable-fpm
373    configure.args-append   --enable-fpm \
374                            --sysconfdir=${phpinidir} \
375                            --with-fpm-user=${fpmuser} \
376                            --with-fpm-group=${fpmgroup}
377   
378    build.target            fpm
379   
380    destroot.target         install-fpm
381   
382    destroot.keepdirs       ${destroot}${prefix}/var/log/${php} \
383                            ${destroot}${prefix}/var/run/${php}
384   
385    post-destroot {
386        xinstall -d -o ${fpmuser} -g ${fpmgroup} ${destroot}${prefix}/var/log/${php} ${destroot}${prefix}/var/run/${php}
387    }
388   
389    startupitem.create      yes
390    startupitem.executable  ${prefix}/sbin/php-fpm[php.suffix_from_branch ${branch}]
391   
392    if {![file exists ${phpinidir}/php-fpm.conf]} {
393        notes-append "
394
395To use ${subport}, copy\
396${phpinidir}/php-fpm.conf.default to\
397${phpinidir}/php-fpm.conf and make changes if desired.
398"
399    } else {
400        notes-append "
401
402You may need to update your php-fpm.conf for any changes that have been made\
403in this version of ${subport}. Compare ${phpinidir}/php-fpm.conf with\
404${phpinidir}/php-fpm.conf.default.
405"
406    }
407}
408
409### Bundled extensions ###
410
411subport ${php}-calendar {
412    description             a PHP extension for converting between different \
413                            calendar formats
414   
415    long_description        ${description}
416}
417
418subport ${php}-curl {
419    categories-append       net www
420   
421    description             a PHP interface to the curl library, which lets you \
422                            download files from servers with a variety of protocols
423   
424    long_description        ${description}
425   
426    depends_lib-append      port:curl
427   
428    configure.args-append   --with-curl=${prefix}
429}
430
431subport ${php}-dba {
432    categories-append       databases
433   
434    description             a PHP interface for accessing DBM databases such as \
435                            BerkeleyDB
436   
437    long_description        ${description}
438   
439    variant gdbm conflicts qdbm description {Add GDBM support} {
440        depends_lib-append      port:gdbm
441        configure.args-append   --with-gdbm=${prefix}
442    }
443   
444    variant qdbm conflicts gdbm description {Add QDBM support} {
445        depends_lib-append      port:qdbm
446        configure.args-append   --with-qdbm=${prefix}
447    }
448}
449
450subport ${php}-enchant {
451    categories-append       textproc devel
452   
453    description             a PHP interface to enchant
454   
455    long_description        ${name} is ${description}, a common API for many spell libraries.
456   
457    depends_lib-append      port:enchant
458   
459    configure.args-append   --with-enchant=${prefix}
460   
461    post-destroot {
462        set docdir ${prefix}/share/doc/${subport}
463        xinstall -d ${destroot}${docdir}
464        xinstall -m 644 -W ${destroot.dir} CREDITS ${destroot}${docdir}
465       
466        set examplesdir ${prefix}/share/examples/${subport}
467        xinstall -d ${destroot}${examplesdir}
468        xinstall -m 644 ${destroot.dir}/docs/examples/example1.php \
469            ${destroot}${examplesdir}
470    }
471}
472
473subport ${php}-exif {
474    categories-append       graphics
475   
476    description             a PHP interface to the EXIF image metadata functions
477   
478    long_description        ${description}
479}
480
481subport ${php}-ftp {
482    categories-append       net
483   
484    description             a PHP extension for accessing file servers using the \
485                            File Transfer Protocol
486   
487    long_description        ${description}
488   
489    depends_lib-append      port:openssl
490   
491    configure.args-append   --with-openssl-dir=${prefix}
492}
493
494subport ${php}-gd {
495    categories-append       graphics
496   
497    description             a PHP interface to the gd library
498   
499    long_description        ${description}
500   
501    depends_lib-append      port:freetype \
502                            port:jpeg \
503                            port:libpng \
504                            port:zlib
505   
506    configure.args-append   --with-freetype-dir=${prefix} \
507                            --with-jpeg-dir=${prefix} \
508                            --with-png-dir=${prefix} \
509                            --with-zlib-dir=${prefix} \
510                            --enable-gd-native-ttf
511   
512    variant t1lib description {Add PostScript Type 1 font support with t1lib} {
513        depends_lib-append      port:t1lib
514        configure.args-append   --with-t1lib=${prefix}
515    }
516}
517
518subport ${php}-gettext {
519    categories-append       devel
520   
521    description             a PHP interface to the gettext natural language \
522                            support functions
523   
524    long_description        ${description}
525   
526    depends_lib-append      port:gettext
527   
528    configure.args-append   --with-gettext=${prefix}
529}
530
531subport ${php}-gmp {
532    categories-append       devel math
533   
534    description             a PHP interface to GMP, the GNU multiprocessing \
535                            library through which you can work with \
536                            arbitrary-length integers
537   
538    long_description        ${description}
539   
540    depends_lib-append      port:gmp
541   
542    configure.args-append   --with-gmp=${prefix}
543}
544
545subport ${php}-iconv {
546    categories-append       textproc
547   
548    description             a PHP interface to the libiconv character encoding \
549                            conversion functions
550   
551    long_description        ${description}
552   
553    depends_lib-append      port:libiconv
554   
555    configure.args-append   --with-iconv=${prefix}
556}
557
558subport ${php}-imap {
559    categories-append       mail
560   
561    description             a PHP interface to the IMAP protocol
562   
563    long_description        ${description}
564   
565    depends_build-append    port:cclient
566   
567    configure.args-append   --with-imap=${prefix} \
568                            --with-imap-ssl=${prefix}
569   
570    platform macosx {
571        configure.args-append   --with-kerberos=/usr
572    }
573}
574
575subport ${php}-intl {
576    categories-append       devel
577   
578    description             internationalization extension for PHP
579   
580    long_description        Internationalization extension implements ICU \
581                            library functionality in PHP.
582   
583    depends_lib-append      port:icu
584}
585
586subport ${php}-ldap {
587    categories-append       databases
588   
589    description             a PHP interface to LDAP
590   
591    long_description        ${subport} is ${description}, the Lightweight Directory \
592                            Access Protocol, which is used to access Directory \
593                            Servers.
594   
595    depends_lib-append      port:openldap \
596                            port:cyrus-sasl2
597   
598    configure.args-append   --with-ldap=${prefix} \
599                            --with-ldap-sasl=${prefix}
600}
601
602subport ${php}-mbstring {
603    categories-append       textproc
604   
605    description             a PHP extension for manipulating strings in multibyte \
606                            encodings
607   
608    long_description        ${description}
609}
610
611subport ${php}-mcrypt {
612    categories-append       security
613   
614    description             a PHP interface to the mcrypt library, which offers \
615                            a wide variety of algorithms
616   
617    long_description        ${description}
618   
619    depends_lib-append      port:libmcrypt
620   
621    # The mcrypt extension may be using libtool unnecessarily; monitor
622    # https://bugs.php.net/bug.php?id=54500
623    depends_lib-append      port:libtool
624   
625    configure.args-append   --with-mcrypt=${prefix}
626}
627
628subport ${php}-mssql {
629    php.extensions          mssql pdo_dblib
630   
631    categories-append       databases
632   
633    description             a PHP interface to MSSQL using FreeTDS, including \
634                            the mssql and pdo_dblib extensions
635   
636    long_description        ${description}
637   
638    depends_lib-append      port:freetds
639   
640    configure.args-append   --with-mssql=${prefix} \
641                            --with-pdo-dblib=${prefix}
642}
643
644subport ${php}-mysql {
645    php.extensions          mysql mysqli pdo_mysql
646   
647    categories-append       databases
648   
649    description             a PHP interface to MySQL databases, including the \
650                            mysql, mysqli and pdo_mysql extensions
651   
652    long_description        ${description}
653   
654    depends_lib-append      port:zlib
655   
656    configure.args-append   --with-zlib-dir=${prefix}
657   
658    variant mysqlnd conflicts mysql4 mysql5 mysql51 mysql55 mysql56 mariadb percona description {Use MySQL Native Driver} {  # added by LDL from devel
659        configure.args-append   --with-mysql=mysqlnd \
660                                --with-mysqli=mysqlnd \
661                                --with-pdo-mysql=mysqlnd
662       
663        configure.cppflags-append   -I${worksrcpath}
664       
665        post-install {
666            set phpini ${prefix}/etc/${php}/php.ini
667            if {1} {
668                ui_msg "To use mysqlnd with a local MySQL server, edit ${phpini} and set"
669                ui_msg "mysql.default_socket, mysqli.default_socket and pdo_mysql.default_socket"
670                ui_msg "to ${prefix}/var/run/mysql5/mysqld.sock"
671            }
672        }
673    }
674   
675    variant mysql4 conflicts mysqlnd mysql5 mysql51 mysql55 mysql56 mariadb percona description {Use MySQL 4 libraries} { # added by LDL from devel
676        depends_lib-append      port:mysql4
677       
678        configure.args-append   --with-mysql=${prefix} \
679                                --with-pdo-mysql=${prefix}
680    }
681   
682    variant mysql5 conflicts mysqlnd mysql4 mysql51 mysql55 mysql56 mariadb percona description {Use MySQL 5 libraries} { # added by LDL from devel
683        depends_lib-append      path:bin/mysql_config5:mysql5
684       
685        post-extract {
686            file mkdir ${workpath}/mysql5
687            file link -symbolic ${workpath}/mysql5/lib ${prefix}/lib/mysql5
688            file link -symbolic ${workpath}/mysql5/include ${prefix}/include/mysql5
689        }
690       
691        configure.args-append   --with-mysql=${workpath}/mysql5 \
692                                --with-mysqli=${prefix}/bin/mysql_config5 \
693                                --with-pdo-mysql=${prefix}/bin/mysql_config5 \
694                                --with-mysql-sock=${prefix}/var/run/mysql5/mysqld.sock
695    }
696   
697    if {![variant_isset mysql4] && ![variant_isset mysql5]} {
698        default_variants +mysqlnd
699    }
700}
701
702subport ${php}-odbc {
703    php.extensions          odbc pdo_odbc
704   
705    categories-append       databases
706   
707    description             a PHP interface for accessing databases via Open \
708                            DataBase Connectivity (ODBC)
709   
710    long_description        ${description}
711   
712    variant iodbc conflicts unixodbc description {Use iODBC} {
713        depends_lib-append      port:libiodbc
714       
715        patchfiles-append       patch-${php}-iODBC.diff
716       
717        configure.args-append   --with-iODBC=${prefix} \
718                                --with-pdo-odbc=iODBC,${prefix}
719    }
720   
721    variant unixodbc conflicts iodbc description {Use unixODBC} {
722        depends_lib-append      port:unixODBC
723       
724        patchfiles-append       patch-${php}-unixODBC.diff
725       
726        configure.args-append   --with-unixODBC=${prefix} \
727                                --with-pdo-odbc=unixODBC,${prefix}
728    }
729   
730    if {![variant_isset iodbc] && ![variant_isset unixodbc]} {
731        default_variants +unixodbc
732    }
733}
734
735subport ${php}-openssl {
736    categories-append       devel security
737   
738    description             a PHP interface to OpenSSL signature-generation \
739                            and -verification and data-encryption and \
740                            -decryption functions
741   
742    long_description        ${description}
743   
744    depends_lib-append      port:openssl
745   
746    post-extract {
747        move ${php.build_dirs}/config0.m4 ${php.build_dirs}/config.m4
748    }
749   
750    configure.args-append   --with-openssl=${prefix}
751   
752    platform macosx {
753        configure.args-append   --with-kerberos=/usr
754    }
755}
756
757subport ${php}-oracle {
758    php.extensions          oci8 pdo_oci
759   
760    categories-append       databases
761   
762    description             a PHP interface to Oracle, including the oci8 and \
763                            pdo_oci extensions
764   
765    long_description        ${description}
766   
767    depends_lib-append      port:oracle-instantclient
768   
769    configure.args-append   --with-oci8=instantclient,${prefix}/lib/oracle \
770                            --with-pdo-oci=instantclient,${prefix}/lib/oracle,10.1
771}
772
773subport ${php}-pcntl {
774    categories-append       sysutils
775   
776    description             a PHP interface to Unix-style process creation, \
777                            program execution, signal handling and process \
778                            termination functions
779   
780    long_description        ${description}
781   
782    notes "
783${subport} should not be enabled within a web server environment.\
784Unexpected results may occur if any process control functions are used within\
785a web server environment.
786"
787}
788
789subport ${php}-posix {
790    categories-append       sysutils
791   
792    description             a PHP interface to additional POSIX functions
793   
794    long_description        a PHP interface to those functions defined in the \
795                            IEEE 1003.1 (POSIX.1) standards document which are \
796                            not accessible through other means
797}
798
799subport ${php}-postgresql {
800    php.extensions          pgsql pdo_pgsql
801   
802    categories-append       databases
803   
804    homepage                http://www.php.net/pgsql
805   
806    description             a PHP interface to PostgreSQL, including \
807                            the pgsql and pdo_pgsql extensions
808   
809    long_description        ${description}
810   
811    variant postgresql82 conflicts postgresql83 postgresql84 postgresql90 postgresql91 description {Use PostgreSQL 8.2 libraries} {
812        depends_lib-append      port:postgresql82
813       
814        configure.args-append   --with-pgsql=${prefix}/lib/postgresql82/bin \
815                                --with-pdo-pgsql=${prefix}/lib/postgresql82/bin
816    }
817   
818    variant postgresql83 conflicts postgresql82 postgresql84 postgresql90 postgresql91 description {Use PostgreSQL 8.3 libraries} {
819        depends_lib-append      port:postgresql83
820       
821        configure.args-append   --with-pgsql=${prefix}/lib/postgresql83/bin \
822                                --with-pdo-pgsql=${prefix}/lib/postgresql83/bin
823    }
824   
825    variant postgresql84 conflicts postgresql82 postgresql83 postgresql90 postgresql91 description {Use PostgreSQL 8.4 libraries} {
826        depends_lib-append      port:postgresql84
827       
828        configure.args-append   --with-pgsql=${prefix}/lib/postgresql84/bin \
829                                --with-pdo-pgsql=${prefix}/lib/postgresql84/bin
830    }
831   
832    variant postgresql90 conflicts postgresql82 postgresql83 postgresql84 postgresql91 description {Use PostgreSQL 9.0 libraries} {
833        depends_lib-append      port:postgresql90
834       
835        configure.args-append   --with-pgsql=${prefix}/lib/postgresql90/bin \
836                                --with-pdo-pgsql=${prefix}/lib/postgresql90/bin
837    }
838   
839    variant postgresql91 conflicts postgresql82 postgresql83 postgresql84 postgresql90 description {Use PostgreSQL 9.1 libraries} {
840        depends_lib-append      port:postgresql91
841       
842        configure.args-append   --with-pgsql=${prefix}/lib/postgresql91/bin \
843                                --with-pdo-pgsql=${prefix}/lib/postgresql91/bin
844    }
845   
846    if {![variant_isset postgresql82] && ![variant_isset postgresql83] && ![variant_isset postgresql84] && ![variant_isset postgresql90] && ![variant_isset postgresql91]} {
847        default_variants +postgresql91
848    }
849}
850
851subport ${php}-pspell {
852    categories-append       textproc
853   
854    description             a PHP interface to the aspell library, which lets you \
855                            check spelling and offer spelling suggestions
856   
857    long_description        ${description}
858   
859    depends_lib-append      port:aspell
860   
861    configure.args-append   --with-pspell=${prefix}
862}
863
864subport ${php}-snmp {
865    categories-append       sysutils
866   
867    description             a PHP interface to the Simple Network Management \
868                            Protocol (SNMP)
869   
870    long_description        ${description}
871   
872    depends_lib-append      port:net-snmp
873   
874    configure.args-append   --with-snmp=${prefix}
875}
876
877subport ${php}-soap {
878    categories-append       net
879   
880    description             a PHP extension for writing SOAP clients and servers
881   
882    long_description        ${description}
883   
884    depends_lib-append      port:libxml2
885   
886    configure.args-append   --with-libxml-dir=${prefix}
887}
888
889subport ${php}-sockets {
890    categories-append       net
891   
892    description             a PHP interface to BSD socket communication \
893                            functions
894   
895    long_description        ${description}
896}
897
898subport ${php}-sqlite {
899    php.extensions          sqlite sqlite3 pdo_sqlite
900   
901    categories-append       databases
902   
903    description             a PHP interface to SQLite, including the sqlite, sqlite3 \
904                            and pdo_sqlite extensions
905   
906    if {[vercmp ${branch} 5.4] >= 0} {
907        php.extensions-delete sqlite
908        description-delete "sqlite,"
909    }
910   
911    long_description        ${description}
912   
913    depends_lib-append      port:sqlite3
914   
915    post-extract {
916        move ${worksrcpath}/ext/sqlite3/config0.m4 ${worksrcpath}/ext/sqlite3/config.m4
917    }
918   
919    configure.args-append   --with-sqlite3=${prefix} \
920                            --with-pdo-sqlite=${prefix} \
921                            --enable-sqlite-utf8
922}
923
924subport ${php}-tidy {
925    categories-append       www
926   
927    description             a PHP interface to tidy, the HTML cleaning and \
928                            repair utility
929   
930    long_description        ${description}
931   
932    depends_lib-append      port:tidy
933   
934    configure.args-append   --with-tidy=${prefix}
935}
936
937subport ${php}-wddx {
938    categories-append       textproc
939   
940    description             a PHP interface to Web Distributed Data Exchange
941   
942    long_description        ${description}
943   
944    depends_build-append    port:expat \
945                            port:libxml2
946   
947    configure.args-append   --with-libexpat-dir=${prefix} \
948                            --with-libxml-dir=${prefix}
949}
950
951subport ${php}-xmlrpc {
952    categories-append       textproc
953   
954    description             a PHP extension for writing XML-RPC clients and servers
955   
956    long_description        ${description}
957   
958    depends_build-append    port:libiconv \
959                            port:libxml2
960   
961    depends_lib-append      port:expat
962   
963    configure.args-append   --with-iconv-dir=${prefix} \
964                            --with-libexpat-dir=${prefix} \
965                            --with-libxml-dir=${prefix}
966   
967    pre-configure {
968        configure.cppflags-append [exec ${prefix}/bin/xml2-config --cflags]
969    }
970}
971
972subport ${php}-xsl {
973    categories-append       textproc
974   
975    description             a PHP interface to libxslt, which implements the XSL \
976                            standard and lets you perform XSL transformations
977   
978    long_description        ${description}
979   
980    depends_lib-append      port:libxslt
981   
982    configure.args-append   --with-xsl=${prefix}
983   
984    configure.cppflags-append   -I${prefix}/include/${php}/php/ext/dom
985}
986
987subport ${php}-zip {
988    categories-append       archivers
989   
990    description             PHP zip functions
991   
992    long_description        ${description}
993   
994    depends_build-append    port:pcre
995   
996    depends_lib-append      port:zlib
997}
998
999}
1000
1001# These variables are not only required by the subsequent code but also by
1002# preceding code in phase blocks.
1003set branch              ${subport_branch}
1004set php                 php[php.suffix_from_branch ${branch}]
1005
1006if {${name} == ${subport}} {
1007    # Set up the stub port.
1008    version             ${branch}
1009    supported_archs     noarch
1010    distfiles
1011    depends_run         port:${php}
1012    use_configure       no
1013    build {}
1014    destroot {
1015        xinstall -d -m 755 ${destroot}${prefix}/share/doc/${subport}
1016        system "echo \"${name} is a stub port\" > ${destroot}${prefix}/share/doc/${subport}/README"
1017    }
1018} else {
1019    # Set an explicit distname so the default from the php portgroup doesn't get used.
1020    distname            ${name}-${version}
1021}
1022
1023# Set up the php portgroup, for extension subports.
1024if {[is_extension_subport]} {
1025    default php.extensions ${php.rootname}
1026    default homepage    http://www.php.net/${php.rootname}
1027   
1028    php.build_dirs
1029    foreach extension ${php.extensions} {
1030        # Speed up extraction by extracting only the modules we're going to be building.
1031        extract.post_args-append ${worksrcdir}/ext/${extension}
1032       
1033        # Run phpize, configure, build and destroot in each extension's directory.
1034        php.build_dirs-append ${worksrcpath}/ext/${extension}
1035    }
1036   
1037    post-extract {
1038        # The PDO extensions need the PDO headers which are installed by the ${php} port.
1039        foreach extension ${php.extensions} {
1040            if {[regexp {^pdo_} ${extension}]} {
1041                file mkdir ${worksrcpath}/ext/${extension}/ext
1042                ln -s ${prefix}/include/${php}/php/ext/pdo ${worksrcpath}/ext/${extension}/ext
1043            }
1044        }
1045    }
1046   
1047    pre-configure {
1048        set php_version [exec ${php.config} --version 2>/dev/null]
1049        if {${version} != ${php_version}} {
1050            ui_error "${subport} @${version} requires ${php} @${version} but you have ${php} @${php_version}."
1051            return -code error "incompatible ${php} installation"
1052        }
1053    }
1054   
1055    destroot.target     install-modules install-headers
1056   
1057    php.add_port_code
1058}