SUMMARY="GDAL - Geospatial Data Abstraction Library"
DESCRIPTION="
GDAL is a translator library for raster and vector geospatial data formats \
that is released under an X/MIT style OpenSource license by the Open \
Source Geospatial Foundation. As a library, it presents a single raster \
abstract data model and vector abstract data model to the calling application \
for all supported formats. It also comes with a variety of useful \
commandline utilies for data translation and processing."
HOMEPAGE="http://www.gdal.org"
COPYRIGHT="
	2007-2014 Even Rouault
	2011 Alessandro Furieri
	1999, 2001, 2002-2003, 2005, 2008 Frank Warmerdam
	2013 Paul Ramsey
	2010 Chaitanya kumar CH
	2005 Radim Blazek
	2009 Leonardo de Paula Rosa Piga
	2006 Oleg Semykin
	2004, 2014 Pirmin Kalberer
	2007 Jens Oberender
	2006 Christopher Condit
	2010 Brian Case
	2000 Daniel Morissette
	2007 Mateusz Loskot
	2008 Shawn Gervais
	2008 Howard Butler
	2013 NextGIS
	2011 Ben Ahmed Daho Ali
	2002 Mark Phillips
	2009-2014 Martin Landa
	2013  ZJU Walkinfo Technology Corp., Ltd.
	"
LICENSE="MIT"
SOURCE_URI="http://download.osgeo.org/gdal/$portVersion/gdal-$portVersion.tar.xz"
CHECKSUM_SHA256="b5186b5817e94743de1bceef66aeee1461687e14f73bf81034fcf0377eacbcc3"
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
PATCHES="gdal-$portVersion.patchset"

PROVIDES="
	gdal$secondaryArchSuffix = $portVersion compat >= 1.11
	lib:libgdal$secondaryArchSuffix = 1.18.0 compat >= 1.18
	cmd:gdal_contour
	cmd:gdal_grid
	cmd:gdal_rasterize
	cmd:gdal_translate
	cmd:gdaladdo
	cmd:gdalbuildvrt
	cmd:gdaldem
	cmd:gdalenhance
	cmd:gdalinfo
	cmd:gdallocationinfo
	cmd:gdalmanage
	cmd:gdalserver
	cmd:gdalsrsinfo
	cmd:gdaltindex
	cmd:gdaltransform
	cmd:gdalwarp
	cmd:nearblack
	cmd:ogr2ogr
	cmd:ogrinfo
	cmd:ogrlineref
	cmd:ogrtindex
	cmd:testepsg
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libexpat$secondaryArchSuffix
	lib:libgeotiff$secondaryArchSuffix
	lib:libgif$secondaryArchSuffix >= 7.0.0
	lib:libjpeg$secondaryArchSuffix
	lib:libpng$secondaryArchSuffix
	lib:libproj$secondaryArchSuffix
	lib:libtiff$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	lib:libstdc++$secondaryArchSuffix
	lib:libiconv$secondaryArchSuffix
	"
BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libexpat$secondaryArchSuffix
	devel:libgeotiff$secondaryArchSuffix
	devel:libgif$secondaryArchSuffix >= 7.0.0
	devel:libjpeg$secondaryArchSuffix
	devel:libpng$secondaryArchSuffix
	devel:libproj$secondaryArchSuffix
	devel:libtiff$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	devel:libiconv$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoconf
	cmd:automake
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:libtoolize
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

BUILD()
{
	expatDir=$portPackageLinksDir/lib~libexpat
	autoreconf -fi
	runConfigure ./configure --with-expat=$expatDir
	make $jobArgs
}

INSTALL()
{
	make install
	
	prepareInstalledDevelLibs libgdal
	fixPkgconfig

	# devel package
	packageEntries devel \
		$binDir/gdal-config \
		$developDir
}

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

PROVIDES_devel="
	gdal${secondaryArchSuffix}_devel = $portVersion compat >= 1.11
	cmd:gdal_config$secondaryArchSuffix
	devel:libgdal$secondaryArchSuffix = 1.18.0 compat >= 1.18
	"
REQUIRES_devel="
	gdal$secondaryArchSuffix == $portVersion base
	"
