SUMMARY="A popular general-purpose scripting language"
DESCRIPTION="PHP is a popular general-purpose scripting language that is \
especially suited to web development.

Fast, flexible and pragmatic, PHP powers everything from your blog to the most \
popular websites in the world."
HOMEPAGE="https://php.net"
REVISION="3"
COPYRIGHT="2001-2014 PHP Group"
LICENSE="PHP License v3.01"
ARCHITECTURES="x86_gcc2"

SOURCE_URI="https://php.net/get/php-$portVersion.tar.bz2/from/this/mirror"
CHECKSUM_SHA256="576f9001b612f5ddc22f447311bbec321e2c959b6a52259d664c4ba04ef044f1"
SOURCE_FILENAME="php-$portVersion.tar.bz2"
PATCHES="php-$portVersion.patch"

PROVIDES="
	php = $portVersion
	cmd:pear
	cmd:peardev
	cmd:pecl
	cmd:phar
	cmd:phar.phar
	cmd:php
	cmd:php_cgi
	cmd:php_config
	cmd:phpize
	"

GLOBAL_WRITABLE_FILES="
	settings/pear.conf keep-old
	"

REQUIRES="
	haiku
	icu
	lib:libxml2
	lib:libz
	lib:libbz2
	lib:libssl
	lib:libcrypto
	lib:libcurl

	lib:libpng16
	lib:libjpeg
	lib:libfreetype
	"

BUILD_REQUIRES="
	icu_devel
	devel:libxml2
	devel:libz
	devel:libbz2
	devel:libssl
	devel:libcrypto
	devel:libcurl

	devel:libpng16
	devel:libjpeg
	devel:libfreetype
	"
BUILD_PREREQUIRES="
	haiku_devel
	cmd:autoreconf
	cmd:awk
	cmd:bison
	cmd:dos2unix
	cmd:gcc
	cmd:make
	cmd:pkg_config
	cmd:freetype_config
	cmd:xml2_config
	cmd:icu_config
	"

PATCH()
{
	dos2unix Zend/zend_language_scanner.l
	dos2unix Zend/zend_language_scanner.c
}

BUILD()
{
	autoreconf
	runConfigure ./configure \
		--with-libxml-dir=/system \
		--with-zlib-dir=/system \
		--with-openssl \
		--with-curl \
		--with-gd \
		--with-png-dir=/system \
		--with-jpeg-dir=/system \
		--with-freetype-dir=/system \
		--disable-opcache \
		--enable-intl \
		--enable-ftp \
		--enable-soap \
		--without-iconv \
		--disable-debug
	make $jobArgs
}

INSTALL()
{
	make install
}

TEST()
{
	make test
}
