SUMMARY="CD-ROM image access library"
DESCRIPTION="Provides uniform access to data stored in various disc image \
formats: Alcohol 120%, BlindWrite, CloneCD, CDRwin, Cdrdao, DiscJuggler, \
Easy CD Creator, Easy Media Creator, ISO9660, Nero Burning ROM, ReadCD, \
Universal Disk Format, XCDRoast, Apple DMG, Compressed ISO, \
Error Code Modeller, gBurner, PowerISO, UltraISO.

A plug-in system allows to add more formats if needed. Libmirage can handle \
user data as well as sync patterns, headers, ECC/EDC, and subchannel \
information, either by extracting it from the image file, or generating it on \
the fly if it is not available."
HOMEPAGE="https://cdemu.sourceforge.io/about/libmirage/"
COPYRIGHT="2007-2018 Rok Mandeljc, Henrik Stokseth"
LICENSE="GNU GPL v2"
REVISION="1"
SOURCE_URI="https://sourceforge.net/projects/cdemu/files/libmirage/libmirage-$portVersion.tar.bz2"
CHECKSUM_SHA256="ce93d053850936eee981a6ce1484cf85e77aef90241ed29c9e63a0313ddeae22"

ARCHITECTURES="?all"
SECONDARY_ARCHITECTURES="x86"

PROVIDES="
	libmirage$secondaryArchSuffix = $portVersion
	lib:libmirage$secondaryArchSuffix = 11.0.0 compat >= 11
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libgio_2.0$secondaryArchSuffix
	lib:libglib_2.0$secondaryArchSuffix
	lib:libgmodule_2.0$secondaryArchSuffix
	lib:libgobject_2.0$secondaryArchSuffix
	lib:libintl$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

PROVIDES_devel="
	libmirage${secondaryArchSuffix}_devel = $portVersion
	devel:libmirage$secondaryArchSuffix = 11.0.0 compat >= 11
"

REQUIRES_devel="
	libmirage$secondaryArchSuffix == $portVersion base
"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libglib_2.0$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:cmake
	cmd:intltool_update
	cmd:gcc$secondaryArchSuffix
	cmd:gettext$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

BUILD()
{
	mkdir -p build
	cd build
	cmake .. $cmakeDirArgs
	make $jobArgs
}

INSTALL()
{
	cd build
	make install
	prepareInstalledDevelLibs libmirage
	fixPkgconfig
	packageEntries devel $developDir
}

TEST()
{
	cd build
	make check
}
