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-2012 George Williams
	The FontForge Project
	"
LICENSE="BSD (3-clause)"
SOURCE_URI="https://github.com/fontforge/fontforge/releases/download/$portVersion/fontforge-2014-11-26-Unix-Source.tar.gz"
SOURCE_FILENAME="fontforge-$portVersion.tar.gz"
CHECKSUM_SHA256="853d52c36d2da8a80c64def2483ddd9f79a028ec8fcea41ae46a7df2cc2cd38f"
#PATCHES="fontforge-$portVersion.patchset"
REVISION="1"
ARCHITECTURES="!x86 !x86_64"
if [ $effectiveTargetArchitecture != x86_gcc2 ]; then
	# x86_gcc2 is fine as primary target architecture as long as we're building
	# for a different secondary architecture.
	ARCHITECTURES="$ARCHITECTURES x86_gcc2"
fi
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:libgunicode$secondaryArchSuffix = 4.0.0 compat >= 4
	lib:libgutils$secondaryArchSuffix = 2.0.0 compat >= 2
	lib:libgioftp$secondaryArchSuffix = 2.0.0 compat >= 2
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libfreetype$secondaryArchSuffix
	lib:libglib_2.0$secondaryArchSuffix
	lib:libjpeg$secondaryArchSuffix
	lib:libpng$secondaryArchSuffix
	lib:libpython2.7$secondaryArchSuffix
	lib:libtiff$secondaryArchSuffix
	lib:libxml2$secondaryArchSuffix
	lib:libz$secondaryArchSuffix

	lib:libbz2$secondaryArchSuffix
	lib:libintl$secondaryArchSuffix
	lib:libiconv$secondaryArchSuffix
	lib:libltdl$secondaryArchSuffix
	"
BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libfreetype$secondaryArchSuffix
	devel:libglib_2.0$secondaryArchSuffix
	devel:libjpeg$secondaryArchSuffix
	devel:libpng$secondaryArchSuffix
	devel:libpython2.7$secondaryArchSuffix
	devel:libtiff$secondaryArchSuffix
	devel:libxml2$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoconf
	cmd:automake
	cmd:gcc$secondaryArchSuffix
	cmd:make
	cmd:libtool
	cmd:ld$secondaryArchSuffix
	cmd:pkg_config$secondaryArchSuffix
	cmd:python2.7
	cmd:perl
	cmd:tar
	cmd:find
	cmd:git
	"

BUILD()
{
	patch -p1 -N < $portDir/patches/fontforge-$portVersion.patchset || true
	./bootstrap --skip-git
	runConfigure ./configure
	make $jobArgs
}

INSTALL()
{
	make install

	prepareInstalledDevelLibs libfontforge libfontforgeexe \
		libgioftp libgunicode libgutils
	fixPkgconfig

	# devel package
	packageEntries devel \
		$developDir
}

# ----- devel package -------------------------------------------------------

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