Permalink
Fetching contributors…
Cannot retrieve contributors at this time
426 lines (370 sloc) 14.5 KB
# -*- 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
PortSystem 1.0
PortGroup active_variants 1.1
name php4
version 4.4.9
revision 19
set major [lindex [split ${version} .] 0]
set my_name php${major}
dist_subdir ${my_name}
categories lang www
license PHP-3.01
maintainers {ryandesign @ryandesign}
homepage http://www.php.net/
distname php-${version}
use_bzip2 yes
master_sites php:get/[lindex ${distfiles} 0]/from/this/mirror?dummy=
platforms darwin freebsd
use_parallel_build yes
description \
PHP: Hypertext Preprocessor
long_description \
PHP is a widely-used general-purpose scripting language \
that is especially suited for Web development \
and can be embedded into HTML.
checksums ${distname}${extract.suffix} \
rmd160 0d77092efaccd8fe6efc16635be98c5d4ccfec66 \
sha256 2ac502d56ba3360fa4ea2e5c53ea6e35b6367a5654161f9aeec86a549b1656c2 \
size 4545009
depends_build \
port:pkgconfig
depends_lib \
port:libiconv \
port:expat \
port:gettext \
port:zlib \
path:lib/libssl.dylib:openssl \
port:tiff \
port:libxml2 \
port:libtool \
port:mhash \
port:libmcrypt \
port:curl \
port:jpeg \
port:libpng \
port:freetype
# Use -p1 to accommodate the Suhosin patch
patch.pre_args -p1
patchfiles \
patch-ext-openssl-openssl.c.diff \
patch-ext-standard-string.c.diff \
patch-jpeg-9.diff \
patch-scripts-php-config.in.diff
set phpinidir ${prefix}/etc/${my_name}
set extraphpinidir ${prefix}/var/db/${my_name}
destroot.keepdirs ${destroot}${extraphpinidir}
configure.args \
--mandir=${prefix}/share/man \
--infodir=${prefix}/share/info \
--includedir=${prefix}/include/php4 \
--libdir=${prefix}/lib/php4 \
--sysconfdir=${prefix}/etc/php4 \
--with-config-file-path=${phpinidir} \
--with-config-file-scan-dir=${extraphpinidir} \
--with-pear=${prefix}/lib/php4 \
--program-suffix=4 \
--enable-mbstring \
--enable-dbx \
--enable-safe-mode \
--enable-dba \
--enable-calendar \
--enable-exif \
--enable-ftp \
--enable-wddx \
--enable-filepro \
--enable-bcmath \
--enable-cli \
--with-xml \
--with-xmlrpc \
--without-mysql \
--with-iconv=${prefix} \
--with-zlib=${prefix} \
--with-gettext=${prefix} \
--with-expat-dir=${prefix} \
--with-dom=${prefix} \
--with-openssl=${prefix} \
--with-mhash=${prefix} \
--with-mcrypt=${prefix} \
--with-mime-magic \
--with-curl=${prefix} \
--with-gd \
--with-jpeg-dir=${prefix} \
--with-png-dir=${prefix} \
--enable-gd-native-ttf \
--with-freetype-dir=${prefix}
if {${os.platform} eq "darwin" && ${os.major} >= 10} {
configure.env-append \
LIBS=-lresolv
}
platform macosx {
configure.args-append \
--with-ldap=/usr \
--with-kerberos=/usr \
--with-iodbc=/usr
}
variant no_web conflicts apache2 apache22 fastcgi description {Don't include any web server support} {}
variant apache2 conflicts apache22 no_web description {Add Apache 2.4 web server module} {
require_active_variants apache2 preforkmpm
destroot.violate_mtree yes
depends_lib-append \
port:apache2
configure.args-append \
--with-apxs2=${prefix}/bin/apxs
}
variant apache22 conflicts apache2 no_web description {Add Apache 2.2 web server module} {
require_active_variants apache22 preforkmpm
destroot.violate_mtree yes
depends_lib-append \
port:apache22
configure.args-append \
--with-apxs2=${prefix}/apache22/bin/apxs
}
variant fastcgi conflicts no_web description {Add FastCGI web server binary} {
if {![variant_isset apache2] && ![variant_isset apache22]} {
configure.args-append \
--enable-fastcgi \
--enable-force-cgi-redirect
}
}
variant mysql4 conflicts mysql5 description {Add MySQL 4 support} {
depends_lib-append \
port:mysql4
configure.args-append \
--with-mysql=${prefix}
}
variant mysql5 conflicts mysql4 description {Add MySQL 5 support} {
depends_lib-append \
path:bin/mysql_config5:mysql5
configure.args-delete \
--without-mysql
configure.args-append \
--with-mysql=${workpath}/mysql5
post-extract {
file mkdir "${workpath}/mysql5"
file link -symbolic "${workpath}/mysql5/lib" "${prefix}/lib/mysql5"
file link -symbolic "${workpath}/mysql5/include" "${prefix}/include/mysql5"
}
post-destroot {
reinplace "s;${workpath}/mysql5/lib;${prefix}/lib/mysql5;" ${destroot}${prefix}/bin/php-config4
}
}
variant postgresql8 requires postgresql82 description {Obsolete name for postgresql82 variant} {}
variant postgresql82 conflicts postgresql83 postgresql84 description {Add PostgreSQL 8.2 support} {
depends_lib-append \
port:postgresql82
configure.args-append \
--with-pgsql=${prefix}/lib/postgresql82/bin
}
variant postgresql83 conflicts postgresql82 postgresql84 description {Add PostgreSQL 8.3 support} {
depends_lib-append \
port:postgresql83
configure.args-append \
--with-pgsql=${prefix}/lib/postgresql83/bin
}
variant postgresql84 conflicts postgresql82 postgresql83 description {Add PostgreSQL 8.4 support} {
depends_lib-append \
port:postgresql84
configure.args-append \
--with-pgsql=${prefix}/lib/postgresql84/bin
}
variant ldap description {Add LDAP protocol support} {
depends_lib-append \
port:openldap
configure.args-append \
--with-ldap=${prefix}
}
variant gmp description {Add GNU MP multiprocessing functions} {
depends_lib-append \
port:gmp
configure.args-append \
--with-gmp=${prefix}
}
variant dbase description {Add dBase file format support} {
configure.args-append \
--enable-dbase
}
variant imap description {Add IMAP protocol support} {
depends_build-append \
port:cclient
configure.args-append \
--with-imap=${prefix} \
--with-imap-ssl=/usr
}
variant pspell description {Add pspell spell-checking functions} {
depends_lib-append \
port:aspell
configure.args-append \
--with-pspell=${prefix}
}
variant xslt description {Add XSLT support using Sablotron} {
depends_lib-append \
port:sablotron
configure.args-append \
--enable-xslt \
--with-xslt-sablot=${prefix} \
--with-iconv-dir=${prefix}
}
if {![variant_isset apache2] && ![variant_isset apache22] && ![variant_isset fastcgi] && ![variant_isset no_web]} {
default_variants +apache22
}
variant readline description {Add GNU readline functions} {
depends_lib-append \
port:readline
configure.args-append \
--with-readline=${prefix}
}
variant t1lib description {Add PostScript Type 1 font support with t1lib} {
depends_lib-append \
port:t1lib
configure.args-append \
--with-t1lib=${prefix}
}
set pdflib_distname pdflib-2.1.8
set pdflib_distfile ${pdflib_distname}.tgz
variant pdflib description {Add PDFlib support} {
master_sites-append http://pecl.php.net/get/:pdflib
extract.only ${distfiles}
distfiles-append ${pdflib_distfile}:pdflib
checksums-append ${pdflib_distfile} \
rmd160 a74d2bba8985bd85fbd61589450c591665663906 \
sha256 410f8b1a9691705e4e70a03eb6468e735232f3871c3e63a4cf164250bd25b5bc \
size 55797
post-extract {
delete ${worksrcpath}/ext/pdf
system -W ${workpath} "gnutar --no-same-owner -xzf ${distpath}/${pdflib_distfile}"
move ${workpath}/${pdflib_distname} ${worksrcpath}/ext/pdf
}
depends_extract-append bin:gnutar:gnutar
depends_lib-append port:pdflib
configure.args-append --with-pdflib=${prefix}
}
variant suhosin description {Add Suhosin patch} {
pre-fetch {
if {${os.platform} eq "darwin" && ${os.major} < 9} {
ui_error "The suhosin variant requires Mac OS X 10.5 or greater."
return -code error "incompatible Mac OS X version"
}
}
set suhosin_patch_version ${version}-0.9.6
set suhosin_patch suhosin-patch-${suhosin_patch_version}.patch.gz
patch_sites-append https://download.suhosin.org/
patchfiles-append ${suhosin_patch}
checksums-append ${suhosin_patch} \
rmd160 39d2e74cc879187b348f2e0dd22755680fafb49d \
sha256 163dc01b0ce2412fec6dcd63f1b4d474c82657672f8d4ca1b40979722c46ca3f \
size 22248
}
destroot.args \
INSTALL_ROOT=${destroot} PHP_PEAR_INSTALL_DIR=${prefix}/lib/php
destroot.target \
install-cli install-pear install-build install-headers install-programs
post-destroot {
#copy module
if {[variant_isset apache2]} {
xinstall -m 755 -d ${destroot}${prefix}/lib/apache2/modules \
${destroot}${prefix}/etc/apache2/extra
xinstall -m 644 ${worksrcpath}/libs/libphp4.so ${destroot}${prefix}/lib/apache2/modules/
xinstall -m 644 -c ${filespath}/mod_php.conf ${destroot}${prefix}/etc/apache2/extra/mod_php.conf.sample
}
if {[variant_isset apache22]} {
xinstall -m 755 -d ${destroot}${prefix}/apache22/modules \
${destroot}${prefix}/apache22/conf/extra
xinstall -m 644 ${worksrcpath}/libs/libphp4.so ${destroot}${prefix}/apache22/modules/
xinstall -m 644 -c ${filespath}/mod_php.conf ${destroot}${prefix}/apache22/conf/extra/mod_php.conf.sample
}
if {[variant_isset fastcgi]} {
# If we've built an Apache module (any version) then the FastCGI binary
# will not have been built, so we need to run through the whole process
# again and build just the FastCGI binary. Keep the options here in sync
# with the options specified in the apache2 and apache22 variants.
if {[variant_isset apache2]} {
configure.args-delete \
--with-apxs2=${prefix}/bin/apxs
}
if {[variant_isset apache22]} {
configure.args-delete \
--with-apxs2=${prefix}/apache22/bin/apxs
}
# Run the build again to get the FastCGI binary. Keep the options here
# in sync with those in the fastcgi variant.
if {[variant_isset apache2] || [variant_isset apache22]} {
configure.args-append \
--enable-fastcgi \
--enable-force-cgi-redirect
ui_msg "$UI_PREFIX Configuring ${name} again for fastcgi"
command_exec configure
ui_msg "$UI_PREFIX Building ${name} again for fastcgi"
command_exec build
ui_msg "$UI_PREFIX Staging ${name} fastcgi into destroot"
}
# Copy the FastCGI binary to the bin dir under a new name so it doesn't
# conflict with the cli version.
xinstall -m 755 ${worksrcpath}/sapi/cgi/php ${destroot}${prefix}/bin/php-cgi${major}
}
file rename ${destroot}${prefix}/etc/php4/pear.conf ${destroot}${prefix}/etc/php4/pear.conf.sample
#copy php.ini
xinstall -m 755 -d ${destroot}${phpinidir}
xinstall -m 644 -W ${worksrcpath} \
php.ini-dist \
php.ini-recommended \
${destroot}${phpinidir}
# rename files
file rename ${destroot}${prefix}/bin/pear ${destroot}${prefix}/bin/pear4
reinplace "s|${prefix}/bin/php|${prefix}/bin/php4|g" ${destroot}${prefix}/bin/pear4
#nuke pear-stuff in ${destroot}
system -W ${destroot} "rm -rf .channels .depdb .depdblock .filemap .lock"
system "if \[ -f ${prefix}/lib/php4/.depdblock \]; then rm -f ${destroot}${prefix}/lib/php4/.depdblock; fi"
system "if \[ -f ${prefix}/lib/php4/.depdb \]; then rm -f ${destroot}${prefix}/lib/php4/.depdb; fi"
system "if \[ -f ${prefix}/lib/php4/.filemap \]; then rm -f ${destroot}${prefix}/lib/php4/.filemap; fi"
system "if \[ -f ${prefix}/lib/php4/.lock \]; then rm -f ${destroot}${prefix}/lib/php4/.lock; fi"
system "if \[ -d ${prefix}/lib/php4/.channels \]; then rm -rf ${destroot}${prefix}/lib/php4/.channels; fi"
}
pre-activate {
set filepath ${extraphpinidir}/.turd_${name}
if {[file exists ${filepath}]} {
delete ${filepath}
}
}
notes "
PHP 4 has reached end-of-life. Please upgrade to a newer version.
To learn how to update your code, please read the following guide:
http://www.php.net/manual/en/migration5.php
"
post-activate {
if {[file exists ${prefix}/etc/php.ini] && ![file exists ${phpinidir}/php.ini]} {
move ${prefix}/etc/php.ini ${phpinidir}
ui_msg "Your ${prefix}/etc/php.ini has been moved to ${phpinidir}/php.ini"
ui_msg ""
}
if {![file exists ${phpinidir}/php.ini]} {
ui_msg "To customize php, copy"
ui_msg "${phpinidir}/php.ini-dist (if this is a development server) or"
ui_msg "${phpinidir}/php.ini-recommended (if this is a production server) to"
ui_msg "${phpinidir}/php.ini and then make changes."
} else {
ui_msg "You may need to update your php.ini for any changes that have been made"
ui_msg "in this version of php. Compare ${phpinidir}/php.ini with"
ui_msg "${phpinidir}/php.ini-dist (if this is a development server) or"
ui_msg "${phpinidir}/php.ini-recommended (if this is a production server)."
}
if {![variant_isset no_web]} {
ui_msg ""
ui_msg "If this is your first install, you need to activate PHP in your web server."
if {![variant_isset fastcgi]} {
if {[variant_isset apache2]} {
set moduledir ${prefix}/lib/apache2/modules
set apxs ${prefix}/bin/apxs
}
if {[variant_isset apache22]} {
set moduledir ${prefix}/apache22/modules
set apxs ${prefix}/apache22/bin/apxs
}
ui_msg ""
ui_msg "To enable PHP in Apache, run"
ui_msg " cd ${moduledir}"
ui_msg " ${apxs} -a -e -n \"${my_name}\" lib${my_name}.so"
}
}
ui_msg "* copy ${prefix}/etc/php4/pear.conf.sample to ${prefix}/etc/php4/pear.conf"
}
livecheck.type none