SUMMARY="A library to import many legacy Mac document formats"
DESCRIPTION="libmwaw is a new project for converting many pre-OSX MAC text \
formats, some graphic formats and some spreadsheet formats."
HOMEPAGE="https://sourceforge.net/projects/libmwaw/"
COPYRIGHT="Fridrich Strba
	Laurent Alonso
	David Tardon"
LICENSE="MPL v2.0
	GNU LGPL v2.1"
REVISION="1"
SOURCE_URI="http://prdownloads.sourceforge.net/libmwaw/libmwaw-$portVersion.tar.bz2"
CHECKSUM_SHA256="9f6575eec6f00259711f651caec6937e662a45fe855a3f12a27a1660dc802230"

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

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

PROVIDES="
	libmwaw$secondaryArchSuffix = $portVersion
	cmd:mwaw2csv$secondaryArchSuffix
	cmd:mwaw2html$secondaryArchSuffix
	cmd:mwaw2raw$secondaryArchSuffix
	cmd:mwaw2svg$secondaryArchSuffix
	cmd:mwaw2text$secondaryArchSuffix
	cmd:mwawFile$secondaryArchSuffix
	cmd:mwawZip$secondaryArchSuffix
	lib:libmwaw_0.3$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libboost_system$secondaryArchSuffix
	lib:librevenge_0.0$secondaryArchSuffix
	lib:librevenge_generators_0.0$secondaryArchSuffix
	lib:librevenge_stream_0.0$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

PROVIDES_devel="
	libmwaw${secondaryArchSuffix}_devel = $portVersion
	devel:libmwaw_0.3$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES_devel="
	libmwaw$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libboost_system$secondaryArchSuffix >= 1.69.0
	devel:librevenge_0.0$secondaryArchSuffix
	devel:librevenge_generators_0.0$secondaryArchSuffix
	devel:librevenge_stream_0.0$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoconf
	cmd:automake
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

BUILD()
{
	autoreconf -fi
	runConfigure ./configure --disable-werror
	make $jobArgs
}

INSTALL()
{
	make install-strip

	rm -f $libDir/libmwaw*.la

	prepareInstalledDevelLibs libmwaw-0.3
	fixPkgconfig

	packageEntries devel $developDir
}
