# SliTaz package receipt.

PACKAGE="freetype"
VERSION="2.10.4"
CATEGORY="x-window"
SHORT_DESC="Freetype font engine."
MAINTAINER="pankso@slitaz.org"
TARBALL="$PACKAGE-$VERSION.tar.xz"
WEB_SITE="http://www.freetype.org/"
WGET_URL="http://download.savannah.gnu.org/releases/freetype/$TARBALL"

DEPENDS="bzip2 zlib libpng"
BUILD_DEPENDS="m4 pcre-dev autoconf automake bzip2-dev libpng-dev \
libtool zlib-dev"

# build first-pass without harfbuzz (loop dep freetype / harfbuzz)
harbuzz=no

# freetype > harfbuzz > freetype
build_with_harfbuzz()
{
    DEPENDS="$DEPENDS harfbuzz"
    BUILD_DEPENDS="$BUILD_DEPENDS freetype-dev harfbuzz-dev"
    harfbuzz=yes
}
[ "$2" == "--harfbuzz" ] && build_with_harfbuzz
[ "$3" == "--harfbuzz" ] && build_with_harfbuzz

# Rules to configure and make the package.
compile_rules()
{
	cd $src
	./autogen.sh
	./configure \
		--sysconfdir=/etc \
		--prefix=/usr \
		--mandir=/usr/share/man \
		--with-bzip2 \
		--with-png \
		--enable-freetype-config \
		--with-harfbuzz=$harfbuzz \
		--disable-static \
		$CONFIGURE_ARGS &&
	make &&
	make DESTDIR=$DESTDIR install
}

# Rules to gen a SliTaz package suitable for Tazpkg.
genpkg_rules()
{
	mkdir -p $fs/usr/lib
	cp -a $install/usr/bin $fs/usr
	cp -a $install/usr/lib/*.so* $fs/usr/lib
}