SUMMARY="Helper library for S3TC texture (de)compression"
DESCRIPTION="Free implementation of the s3tc texture compression algorithm."
HOMEPAGE="https://people.freedesktop.org/~cbrill/libtxc_dxtn/"
COPYRIGHT="2004 Roland Scheidegger"
LICENSE="BSD (3-clause)"
REVISION="1"
SOURCE_URI="https://people.freedesktop.org/~cbrill/libtxc_dxtn/libtxc_dxtn-$portVersion.tar.bz2"
CHECKSUM_SHA256="45290d12cdca529a3f41e7fc35c4250fc1b6d2fc16b56680f8401f6aa792ae60"
SOURCE_FILENAME="libtxc_dxtn-$portVersion.tar.bz2"

ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"

libVersion="$portVersion"
libVersionCompat="$libVersion compat >= ${libVersion%%.*}"

PROVIDES="
	libtxc_dxtn$secondaryArchSuffix = $portVersion
	lib:libtxc_dxtn$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libGL$secondaryArchSuffix
	"

PROVIDES_devel="
	libtxc_dxtn${secondaryArchSuffix}_devel = $portVersion
	devel:libtxc_dxtn$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES_devel="
	libtxc_dxtn$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libGL$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:awk
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

defineDebugInfoPackage libtxc_dxtn$secondaryArchSuffix \
	"$libDir"/libtxc_dxtn.so

BUILD()
{
	runConfigure ./configure
	make $jobArgs
}

INSTALL()
{
	make install

	rm -f "$libDir"/*.la

	# prepare devel/lib
	prepareInstalledDevelLib libtxc_dxtn
	fixPkgconfig

	# devel package
	packageEntries devel \
		"$developDir"
}

TEST()
{
	make check
}
