# SliTaz package receipt.

PACKED_SIZE="392.0K"
UNPACKED_SIZE="1.1M"
PACKAGE="cairo"
VERSION="1.16.0"
CATEGORY="x-window"
SHORT_DESC="2D graphics library"
MAINTAINER="pankso@slitaz.org"
LICENSE="MPL LGPL2.1"
WEB_SITE="https://www.cairographics.org/"

TARBALL="$PACKAGE-$VERSION.tar.xz"
WGET_URL="${WEB_SITE}releases/$TARBALL"

DEPENDS="bzlib fontconfig freetype glib glibc-base harfbuzz libffi libpng
	libxcb libxml2 pcre pixman xorg-libX11 xorg-libXau xorg-libXdmcp
	xorg-libXext xorg-libXrender zlib"
BUILD_DEPENDS="expat-dev fontconfig-dev freetype-dev glib-dev libpng-dev
	pixman-dev pkg-config libxcb-dev libxml2-dev util-linux-uuid-dev
	xcb-util-dev xorg-libX11-dev xorg-libXau-dev xorg-libXdmcp-dev
	xorg-libXrender-dev zlib-dev"
SPLIT="cairo-tools"
SIBLINGS="cairo-gl"

HOST_ARCH="i486 arm"

# Handle cross compilation
case "$ARCH" in
	arm*) export CFLAGS="$CFLAGS -L/cross/$ARCH/sysroot/usr/lib" ;;
esac

current_version()
{
	wget -O - https://www.cairographics.org/releases/ 2>/dev/null | \
	sed '/cairo-/!d;s|.*cairo-||;s|.tar.*||' | sed '$!d'
}

# Rules to configure and make the package.
compile_rules()
{
	# modify lookup-symbol.c for binutils-2.37
	patch --strip=0 --input=$stuff/patches/lookup-symbol.c-1.16.0 &&
	sed -i '/index.sgml/d'	doc/public/Makefile* &&

	./configure			\
		--prefix=/usr		\
		--disable-gl		\
		--disable-static	\
		--enable-tee		\
		--enable-xcb		\
		--enable-xlib-xcb	\
		$CONFIGURE_ARGS &&
	make $MAKEFLAGS &&
	make install DESTDIR=$DESTDIR
}

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