SUMMARY="A library for manipulating disk image files"
DESCRIPTION="LIBDSK is a library for accessing discs and disc image files. \
It is intended for use in:
* Emulator tools - converting between real floppy discs and disc images, as \
CPCTRANS / PCWTRANS do under DOS.
* Filesystem utilities - CPMTOOLS is configurable to use LIBDSK, thus allowing \
the use of CPMTOOLS on emulator .DSK images. To do this, install LIBDSK and \
then build CPMTOOLS, using \"./configure --with-libdsk\". For CPMTOOLS 1.9 or \
2.0, you will also need to apply this patch.
* Emulators - it is possible to use LIBDSK as part of an emulator's floppy \
controller emulation, thus giving the emulator transparent access to .DSK \
files or real discs.
"
COPYRIGHT="2010-2015 John Elliott"
LICENSE="GNU GPL v2"
HOMEPAGE="http://www.seasip.demon.co.uk/Unix/LibDsk/"
REVISION="1"
ARCHITECTURES="x86 x86_gcc2"
SECONDARY_ARCHITECTURES="x86 x86_gcc2"

SOURCE_URI="http://www.seasip.info/Unix/LibDsk/libdsk-$portVersion.tar.gz"
CHECKSUM_SHA256="1472cb30534e3a1b3ac0c2e7e4a00a9c247955af5d407cb95c25391fb61e45d4"

PROVIDES="
	libdsk$secondaryArchSuffix = $portVersion
	lib:libdsk$secondaryArchSuffix = 3.3.1 compat >= 3
	"


if [ -z "$secondaryArchSuffix" ]; then
PROVIDES_tools="$PROVIDES
	cmd:apriboot
	cmd:dskdump
	cmd:dskform
	cmd:dskid
	cmd:dskscan
	cmd:dsktrans
	cmd:dskutil
	cmd:md3serial
	"

REQUIRES_tools="
	haiku
	lib:libdsk
"
fi

PROVIDES_devel="
	devel:libdsk$secondaryArchSuffix = $portVersion
"

REQUIRES_devel="
	libdsk$secondaryArchSuffix == $portVersion base
"

REQUIRES="
	haiku$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
"

BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoconf
	cmd:gcc$secondaryArchSuffix
	cmd:libtoolize
	cmd:make
"

BUILD()
{
	# Need to update the libtools in the package to build shared libraries
#aclocal
#	libtoolize --install --copy --force
#	autoconf
	runConfigure ./configure
	make $jobArgs
}

INSTALL()
{
	make install

	# remove command for secondary architecture
	if [ -n "$secondaryArchSuffix" ]; then
		rm -rf $binDir
	fi

	prepareInstalledDevelLib libdsk

	packageEntries devel $developDir
	packageEntries tools $binDir
}

