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

# source: BLFS 11.3 updated with Fatdog options
TARBALL=php-$PKGVER.tar.xz
MD5SUM=cb768cf744184e64d48b15305c437336
SRC_URL=http://www.php.net/distributions/$TARBALL
BUNDLE=

# using internal GD
SLACKREQ='libxml2 libjpeg-turbo libtiff libpng libexif freetype2 libX11
libxslt libpcre2 aspell libenchant curl sqlite3 openssl gdbm
libmhash libreadline libargon2 libsodium libwebp libzip
liboniguruma postgresql'
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-config-file-scan-dir=/etc/php/$PKGVER/conf.d \
	    --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 --enable-zip \
		--enable-gd --with-freetype-dir=/usr --with-jpeg=/usr --with-xpm=/usr --with-webp=/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-intl --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 NEWS README* UPGRADING* \
						/usr/share/doc/php-$PKGVER &&
	ln -v -sfn          /usr/$LIBDIR/php/doc/Archive_Tar/docs/Archive_Tar.txt \
						/usr/share/doc/php-$PKGVER &&
	ln -v -sfn          /usr/$LIBDIR/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.php_${PKGVER//./_} &&
	rm /etc/httpd/httpd.conf.bak &&

	# for extensions and compatibility with common tutorials
	mkdir -p /etc/php/$PKGVER/conf.d &&

	# for PEAR and others
	sed -i "s@php/includes\"@&\ninclude_path = \".:/usr/$LIBDIR/php\"@" /etc/php.ini &&

	# remove unwanted PEAR files
	rm -rf /usr/$LIBDIR/php/.registry/.channel.pecl.php.net \
	/usr/$LIBDIR/php/.registry/.channel.doc.php.net \
	/usr/$LIBDIR/php/.registry/.channel.__uri &&

	# multi-lib
	mv -v /usr/bin/php-config{,-64}               &&
	ln -sfv multiarch_wrapper /usr/bin/php-config
}

# vim:ft=sh:

