SUMMARY="Set of tools for creating TeX documents with graphics"
DESCRIPTION="Fig2dev is a set of tools for creating TeX documents with \
graphics which are portable, in the sense that they can be printed in a wide \
variety of environments.

Fig2dev consists of the fig2dev and the transfig commands.  The fig2dev
command translates Fig code to other graphic description languages.  The
transfig command generates transfig.tex, a macro file for \input in a
TeX document, and a Makefile which translates Fig code to various
graphics description languages using the fig2dev program."
HOMEPAGE="http://mcj.sourceforge.net/"
COPYRIGHT="1991 by Micah Beck
	1985-1988 by Supoj Sutanthavibul
	1989-2015 by Brian V. Smith
	2015-2020 by Thomas Loimer"
LICENSE="MIT"
REVISION="1"
SOURCE_URI="https://sourceforge.net/projects/mcj/files/fig2dev-$portVersion.tar.xz"
CHECKSUM_SHA256="418a164aa9fad72d25bb4fec8d7b452fe3a2f12f990cf22e05c0eb16cecb68cb"

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

commandBinDir=$binDir
commandSuffix=$secondaryArchSuffix
if [ "$targetArchitecture" = x86_gcc2 ]; then
	commandSuffix=
	commandBinDir=$prefix/bin
fi

PROVIDES="
	fig2dev$secondaryArchSuffix = $portVersion
	cmd:fig2dev$commandSuffix = $portVersion
	cmd:fig2ps2tex$commandSuffix
	cmd:pic2tpic$commandSuffix
	cmd:transfig$commandSuffix = 3.2.4
	"
REQUIRES="
	haiku$secondaryArchSuffix
	cmd:awk
	cmd:bc
	cmd:convert$secondaryArchSuffix
	cmd:gs
	cmd:sed
	lib:libpng16$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	cmd:gs
	devel:libpng16$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:awk
	cmd:gcc$secondaryArchSuffix
	cmd:make
	"

TEST_REQUIRES="
	cmd:aclocal
	cmd:convert$secondaryArchSuffix
	cmd:find
	cmd:pnmtotiff

# the latex tests don't work
#	cmd:fmtutil
#	cmd:latex
#	texlive_latex
"

defineDebugInfoPackage fig2dev$secondaryArchSuffix \
	$commandBinDir/fig2dev \
	$commandBinDir/transfig

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

INSTALL()
{
	make install
}

TEST()
{
	# update the TeX formats for latex tests (doesn't work)
	# fmtutil-sys --missing

	make check
}
