SUMMARY="Meta data extraction tool and library"
DESCRIPTION="GNU libextractor is a library used to extract meta data from files of \
arbitrary type.  It is designed to use helper-libraries to perform the \
actual extraction, and to be trivially extendable by linking against \
external extractors for additional file types.  Common use-cases for \
GNU libextractor include detail-views in file managers, detailed \
search results in file-sharing networks and general information \
gathering in forensics investigations and penetration testing."
HOMEPAGE="https://www.gnu.org/software/libextractor/"
COPYRIGHT="2013 GNU Project"
LICENSE="GNU GPL v3"
REVISION="5"
SOURCE_URI="ftp://ftp.gnu.org/gnu/libextractor/libextractor-1.3.tar.gz"
CHECKSUM_SHA256="868ad64c9a056d6b923d451d746935bffb1ddf5d89c3eb4f67d786001a3f7b7f"
if [ $effectiveTargetArchitecture = x86_gcc2 ]; then
	PATCHES="libextractor-1.3_gcc2.patchset"
fi

# x86_gcc2 is disabled because the following dependencies are broken on it:
# libarchive
# libexiv2
# libgsf
# libgstreamer
ARCHITECTURES="?all !x86_gcc2"
SECONDARY_ARCHITECTURES="!x86_gcc2 ?x86"

PROVIDES="
	libextractor$secondaryArchSuffix = $portVersion
	cmd:extract$secondaryArchSuffix = $portVersion
	lib:libextractor$secondaryArchSuffix = $portVersion compat >= 0
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libarchive$secondaryArchSuffix
	lib:libavutil$secondaryArchSuffix
	lib:libbz2$secondaryArchSuffix
	lib:libexiv2$secondaryArchSuffix
	lib:libflac$secondaryArchSuffix
	lib:libgif$secondaryArchSuffix
	lib:libgsf$secondaryArchSuffix
	lib:libgstreamer$secondaryArchSuffix
	lib:libjpeg$secondaryArchSuffix
	lib:libmagic$secondaryArchSuffix
	lib:libmp4v2$secondaryArchSuffix
	lib:libmpeg2$secondaryArchSuffix
	lib:libtidy$secondaryArchSuffix
	lib:libtiff$secondaryArchSuffix
	lib:libvorbis$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

PROVIDES_devel="
	libextractor${secondaryArchSuffix}_devel = $portVersion
	devel:libextractor$secondaryArchSuffix = $portVersion compat >= 0
	"
REQUIRES_devel="
	libextractor$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libarchive$secondaryArchSuffix
	devel:libavutil$secondaryArchSuffix
	devel:libbz2$secondaryArchSuffix
	devel:libcurl$secondaryArchSuffix
	devel:libexiv2$secondaryArchSuffix
	devel:libflac$secondaryArchSuffix
	devel:libgif$secondaryArchSuffix
	devel:libgsf$secondaryArchSuffix
	devel:libgstreamer$secondaryArchSuffix
	devel:libjpeg$secondaryArchSuffix
	devel:libltdl$secondaryArchSuffix
	devel:libmagic$secondaryArchSuffix
	devel:libmp4v2$secondaryArchSuffix
	devel:libmpeg2$secondaryArchSuffix
	devel:libtidy$secondaryArchSuffix
	devel:libtiff$secondaryArchSuffix
	devel:libvorbis$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:make
	"

BUILD()
{
	runConfigure ./configure --disable-dependency-tracking
	make $jobArgs
}

INSTALL()
{
	make install

	prepareInstalledDevelLib libextractor
	fixPkgconfig

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

	packageEntries devel \
		$developDir
}

TEST()
{
	make check
}
