### this file is sourced not run
PKGVER=2.13.0
PKGBUILD=1
PKGARCH=i686

# BLFS 8.2 updated to 2.13
# BLFS 7.5 updated to 2.11.1, updated with Arch recipe
# BLFS 7.5 version (2.11.0) is buggy, FcPatternCreate didn't zero out FcPattern

TARBALL=fontconfig-$PKGVER.tar.bz2
MD5SUM=60d2394a79d3b2e5db2daea55193fa47
SRC_URL=http://www.freedesktop.org/software/fontconfig/release/$TARBALL
BUNDLE=

SLACKREQ='freetype2_32 expat32'
SLACKDESC="fontconfig32: fontconfig $PKGVER (Font configuration library)  
fontconfig32:  
fontconfig32: The Fontconfig package contains a library and support programs 
fontconfig32: used for configuring and customizing font access.  
fontconfig32: 
fontconfig32: 
fontconfig32: 
fontconfig32: 
fontconfig32: 
fontconfig32: 
fontconfig32:
"

### default pkg_download
### prepare
pkg_prepare() {
	pkg_prepare_default &&
	cd tmp/fontconfig* &&
	patch -Np1 -i ../pkg/fontconfig-disable-uuid.patch
}

### package - only collect the libraries
pkg_package() {
	rm -rf usr/include usr/share etc usr/bin
}

### build
pkg_build() {
	cd /tmp/fontconfig*

	# BLFS 8.2 force to re-generate fcobjshash.h
	rm -f src/fcobjshash.h &&
	
	CONFFLAGS="$CONFFLAGS --docdir=/usr/share/doc/fontconfig-$PKGVER \
    --with-templatedir=/etc/fonts/conf.avail \
    --with-xmldir=/etc/fonts \
    --disable-static \
    --with-default-fonts=/usr/share/fonts \
    --with-add-fonts=/usr/share/fonts \
    --with-cache-dir=/var/db/fontconfig" 
    
    pkg_build_autoconf &&
	rm -rf /var/db/fontconfig/* # this will be re-created on demand
	
	# docs are only available on full release, not git release 
	install -v -dm755 \
			/usr/share/{man/man{3,5},doc/fontconfig-$PKGVER/fontconfig-devel} &&
	install -v -m644 fc-*/*.1          /usr/share/man/man1 &&
	install -v -m644 doc/*.3           /usr/share/man/man3 &&
	install -v -m644 doc/fonts-conf.5  /usr/share/man/man5 &&
	install -v -m644 doc/fontconfig-devel/* \
			/usr/share/doc/fontconfig-$PKGVER/fontconfig-devel &&
	install -v -m644 doc/*.{pdf,sgml,txt,html} \
		   /usr/share/doc/fontconfig-$PKGVER &&
	
	# rather useless these days and cause errors on older fontconfig
	rm -f /etc/fonts/conf.d/10-scale-bitmap-fonts.conf  &&

	# remove uuid
	if [ -d /usr/share/fonts ]; then
		find /usr/share/fonts -name .uuid -delete	
	fi &&
	
	pkg_build_slackdesc
}
