SUMMARY="Extract page mode and named destinations as PDFmark from PDF"
DESCRIPTION="PDFmarks is a technique that accompanies PDF and that is used to \
store metadata such as author or title, but also structural information such \
as bookmarks or hyperlinks.
When Ghostscript reads the main PDF generated by the TEX system with embedded \
PDF files and outputs the final PDF, the PDF page mode and name targets etc. \
are not preserved. Therefore, when you open the final PDF, it is not \
displayed correctly. Also, remote PDF links do not work correctly.
This program is able to extract the page mode and named targets as PDFmark \
from PDF. In this way, you can obtain embedded PDF files that have kept this \
information."
HOMEPAGE="https://github.com/trueroad/extractpdfmark"
COPYRIGHT="2016–2018 Masamichi Hosoda"
LICENSE="GNU GPL v3"
REVISION="1"
SOURCE_URI="https://github.com/trueroad/extractpdfmark/releases/download/v$portVersion/extractpdfmark-$portVersion.tar.gz"
CHECKSUM_SHA256="0935045084211fcf68a9faaba2b65c037d0adfd7fa27224d2b6c7ae0fd7964cb"
SOURCE_DIR="extractpdfmark-$portVersion"

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

# On x86_gcc2 we don't want to install the commands in bin/<arch>/, but in bin/.
commandSuffix=$secondaryArchSuffix
commandBinDir=$binDir
if [ "$targetArchitecture" = x86_gcc2 ]; then
	commandSuffix=
	commandBinDir=$prefix/bin
fi

PROVIDES="
	extractpdfmark$secondaryArchSuffix = $portVersion
	cmd:extractpdfmark$commandSuffix
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libiconv$secondaryArchSuffix
	lib:libpoppler_cpp$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libiconv$secondaryArchSuffix
	devel:libpoppler_cpp$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:awk
	cmd:diff
	cmd:g++$secondaryArchSuffix
	cmd:gs
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

defineDebugInfoPackage extractpdfmark$secondaryArchSuffix \
	"$commandBinDir"/extractpdfmark

BUILD()
{
	runConfigure --omit-dirs binDir ./configure --bindir=$commandBinDir
	make $jobArgs
}

INSTALL()
{
	make install
}

TEST()
{
	make check
}
