SUMMARY="Proj.4 cartographic projection software"
DESCRIPTION="Proj.4 is a library for performing conversions between \
cartographic projections."
HOMEPAGE="http://trac.osgeo.org/geotiff/"
LICENSE="GNU GPL v2"
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"

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

SOURCE_URI="http://download.osgeo.org/geotiff/libgeotiff/libgeotiff-$portVersion.tar.gz"
CHECKSUM_SHA256="d0acb8d341fd6a8f2c673456e09fdb8f50f91e3166ac934719fe05b30d328329"
COPYRIGHT="2000 Frank Warmerdam"
PATCHES="libgeotiff-$portVersion.patchset"

PROVIDES="
	libgeotiff$secondaryArchSuffix = $portVersion compat >= 1
	lib:libgeotiff$secondaryArchSuffix = 2.1.0 compat >= 2.1
	cmd:applygeo
	cmd:geotifcp
	cmd:listgeo
	cmd:makegeo
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	lib:libtiff$secondaryArchSuffix
	lib:libjpeg$secondaryArchSuffix
	lib:libproj$secondaryArchSuffix
	"
PROVIDES_devel="
	libgeotiff${secondaryArchSuffix}_devel = $portVersion compat >= 1
	devel:libgeotiff$secondaryArchSuffix = 2.1.0 compat >= 2.1
	"
REQUIRES_devel="
	libgeotiff$secondaryArchSuffix == $portVersion base
	"
BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libz$secondaryArchSuffix
	devel:libtiff$secondaryArchSuffix
	devel:libjpeg$secondaryArchSuffix
	devel:libproj$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:autoconf
	cmd:autoreconf
	cmd:aclocal
	cmd:libtoolize
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	cmd:awk
	"
	
BUILD()
{
	jpegDir=$portPackageLinksDir/lib~libjpeg
	zlibDir=$portPackageLinksDir/lib~libz
	autoreconf -fi
	runConfigure ./configure --with-zlib=$zlibDir \
		--with-jpeg=$jpegDir
	make $jobArgs
}

INSTALL()
{
	make install

	prepareInstalledDevelLibs libgeotiff
	fixPkgconfig

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