SUMMARY="A cartographic projection software"
DESCRIPTION="Proj.4 is a library for performing conversions between \
cartographic projections."
HOMEPAGE="http://trac.osgeo.org/proj/"
COPYRIGHT="2000, Frank Warmerdam"
LICENSE="MIT"
REVISION="1"
SOURCE_URI="https://github.com/OSGeo/proj.4/archive/$portVersion.tar.gz"
CHECKSUM_SHA256="49635259993aa3ed7d06ae39ed12fac250401e7fc2d1c459d86e28400abbeb44"
SOURCE_DIR="proj.4-$portVersion"

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"

if [ $targetArchitecture != x86_gcc2 ]; then
	commandSuffix=
	commandBinDir=$prefix/bin
fi

PROVIDES="
	proj$secondaryArchSuffix = $portVersion compat >= 4
	lib:libproj$secondaryArchSuffix = 0.7.0 compat >= 0.7
	cmd:cs2cs$secondaryArchSuffix
	cmd:geod$secondaryArchSuffix
	cmd:invgeod$secondaryArchSuffix
	cmd:invproj$secondaryArchSuffix
	cmd:nad2bin$secondaryArchSuffix
	cmd:proj$secondaryArchSuffix
	"
REQUIRES="
	haiku$secondaryArchSuffix
	"

PROVIDES_devel="
	proj${secondaryArchSuffix}_devel = $portVersion compat >= 4
	devel:libproj$secondaryArchSuffix = 0.7.0 compat >= 0.7
	"
REQUIRES_devel="
	proj$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	"
BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:make
	cmd:awk
	"
	
BUILD()
{
	chmod +x ./configure
	runConfigure ./configure
	make $jobArgs
}

INSTALL()
{
	make install

	prepareInstalledDevelLibs libproj
	fixPkgconfig

	# devel package
	packageEntries devel \
		$developDir \
		$manDir/man3
}
