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

# post BLFS 7.5 (2014-08-04) updated to post BLFS 9.0 2019-11-24
TARBALL=php-$PKGVER.tar.xz
MD5SUM=e52a0dc6e7d94024989d0a3746070487
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 
libmhash libreadline libargon2 libsodium libwebp libzip'
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 --with-freetype-dir=/usr --with-jpeg-dir=/usr --with-xpm-dir=/usr --with-png-dir=/usr --with-webp-dir=/usr \
		--enable-dba=shared --with-gdbm                 \
		--enable-mysqlnd --with-pdo-mysql --with-mysqli \
		--with-pdo-pgsql --with-pgsql    \
		--with-mhash                     \
		--with-gmp --enable-bcmath       \
		--enable-mbstring --with-gettext \
		--with-enchant --enable-exif     \
		--enable-soap --enable-calendar  \
		--with-readline --with-xsl       \
		--with-password-argon2 --with-sodium \
		--enable-sockets &&
	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
}

