SUMMARY="An outline font editor"
DESCRIPTION="An outline font editor that lets you create your own OpenType, \
TrueType, CID-keyed, multi-master fonts and more... or simply edit existing \
ones."
HOMEPAGE="http://fontforge.sourceforge.net"
COPYRIGHT="2000-2017 George Williams
	The FontForge Project
	"
LICENSE="BSD (3-clause)"
REVISION="3"
SOURCE_URI="https://github.com/fontforge/fontforge/releases/download/$portVersion/fontforge-dist-$portVersion.tar.xz"
CHECKSUM_SHA256="840adefbedd1717e6b70b33ad1e7f2b116678fa6a3d52d45316793b9fd808822"
SOURCE_DIR="fontforge-2.0.$portVersion"
PATCHES="fontforge-$portVersion.patchset"

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

PROVIDES="
	fontforge$secondaryArchSuffix = $portVersion
	cmd:fontforge$secondaryArchSuffix
	cmd:fontimage$secondaryArchSuffix
	cmd:fontlint$secondaryArchSuffix
	cmd:sfddiff$secondaryArchSuffix
	lib:libfontforge$secondaryArchSuffix = 2.0.0 compat >= 2
	lib:libfontforgeexe$secondaryArchSuffix = 2.0.0 compat >= 2
	lib:libgioftp$secondaryArchSuffix = 2.0.0 compat >= 2
	lib:libgunicode$secondaryArchSuffix = 4.0.0 compat >= 4
	lib:libgutils$secondaryArchSuffix = 2.0.0 compat >= 2
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libbz2$secondaryArchSuffix
	lib:libfreetype$secondaryArchSuffix
	lib:libglib_2.0$secondaryArchSuffix
	lib:libiconv$secondaryArchSuffix
	lib:libintl$secondaryArchSuffix
	lib:libjpeg$secondaryArchSuffix
	lib:libltdl$secondaryArchSuffix
	lib:libpng$secondaryArchSuffix
	lib:libpython3.6m$secondaryArchSuffix
	lib:libtiff$secondaryArchSuffix
	lib:libxml2$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

PROVIDES_devel="
	fontforge${secondaryArchSuffix}_devel = $portVersion
	devel:libfontforge$secondaryArchSuffix = 2.0.0 compat >= 2
	devel:libfontforgeexe$secondaryArchSuffix = 2.0.0 compat >= 2
	devel:libgioftp$secondaryArchSuffix = 2.0.0 compat >= 2
	devel:libgunicode$secondaryArchSuffix = 4.0.0 compat >= 4
	devel:libgutils$secondaryArchSuffix = 2.0.0 compat >= 2
	"
REQUIRES_devel="
	fontforge$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libfreetype$secondaryArchSuffix
	devel:libglib_2.0$secondaryArchSuffix
	devel:libjpeg$secondaryArchSuffix
	devel:libpng$secondaryArchSuffix
	devel:libpython3.6m$secondaryArchSuffix
	devel:libtiff$secondaryArchSuffix
	devel:libxml2$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoconf
	cmd:automake
	cmd:find
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:libtool
	cmd:make
	cmd:perl
	cmd:pkg_config$secondaryArchSuffix
	cmd:python3
	cmd:tar
	"

BUILD()
{
	export LDFLAGS="-lnetwork $LDFLAGS"
	runConfigure ./configure
	make $jobArgs
}

INSTALL()
{
	make install

	for l in libfontforge libfontforgeexe libgioftp libgunicode libgutils; do
		rm -f $libDir/$l.la
		prepareInstalledDevelLib $l
	done
	fixPkgconfig

	# devel package
	packageEntries devel \
		$developDir
}
