NAME=fontconfig
VERSION=2.3.2
SOURCE=(http://fontconfig.org/release/fontconfig-$VERSION.tar.gz
	setup.05.fontconfig )
PATCH=http://www.freetype.org/freetype2/patches/fontconfig-2.3.2-noftinternals.patch
BUILD=${BUILD:-3}
OPTIMIZE=${OPTIMIZE:-"-O2 -pipe -fomit-frame-pointer"}

# For concistency, fontconfig packs are built with the same PREFIXTYPE
# as freetype.
PREFIXTYPE=normal

build() {
	_explode 0
	cd fontconfig-$VERSION

	# This is already fixed in CVS.
	_patch 0 -p1

	# NOTE: Change the default fonts dir below if you are installing
	# fontconfig to different prefix than X.org!
	$CONFIGURE \
		--disable-static \
		--disable-docs \
		--with-default-fonts=$DATADIR/fonts \
		--with-add-fonts=$LIBDIR/X11/fonts
	# Uses some obscure sgml tool...
	make -i
	make -i install DESTDIR=$PKG

	# Empty files/dirs:
	rm -rf $PKG$PREFIX/doc $PKG$DATADIR/doc
	_rm_empty_dirs $PKG$MANDIR

	_doc 0 fontconfig-$VERSION  AUTHORS COPYING INSTALL NEWS README

	# conf.d replaces the old local.conf. Like local.conf, conf.d is
	# for site specific configuration.
	mv $PKG$SYSCONFDIR/fonts/conf.d $PKG$SYSCONFDIR/fonts/conf.d-examples
	mkdir $PKG$SYSCONFDIR/fonts/conf.d

	# Run fc-cache at the end of the installation and also show
	# it in the Setup menu of pkgotool.
	mkdir -p $PKG/var/log/setup
	sed "s|@BINDIR@|$BINDIR|g" ${SOURCE[1]} > $PKG/var/log/setup/setup.05.fontconfig
	chmod 755 $PKG/var/log/setup/setup.05.fontconfig

	_chfix
	_chgrp_bin
}
