source: trunk/dports/lang/php4/Portfile

Last change on this file was 146517, checked in by raimue@…, 19 months ago

Mass rev-bump dependents of port openssl due to ABI change

Disabling SSLv2 in r146162 changed the ABI of the library, leading to loading
errors for binaries with references to SSLv2 symbols.

https://lists.macosforge.org/pipermail/macports-dev/2016-March/032531.html

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 16.5 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 146517 2016-03-10 17:49:28Z ryandesign@macports.org $
3
4PortSystem              1.0
5
6name                    php4
7version                 4.4.9
8revision                17
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    path:lib/libssl.dylib: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} eq "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} ne "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} "gnutar --no-same-owner -xzf ${distpath}/${pdflib_distfile}"
295        move ${workpath}/${pdflib_distname} ${worksrcpath}/ext/pdf
296    }
297    depends_extract-append        bin:gnutar:gnutar
298    depends_lib-append          port:pdflib
299    configure.args-append       --with-pdflib=${prefix}
300}
301
302variant suhosin description {Add Suhosin patch} {
303    pre-fetch {
304        if {${os.platform} eq "darwin" && ${os.major} < 9} {
305            ui_error "The suhosin variant requires Mac OS X 10.5 or greater."
306            return -code error "incompatible Mac OS X version"
307        }
308    }
309    set suhosin_patch_version   ${version}-0.9.6
310    set suhosin_patch           suhosin-patch-${suhosin_patch_version}.patch.gz
311    patch_sites-append          http://download.suhosin.org/
312    patchfiles-append           ${suhosin_patch}
313    checksums-append \
314        ${suhosin_patch} \
315            md5     c4e88782b1572e0aee26e6b2124e6257 \
316            sha1    b2b5121dc1f2bb5ffed968efb978a4a1ac9fcca6 \
317            rmd160  39d2e74cc879187b348f2e0dd22755680fafb49d \
318}
319
320destroot.args \
321    INSTALL_ROOT=${destroot} PHP_PEAR_INSTALL_DIR=${prefix}/lib/php
322
323destroot.target \
324    install-cli install-pear install-build install-headers install-programs
325
326post-destroot {
327    #copy module
328    if { [variant_isset apache] } {
329        xinstall -m 755 -d ${destroot}${prefix}/libexec/apache \
330            ${destroot}${prefix}/etc/apache/extra
331        xinstall -m 755 ${worksrcpath}/libs/libphp4.so ${destroot}${prefix}/libexec/apache/
332        xinstall -m 755 -c ${filespath}/mod_php.conf ${destroot}$prefix/etc/apache/extra/mod_php.conf.sample
333    }
334   
335    if { [variant_isset apache2] } {
336        xinstall -m 755 -d ${destroot}${prefix}/apache2/modules \
337            ${destroot}${prefix}/apache2/conf/extra
338        xinstall -m 755 ${worksrcpath}/libs/libphp4.so ${destroot}${prefix}/apache2/modules/
339        xinstall -m 755 -c ${filespath}/mod_php.conf ${destroot}${prefix}/apache2/conf/extra/mod_php.conf.sample
340    }
341   
342    if { [variant_isset apache20] } {
343        xinstall -m 755 -d ${destroot}${prefix}/apache20/modules \
344            ${destroot}${prefix}/apache20/conf/extra
345        xinstall -m 755 ${worksrcpath}/libs/libphp4.so ${destroot}${prefix}/apache20/modules/
346        xinstall -m 755 -c ${filespath}/mod_php.conf ${destroot}${prefix}/apache20/conf/extra/mod_php.conf.sample
347    }
348   
349    if { [variant_isset fastcgi] } {
350        # If we've built an Apache module (any version) then the FastCGI binary
351        # will not have been built, so we need to run through the whole process
352        # again and build just the FastCGI binary. Keep the options here in sync
353        # with the options specified in the apache, apache2 and apache20 variants.
354        if { [variant_isset apache] } {
355            if { ![variant_isset macosx] && (![info exists os.subplatform] || ${os.subplatform} ne "macosx") } {
356                configure.args-delete \
357                    --with-apxs=${prefix}/sbin/apxs
358            } else {
359                configure.args-delete \
360                    --with-apxs=/usr/sbin/apxs
361            }
362        }
363        if { [variant_isset apache2] } {
364            configure.args-delete \
365                --with-apxs2=${prefix}/apache2/bin/apxs
366        }
367        if { [variant_isset apache20] } {
368            configure.args-delete \
369                --with-apxs2=${prefix}/apache20/bin/apxs
370        }
371       
372        # Run the build again to get the FastCGI binary. Keep the options here
373        # in sync with those in the fastcgi variant.
374        if { [variant_isset apache] || [variant_isset apache2] || [variant_isset apache20] } {
375            configure.args-append \
376                --enable-fastcgi \
377                --enable-force-cgi-redirect
378            ui_msg "$UI_PREFIX Configuring ${name} again for fastcgi"
379            command_exec configure
380            ui_msg "$UI_PREFIX Building ${name} again for fastcgi"
381            command_exec build
382            ui_msg "$UI_PREFIX Staging ${name} fastcgi into destroot"
383        }
384       
385        # Copy the FastCGI binary to the bin dir under a new name so it doesn't
386        # conflict with the cli version.
387        xinstall -m 755 ${worksrcpath}/sapi/cgi/php ${destroot}${prefix}/bin/php-cgi${major}
388    }
389   
390    file rename ${destroot}${prefix}/etc/php4/pear.conf ${destroot}${prefix}/etc/php4/pear.conf.sample
391   
392    #copy php.ini
393    xinstall -m 755 -d ${destroot}${phpinidir}
394    xinstall -m 644 -W ${worksrcpath} \
395        php.ini-dist \
396        php.ini-recommended \
397        ${destroot}${phpinidir}
398   
399    # rename files
400    file rename ${destroot}${prefix}/bin/pear ${destroot}${prefix}/bin/pear4
401    reinplace "s|${prefix}/bin/php|${prefix}/bin/php4|g" ${destroot}${prefix}/bin/pear4
402   
403    #nuke pear-stuff in ${destroot}
404    system -W ${destroot} "rm -rf .channels .depdb .depdblock .filemap .lock"
405   
406    system "if \[ -f ${prefix}/lib/php4/.depdblock \]; then rm -f ${destroot}${prefix}/lib/php4/.depdblock; fi"
407    system "if \[ -f ${prefix}/lib/php4/.depdb \]; then rm -f ${destroot}${prefix}/lib/php4/.depdb; fi"
408    system "if \[ -f ${prefix}/lib/php4/.filemap \]; then rm -f ${destroot}${prefix}/lib/php4/.filemap; fi"
409    system "if \[ -f ${prefix}/lib/php4/.lock \]; then rm -f ${destroot}${prefix}/lib/php4/.lock; fi"
410    system "if \[ -d ${prefix}/lib/php4/.channels \]; then rm -rf ${destroot}${prefix}/lib/php4/.channels; fi"
411}
412
413pre-activate {
414    set filepath ${extraphpinidir}/.turd_${name}
415    if {[file exists ${filepath}]} {
416        delete ${filepath}
417    }
418}
419
420notes "
421PHP 4 is obsolete. Please update to PHP 5 (the php5 port).\
422For information on how to update your code, please see\
423http://www.php.net/manual/en/migration5.php
424"
425
426post-activate {
427    if {[file exists ${prefix}/etc/php.ini] && ![file exists ${phpinidir}/php.ini]} {
428        move ${prefix}/etc/php.ini ${phpinidir}
429        ui_msg "Your ${prefix}/etc/php.ini has been moved to ${phpinidir}/php.ini"
430        ui_msg ""
431    }
432    if {![file exists ${phpinidir}/php.ini]} {
433        ui_msg "To customize php, copy"
434        ui_msg "${phpinidir}/php.ini-dist (if this is a development server) or"
435        ui_msg "${phpinidir}/php.ini-recommended (if this is a production server) to"
436        ui_msg "${phpinidir}/php.ini and then make changes."
437    } else {
438        ui_msg "You may need to update your php.ini for any changes that have been made"
439        ui_msg "in this version of php. Compare ${phpinidir}/php.ini with"
440        ui_msg "${phpinidir}/php.ini-dist (if this is a development server) or"
441        ui_msg "${phpinidir}/php.ini-recommended (if this is a production server)."
442    }
443   
444    if {![variant_isset no_web]} {
445        ui_msg ""
446        ui_msg "If this is your first install, you need to activate PHP in your web server."
447        if {![variant_isset fastcgi]} {
448            if {[variant_isset apache]} {
449                set moduledir ${prefix}/libexec/modules
450                set apxs ${prefix}/apache/bin/apxs
451            }
452            if {[variant_isset apache2]} {
453                set moduledir ${prefix}/apache2/modules
454                set apxs ${prefix}/apache2/bin/apxs
455            }
456            if {[variant_isset apache20]} {
457                set moduledir ${prefix}/apache20/modules
458                set apxs ${prefix}/apache20/bin/apxs
459            }
460            ui_msg ""
461            ui_msg "To enable PHP in Apache, run"
462            ui_msg "  cd ${moduledir}"
463            ui_msg "  ${apxs} -a -e -n \"${my_name}\" lib${my_name}.so"
464        }
465    }
466   
467    ui_msg "* copy  ${prefix}/etc/php4/pear.conf.sample to  ${prefix}/etc/php4/pear.conf"
468}
469
470livecheck.type          none
Note: See TracBrowser for help on using the repository browser.