source: trunk/dports/lang/php4/Portfile @ 111348

Last change on this file since 111348 was 111348, checked in by ryandesign@…, 6 years ago

remove use of [suffix] proc in my ports because it is thought to be confusing

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 16.4 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 111348 2013-09-19 06:13:15Z ryandesign@macports.org $
3
4PortSystem              1.0
5
6name                    php4
7version                 4.4.9
8revision                15
9set major               [lindex [split ${version} .] 0]
10set my_name             php${major}
11dist_subdir             ${my_name}
12categories              lang www
13license                 PHP-3.01
14maintainers             ryandesign
15homepage                http://www.php.net/
16distname                php-${version}
17use_bzip2               yes
18master_sites            php:get/[lindex ${distfiles} 0]/from/this/mirror?dummy=
19platforms               darwin freebsd
20use_parallel_build      yes
21
22description \
23    PHP: Hypertext Preprocessor
24
25long_description \
26    PHP is a widely-used general-purpose scripting language \
27    that is especially suited for Web development \
28    and can be embedded into HTML.
29
30checksums \
31    ${distname}${extract.suffix} \
32        md5     2e3b2a0e27f10cb84fd00e5ecd7a1880 \
33        sha1    ab3d2205d756ddf93452b57bd6ce6a2014b1c374 \
34        rmd160  0d77092efaccd8fe6efc16635be98c5d4ccfec66
35
36depends_build \
37    port:pkgconfig
38
39depends_lib \
40    port:libiconv \
41    port:expat \
42    port:gettext \
43    port:zlib \
44    port:openssl \
45    port:tiff \
46    port:libxml2 \
47    port:libtool \
48    port:mhash \
49    port:libmcrypt \
50    port:curl \
51    port:jpeg \
52    port:libpng \
53    port:freetype
54
55# Use -p1 to accommodate the Suhosin patch
56patch.pre_args          -p1
57patchfiles \
58    patch-ext-openssl-openssl.c.diff \
59    patch-ext-standard-string.c.diff \
60    patch-scripts-php-config.in.diff
61
62set phpinidir           ${prefix}/etc/${my_name}
63set extraphpinidir      ${prefix}/var/db/${my_name}
64
65destroot.keepdirs       ${destroot}${extraphpinidir}
66
67configure.args \
68    --mandir=${prefix}/share/man \
69    --infodir=${prefix}/share/info \
70    --includedir=${prefix}/include/php4 \
71    --libdir=${prefix}/lib/php4 \
72    --sysconfdir=${prefix}/etc/php4 \
73    --with-config-file-path=${phpinidir} \
74    --with-config-file-scan-dir=${extraphpinidir} \
75    --with-pear=${prefix}/lib/php4 \
76    --program-suffix=4 \
77    --enable-mbstring \
78    --enable-dbx \
79    --enable-safe-mode \
80    --enable-dba \
81    --enable-calendar \
82    --enable-exif \
83    --enable-ftp \
84    --enable-wddx \
85    --enable-filepro \
86    --enable-bcmath \
87    --enable-cli \
88    --with-xml \
89    --with-xmlrpc \
90    --without-mysql \
91    --with-iconv=${prefix} \
92    --with-zlib=${prefix} \
93    --with-gettext=${prefix} \
94    --with-expat-dir=${prefix} \
95    --with-dom=${prefix} \
96    --with-openssl=${prefix} \
97    --with-mhash=${prefix} \
98    --with-mcrypt=${prefix} \
99    --with-mime-magic \
100    --with-curl=${prefix} \
101    --with-gd \
102    --with-jpeg-dir=${prefix} \
103    --with-png-dir=${prefix} \
104    --enable-gd-native-ttf \
105    --with-freetype-dir=${prefix}
106
107if {${os.platform} == "darwin" && ${os.major} >= 10} {
108    configure.env-append \
109        LIBS=-lresolv
110}
111
112platform macosx {
113    configure.args-append \
114        --with-ldap=/usr \
115        --with-kerberos=/usr \
116        --with-iodbc=/usr
117}
118
119variant no_web conflicts apache apache2 apache20 fastcgi description {Don't include any web server support} {}
120
121variant apache conflicts apache2 apache20 no_web description {Add Apache 1 web server module} {
122    if { ! [variant_isset macosx] && (![info exists os.subplatform] || ${os.subplatform} != "macosx") } {
123        depends_lib-append \
124            port:apache
125        configure.args-append \
126            --with-apxs=${prefix}/sbin/apxs
127    } else {
128        destroot.violate_mtree yes
129        configure.args-append \
130            --with-apxs=/usr/sbin/apxs
131    }
132}
133
134variant apache2 conflicts apache apache20 no_web description {Add Apache 2.2 web server module} {
135    pre-configure {
136        # Checking for mod_cgi.so is a convenient way to verify apache2 is using its
137        # +preforkmpm variant. (+eventmpm and +workermpm instead provide mod_cgid.so.)
138        if {![file exists ${prefix}/apache2/modules/mod_cgi.so]} {
139            ui_error "To use ${name} with the +apache2 variant, apache2 must be installed with the +preforkmpm variant."
140            return -code error "incompatible apache2 installation"
141        }
142    }
143    destroot.violate_mtree yes
144    depends_lib-append \
145        port:apache2
146    configure.args-append \
147        --with-apxs2=${prefix}/apache2/bin/apxs
148}
149
150variant apache20 conflicts apache apache2 no_web description {Add Apache 2.0 web server module} {
151    pre-configure {
152        # Checking for mod_cgi.so is a convenient way to verify apache20 is using its
153        # +preforkmpm variant. (+workermpm instead provides mod_cgid.so.)
154        if {![file exists ${prefix}/apache20/modules/mod_cgi.so]} {
155            ui_error "To use ${name} with the +apache20 variant, apache20 must be installed with the +preforkmpm variant."
156            return -code error "incompatible apache20 installation"
157        }
158    }
159    destroot.violate_mtree yes
160    depends_lib-append \
161        port:apache20
162    configure.args-append \
163        --with-apxs2=${prefix}/apache20/bin/apxs
164}
165
166variant fastcgi conflicts no_web description {Add FastCGI web server binary} {
167    if { ![variant_isset apache] && ![variant_isset apache2] && ![variant_isset apache20] } {
168        configure.args-append \
169            --enable-fastcgi \
170            --enable-force-cgi-redirect
171    }
172}
173
174variant mysql4 conflicts mysql5 description {Add MySQL 4 support} {
175    depends_lib-append \
176        port:mysql4
177    configure.args-append \
178        --with-mysql=${prefix}
179}
180
181variant mysql5 conflicts mysql4 description {Add MySQL 5 support} {
182    depends_lib-append \
183        path:bin/mysql_config5:mysql5
184    configure.args-delete \
185        --without-mysql
186    configure.args-append \
187        --with-mysql=${workpath}/mysql5
188    post-extract {
189        file mkdir "${workpath}/mysql5"
190        file link -symbolic "${workpath}/mysql5/lib" "${prefix}/lib/mysql5"
191        file link -symbolic "${workpath}/mysql5/include" "${prefix}/include/mysql5"
192    }
193   
194    post-destroot {
195        reinplace "s;${workpath}/mysql5/lib;${prefix}/lib/mysql5;" ${destroot}${prefix}/bin/php-config4
196    }
197}
198
199variant postgresql8 requires postgresql82 description {Obsolete name for postgresql82 variant} {}
200
201variant postgresql82 conflicts postgresql83 postgresql84 description {Add PostgreSQL 8.2 support} {
202    depends_lib-append \
203        port:postgresql82
204    configure.args-append \
205        --with-pgsql=${prefix}/lib/postgresql82/bin
206}
207
208variant postgresql83 conflicts postgresql82 postgresql84 description {Add PostgreSQL 8.3 support} {
209    depends_lib-append \
210        port:postgresql83
211    configure.args-append \
212        --with-pgsql=${prefix}/lib/postgresql83/bin
213}
214
215variant postgresql84 conflicts postgresql82 postgresql83 description {Add PostgreSQL 8.4 support} {
216    depends_lib-append \
217        port:postgresql84
218    configure.args-append \
219        --with-pgsql=${prefix}/lib/postgresql84/bin
220}
221
222variant ldap description {Add LDAP protocol support} {
223    depends_lib-append \
224        port:openldap
225    configure.args-append \
226        --with-ldap=${prefix}
227}
228
229variant gmp description {Add GNU MP multiprocessing functions} {
230    depends_lib-append \
231        port:gmp
232    configure.args-append \
233        --with-gmp=${prefix}
234}
235
236variant dbase description {Add dBase file format support} {
237    configure.args-append \
238        --enable-dbase
239}
240
241variant imap description {Add IMAP protocol support} {
242    depends_build-append \
243        port:cclient
244    configure.args-append \
245        --with-imap=${prefix} \
246        --with-imap-ssl=/usr
247}
248
249variant pspell description {Add pspell spell-checking functions} {
250    depends_lib-append \
251        port:aspell
252    configure.args-append \
253        --with-pspell=${prefix}
254}
255
256variant xslt description {Add XSLT support using Sablotron} {
257    depends_lib-append \
258        port:sablotron
259    configure.args-append \
260        --enable-xslt \
261        --with-xslt-sablot=${prefix} \
262        --with-iconv-dir=${prefix}
263}
264
265if {![variant_isset apache] && ![variant_isset apache2] && ![variant_isset apache20] && ![variant_isset fastcgi] && ![variant_isset no_web]} {
266    default_variants +apache2
267}
268
269variant readline description {Add GNU readline functions} {
270    depends_lib-append \
271        port:readline
272    configure.args-append \
273        --with-readline=${prefix}
274}
275
276variant t1lib description {Add PostScript Type 1 font support with t1lib} {
277    depends_lib-append \
278        port:t1lib
279    configure.args-append \
280        --with-t1lib=${prefix}
281}
282
283set pdflib_distname pdflib-2.1.8
284set pdflib_distfile ${pdflib_distname}.tgz
285variant pdflib description {Add PDFlib support} {
286    master_sites-append         http://pecl.php.net/get/:pdflib
287    extract.only                ${distfiles}
288    distfiles-append            ${pdflib_distfile}:pdflib
289    checksums-append            ${pdflib_distfile} \
290                                sha1    5d0b01dc6fe81a39e7832a4c719983ebd06f6174 \
291                                rmd160  a74d2bba8985bd85fbd61589450c591665663906
292    post-extract {
293        delete ${worksrcpath}/ext/pdf
294        system -W ${workpath} "/usr/bin/gnutar --no-same-owner -xzf ${distpath}/${pdflib_distfile}"
295        move ${workpath}/${pdflib_distname} ${worksrcpath}/ext/pdf
296    }
297    depends_lib-append          port:pdflib
298    configure.args-append       --with-pdflib=${prefix}
299}
300
301variant suhosin description {Add Suhosin patch} {
302    pre-fetch {
303        if {"darwin" == ${os.platform} && ${os.major} < 9} {
304            ui_error "The suhosin variant requires Mac OS X 10.5 or greater."
305            return -code error "incompatible Mac OS X version"
306        }
307    }
308    set suhosin_patch_version   ${version}-0.9.6
309    set suhosin_patch           suhosin-patch-${suhosin_patch_version}.patch.gz
310    patch_sites-append          http://download.suhosin.org/
311    patchfiles-append           ${suhosin_patch}
312    checksums-append \
313        ${suhosin_patch} \
314            md5     c4e88782b1572e0aee26e6b2124e6257 \
315            sha1    b2b5121dc1f2bb5ffed968efb978a4a1ac9fcca6 \
316            rmd160  39d2e74cc879187b348f2e0dd22755680fafb49d \
317}
318
319destroot.args \
320    INSTALL_ROOT=${destroot} PHP_PEAR_INSTALL_DIR=${prefix}/lib/php
321
322destroot.target \
323    install-cli install-pear install-build install-headers install-programs
324
325post-destroot {
326    #copy module
327    if { [variant_isset apache] } {
328        xinstall -m 755 -d ${destroot}${prefix}/libexec/apache \
329            ${destroot}${prefix}/etc/apache/extra
330        xinstall -m 755 ${worksrcpath}/libs/libphp4.so ${destroot}${prefix}/libexec/apache/
331        xinstall -m 755 -c ${filespath}/mod_php.conf ${destroot}$prefix/etc/apache/extra/mod_php.conf.sample
332    }
333   
334    if { [variant_isset apache2] } {
335        xinstall -m 755 -d ${destroot}${prefix}/apache2/modules \
336            ${destroot}${prefix}/apache2/conf/extra
337        xinstall -m 755 ${worksrcpath}/libs/libphp4.so ${destroot}${prefix}/apache2/modules/
338        xinstall -m 755 -c ${filespath}/mod_php.conf ${destroot}${prefix}/apache2/conf/extra/mod_php.conf.sample
339    }
340   
341    if { [variant_isset apache20] } {
342        xinstall -m 755 -d ${destroot}${prefix}/apache20/modules \
343            ${destroot}${prefix}/apache20/conf/extra
344        xinstall -m 755 ${worksrcpath}/libs/libphp4.so ${destroot}${prefix}/apache20/modules/
345        xinstall -m 755 -c ${filespath}/mod_php.conf ${destroot}${prefix}/apache20/conf/extra/mod_php.conf.sample
346    }
347   
348    if { [variant_isset fastcgi] } {
349        # If we've built an Apache module (any version) then the FastCGI binary
350        # will not have been built, so we need to run through the whole process
351        # again and build just the FastCGI binary. Keep the options here in sync
352        # with the options specified in the apache, apache2 and apache20 variants.
353        if { [variant_isset apache] } {
354            if { ![variant_isset macosx] && (![info exists os.subplatform] || ${os.subplatform} != "macosx") } {
355                configure.args-delete \
356                    --with-apxs=${prefix}/sbin/apxs
357            } else {
358                configure.args-delete \
359                    --with-apxs=/usr/sbin/apxs
360            }
361        }
362        if { [variant_isset apache2] } {
363            configure.args-delete \
364                --with-apxs2=${prefix}/apache2/bin/apxs
365        }
366        if { [variant_isset apache20] } {
367            configure.args-delete \
368                --with-apxs2=${prefix}/apache20/bin/apxs
369        }
370       
371        # Run the build again to get the FastCGI binary. Keep the options here
372        # in sync with those in the fastcgi variant.
373        if { [variant_isset apache] || [variant_isset apache2] || [variant_isset apache20] } {
374            configure.args-append \
375                --enable-fastcgi \
376                --enable-force-cgi-redirect
377            ui_msg "$UI_PREFIX Configuring ${name} again for fastcgi"
378            command_exec configure
379            ui_msg "$UI_PREFIX Building ${name} again for fastcgi"
380            command_exec build
381            ui_msg "$UI_PREFIX Staging ${name} fastcgi into destroot"
382        }
383       
384        # Copy the FastCGI binary to the bin dir under a new name so it doesn't
385        # conflict with the cli version.
386        xinstall -m 755 ${worksrcpath}/sapi/cgi/php ${destroot}${prefix}/bin/php-cgi${major}
387    }
388   
389    file rename ${destroot}${prefix}/etc/php4/pear.conf ${destroot}${prefix}/etc/php4/pear.conf.sample
390   
391    #copy php.ini
392    xinstall -m 755 -d ${destroot}${phpinidir}
393    xinstall -m 644 -W ${worksrcpath} \
394        php.ini-dist \
395        php.ini-recommended \
396        ${destroot}${phpinidir}
397   
398    # rename files
399    file rename ${destroot}${prefix}/bin/pear ${destroot}${prefix}/bin/pear4
400    reinplace "s|${prefix}/bin/php|${prefix}/bin/php4|g" ${destroot}${prefix}/bin/pear4
401   
402    #nuke pear-stuff in ${destroot}
403    system -W ${destroot} "rm -rf .channels .depdb .depdblock .filemap .lock"
404   
405    system "if \[ -f ${prefix}/lib/php4/.depdblock \]; then rm -f ${destroot}${prefix}/lib/php4/.depdblock; fi"
406    system "if \[ -f ${prefix}/lib/php4/.depdb \]; then rm -f ${destroot}${prefix}/lib/php4/.depdb; fi"
407    system "if \[ -f ${prefix}/lib/php4/.filemap \]; then rm -f ${destroot}${prefix}/lib/php4/.filemap; fi"
408    system "if \[ -f ${prefix}/lib/php4/.lock \]; then rm -f ${destroot}${prefix}/lib/php4/.lock; fi"
409    system "if \[ -d ${prefix}/lib/php4/.channels \]; then rm -rf ${destroot}${prefix}/lib/php4/.channels; fi"
410}
411
412pre-activate {
413    set filepath ${extraphpinidir}/.turd_${name}
414    if {[file exists ${filepath}]} {
415        delete ${filepath}
416    }
417}
418
419notes "
420PHP 4 is obsolete. Please update to PHP 5 (the php5 port).\
421For information on how to update your code, please see\
422http://www.php.net/manual/en/migration5.php
423"
424
425post-activate {
426    if {[file exists ${prefix}/etc/php.ini] && ![file exists ${phpinidir}/php.ini]} {
427        move ${prefix}/etc/php.ini ${phpinidir}
428        ui_msg "Your ${prefix}/etc/php.ini has been moved to ${phpinidir}/php.ini"
429        ui_msg ""
430    }
431    if {![file exists ${phpinidir}/php.ini]} {
432        ui_msg "To customize php, copy"
433        ui_msg "${phpinidir}/php.ini-dist (if this is a development server) or"
434        ui_msg "${phpinidir}/php.ini-recommended (if this is a production server) to"
435        ui_msg "${phpinidir}/php.ini and then make changes."
436    } else {
437        ui_msg "You may need to update your php.ini for any changes that have been made"
438        ui_msg "in this version of php. Compare ${phpinidir}/php.ini with"
439        ui_msg "${phpinidir}/php.ini-dist (if this is a development server) or"
440        ui_msg "${phpinidir}/php.ini-recommended (if this is a production server)."
441    }
442   
443    if {![variant_isset no_web]} {
444        ui_msg ""
445        ui_msg "If this is your first install, you need to activate PHP in your web server."
446        if {![variant_isset fastcgi]} {
447            if {[variant_isset apache]} {
448                set moduledir ${prefix}/libexec/modules
449                set apxs ${prefix}/apache/bin/apxs
450            }
451            if {[variant_isset apache2]} {
452                set moduledir ${prefix}/apache2/modules
453                set apxs ${prefix}/apache2/bin/apxs
454            }
455            if {[variant_isset apache20]} {
456                set moduledir ${prefix}/apache20/modules
457                set apxs ${prefix}/apache20/bin/apxs
458            }
459            ui_msg ""
460            ui_msg "To enable PHP in Apache, run"
461            ui_msg "  cd ${moduledir}"
462            ui_msg "  ${apxs} -a -e -n \"${my_name}\" lib${my_name}.so"
463        }
464    }
465   
466    ui_msg "* copy  ${prefix}/etc/php4/pear.conf.sample to  ${prefix}/etc/php4/pear.conf"
467}
468
469livecheck.type          none
Note: See TracBrowser for help on using the repository browser.