SUMMARY="A library to encapsulate CD-ROM reading and control"
DESCRIPTION="The libcdio package contains a library for CD-ROM and CD image \
access. Applications wishing to be oblivious of the OS- and device-dependent \
properties of a CD-ROM or of the specific details of various CD-image formats \
may benefit from using this library."
HOMEPAGE="https://www.gnu.org/software/libcdio/"
COPYRIGHT="2002-2014 Rocky Bernstein and Herbert Valerio Riedel"
LICENSE="GNU GPL v3"
REVISION="2"
SOURCE_URI="https://ftpmirror.gnu.org/libcdio/libcdio-$portVersion.tar.gz
	https://ftp.gnu.org/gnu/libcdio/libcdio-$portVersion.tar.gz"
CHECKSUM_SHA256="96e2c903f866ae96f9f5b9048fa32db0921464a2286f5b586c0f02699710025a"
SOURCE_DIR="libcdio-$portVersion"
PATCHES="libcdio-$portVersion.patchset"

ARCHITECTURES="all"
SECONDARY_ARCHITECTURES="x86_gcc2 x86"


PROVIDES="
	libcdio0$secondaryArchSuffix = $portVersion
	lib:libcdio$secondaryArchSuffix = 16.0.0 compat >= 16
	lib:libcdio++$secondaryArchSuffix = 0.0.2 compat >= 0
	lib:libiso9660$secondaryArchSuffix = 10.0.0 compat >= 10
	lib:libiso9660++$secondaryArchSuffix = 0.0.0 compat >= 0
	lib:libudf$secondaryArchSuffix = 0.0.0 compat >= 0
	"
if [ -z "$secondaryArchSuffix" ]; then
	PROVIDES="$PROVIDES
		cmd:cdda_player
		cmd:cd_drive
		cmd:cd_info
		cmd:cd_read
		cmd:iso_info
		cmd:iso_read
		cmd:mmc_tool
		"
fi
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libiconv$secondaryArchSuffix
	lib:libncurses$secondaryArchSuffix
	"
CONFLICTS="
	libcdio$secondaryArchSuffix
	"

PROVIDES_devel="
	libcdio0${secondaryArchSuffix}_devel = $portVersion
	devel:libcdio${secondaryArchSuffix} = 16.0.0 compat >= 16
	devel:libcdio++${secondaryArchSuffix} = 0.0.2 compat >= 0
	devel:libiso9660${secondaryArchSuffix} = 10.0.0 compat >= 10
	devel:libiso9660++${secondaryArchSuffix} = 0.0.0 compat >= 0
	devel:libudf${secondaryArchSuffix} = 0.0.0 compat >= 0
	"
REQUIRES_devel="
	libcdio0$secondaryArchSuffix == $portVersion base
	"
CONFLICTS_devel="
	libcdio${secondaryArchSuffix}_devel
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libiconv$secondaryArchSuffix
	devel:libncurses$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:automake
	cmd:autoreconf
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	"

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

INSTALL()
{
	make install

	rm $libDir/lib*.la

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

	# set up the develop directory correctly
	prepareInstalledDevelLibs libcdio libcdio++ libudf libiso9660 libiso9660++
	fixPkgconfig

	# devel package
	packageEntries devel \
		$developDir
}

TEST()
{
	make check
}
