# SliTaz package receipt.

PACKED_SIZE="32.0K"
UNPACKED_SIZE="92.0K"
PACKAGE="pkg-config"
VERSION="0.29.2"
CATEGORY="development"
SHORT_DESC="Free desktop packages manager."
MAINTAINER="pankso@slitaz.org"
LICENSE="GPL2"
TARBALL="$PACKAGE-$VERSION.tar.gz"
WEB_SITE="https://pkg-config.freedesktop.org/wiki/"
WGET_URL="https://pkg-config.freedesktop.org/releases/$TARBALL"
HOST_ARCH="i486 arm"

DEPENDS="glibc-base"
BUILD_DEPENDS="automake gcc libtool"

# Handle cross compilation.
case "$ARCH" in
	arm) BUILD_DEPENDS="" ;;
esac

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

# Rules to configure and make the package.
compile_rules()
{
	autoreconf
	sed -i 's/\$(LN).*pkg-config\$(EXEEXT) \$(host_tool)/echo \1/' Makefile*
	case "$ARCH" in
		arm)
			./configure \
				--program-prefix=$TOOLPREFIX \
				--build=i486-slitaz-linux \
				--host=arm-slitaz-linux-gnueabi \
				--cache-file=arm-linux.cache ;;
		*)
			./configure \
				--program-prefix=$TOOLPREFIX \
				--build=$HOST_SYSTEM \
				--host=$HOST_SYSTEM ;;
	esac &&
	make && make install
}

# Rules to gen a SliTaz package suitable for Tazpkg.
genpkg_rules()
{
	mkdir -p $fs/usr/share
	cp -a $install/usr/bin $fs/usr
	cp -a $install/usr/share/aclocal $fs/usr/share
	# This is the default pkg-config so make a symling for package that dont
	# cross compile or search for /usr/bin/pkg-config.
	cd $fs/usr/bin && ln -s ${TOOLPREFIX}pkg-config pkg-config
}
