SUMMARY="Author, disassemble and analyze Video CDs"
DESCRIPTION="GNU VCDImager is a full-featured mastering suite for authoring, \
disassembling and analyzing Video CDs and Super Video CDs.

The following features are available so far (some features are only available \
in the latest alpha snapshots):

* Free software available under the GNU Public License
* Support for Video CD 1.1 and 2.0 disc formats
* Support for the Super Video CD 1.0 disc format
* Full PBC (playback control) support (play lists, selection lists and end \
lists)
* Support for segment play items
* Automatic padding of MPEG streams on the fly
* Support for 99-minute (out-of-specification) CD-R media
* Extraction of Video CDs into files (incl. the PBC information)
* Runs on all major UNIX flavors and on Win32
* Use of XML for the description of Video CDs"
HOMEPAGE="http://www.vcdimager.org/"
COPYRIGHT="2000-2004 Herbert Valerio Riedel
	2001 Arnd Bergmann
	2004-2011 Rocky Bernstein"
LICENSE="GNU GPL v2"
REVISION="4"
SOURCE_URI="https://ftpmirror.gnu.org/vcdimager/vcdimager-$portVersion.tar.gz"
CHECKSUM_SHA256="67515fefb9829d054beae40f3e840309be60cda7d68753cafdd526727758f67a"
PATCHES="vcdimager-$portVersion.patchset"

ARCHITECTURES="all"
SECONDARY_ARCHITECTURES="x86_gcc2 x86"

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

PROVIDES="
	vcdimager$secondaryArchSuffix = $portVersion
	lib:libvcdinfo$secondaryArchSuffix = $libVersionCompat
	"
if [ -z "$secondaryArchSuffix" ]; then
	PROVIDES="$PROVIDES
		cmd:cdxa2mpeg = $portVersion
		cmd:vcd_info = $portVersion
		cmd:vcdimager = $portVersion
		cmd:vcdxbuild = $portVersion
		cmd:vcdxgen = $portVersion
		cmd:vcdxminfo = $portVersion
		cmd:vcdxrip = $portVersion
		"
fi
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libcdio$secondaryArchSuffix
	lib:libxml2$secondaryArchSuffix
	lib:libpopt$secondaryArchSuffix
	lib:libiconv$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

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

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libcdio$secondaryArchSuffix >= 19
	devel:libxml2$secondaryArchSuffix
	devel:libpopt$secondaryArchSuffix
	devel:libiconv$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:libtool
	cmd:aclocal
	cmd:autoconf
	cmd:automake
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

PATCH()
{
	sed -i 's/AM_CONFIG_HEADER/AC_CONFIG_HEADERS/g' configure.ac
	sed -i 's/AM_PROG_CC_STDC//g' configure.ac
}

defineDebugInfoPackage vcdimager$secondaryArchSuffix \
	"$libDir"/libvcdinfo.so.$libVersion

BUILD()
{
	libtoolize --force --copy --install
	aclocal
	autoreconf -vfi

	runConfigure ./configure
	make $jobArgs
}

INSTALL()
{
	make install

	if [ -n "$secondaryArchSuffix" ]; then
		rm -rf $documentationDir $binDir
	fi

	rm "$libDir"/*.la

	# prepare develop/lib
	prepareInstalledDevelLibs libvcdinfo
	fixPkgconfig

	packageEntries devel \
		$developDir
}

TEST()
{
	make check
}
