summaryrefslogtreecommitdiff
path: root/lang/php52
diff options
context:
space:
mode:
Diffstat (limited to 'lang/php52')
-rw-r--r--lang/php52/Makefile178
-rw-r--r--lang/php52/Makefile.ext618
-rw-r--r--lang/php52/distinfo9
-rw-r--r--lang/php52/files/patch-TSRM_threads.m411
-rw-r--r--lang/php52/files/patch-Zend::zend.h11
-rw-r--r--lang/php52/files/patch-Zend_zend_list.c38
-rw-r--r--lang/php52/files/patch-Zend_zend_list.h24
-rw-r--r--lang/php52/files/patch-acinclude.m453
-rw-r--r--lang/php52/files/patch-configure.in55
-rw-r--r--lang/php52/files/patch-ext_standard_array.c33
-rw-r--r--lang/php52/files/patch-ext_standard_basic_functions.c28
-rw-r--r--lang/php52/files/patch-ext_standard_image.c50
-rw-r--r--lang/php52/files/patch-ext_standard_php_dns.h13
-rw-r--r--lang/php52/files/patch-main::php_config.h.in12
-rw-r--r--lang/php52/files/patch-php.ini-dist18
-rw-r--r--lang/php52/files/patch-php.ini-recommended18
-rw-r--r--lang/php52/files/patch-sapi_cgi_Makefile.frag9
-rw-r--r--lang/php52/files/patch-sapi_cgi_config9.m455
-rw-r--r--lang/php52/files/patch-scripts::phpize.in13
-rw-r--r--lang/php52/pkg-descr8
-rw-r--r--lang/php52/pkg-message.mod10
-rw-r--r--lang/php52/pkg-plist208
22 files changed, 1472 insertions, 0 deletions
diff --git a/lang/php52/Makefile b/lang/php52/Makefile
new file mode 100644
index 000000000000..5520d9eff8dd
--- /dev/null
+++ b/lang/php52/Makefile
@@ -0,0 +1,178 @@
+# New ports collection makefile for: php52
+# Date created: 17 Apr 2010
+# Whom: Alex Keda <admin@lissyara.su>
+#
+# $FreeBSD$
+#
+
+PORTNAME= php52
+PORTVERSION= 5.2.12
+PORTREVISION?= 2
+CATEGORIES?= lang devel www
+MASTER_SITES= ${MASTER_SITE_PHP}
+MASTER_SITE_SUBDIR= distributions
+DISTNAME= php-${PORTVERSION}
+
+MAINTAINER= admin@lissyara.su
+COMMENT= PHP Scripting Language
+
+LATEST_LINK= ${PKGNAMEPREFIX}${PORTNAME}${PKGNAMESUFFIX}
+
+USE_BZIP2= yes
+MAKE_JOBS_SAFE= yes
+.if !defined(PKGNAMESUFFIX)
+USE_AUTOTOOLS= autoconf:262
+
+CONFIGURE_ARGS= \
+ --with-layout=GNU \
+ --with-config-file-scan-dir=${PREFIX}/etc/php \
+ --disable-all \
+ --enable-libxml \
+ --with-libxml-dir=${LOCALBASE} \
+ --enable-reflection \
+ --program-prefix=""
+
+USE_GNOME= libxml2
+
+OPTIONS= CLI "Build CLI version" on \
+ CGI "Build CGI version" on \
+ APACHE "Build Apache module" off \
+ DEBUG "Enable debug" off \
+ SUHOSIN "Enable Suhosin protection system (not for jails)" on \
+ MULTIBYTE "Enable zend multibyte support" off \
+ IPV6 "Enable ipv6 support" on \
+ MAILHEAD "Enable mail header patch" off \
+ REDIRECT "Enable force-cgi-redirect support (CGI only)" off \
+ DISCARD "Enable discard-path support (CGI only)" off \
+ FASTCGI "Enable fastcgi support (CGI only)" on \
+ PATHINFO "Enable path-info-check support (CGI only)" on
+
+CONFLICTS= php4-4* php5-5.3*
+
+MAN1= php-config.1 phpize.1
+
+.include <bsd.port.pre.mk>
+
+PATCH_DIST_STRIP= -p1
+
+.if !defined(WITHOUT_SUHOSIN)
+#PATCHFILES+= suhosin-patch-${PORTVERSION}-0.9.7.patch.gz:suhosin
+PATCHFILES+= suhosin-patch-5.2.11-0.9.7.patch.gz:suhosin
+PATCH_SITES+= http://download.suhosin.org/:suhosin
+PLIST_SUB+= SUHOSIN=""
+.else
+PLIST_SUB+= SUHOSIN="@comment "
+.endif
+
+.if defined(WITH_MAILHEAD)
+#PATCHFILES+= php-${PORTVERSION}-mail-header.patch:mail
+PATCHFILES+= php-5.2.10-mail-header.patch:mail
+PATCH_SITES+= http://choon.net/opensource/php/:mail
+.endif
+
+.if !defined(WITHOUT_CLI)
+PHP_SAPI+= cli
+PLIST_SUB+= CLI=""
+MAN1+= php.1
+.else
+PLIST_SUB+= CLI="@comment "
+CONFIGURE_ARGS+=--disable-cli
+.endif
+
+.if !defined(WITHOUT_CGI)
+PHP_SAPI+= cgi
+PLIST_SUB+= CGI=""
+.if defined(WITH_REDIRECT)
+CONFIGURE_ARGS+=--enable-force-cgi-redirect
+.endif
+.if defined(WITH_DISCARD)
+CONFIGURE_ARGS+=--enable-discard-path
+.endif
+.if !defined(WITHOUT_FASTCGI)
+CONFIGURE_ARGS+=--enable-fastcgi
+.endif
+.if defined(WITHOUT_PATHINFO)
+CONFIGURE_ARGS+=--disable-path-info-check
+.endif
+.else
+PLIST_SUB+= CGI="@comment "
+CONFIGURE_ARGS+=--disable-cgi
+.endif
+
+.if defined(WITH_APACHE)
+PHP_SAPI+= mod
+USE_APACHE= 1.3+
+.include "${PORTSDIR}/Mk/bsd.apache.mk"
+.if ${APACHE_VERSION} > 13
+CONFIGURE_ARGS+=--with-apxs2=${APXS}
+.else
+CONFIGURE_ARGS+=--with-apxs=${APXS}
+.endif
+PKGMESSAGE= ${PKGDIR}/pkg-message.mod
+MODULENAME= lib${PORTNAME}
+SHORTMODNAME= ${PORTNAME}
+PLIST_SUB+= APACHE=""
+.else
+PLIST_SUB+= APACHE="@comment "
+.endif
+
+.if !defined(WITH_REGEX_TYPE) || ${WITH_REGEX_TYPE} == "php"
+CONFIGURE_ARGS+=--with-regex=php
+.elif defined(WITH_REGEX_TYPE) && ${WITH_REGEX_TYPE} == "system"
+CONFIGURE_ARGS+=--with-regex=system
+.elif defined(WITH_REGEX_TYPE) && ${WITH_REGEX_TYPE} == "apache"
+CONFIGURE_ARGS+=--with-regex=apache
+.endif
+
+.if !defined(WITH_ZEND_VM) || ${WITH_ZEND_VM} == "CALL"
+CONFIGURE_ARGS+=--with-zend-vm=CALL
+.elif defined(WITH_ZEND_VM) && ${WITH_ZEND_VM} == "SWITCH"
+CONFIGURE_ARGS+=--with-zend-vm=SWITCH
+.elif defined(WITH_ZEND_VM) && ${WITH_ZEND_VM} == "GOTO"
+CONFIGURE_ARGS+=--with-zend-vm=GOTO
+.endif
+
+CONFIGURE_ENV+= ac_cv_pthreads_lib="" \
+ ac_cv_pthreads_cflags="" \
+ pthreads_working="yes" \
+ lt_cv_path_SED="sed"
+
+MAKE_ENV+= LDFLAGS="${LDFLAGS}"
+
+.if defined(WITH_DEBUG)
+CONFIGURE_ARGS+=--enable-debug
+.endif
+
+.if defined(WITH_MULTIBYTE)
+CONFIGURE_ARGS+=--enable-zend-multibyte
+.endif
+
+.if defined(WITHOUT_IPV6)
+CONFIGURE_ARGS+=--disable-ipv6
+.endif
+
+post-patch:
+ @${TOUCH} ${WRKSRC}/ext/php_config.h
+ @${REINPLACE_CMD} "s|^\(extension_dir\)|; \1|" ${WRKSRC}/php.ini-*
+
+pre-configure:
+ @${CAT} ${WRKSRC}/acinclude.m4 ${WRKSRC}/build/libtool.m4 > ${WRKSRC}/aclocal.m4
+
+post-build:
+ @${ECHO_CMD} "PHP_VER=52" > ${WRKDIR}/php.conf
+ @${ECHO_CMD} "PHP_VERSION=${PORTVERSION}" >> ${WRKDIR}/php.conf
+ @${ECHO_CMD} "PHP_SAPI=${PHP_SAPI}" >> ${WRKDIR}/php.conf
+
+post-install:
+ @${INSTALL_DATA} ${WRKSRC}/php.ini-dist ${PREFIX}/etc
+ @${INSTALL_DATA} ${WRKSRC}/php.ini-recommended ${PREFIX}/etc
+ @${INSTALL_DATA} ${WRKDIR}/php.conf ${PREFIX}/etc
+ @${TOUCH} ${PREFIX}/include/php/ext/php_config.h
+.if defined(WITH_APACHE)
+ @${CAT} ${PKGMESSAGE}
+.endif
+
+.else
+.include "${MASTERDIR}/Makefile.ext"
+.endif
+.include <bsd.port.post.mk>
diff --git a/lang/php52/Makefile.ext b/lang/php52/Makefile.ext
new file mode 100644
index 000000000000..7c04f1338cfb
--- /dev/null
+++ b/lang/php52/Makefile.ext
@@ -0,0 +1,618 @@
+COMMENT= The ${PHP_MODNAME} shared extension for php
+
+USE_PHP= yes
+USE_PHPEXT= yes
+PHP_MODNAME= ${PKGNAMESUFFIX:S/-//}
+DEFAULT_PHP_VER=5
+BROKEN_WITH_PHP=4
+
+EXTSUBDIR= ${DISTNAME}/ext/${PHP_MODNAME}
+WRKSRC= ${WRKDIR}/${EXTSUBDIR}
+PATCHDIR= ${.CURDIR}/files
+PLIST= ${NONEXISTENT}
+
+EXTRACT_AFTER_ARGS?= | ${TAR} -xf - ${EXTSUBDIR}
+
+.if ${PHP_MODNAME} == "bcmath"
+CONFIGURE_ARGS+=--enable-bcmath
+
+PHP_HEADER_DIRS=libbcmath libbcmath/src
+.endif
+
+.if ${PHP_MODNAME} == "bz2"
+.if exists(/usr/bin/bzip2)
+BZ2BASE= /usr
+.else
+BZ2BASE= ${LOCALBASE}
+LIB_DEPENDS+= bz2.1:${PORTSDIR}/archivers/bzip2
+.endif
+CONFIGURE_ARGS+=--with-bz2=${BZ2BASE}
+.endif
+
+.if ${PHP_MODNAME} == "calendar"
+CONFIGURE_ARGS+=--enable-calendar
+.endif
+
+.if ${PHP_MODNAME} == "ctype"
+CONFIGURE_ARGS+=--enable-ctype
+.endif
+
+.if ${PHP_MODNAME} == "curl"
+LIB_DEPENDS+= curl.6:${PORTSDIR}/ftp/curl
+
+CONFIGURE_ARGS+=--with-curl=${LOCALBASE}
+.endif
+
+.if ${PHP_MODNAME} == "dba"
+CONFIGURE_ARGS+=--enable-dba
+
+OPTIONS= CDB "cdb database support" on \
+ DB4 "Berkeley DB4 support" off \
+ GDBM "GDBM database support" off \
+ QDBM "QDBM database support" off \
+ INIFILE "INI file support" on \
+ FLATFILE "flatfile support" on
+
+PHP_HEADER_DIRS= libcdb libflatfile libinifile
+.endif
+
+.if ${PHP_MODNAME} == "dbase"
+CONFIGURE_ARGS+=--enable-dbase
+.endif
+
+.if ${PHP_MODNAME} == "dom"
+CONFIGURE_ARGS+=--enable-dom \
+ --with-libxml-dir=${LOCALBASE}
+
+USE_GNOME= libxml2
+
+USE_PHP= spl
+USE_PHP_BUILD= yes
+.endif
+
+.if ${PHP_MODNAME} == "exif"
+CONFIGURE_ARGS+=--enable-exif
+.endif
+
+.if ${PHP_MODNAME} == "filter"
+CONFIGURE_ARGS+=--enable-filter \
+ --with-pcre-dir=${LOCALBASE}
+
+USE_PHP= pcre
+USE_PHP_BUILD= yes
+.endif
+
+.if ${PHP_MODNAME} == "ftp"
+CONFIGURE_ARGS+=--enable-ftp \
+ --with-openssl-dir=${OPENSSLBASE}
+
+LDFLAGS+= -L${OPENSSLLIB} -lcrypto -lssl
+USE_OPENSSL= yes
+.endif
+
+.if ${PHP_MODNAME} == "gd"
+LIB_DEPENDS= freetype.9:${PORTSDIR}/print/freetype2 \
+ png.6:${PORTSDIR}/graphics/png \
+ jpeg.11:${PORTSDIR}/graphics/jpeg
+. if !defined(WITHOUT_X11)
+USE_XORG= xpm
+. endif
+
+CONFIGURE_ARGS+=--with-gd \
+ --with-freetype-dir=${LOCALBASE} \
+ --with-jpeg-dir=${LOCALBASE} \
+ --with-png-dir=${LOCALBASE} \
+ --with-zlib-dir=/usr
+. if !defined(WITHOUT_X11)
+CONFIGURE_ARGS+=--with-xpm-dir=${LOCALBASE}
+. endif
+
+OPTIONS= T1LIB "Include T1lib support" on \
+ TRUETYPE "Enable TrueType string function" on \
+ JIS "Enable JIS-mapped Japanese font support" off
+
+PHP_HEADER_DIRS=libgd
+.endif
+
+.if ${PHP_MODNAME} == "gettext"
+CONFIGURE_ARGS+=--with-gettext=${LOCALBASE}
+
+USE_GETTEXT= yes
+.endif
+
+.if ${PHP_MODNAME} == "gmp"
+LIB_DEPENDS+= gmp.8:${PORTSDIR}/math/libgmp4
+
+CONFIGURE_ARGS+=--with-gmp=${LOCALBASE}
+.endif
+
+.if ${PHP_MODNAME} == "hash"
+CONFIGURE_ARGS+=--enable-hash
+.endif
+
+.if ${PHP_MODNAME} == "iconv"
+CONFIGURE_ARGS+=--with-iconv=${LOCALBASE} \
+ --with-iconv-dir=${LOCALBASE}
+
+USE_ICONV= yes
+.endif
+
+.if ${PHP_MODNAME} == "imap"
+LIB_DEPENDS+= c-client4.9:${PORTSDIR}/mail/cclient
+
+CONFIGURE_ARGS+=--with-imap=${LOCALBASE}
+.if !defined(WITHOUT_SSL)
+CONFIGURE_ARGS+=--with-imap-ssl=${OPENSSLBASE}
+
+LDFLAGS+= -L${OPENSSLLIB} -lcrypto -lssl
+USE_OPENSSL= yes
+.endif
+.endif
+
+.if ${PHP_MODNAME} == "interbase"
+CONFIGURE_ARGS+=--with-interbase=${LOCALBASE}
+
+USE_FIREBIRD= yes
+.endif
+
+.if ${PHP_MODNAME} == "json"
+CONFIGURE_ARGS+=--enable-json
+.endif
+
+.if ${PHP_MODNAME} == "ldap"
+CONFIGURE_ARGS+=--with-ldap=${LOCALBASE}
+
+USE_OPENLDAP= yes
+
+. ifdef(WANT_OPENLDAP_SASL)
+CONFIGURE_ARGS+=--with-ldap-sasl
+. endif
+.endif
+
+.if ${PHP_MODNAME} == "mbstring"
+CONFIGURE_ARGS+=--enable-mbstring
+
+OPTIONS= REGEX "Enable multibyte regex support" on
+
+PHP_HEADER_DIRS=libmbfl libmbfl/filters libmbfl/mbfl libmbfl/nls oniguruma
+.endif
+
+.if ${PHP_MODNAME} == "mcrypt"
+LIB_DEPENDS+= mcrypt.8:${PORTSDIR}/security/libmcrypt
+
+CONFIGURE_ARGS+=--with-mcrypt=${LOCALBASE}
+
+USE_AUTOTOOLS= libltdl:22
+.endif
+
+.if ${PHP_MODNAME} == "mhash"
+LIB_DEPENDS+= mhash.2:${PORTSDIR}/security/mhash
+
+CONFIGURE_ARGS+=--with-mhash=${LOCALBASE}
+.endif
+
+.if ${PHP_MODNAME} == "ming"
+LIB_DEPENDS+= ming.4:${PORTSDIR}/graphics/ming
+
+CONFIGURE_ARGS+=--with-ming=${LOCALBASE}
+.endif
+
+.if ${PHP_MODNAME} == "mssql"
+LIB_DEPENDS+= sybdb.5:${PORTSDIR}/databases/freetds-msdblib
+
+CONFIGURE_ARGS+=--with-mssql=${LOCALBASE}
+.endif
+
+.if ${PHP_MODNAME} == "mysql"
+CONFIGURE_ARGS+=--with-mysql=${LOCALBASE} \
+ --with-zlib-dir=/usr
+
+USE_MYSQL= yes
+.endif
+
+.if ${PHP_MODNAME} == "mysqli"
+CONFIGURE_ARGS+=--with-mysqli=${LOCALBASE}/bin/mysql_config
+
+USE_MYSQL= yes
+BROKEN_WITH_MYSQL= 323 40
+
+USE_PHP= spl
+USE_PHP_BUILD= yes
+.endif
+
+.if ${PHP_MODNAME} == "ncurses"
+CONFIGURE_ARGS+=--with-ncurses=/usr
+.endif
+
+.if ${PHP_MODNAME} == "oci8"
+BUILD_DEPENDS+= ${LOCALBASE}/oracle8-client/lib/libclntsh.a:${PORTSDIR}/databases/oracle8-client
+
+RUN_DEPENDS+= ${BUILD_DEPENDS}
+
+CONFIGURE_ARGS+=--with-oci8=${LOCALBASE}/oracle8-client
+.endif
+
+.if ${PHP_MODNAME} == "odbc"
+LIB_DEPENDS+= odbc.1:${PORTSDIR}/databases/unixODBC
+
+CONFIGURE_ARGS+=--with-unixODBC=${LOCALBASE}
+.endif
+
+.if ${PHP_MODNAME} == "openssl"
+CONFIGURE_ARGS+=--with-openssl=${OPENSSLBASE}
+
+LDFLAGS+= -L${OPENSSLLIB} -lcrypto -lssl
+USE_OPENSSL= yes
+.endif
+
+.if ${PHP_MODNAME} == "pcntl"
+CONFIGURE_ARGS+=--enable-pcntl
+.endif
+
+.if ${PHP_MODNAME} == "pcre"
+OPTIONS= BUNDLED_PCRE "Select if you use apache 2.0.x" off
+.endif
+
+.if ${PHP_MODNAME} == "pdo"
+CONFIGURE_ARGS+=--enable-pdo
+.endif
+
+.if ${PHP_MODNAME} == "pdo_dblib"
+CONFIGURE_ARGS+=--with-pdo-dblib=${LOCALBASE}
+
+USE_PHP= pdo
+USE_PHP_BUILD= yes
+
+OPTIONS= MSSQL "Enable Microsoft SQL Server support" off
+.endif
+
+.if ${PHP_MODNAME} == "pdo_firebird"
+CONFIGURE_ARGS+=--with-pdo-firebird=${LOCALBASE}
+
+USE_PHP= pdo
+USE_PHP_BUILD= yes
+
+USE_FIREBIRD= yes
+.endif
+
+.if ${PHP_MODNAME} == "pdo_mysql"
+CONFIGURE_ARGS+=--with-pdo-mysql=${LOCALBASE} \
+ --with-zlib-dir=/usr
+
+USE_MYSQL= yes
+
+USE_PHP= pdo
+USE_PHP_BUILD= yes
+.endif
+
+.if ${PHP_MODNAME} == "pdo_oci"
+BUILD_DEPENDS+= ${LOCALBASE}/oracle8-client/lib/libclntsh.a:${PORTSDIR}/databases/oracle8-client
+
+RUN_DEPENDS+= ${BUILD_DEPENDS}
+
+CONFIGURE_ARGS+=--with-pdo-oci=${LOCALBASE}/oracle8-client
+
+USE_PHP= pdo
+USE_PHP_BUILD= yes
+.endif
+
+.if ${PHP_MODNAME} == "pdo_odbc"
+LIB_DEPENDS+= odbc.1:${PORTSDIR}/databases/unixODBC
+
+CONFIGURE_ARGS+=--with-pdo-odbc=unixODBC,${LOCALBASE}
+
+USE_PHP= pdo
+USE_PHP_BUILD= yes
+.endif
+
+.if ${PHP_MODNAME} == "pdo_pgsql"
+USE_PGSQL= yes
+
+CONFIGURE_ARGS+=--with-pdo-pgsql=${LOCALBASE}
+
+USE_PHP= pdo
+USE_PHP_BUILD= yes
+.endif
+
+.if ${PHP_MODNAME} == "pdo_sqlite"
+. if defined(WITH_SQLITE_PORT)
+USE_SQLITE= yes
+CONFIGURE_ARGS+=--with-pdo-sqlite=${LOCALBASE}
+. else
+CONFIGURE_ARGS+=--with-pdo-sqlite
+. endif
+
+USE_PHP= pdo
+USE_PHP_BUILD= yes
+PHP_HEADER_DIRS=sqlite/src
+.endif
+
+
+.if ${PHP_MODNAME} == "pgsql"
+USE_PGSQL= yes
+
+CONFIGURE_ARGS+=--with-pgsql=${LOCALBASE}
+.endif
+
+.if ${PHP_MODNAME} == "posix"
+CONFIGURE_ARGS+=--enable-posix
+.endif
+
+.if ${PHP_MODNAME} == "pspell"
+LIB_DEPENDS+= aspell.16:${PORTSDIR}/textproc/aspell
+
+CONFIGURE_ARGS+=--with-pspell=${LOCALBASE}
+
+# Ugly hack to load session before psell to avoid crashes
+USE_PHP= session
+USE_PHP_BUILD= yes
+.endif
+
+.if ${PHP_MODNAME} == "readline"
+CONFIGURE_ARGS+=--with-readline=/usr
+.endif
+
+.if ${PHP_MODNAME} == "recode"
+LIB_DEPENDS+= recode.3:${PORTSDIR}/converters/recode
+
+CONFIGURE_ARGS+=--with-recode=${LOCALBASE}
+.endif
+
+.if ${PHP_MODNAME} == "session"
+CONFIGURE_ARGS+=--enable-session
+.endif
+
+.if ${PHP_MODNAME} == "shmop"
+CONFIGURE_ARGS+=--enable-shmop
+.endif
+
+.if ${PHP_MODNAME} == "simplexml"
+CONFIGURE_ARGS+=--enable-simplexml \
+ --with-libxml-dir=${LOCALBASE}
+
+USE_GNOME= libxml2
+.endif
+
+.if ${PHP_MODNAME} == "snmp"
+CONFIGURE_ARGS+=--with-snmp=${LOCALBASE} \
+ --with-openssl-dir=${OPENSSLBASE} \
+ --enable-ucd-snmp-hack
+
+LIB_DEPENDS+= netsnmp.16:${PORTSDIR}/net-mgmt/net-snmp
+LDFLAGS+= -L${OPENSSLLIB} -lcrypto -lssl
+USE_OPENSSL= yes
+.endif
+
+.if ${PHP_MODNAME} == "soap"
+CONFIGURE_ARGS+=--enable-soap \
+ --with-libxml-dir=${LOCALBASE}
+
+USE_GNOME= libxml2
+
+USE_PHP= session
+USE_PHP_BUILD= yes
+.endif
+
+.if ${PHP_MODNAME} == "spl"
+CONFIGURE_ARGS+=--enable-spl \
+ --with-libxml-dir=${LOCALBASE}
+
+USE_GNOME= libxml2
+
+USE_PHP= pcre simplexml
+USE_PHP_BUILD= yes
+.endif
+
+.if ${PHP_MODNAME} == "sockets"
+CONFIGURE_ARGS+=--enable-sockets
+.endif
+
+.if ${PHP_MODNAME} == "sqlite"
+CONFIGURE_ARGS+=--with-sqlite
+
+USE_PHP= session
+USE_PHP_BUILD= yes
+PHP_HEADER_DIRS=libsqlite/src
+
+USE_PHP= spl
+USE_PHP_BUILD= yes
+
+OPTIONS= UTF8 "Enable UTF-8 support" off
+.endif
+
+.if ${PHP_MODNAME} == "sybase_ct"
+LIB_DEPENDS+= ct.4:${PORTSDIR}/databases/freetds
+
+CONFIGURE_ARGS+=--with-sybase-ct=${LOCALBASE}
+.endif
+
+.if ${PHP_MODNAME} == "sysvmsg"
+CONFIGURE_ARGS+=--enable-sysvmsg
+.endif
+
+.if ${PHP_MODNAME} == "sysvsem"
+CONFIGURE_ARGS+=--enable-sysvsem
+.endif
+
+.if ${PHP_MODNAME} == "sysvshm"
+CONFIGURE_ARGS+=--enable-sysvshm
+.endif
+
+.if ${PHP_MODNAME} == "tidy"
+CONFIGURE_ARGS+=--with-tidy=${LOCALBASE}
+
+LIB_DEPENDS+= tidy-0.99.0:${PORTSDIR}/www/tidy-lib
+.endif
+
+.if ${PHP_MODNAME} == "tokenizer"
+CONFIGURE_ARGS+=--enable-tokenizer
+.endif
+
+.if ${PHP_MODNAME} == "wddx"
+CONFIGURE_ARGS+=--enable-wddx \
+ --with-libxml-dir=${LOCALBASE}
+
+USE_GNOME= libxml2
+
+USE_PHP= xml session
+USE_PHP_BUILD= yes
+.endif
+
+.if ${PHP_MODNAME} == "xml"
+CONFIGURE_ARGS+=--enable-xml \
+ --with-libxml-dir=${LOCALBASE}
+
+USE_GNOME= libxml2
+.endif
+
+.if ${PHP_MODNAME} == "xmlreader"
+CONFIGURE_ARGS+=--enable-xmlreader \
+ --with-libxml-dir=${LOCALBASE}
+
+USE_GNOME= libxml2
+
+USE_PHP= dom
+USE_PHP_BUILD= yes
+.endif
+
+.if ${PHP_MODNAME} == "xmlrpc"
+CONFIGURE_ARGS+=--with-xmlrpc \
+ --with-libxml-dir=${LOCALBASE} \
+ --with-iconv-dir=${LOCALBASE}
+
+USE_ICONV= yes
+USE_GNOME= libxml2
+
+PHP_HEADER_DIRS=libxmlrpc
+
+USE_PHP= xml
+USE_PHP_BUILD= yes
+.endif
+
+.if ${PHP_MODNAME} == "xmlwriter"
+CONFIGURE_ARGS+=--enable-xmlwriter \
+ --with-libxml-dir=${LOCALBASE}
+
+USE_GNOME= libxml2
+.endif
+
+.if ${PHP_MODNAME} == "xsl"
+CONFIGURE_ARGS+=--with-xsl=${LOCALBASE}
+
+USE_GNOME= libxslt
+USE_PHP= dom xml
+USE_PHP_BUILD= yes
+.endif
+
+.if ${PHP_MODNAME} == "zip"
+CONFIGURE_ARGS+=--enable-zip \
+ --with-zlib-dir=/usr
+.endif
+
+.if ${PHP_MODNAME} == "zlib"
+CONFIGURE_ARGS+=--with-zlib=/usr
+.endif
+
+.include <bsd.port.pre.mk>
+
+.if ${PHP_MODNAME} == "dba"
+. if defined(WITHOUT_CDB)
+CONFIGURE_ARGS+=--without-cdb
+. endif
+. if defined(WITH_DB4)
+CONFIGURE_ARGS+=--with-db4=${LOCALBASE}
+
+USE_BDB= 40+
+WITH_BDB_HIGHEST= yes
+. endif
+. if defined(WITH_GDBM)
+LIB_DEPENDS+= gdbm.3:${PORTSDIR}/databases/gdbm
+
+CONFIGURE_ARGS+=--with-gdbm=${LOCALBASE}
+. endif
+. if defined(WITH_QDBM)
+LIB_DEPENDS+= qdbm.14:${PORTSDIR}/databases/qdbm
+
+CONFIGURE_ARGS+=--with-qdbm=${LOCALBASE}
+. endif
+. if defined(WITHOUT_INIFILE)
+CONFIGURE_ARGS+=--disable-inifile
+. endif
+. if defined(WITHOUT_FLATFILE)
+CONFIGURE_ARGS+=--disable-flatfile
+. endif
+.endif
+
+.if ${PHP_MODNAME} == "gd"
+. if !defined(WITHOUT_T1LIB)
+LIB_DEPENDS+= t1.5:${PORTSDIR}/devel/t1lib
+
+CONFIGURE_ARGS+=--with-t1lib=${LOCALBASE}
+. endif
+. if !defined(WITHOUT_TRUETYPE)
+CONFIGURE_ARGS+=--enable-gd-native-ttf
+. endif
+. if defined(WITH_JIS)
+CONFIGURE_ARGS+=--enable-gd-jis-conv
+. endif
+.endif
+
+.if ${PHP_MODNAME} == "mbstring"
+. if defined(WITHOUT_REGEX)
+CONFIGURE_ARGS+=--disable-mbregex
+. endif
+.endif
+
+.if ${PHP_MODNAME} == "openssl"
+post-extract:
+ @${MV} ${WRKSRC}/config0.m4 ${WRKSRC}/config.m4
+.endif
+
+.if ${PHP_MODNAME} == "oci8" || ${PHP_MODNAME} == "pdo_oci"
+pre-configure:
+ @cd ${WRKSRC}; \
+ for lib in ${LOCALBASE}/oracle8-client/lib/libclntsh /usr/lib/libpthread; do \
+ /usr/bin/ar x $${lib}.a; \
+ done; \
+ /usr/bin/ar rcs liboci8.a *.o
+.endif
+
+.if ${PHP_MODNAME} == "pcre"
+. if defined(WITH_BUNDLED_PCRE)
+CONFIGURE_ARGS+=--with-pcre-regex=yes
+
+PHP_HEADER_DIRS=pcrelib
+. else
+LIB_DEPENDS+= pcre.0:${PORTSDIR}/devel/pcre
+
+CONFIGURE_ARGS+=--with-pcre-regex=${LOCALBASE}
+. endif
+
+post-extract:
+ @${MV} ${WRKSRC}/config0.m4 ${WRKSRC}/config.m4
+.endif
+
+.if ${PHP_MODNAME} == "pdo_dblib"
+.if defined(WITH_MSSQL)
+LIB_DEPENDS+= sybdb.5:${PORTSDIR}/databases/freetds-msdblib
+.else
+LIB_DEPENDS+= ct.4:${PORTSDIR}/databases/freetds
+.endif
+.endif
+
+.if ${PHP_MODNAME} == "sqlite"
+. if defined(WITH_UTF8)
+CONFIGURE_ARGS+=--enable-sqlite-utf8
+. endif
+.endif
+
+.if ${PHP_MODNAME} == "xml"
+post-extract:
+ @${MKDIR} ${WRKSRC}/ext/xml
+ @${CP} ${WRKSRC}/expat_compat.h ${WRKSRC}/ext/xml
+.endif
+
+.if ${PHP_MODNAME} == "zlib"
+post-extract:
+ @${MV} ${WRKSRC}/config0.m4 ${WRKSRC}/config.m4
+.endif
diff --git a/lang/php52/distinfo b/lang/php52/distinfo
new file mode 100644
index 000000000000..0f0bbaba1d64
--- /dev/null
+++ b/lang/php52/distinfo
@@ -0,0 +1,9 @@
+MD5 (php-5.2.12.tar.bz2) = 5b7077e366c7eeab34da31dd860a1923
+SHA256 (php-5.2.12.tar.bz2) = e65756a8412726a491ca48da1e0693eaeb3f38f19fb6cbc8f53005cab1f2491a
+SIZE (php-5.2.12.tar.bz2) = 9075161
+MD5 (suhosin-patch-5.2.11-0.9.7.patch.gz) = 8f9de4d97fae6eba163cf3699509a260
+SHA256 (suhosin-patch-5.2.11-0.9.7.patch.gz) = 392f10c9b7d9c47f30e989fb7775cc46d36153b933bf7ac9ccd8826b2954584b
+SIZE (suhosin-patch-5.2.11-0.9.7.patch.gz) = 23050
+MD5 (php-5.2.10-mail-header.patch) = 7f73682e78d32e22989c3fb3678d668b
+SHA256 (php-5.2.10-mail-header.patch) = a61d50540f4aae32390118453845c380fe935b6d1e46cef6819c8561946e942f
+SIZE (php-5.2.10-mail-header.patch) = 3383
diff --git a/lang/php52/files/patch-TSRM_threads.m4 b/lang/php52/files/patch-TSRM_threads.m4
new file mode 100644
index 000000000000..227f6d26c9d5
--- /dev/null
+++ b/lang/php52/files/patch-TSRM_threads.m4
@@ -0,0 +1,11 @@
+--- TSRM/threads.m4.orig 2005-04-27 15:22:18.000000000 +0200
++++ TSRM/threads.m4 2009-09-22 10:01:37.000000000 +0200
+@@ -79,7 +79,7 @@
+ pthread_mutexattr_t mattr;
+ int data = 1;
+ pthread_mutexattr_init(&mattr);
+- return pthread_create(&thd, NULL, thread_routine, &data);
++ return 0;
+ } ], [
+ pthreads_working=yes
+ ], [
diff --git a/lang/php52/files/patch-Zend::zend.h b/lang/php52/files/patch-Zend::zend.h
new file mode 100644
index 000000000000..49d678719636
--- /dev/null
+++ b/lang/php52/files/patch-Zend::zend.h
@@ -0,0 +1,11 @@
+--- Zend/zend.h.orig Tue Nov 15 14:35:22 2005
++++ Zend/zend.h Fri Nov 25 09:31:48 2005
+@@ -178,7 +178,7 @@
+ #endif
+
+
+-#if (HAVE_ALLOCA || (defined (__GNUC__) && __GNUC__ >= 2)) && !(defined(ZTS) && defined(ZEND_WIN32)) && !(defined(ZTS) && defined(NETWARE)) && !(defined(ZTS) && defined(HPUX)) && !defined(DARWIN)
++#if (HAVE_ALLOCA || (defined (__GNUC__) && __GNUC__ >= 2)) && !(defined(ZTS) && defined(ZEND_WIN32)) && !(defined(ZTS) && defined(NETWARE)) && !(defined(ZTS) && defined(HPUX)) && !defined(DARWIN) && !(defined(ZTS) && defined(__FreeBSD__))
+ # define do_alloca(p) alloca(p)
+ # define free_alloca(p)
+ #else
diff --git a/lang/php52/files/patch-Zend_zend_list.c b/lang/php52/files/patch-Zend_zend_list.c
new file mode 100644
index 000000000000..efa8862d1ce8
--- /dev/null
+++ b/lang/php52/files/patch-Zend_zend_list.c
@@ -0,0 +1,38 @@
+--- Zend/zend_list.c.orig 2007-01-01 10:35:46.000000000 +0100
++++ Zend/zend_list.c 2008-01-29 11:05:14.000000000 +0100
+@@ -48,7 +48,7 @@
+ return index;
+ }
+
+-ZEND_API int _zend_list_delete(int id TSRMLS_DC)
++ZEND_API int _zend_list_delete(ulong id TSRMLS_DC)
+ {
+ zend_rsrc_list_entry *le;
+
+@@ -65,7 +65,7 @@
+ }
+
+
+-ZEND_API void *_zend_list_find(int id, int *type TSRMLS_DC)
++ZEND_API void *_zend_list_find(ulong id, int *type TSRMLS_DC)
+ {
+ zend_rsrc_list_entry *le;
+
+@@ -78,7 +78,7 @@
+ }
+ }
+
+-ZEND_API int _zend_list_addref(int id TSRMLS_DC)
++ZEND_API int _zend_list_addref(ulong id TSRMLS_DC)
+ {
+ zend_rsrc_list_entry *le;
+
+@@ -350,7 +350,7 @@
+ }
+
+
+-char *zend_rsrc_list_get_rsrc_type(int resource TSRMLS_DC)
++char *zend_rsrc_list_get_rsrc_type(ulong resource TSRMLS_DC)
+ {
+ zend_rsrc_list_dtors_entry *lde;
+ int rsrc_type;
diff --git a/lang/php52/files/patch-Zend_zend_list.h b/lang/php52/files/patch-Zend_zend_list.h
new file mode 100644
index 000000000000..308ac56b33b2
--- /dev/null
+++ b/lang/php52/files/patch-Zend_zend_list.h
@@ -0,0 +1,24 @@
+--- Zend/zend_list.h.orig 2007-01-01 10:35:46.000000000 +0100
++++ Zend/zend_list.h 2008-01-29 11:05:12.000000000 +0100
+@@ -71,9 +71,9 @@
+ void zend_destroy_rsrc_list_dtors(void);
+
+ ZEND_API int zend_list_insert(void *ptr, int type);
+-ZEND_API int _zend_list_addref(int id TSRMLS_DC);
+-ZEND_API int _zend_list_delete(int id TSRMLS_DC);
+-ZEND_API void *_zend_list_find(int id, int *type TSRMLS_DC);
++ZEND_API int _zend_list_addref(ulong id TSRMLS_DC);
++ZEND_API int _zend_list_delete(ulong id TSRMLS_DC);
++ZEND_API void *_zend_list_find(ulong id, int *type TSRMLS_DC);
+
+ #define zend_list_addref(id) _zend_list_addref(id TSRMLS_CC)
+ #define zend_list_delete(id) _zend_list_delete(id TSRMLS_CC)
+@@ -82,7 +82,7 @@
+ ZEND_API int zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int rsrc_type);
+ ZEND_API void *zend_fetch_resource(zval **passed_id TSRMLS_DC, int default_id, char *resource_type_name, int *found_resource_type, int num_resource_types, ...);
+
+-ZEND_API char *zend_rsrc_list_get_rsrc_type(int resource TSRMLS_DC);
++ZEND_API char *zend_rsrc_list_get_rsrc_type(ulong resource TSRMLS_DC);
+ ZEND_API int zend_fetch_list_dtor_id(char *type_name);
+
+ extern ZEND_API int le_index_ptr; /* list entry type for index pointers */
diff --git a/lang/php52/files/patch-acinclude.m4 b/lang/php52/files/patch-acinclude.m4
new file mode 100644
index 000000000000..4f9a9462f947
--- /dev/null
+++ b/lang/php52/files/patch-acinclude.m4
@@ -0,0 +1,53 @@
+--- acinclude.m4.orig 2009-05-09 22:28:02.000000000 +0200
++++ acinclude.m4 2009-06-25 08:08:05.000000000 +0200
+@@ -194,7 +194,7 @@
+ dnl
+ dnl which array to append to?
+ AC_DEFUN([PHP_ADD_SOURCES],[
+- PHP_ADD_SOURCES_X($1, $2, $3, ifelse($4,cli,PHP_CLI_OBJS,ifelse($4,sapi,PHP_SAPI_OBJS,PHP_GLOBAL_OBJS)))
++ PHP_ADD_SOURCES_X($1, $2, $3, ifelse($4,cli,PHP_CLI_OBJS,ifelse($4,sapi,PHP_SAPI_OBJS,ifelse($4,cgi,PHP_CGI_OBJS,PHP_GLOBAL_OBJS))))
+ ])
+
+ dnl
+@@ -968,15 +968,8 @@
+ if test "$3" != "shared" && test "$3" != "yes" && test "$4" = "cli"; then
+ dnl ---------------------------------------------- CLI static module
+ [PHP_]translit($1,a-z_-,A-Z__)[_SHARED]=no
+- case "$PHP_SAPI" in
+- cgi|embed[)]
+- PHP_ADD_SOURCES(PHP_EXT_DIR($1),$2,$ac_extra,)
+- EXT_STATIC="$EXT_STATIC $1"
+- ;;
+- *[)]
+ PHP_ADD_SOURCES(PHP_EXT_DIR($1),$2,$ac_extra,cli)
+- ;;
+- esac
++ PHP_ADD_SOURCES(PHP_EXT_DIR($1),$2,$ac_extra,cgi)
+ EXT_CLI_STATIC="$EXT_CLI_STATIC $1"
+ fi
+ PHP_ADD_BUILD_DIR($ext_builddir)
+@@ -1026,12 +1019,6 @@
+ build to be successful.
+ ])
+ fi
+- if test "x$is_it_enabled" = "xno" && test "x$3" != "xtrue"; then
+- AC_MSG_ERROR([
+-You've configured extension $1, which depends on extension $2,
+-but you've either not enabled $2, or have disabled it.
+-])
+- fi
+ dnl Some systems require that we link $2 to $1 when building
+ ])
+
+@@ -2303,9 +2290,9 @@
+ test -z "$PHP_IMAP_SSL" && PHP_IMAP_SSL=no
+
+ dnl Fallbacks for different configure options
+- if test "$PHP_OPENSSL" != "no"; then
++ if test -n "$PHP_OPENSSL" && test "$PHP_OPENSSL" != "no"; then
+ PHP_OPENSSL_DIR=$PHP_OPENSSL
+- elif test "$PHP_IMAP_SSL" != "no"; then
++ elif test -n "$PHP_IMAP_SSL" && test "$PHP_IMAP_SSL" != "no"; then
+ PHP_OPENSSL_DIR=$PHP_IMAP_SSL
+ fi
+
diff --git a/lang/php52/files/patch-configure.in b/lang/php52/files/patch-configure.in
new file mode 100644
index 000000000000..f5f5c5a113c9
--- /dev/null
+++ b/lang/php52/files/patch-configure.in
@@ -0,0 +1,55 @@
+--- configure.in.orig 2008-12-05 07:58:47.000000000 +0100
++++ configure.in 2008-12-05 08:02:26.000000000 +0100
+@@ -270,7 +270,6 @@
+ dnl .
+ dnl -------------------------------------------------------------------------
+
+-PTHREADS_CHECK
+ PHP_HELP_SEPARATOR([SAPI modules:])
+ PHP_SHLIB_SUFFIX_NAMES
+ PHP_SAPI=default
+@@ -295,7 +294,6 @@
+
+ if test "$enable_maintainer_zts" = "yes"; then
+ PTHREADS_ASSIGN_VARS
+- PTHREADS_FLAGS
+ fi
+
+ divert(3)
+@@ -1136,7 +1134,7 @@
+ EXPANDED_DATADIR=$datadir
+ EXPANDED_PHP_CONFIG_FILE_PATH=`eval echo "$PHP_CONFIG_FILE_PATH"`
+ EXPANDED_PHP_CONFIG_FILE_SCAN_DIR=`eval echo "$PHP_CONFIG_FILE_SCAN_DIR"`
+-INCLUDE_PATH=.:$EXPANDED_PEAR_INSTALLDIR
++INCLUDE_PATH=.:${prefix}/share/pear
+
+ exec_prefix=$old_exec_prefix
+ libdir=$old_libdir
+@@ -1344,22 +1342,19 @@
+ INLINE_CFLAGS="$INLINE_CFLAGS $standard_libtool_flag"
+ CXXFLAGS="$CXXFLAGS $standard_libtool_flag"
+
+-all_targets="$lcov_target \$(OVERALL_TARGET) \$(PHP_MODULES) \$(PHP_ZEND_EX) \$(PHP_CLI_TARGET)"
+-install_targets="$install_modules install-build install-headers install-programs $install_pear"
++all_targets="$lcov_target \$(OVERALL_TARGET) \$(PHP_MODULES) \$(PHP_ZEND_EX) \$(PHP_CLI_TARGET) \$(PHP_CGI_TARGET)"
++install_targets="$PHP_INSTALL_CLI_TARGET $PHP_INSTALL_CGI_TARGET $install_modules install-build install-headers install-programs $install_pear"
+
+ case $PHP_SAPI in
+- cli)
+- install_targets="$PHP_INSTALL_CLI_TARGET $install_targets"
+- ;;
+- *)
+- install_targets="install-sapi $PHP_INSTALL_CLI_TARGET $install_targets"
++ apache|apache2handler)
++ install_targets="install-sapi $install_targets"
+ ;;
+ esac
+
+ PHP_SUBST(all_targets)
+ PHP_SUBST(install_targets)
+
+-PHP_INSTALL_HEADERS([Zend/ TSRM/ include/ main/ main/streams/ regex/])
++PHP_INSTALL_HEADERS([Zend/ TSRM/ main/ main/streams/ regex/])
+
+ PHP_ADD_SOURCES(TSRM, TSRM.c tsrm_strtok_r.c tsrm_virtual_cwd.c)
+
diff --git a/lang/php52/files/patch-ext_standard_array.c b/lang/php52/files/patch-ext_standard_array.c
new file mode 100644
index 000000000000..bd6d4d0c95d4
--- /dev/null
+++ b/lang/php52/files/patch-ext_standard_array.c
@@ -0,0 +1,33 @@
+--- ext/standard/array.c.orig Mon Feb 12 20:20:48 2007
++++ ext/standard/array.c Mon Feb 12 20:22:14 2007
+@@ -295,6 +295,7 @@
+ PHP_FUNCTION(count)
+ {
+ zval *array;
++ zend_class_entry **ce_Countable;
+ long mode = COUNT_NORMAL;
+
+ if (zend_parse_parameters (ZEND_NUM_ARGS() TSRMLS_CC, "z|l", &array, &mode) == FAILURE)
+@@ -308,11 +309,11 @@
+ RETURN_LONG (php_count_recursive (array, mode TSRMLS_CC));
+ break;
+ case IS_OBJECT: {
+-#ifdef HAVE_SPL
+ /* it the object implements Countable we call its count() method */
+ zval *retval;
+
+- if (Z_OBJ_HT_P(array)->get_class_entry && instanceof_function(Z_OBJCE_P(array), spl_ce_Countable TSRMLS_CC)) {
++ if (zend_lookup_class_ex("Countable", 9, 0, &ce_Countable TSRMLS_CC) != FAILURE) {
++ if (Z_OBJ_HT_P(array)->get_class_entry && instanceof_function(Z_OBJCE_P(array), *ce_Countable TSRMLS_CC)) {
+ zend_call_method_with_0_params(&array, NULL, NULL, "count", &retval);
+ if (retval) {
+ convert_to_long(retval);
+@@ -321,7 +322,7 @@
+ }
+ return;
+ }
+-#endif
++ }
+ /* if not we return the number of properties (not taking visibility into account) */
+ if (Z_OBJ_HT_P(array)->count_elements) {
+ RETVAL_LONG(1);
diff --git a/lang/php52/files/patch-ext_standard_basic_functions.c b/lang/php52/files/patch-ext_standard_basic_functions.c
new file mode 100644
index 000000000000..9ef6dd343cbf
--- /dev/null
+++ b/lang/php52/files/patch-ext_standard_basic_functions.c
@@ -0,0 +1,28 @@
+--- ext/standard/basic_functions.c.orig 2008-06-09 14:06:40.000000000 +0200
++++ ext/standard/basic_functions.c 2008-06-09 14:08:28.000000000 +0200
+@@ -87,6 +87,7 @@
+ # include <sys/loadavg.h>
+ #endif
+
++#define HARTMUT_0
+ #ifdef HARTMUT_0
+ #include <getopt.h>
+ #endif
+@@ -3859,7 +3860,7 @@
+ SetEnvironmentVariable(pe->key, "bugbug");
+ #endif
+ putenv(pe->previous_value);
+-# if defined(PHP_WIN32)
++# if defined(PHP_WIN32) || __FreeBSD_version < 700050
+ efree(pe->previous_value);
+ # endif
+ } else {
+@@ -4461,7 +4462,7 @@
+ pe.previous_value = NULL;
+ for (env = environ; env != NULL && *env != NULL; env++) {
+ if (!strncmp(*env, pe.key, pe.key_len) && (*env)[pe.key_len] == '=') { /* found it */
+-#if defined(PHP_WIN32)
++#if defined(PHP_WIN32) || __FreeBSD_version < 700050
+ /* must copy previous value because MSVCRT's putenv can free the string without notice */
+ pe.previous_value = estrdup(*env);
+ #else
diff --git a/lang/php52/files/patch-ext_standard_image.c b/lang/php52/files/patch-ext_standard_image.c
new file mode 100644
index 000000000000..be29b54b2650
--- /dev/null
+++ b/lang/php52/files/patch-ext_standard_image.c
@@ -0,0 +1,50 @@
+--- ext/standard/image.c.orig 2007-10-04 15:31:11.000000000 +0200
++++ ext/standard/image.c 2007-11-13 22:47:04.000000000 +0100
+@@ -31,9 +31,7 @@
+ #endif
+ #include "php_image.h"
+
+-#if HAVE_ZLIB && !defined(COMPILE_DL_ZLIB)
+ #include "zlib.h"
+-#endif
+
+ /* file type markers */
+ PHPAPI const char php_sig_gif[3] = {'G', 'I', 'F'};
+@@ -80,9 +78,7 @@
+ REGISTER_LONG_CONSTANT("IMAGETYPE_JP2", IMAGE_FILETYPE_JP2, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMAGETYPE_JPX", IMAGE_FILETYPE_JPX, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMAGETYPE_JB2", IMAGE_FILETYPE_JB2, CONST_CS | CONST_PERSISTENT);
+-#if HAVE_ZLIB && !defined(COMPILE_DL_ZLIB)
+ REGISTER_LONG_CONSTANT("IMAGETYPE_SWC", IMAGE_FILETYPE_SWC, CONST_CS | CONST_PERSISTENT);
+-#endif
+ REGISTER_LONG_CONSTANT("IMAGETYPE_IFF", IMAGE_FILETYPE_IFF, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMAGETYPE_WBMP", IMAGE_FILETYPE_WBMP, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IMAGETYPE_JPEG2000",IMAGE_FILETYPE_JPC, CONST_CS | CONST_PERSISTENT); /* keep alias */
+@@ -184,7 +180,6 @@
+ }
+ /* }}} */
+
+-#if HAVE_ZLIB && !defined(COMPILE_DL_ZLIB)
+ /* {{{ php_handle_swc
+ */
+ static struct gfxinfo *php_handle_swc(php_stream * stream TSRMLS_DC)
+@@ -255,7 +250,6 @@
+ return result;
+ }
+ /* }}} */
+-#endif
+
+ /* {{{ php_handle_swf
+ */
+@@ -1314,11 +1308,7 @@
+ result = php_handle_swf(stream TSRMLS_CC);
+ break;
+ case IMAGE_FILETYPE_SWC:
+-#if HAVE_ZLIB && !defined(COMPILE_DL_ZLIB)
+ result = php_handle_swc(stream TSRMLS_CC);
+-#else
+- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "The image is a compressed SWF file, but you do not have a static version of the zlib extension enabled");
+-#endif
+ break;
+ case IMAGE_FILETYPE_PSD:
+ result = php_handle_psd(stream TSRMLS_CC);
diff --git a/lang/php52/files/patch-ext_standard_php_dns.h b/lang/php52/files/patch-ext_standard_php_dns.h
new file mode 100644
index 000000000000..8ab9e9c01d38
--- /dev/null
+++ b/lang/php52/files/patch-ext_standard_php_dns.h
@@ -0,0 +1,13 @@
+--- ext/standard/php_dns.h.orig Sun Jun 19 11:57:31 2005
++++ ext/standard/php_dns.h Sun Jun 19 12:03:37 2005
+@@ -25,6 +25,10 @@
+
+ #if HAVE_RES_NMKQUERY && HAVE_RES_NSEND && HAVE_DN_EXPAND && HAVE_DN_SKIPNAME
+ #define HAVE_DNS_FUNCS 1
++#define res_ninit __res_ninit
++#define res_nmkquery __res_nmkquery
++#define res_nsend __res_nsend
++#define res_nclose __res_nclose
+ #endif
+
+ PHP_FUNCTION(gethostbyaddr);
diff --git a/lang/php52/files/patch-main::php_config.h.in b/lang/php52/files/patch-main::php_config.h.in
new file mode 100644
index 000000000000..8e9938876421
--- /dev/null
+++ b/lang/php52/files/patch-main::php_config.h.in
@@ -0,0 +1,12 @@
+--- main/php_config.h.in.orig Wed Jan 11 15:25:52 2006
++++ main/php_config.h.in Wed May 3 09:38:09 2006
+@@ -2760,6 +2760,9 @@
+ /* Define if uint32_t type is present. */
+ #undef HAVE_UINT32_T
+
++/* Include external shared modules configurations */
++#include "ext/php_config.h"
++
+ /* Whether sprintf is broken */
+ #undef ZEND_BROKEN_SPRINTF
+
diff --git a/lang/php52/files/patch-php.ini-dist b/lang/php52/files/patch-php.ini-dist
new file mode 100644
index 000000000000..6d84f3a80891
--- /dev/null
+++ b/lang/php52/files/patch-php.ini-dist
@@ -0,0 +1,18 @@
+--- php.ini-dist.orig Fri Dec 30 18:19:43 2005
++++ php.ini-dist Mon Oct 16 08:12:28 2006
+@@ -165,6 +165,15 @@
+
+ ; Safe Mode
+ ;
++; SECURITY NOTE: The FreeBSD Security Officer strongly recommend that
++; the PHP Safe Mode feature not be relied upon for security, since the
++; issues Safe Mode tries to handle cannot properly be handled in PHP
++; (primarily due to PHP's use of external libraries). While many bugs
++; in Safe Mode has been fixed it's very likely that more issues exist
++; which allows a user to bypass Safe Mode restrictions.
++; For increased security we always recommend to install the Suhosin
++; extension.
++;
+ safe_mode = Off
+
+ ; By default, Safe Mode does a UID compare check when
diff --git a/lang/php52/files/patch-php.ini-recommended b/lang/php52/files/patch-php.ini-recommended
new file mode 100644
index 000000000000..7b648b1ea0b5
--- /dev/null
+++ b/lang/php52/files/patch-php.ini-recommended
@@ -0,0 +1,18 @@
+--- php.ini-recommended.orig Fri Dec 30 18:19:43 2005
++++ php.ini-recommended Mon Oct 16 08:13:05 2006
+@@ -223,6 +223,15 @@
+ ;
+ ; Safe Mode
+ ;
++; SECURITY NOTE: The FreeBSD Security Officer strongly recommend that
++; the PHP Safe Mode feature not be relied upon for security, since the
++; issues Safe Mode tries to handle cannot properly be handled in PHP
++; (primarily due to PHP's use of external libraries). While many bugs
++; in Safe Mode has been fixed it's very likely that more issues exist
++; which allows a user to bypass Safe Mode restrictions.
++; For increased security we recommend to always install the Suhosin
++; extension.
++;
+ safe_mode = Off
+
+ ; By default, Safe Mode does a UID compare check when
diff --git a/lang/php52/files/patch-sapi_cgi_Makefile.frag b/lang/php52/files/patch-sapi_cgi_Makefile.frag
new file mode 100644
index 000000000000..26a0e4b1a3ba
--- /dev/null
+++ b/lang/php52/files/patch-sapi_cgi_Makefile.frag
@@ -0,0 +1,9 @@
+--- sapi/cgi/Makefile.frag.orig Wed May 3 10:09:02 2006
++++ sapi/cgi/Makefile.frag Wed May 3 10:08:54 2006
+@@ -1,2 +1,5 @@
+-$(SAPI_CGI_PATH): $(PHP_GLOBAL_OBJS) $(PHP_SAPI_OBJS)
++$(SAPI_CGI_PATH): $(PHP_GLOBAL_OBJS) $(PHP_CGI_OBJS)
+ $(BUILD_CGI)
++
++install-cgi: $(SAPI_CGI_PATH)
++ @$(INSTALL_CGI)
diff --git a/lang/php52/files/patch-sapi_cgi_config9.m4 b/lang/php52/files/patch-sapi_cgi_config9.m4
new file mode 100644
index 000000000000..c40894155cc8
--- /dev/null
+++ b/lang/php52/files/patch-sapi_cgi_config9.m4
@@ -0,0 +1,55 @@
+--- sapi/cgi/config9.m4.orig Thu Jul 12 01:20:36 2007
++++ sapi/cgi/config9.m4 Wed Sep 5 07:55:06 2007
+@@ -25,7 +25,6 @@
+ dnl
+ dnl CGI setup
+ dnl
+-if test "$PHP_SAPI" = "default"; then
+ AC_MSG_CHECKING(whether to build CGI binary)
+ if test "$PHP_CGI" != "no"; then
+ AC_MSG_RESULT(yes)
+@@ -85,8 +84,9 @@
+ AC_MSG_RESULT($PHP_PATH_INFO_CHECK)
+
+ dnl Set install target and select SAPI
+- INSTALL_IT="@echo \"Installing PHP CGI binary: \$(INSTALL_ROOT)\$(bindir)/\"; \$(INSTALL) -m 0755 \$(SAPI_CGI_PATH) \$(INSTALL_ROOT)\$(bindir)/\$(program_prefix)php-cgi\$(program_suffix)\$(EXEEXT)"
+- PHP_SELECT_SAPI(cgi, program, $PHP_FCGI_FILES cgi_main.c getopt.c,, '$(SAPI_CGI_PATH)')
++ INSTALL_CGI="@echo \"Installing PHP CGI binary: \$(INSTALL_ROOT)\$(bindir)/\"; \$(INSTALL) -m 0755 \$(SAPI_CGI_PATH) \$(INSTALL_ROOT)\$(bindir)/\$(program_prefix)php-cgi\$(program_suffix)\$(EXEEXT)"
++ PHP_ADD_SOURCES(sapi/cgi, $PHP_FCGI_FILES cgi_main.c getopt.c,, cgi)
++ PHP_ADD_SOURCES(/main, internal_functions.c,,cgi)
+
+ case $host_alias in
+ *aix*)
+@@ -96,17 +96,29 @@
+ BUILD_CGI="\$(CC) \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(NATIVE_RPATHS) \$(PHP_GLOBAL_OBJS:.lo=.o) \$(PHP_SAPI_OBJS:.lo=.o) \$(PHP_FRAMEWORKS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_CGI_PATH)"
+ ;;
+ *)
+- BUILD_CGI="\$(LIBTOOL) --mode=link \$(CC) -export-dynamic \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(PHP_RPATHS) \$(PHP_GLOBAL_OBJS) \$(PHP_SAPI_OBJS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_CGI_PATH)"
++ BUILD_CGI="\$(LIBTOOL) --mode=link \$(CC) -export-dynamic \$(CFLAGS_CLEAN) \$(EXTRA_CFLAGS) \$(EXTRA_LDFLAGS_PROGRAM) \$(LDFLAGS) \$(PHP_RPATHS) \$(PHP_GLOBAL_OBJS) \$(PHP_CGI_OBJS) \$(EXTRA_LIBS) \$(ZEND_EXTRA_LIBS) -o \$(SAPI_CGI_PATH)"
+ ;;
+ esac
+
++ PHP_CGI_TARGET="\$(SAPI_CGI_PATH)"
++ PHP_INSTALL_CGI_TARGET="install-cgi"
+ PHP_SUBST(BUILD_CGI)
++ PHP_SUBST(INSTALL_CGI)
++ PHP_SUBST(PHP_CGI_OBJS)
++ PHP_SUBST(PHP_CGI_TARGET)
++ PHP_SUBST(PHP_INSTALL_CGI_TARGET)
+
+- elif test "$PHP_CLI" != "no"; then
+- AC_MSG_RESULT(no)
++ if test "$PHP_SAPI" = "default" ; then
++ PHP_BUILD_PROGRAM($SAPI_CGI_PATH)
++ fi
++ else
++ AC_MSG_RESULT(no)
++ if test "$PHP_SAPI" = "default" ; then
++ if test "$PHP_CLI" != "no" ; then
+ OVERALL_TARGET=
+ PHP_SAPI=cli
+ else
+ AC_MSG_ERROR([No SAPIs selected.])
+ fi
++ fi
+ fi
diff --git a/lang/php52/files/patch-scripts::phpize.in b/lang/php52/files/patch-scripts::phpize.in
new file mode 100644
index 000000000000..8d3afdbecc08
--- /dev/null
+++ b/lang/php52/files/patch-scripts::phpize.in
@@ -0,0 +1,13 @@
+--- scripts/phpize.in.orig Mon Dec 12 12:51:45 2005
++++ scripts/phpize.in Wed May 3 09:38:09 2006
+@@ -99,8 +99,8 @@
+
+ phpize_check_autotools()
+ {
+- test -z "$PHP_AUTOCONF" && PHP_AUTOCONF=autoconf
+- test -z "$PHP_AUTOHEADER" && PHP_AUTOHEADER=autoheader
++ test -z "$PHP_AUTOCONF" && PHP_AUTOCONF=autoconf-2.62
++ test -z "$PHP_AUTOHEADER" && PHP_AUTOHEADER=autoheader-2.62
+
+ if test ! -x "`$php_shtool path $PHP_AUTOCONF`"; then
+ cat <<EOF
diff --git a/lang/php52/pkg-descr b/lang/php52/pkg-descr
new file mode 100644
index 000000000000..a53cdb1bde68
--- /dev/null
+++ b/lang/php52/pkg-descr
@@ -0,0 +1,8 @@
+PHP, which stands for "PHP: Hypertext Preprocessor" is a widely-used Open
+Source general-purpose scripting language that is especially suited for
+Web development and can be embedded into HTML. Its syntax draws upon C,
+Java, and Perl, and is easy to learn. The main goal of the language is to
+allow web developers to write dynamically generated webpages quickly, but
+you can do much more with PHP.
+
+WWW: http://www.php.net/
diff --git a/lang/php52/pkg-message.mod b/lang/php52/pkg-message.mod
new file mode 100644
index 000000000000..555f5b053ae8
--- /dev/null
+++ b/lang/php52/pkg-message.mod
@@ -0,0 +1,10 @@
+***************************************************************
+
+Make sure index.php is part of your DirectoryIndex.
+
+You should add the following to your Apache configuration file:
+
+AddType application/x-httpd-php .php
+AddType application/x-httpd-php-source .phps
+
+***************************************************************
diff --git a/lang/php52/pkg-plist b/lang/php52/pkg-plist
new file mode 100644
index 000000000000..d5d252f247f7
--- /dev/null
+++ b/lang/php52/pkg-plist
@@ -0,0 +1,208 @@
+%%CLI%%bin/php
+%%CGI%%bin/php-cgi
+bin/php-config
+bin/phpize
+etc/php.conf
+etc/php.ini-dist
+etc/php.ini-recommended
+include/php/TSRM/TSRM.h
+include/php/TSRM/acconfig.h
+include/php/TSRM/readdir.h
+include/php/TSRM/tsrm_config.h
+include/php/TSRM/tsrm_config.w32.h
+include/php/TSRM/tsrm_config_common.h
+include/php/TSRM/tsrm_nw.h
+include/php/TSRM/tsrm_strtok_r.h
+include/php/TSRM/tsrm_virtual_cwd.h
+include/php/TSRM/tsrm_win32.h
+include/php/Zend/FlexLexer.h
+include/php/Zend/acconfig.h
+include/php/Zend/zend.h
+include/php/Zend/zend_API.h
+include/php/Zend/zend_alloc.h
+include/php/Zend/zend_builtin_functions.h
+include/php/Zend/zend_compile.h
+include/php/Zend/zend_config.h
+include/php/Zend/zend_config.nw.h
+include/php/Zend/zend_config.w32.h
+include/php/Zend/zend_constants.h
+include/php/Zend/zend_dynamic_array.h
+include/php/Zend/zend_errors.h
+include/php/Zend/zend_exceptions.h
+include/php/Zend/zend_execute.h
+include/php/Zend/zend_extensions.h
+include/php/Zend/zend_fast_cache.h
+include/php/Zend/zend_globals.h
+include/php/Zend/zend_globals_macros.h
+include/php/Zend/zend_hash.h
+include/php/Zend/zend_highlight.h
+include/php/Zend/zend_indent.h
+include/php/Zend/zend_ini.h
+include/php/Zend/zend_ini_parser.h
+include/php/Zend/zend_ini_scanner.h
+include/php/Zend/zend_interfaces.h
+include/php/Zend/zend_istdiostream.h
+include/php/Zend/zend_iterators.h
+include/php/Zend/zend_language_parser.h
+include/php/Zend/zend_language_scanner.h
+include/php/Zend/zend_list.h
+include/php/Zend/zend_llist.h
+include/php/Zend/zend_modules.h
+include/php/Zend/zend_multibyte.h
+include/php/Zend/zend_multiply.h
+include/php/Zend/zend_object_handlers.h
+include/php/Zend/zend_objects.h
+include/php/Zend/zend_objects_API.h
+include/php/Zend/zend_operators.h
+include/php/Zend/zend_ptr_stack.h
+include/php/Zend/zend_qsort.h
+include/php/Zend/zend_stack.h
+include/php/Zend/zend_static_allocator.h
+include/php/Zend/zend_stream.h
+include/php/Zend/zend_strtod.h
+include/php/Zend/zend_ts_hash.h
+include/php/Zend/zend_types.h
+include/php/Zend/zend_variables.h
+include/php/Zend/zend_vm.h
+include/php/Zend/zend_vm_def.h
+include/php/Zend/zend_vm_execute.h
+include/php/Zend/zend_vm_opcodes.h
+include/php/ext/date/lib/timelib.h
+include/php/ext/date/lib/timelib_config.h
+include/php/ext/date/lib/timelib_structs.h
+include/php/ext/date/php_date.h
+include/php/ext/libxml/php_libxml.h
+include/php/ext/standard/base64.h
+include/php/ext/standard/basic_functions.h
+include/php/ext/standard/crc32.h
+include/php/ext/standard/credits.h
+include/php/ext/standard/credits_ext.h
+include/php/ext/standard/credits_sapi.h
+include/php/ext/standard/css.h
+include/php/ext/standard/cyr_convert.h
+include/php/ext/standard/datetime.h
+include/php/ext/standard/dl.h
+include/php/ext/standard/exec.h
+include/php/ext/standard/file.h
+include/php/ext/standard/flock_compat.h
+include/php/ext/standard/fsock.h
+include/php/ext/standard/head.h
+include/php/ext/standard/html.h
+include/php/ext/standard/info.h
+include/php/ext/standard/md5.h
+include/php/ext/standard/microtime.h
+include/php/ext/standard/pack.h
+include/php/ext/standard/pageinfo.h
+include/php/ext/standard/php_array.h
+include/php/ext/standard/php_assert.h
+include/php/ext/standard/php_browscap.h
+include/php/ext/standard/php_crypt.h
+include/php/ext/standard/php_dir.h
+include/php/ext/standard/php_dns.h
+include/php/ext/standard/php_ext_syslog.h
+include/php/ext/standard/php_filestat.h
+include/php/ext/standard/php_fopen_wrappers.h
+include/php/ext/standard/php_ftok.h
+include/php/ext/standard/php_http.h
+include/php/ext/standard/php_image.h
+include/php/ext/standard/php_incomplete_class.h
+include/php/ext/standard/php_iptc.h
+include/php/ext/standard/php_lcg.h
+include/php/ext/standard/php_link.h
+include/php/ext/standard/php_mail.h
+include/php/ext/standard/php_math.h
+include/php/ext/standard/php_metaphone.h
+include/php/ext/standard/php_rand.h
+include/php/ext/standard/php_smart_str.h
+include/php/ext/standard/php_smart_str_public.h
+include/php/ext/standard/php_standard.h
+include/php/ext/standard/php_string.h
+include/php/ext/standard/php_type.h
+include/php/ext/standard/php_uuencode.h
+include/php/ext/standard/php_var.h
+include/php/ext/standard/php_versioning.h
+include/php/ext/standard/proc_open.h
+include/php/ext/standard/quot_print.h
+include/php/ext/standard/reg.h
+include/php/ext/standard/scanf.h
+include/php/ext/standard/sha1.h
+include/php/ext/standard/streamsfuncs.h
+include/php/ext/standard/uniqid.h
+include/php/ext/standard/url.h
+include/php/ext/standard/url_scanner_ex.h
+@exec touch %D/include/php/ext/php_config.h
+@unexec [ -s %D/include/php/ext/php_config.h ] || rm %D/include/php/ext/php_config.h
+include/php/main/SAPI.h
+include/php/main/build-defs.h
+include/php/main/config.w32.h
+include/php/main/fopen_wrappers.h
+include/php/main/logos.h
+include/php/main/php.h
+include/php/main/php3_compat.h
+include/php/main/php_compat.h
+include/php/main/php_config.h
+include/php/main/php_content_types.h
+include/php/main/php_globals.h
+include/php/main/php_ini.h
+include/php/main/php_logos.h
+include/php/main/php_main.h
+include/php/main/php_memory_streams.h
+include/php/main/php_network.h
+include/php/main/php_open_temporary_file.h
+include/php/main/php_output.h
+include/php/main/php_reentrancy.h
+include/php/main/php_regex.h
+include/php/main/php_scandir.h
+include/php/main/php_streams.h
+include/php/main/php_syslog.h
+include/php/main/php_ticks.h
+include/php/main/php_variables.h
+include/php/main/php_version.h
+include/php/main/rfc1867.h
+include/php/main/safe_mode.h
+include/php/main/snprintf.h
+include/php/main/spprintf.h
+include/php/main/streams/php_stream_context.h
+include/php/main/streams/php_stream_filter_api.h
+include/php/main/streams/php_stream_mmap.h
+include/php/main/streams/php_streams_int.h
+include/php/main/streams/php_stream_transport.h
+include/php/main/streams/php_stream_userspace.h
+include/php/main/streams/php_stream_plain_wrapper.h
+%%SUHOSIN%%include/php/main/suhosin_globals.h
+%%SUHOSIN%%include/php/main/suhosin_logo.h
+%%SUHOSIN%%include/php/main/suhosin_patch.h
+include/php/main/win95nt.h
+include/php/regex/cclass.h
+include/php/regex/cname.h
+include/php/regex/regex.h
+include/php/regex/regex2.h
+include/php/regex/regex_extra.h
+include/php/regex/utils.h
+lib/php/build/Makefile.global
+lib/php/build/acinclude.m4
+lib/php/build/config.guess
+lib/php/build/config.sub
+lib/php/build/libtool.m4
+lib/php/build/ltmain.sh
+lib/php/build/mkdep.awk
+lib/php/build/phpize.m4
+lib/php/build/run-tests.php
+lib/php/build/scan_makefile_in.awk
+lib/php/build/shtool
+%%APACHE%%%%APACHEMODDIR%%/%%AP_MODULE%%
+%%APACHE%%@exec %D/sbin/apxs -e -a -n %%AP_NAME%% %f
+%%APACHE%%@unexec %D/sbin/apxs -e -A -n %%AP_NAME%% %f
+@dirrm include/php/TSRM
+@dirrm include/php/Zend
+@dirrm include/php/ext/date/lib
+@dirrm include/php/ext/date
+@dirrm include/php/ext/libxml
+@dirrm include/php/ext/standard
+@dirrmtry include/php/ext
+@dirrm include/php/main/streams
+@dirrm include/php/main
+@dirrm include/php/regex
+@dirrmtry include/php
+@dirrm lib/php/build
+@dirrmtry lib/php