# SliTaz package receipt.

PACKAGE="cairo-gl"
VERSION="1.16.0"
CATEGORY="x-window"
SHORT_DESC="2D graphics library with GL support."
MAINTAINER="pankso@slitaz.org"
LICENSE="MPL LGPL2.1"
WEB_SITE="https://www.cairographics.org/"

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

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

# What is the latest version available today?
current_version()
{
	wget -O - ${WGET_URL%/*} 2>/dev/null | \
	sed "/\"$SOURCE-/!d;/5c/d;s|.*$SOURCE-||;s|.tar.*||" | sort -Vr | sed q
}

# 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		\
		--enable-xcb		\
		--enable-tee		\
		--enable-gl		\
		--disable-static	\
		$CONFIGURE_ARGS &&
	make $MAKEFLAGS &&
	make DESTDIR=$DESTDIR install
}

# 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
}