### this file is sourced not run
PKGVER=7.2.11
PKGBUILD=1
PKGARCH=x86_64

# post BLFS 7.5 (2014-08-04) updated to post BLFS 8.3 2018-10-15
TARBALL=php-$PKGVER.tar.xz
MD5SUM=28c3d5310a64799fd54c5e49e4982cf9
SRC_URL=http://www.php.net/distributions/$TARBALL
BUNDLE=

SLACKREQ='libxml2 libjpeg-turbo libtiff libpng libexif freetype2 libX11 libgd
libxslt libpcre aspell libenchant curl sqlite3 openssl gdbm 
libmcrypt libmhash libreadline'
SLACKDESC="php: php $PKGVER (PHP Hypertext Processor)  
php:  
php: PHP is the PHP Hypertext Preprocessor. Primarily used in dynamic web 
php: sites, it allows for programming code to be directly embedded into the 
php: HTML markup. It is also useful as a general purpose scripting language.  
php: 
php: 
php: 
php: 
php: 
php: 
"

### default pkg_download
### default pkg_prepare
### default pkg_package
### build
pkg_build() {
	cd /tmp/php* &&

	./configure $CONFFLAGS --datadir=/usr/share/php --mandir=/usr/share/man \
	    --with-config-file-path=/etc --with-pear=/usr/$LIBDIR/php \
		--with-openssl --with-curl --enable-ftp \
		--enable-fpm --with-fpm-user=webuser --with-fpm-group=webuser \
		--with-apxs2 \
		--with-bz2 --with-zlib --enable-zip \
		--with-gd --enable-gd-native-ttf \
		--with-freetype-dir=/usr --with-jpeg-dir=/usr --with-xpm-dir=/usr --with-png-dir=/usr \
		--enable-dba=shared --with-gdbm \
		--enable-mysqlnd --with-pdo-mysql --with-mysqli --with-mysql \
		--with-pdo-pgsql --with-pgsql \
		--with-mhash --with-mcrypt \
		--with-gmp --enable-bcmath \
		--enable-mbstring --with-gettext \
		--with-enchant --enable-exif  \
		--enable-soap --enable-calendar \
		--with-readline &&
	make $MAKEFLAGS &&
	
	make install                                         &&
	install -v -m644 php.ini-production /etc/php.ini     &&
	mv -v /etc/php-fpm.conf{.default,}                   &&

	install -v -m755 -d /usr/share/doc/php-$PKGVER &&
	install -v -m644    CODING_STANDARDS EXTENSIONS INSTALL NEWS README* UPGRADING* php.gif \
						/usr/share/doc/php-$PKGVER &&
	ln -v -sfn          /usr/lib/php/doc/Archive_Tar/docs/Archive_Tar.txt \
						/usr/share/doc/php-$PKGVER &&
	ln -v -sfn          /usr/lib/php/doc/Structures_Graph/docs \
						/usr/share/doc/php-$PKGVER &&
	pkg_build_slackdesc &&

	# don't overwrite apache's configuration
	mv /etc/httpd/httpd.conf /etc/httpd/httpd.conf.php7 &&
	rm /etc/httpd/httpd.conf.bak &&
	
	# multi-lib
	mv -v /usr/bin/php-config{,-64}
	ln -sfv multiarch_wrapper /usr/bin/php-config
}

