source: trunk/dports/lang/php52/Portfile @ 64763

Last change on this file since 64763 was 64763, checked in by nox@…, 8 years ago

Update jpeg to 8a and rev-bump all of its direct dependents (#23260)

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