SUMMARY="The 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="https://www.gdal.org/"
COPYRIGHT="2007-2017 Even Rouault
	2015-2017 Planet Labs
	2017 Hobu Inc
	2009-2016 Martin Landa
	2013-2016 NextGIS
	2016 Alexandr Borzykh
	2016 Andrew Sudorgin
	2016 Avyav Kumar Singh
	2016 Dmitry Baryshnikov
	2016 Julien Michel
	2016 Lucian Plesea
	2016 Piers Titus van der Torren
	2016 SatCen - European Union Satellite Centre
	2005 2007-2008 2010 2013 2015 Tamas Szekeres
	2006-2008 2010 2015 Ivan Lucena
	2015 Airbus DS Geo SA
	2015 European Union (European Environment Agency)
	2015 European Union Satellite Centre
	2015 Faza Mahamood
	2015 Sean Gillies
	2010 2013-2014 Kyle Shannon
	2008-2014 Antonio Valentino
	2004 2014 Pirmin Kalberer Sourcepole AG
	2013-2014 ZJU Walkinfo Technology Corp. Ltd
	2014 François Hissel
	2014 Matthieu Volat
	2014 Mikhail Gusev
	2014 Norman Barker
	2014 Oslandia
	2014 Sebastian Walter
	1998-2013 Frank Warmerdam
	2009-2013 Jorge Arevalo
	2009-2013 David Zwarg
	2011 2013 Paul Ramsey
	2013 Alan Boudreault
	2013 EOX IT Services GmbH
	2012 Andrew Migal
	2012 Jean-Claude Repetto
	2012 LibKEA
	2012 Roger Veciana
	2010-2011 Martin Lambers
	2011 Adam Estrada
	2011 Alessandro Furieri
	2011 Ben Ahmed Daho Ali
	2005-2007 2010 Daylon Graphics Ltd
	2006-2007 2010 Mateusz Loskot
	2009-2010 PCI Geomatics 50 West Wilmot Street Richmond Hill Ont Canada
	2009-2010 Ragi Yaser Burhum
	2010 Brian Case
	2010 Chaitanya kumar CH
	2010 Chris Yesson
	2010 Constantin Jucovschi
	2010 ESRI
	2010 Seth Price
	2010 SPADAC Inc.
	2010 Thomas Hirsch
	2002-2009 Andrey Kiselev
	2009 Leonardo de Paula Rosa Piga
	2009 Volker Wichmann
	1998-2008 Daniel Morissette
	2006 2008 Henrik Johansson
	2007-2008 Howard Butler
	2008 Chris Toney
	2008 Her majesty the Queen in right of Canada as represented by the Canadian Nuclear Safety Commission
	2008 Klokan Petr Pridal
	2008 Shawn Gervais
	2008 Xiuguang Zhou (ESRI)
	2004 2007 ITC
	2005 2007 Ari Jolma
	2005 2007 Kevin Ruland
	2006-2007 Waypoint Information Technology
	2007 Adam Guernsey
	2007 Adam Nowacki
	2007 Andrea Aime
	2007 Chris Schmidt
	2007 Christian Mueller
	2007 Geoconcept and IGN
	2007 Jens Oberender
	2007 Philippe P. Vachon
	2006 Benjamin Collins
	2006 Christopher Condit
	2006 James Flemer
	2006 Kevin Locke
	2006 MapShots Inc
	2006 Oleg Semykin
	2006 The MITRE Corporation
	2005 Benjamin Simon
	2005 Daniel Wallner
	2005 Frans van den Bergh
	2005 Radim Blazek
	2005 Sam Gillingham
	2005 Vexcel Corp
	2004 Kor de Jong
	2004 VIZRT Inc
	1999-2003 Stephane Villeneuve
	2003 Applied Coherent Technology Corporation
	2003 OPeNDAP Inc
	1999 2001-2002 Safe Software Inc.
	2000-2002 Avenza Systems Inc.
	2002 i3 - information integration and imaging Fort Collin,CO
	2002 Mark Phillips
	2000-2001 Atlantis Scientific Inc
	2001 Keyhole Inc.
	2001 Simon Perkins
	2000 Derrick J Brashear
	1999 Intergraph Corporation
	1999 Les Technologies SoftMap Inc
	1998 Global Geomatics
	1992 Michigan State University
	PCRaster owners"
LICENSE="MIT
	GNU GPL v3"
REVISION="1"
SOURCE_URI="https://download.osgeo.org/gdal/$portVersion/gdal-$portVersion.tar.xz"
CHECKSUM_SHA256="6c588b58fcb63ff3f288eb9f02d76791c0955ba9210d98c3abd879c770ae28ea"

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

commandSuffix=$secondaryArchSuffix
commandBinDir=$binDir
if [ "$targetArchitecture" = x86_gcc2 ]; then
	commandSuffix=
	commandBinDir=$prefix/bin
fi

libVersion=28.0.1
libVersionCompat="$libVersion compat >= ${libVersion%%.*}"

PROVIDES="
	gdal$secondaryArchSuffix = $portVersion
	lib:libgdal$secondaryArchSuffix = $libVersionCompat
	cmd:gdal_create
	cmd:gdal_contour
	cmd:gdal_grid
	cmd:gdal_rasterize
	cmd:gdal_translate
	cmd:gdal_viewshed
	cmd:gdaladdo
	cmd:gdalbuildvrt
	cmd:gdaldem
	cmd:gdalenhance
	cmd:gdalinfo
	cmd:gdallocationinfo
	cmd:gdalmanage
	cmd:gdalmdiminfo
	cmd:gdalmdimtranslate
	cmd:gdalserver
	cmd:gdalsrsinfo
	cmd:gdaltindex
	cmd:gdaltransform
	cmd:gdalwarp
	cmd:gnmanalyse
	cmd:gnmmanage
	cmd:nearblack
	cmd:ogr2ogr
	cmd:ogrinfo
	cmd:ogrlineref
	cmd:ogrtindex
	cmd:testepsg
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libarmadillo$secondaryArchSuffix
	lib:libexpat$secondaryArchSuffix
	lib:libgeotiff$secondaryArchSuffix
	lib:libgif$secondaryArchSuffix
	lib:libhdf5$secondaryArchSuffix
	lib:libiconv$secondaryArchSuffix
	lib:libjpeg$secondaryArchSuffix
	lib:libnetcdf$secondaryArchSuffix
	lib:libpcre$secondaryArchSuffix
	lib:libpng16$secondaryArchSuffix
	lib:libproj$secondaryArchSuffix
	lib:libssl$secondaryArchSuffix
	lib:libtiff$secondaryArchSuffix
	lib:libwebp$secondaryArchSuffix
	lib:libxml2$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	lib:libzstd$secondaryArchSuffix
	"

PROVIDES_devel="
	gdal${secondaryArchSuffix}_devel = $portVersion
	cmd:gdal_config
	devel:libgdal$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES_devel="
	gdal$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libarmadillo$secondaryArchSuffix
	devel:libexpat$secondaryArchSuffix
	devel:libgeotiff$secondaryArchSuffix >= 5
	devel:libgif$secondaryArchSuffix >= 7.0.0
	devel:libhdf5$secondaryArchSuffix
	devel:libiconv$secondaryArchSuffix
	devel:libjpeg$secondaryArchSuffix
	devel:libnetcdf$secondaryArchSuffix
	devel:libpng16$secondaryArchSuffix
	devel:libproj$secondaryArchSuffix >= 15
	devel:libssl$secondaryArchSuffix
	devel:libtiff$secondaryArchSuffix >= 5
	devel:libwebp$secondaryArchSuffix >= 7
	devel:libxml2$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	devel:libzstd$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoconf
	cmd:automake
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

defineDebugInfoPackage gdal$secondaryArchSuffix \
	$libDir/libgdal.so.$libVersion

BUILD()
{
	export LDFLAGS="-lnetwork"
	expatDir=$portPackageLinksDir/lib~libexpat
	autoreconf -fi
	runConfigure --omit-dirs binDir ./configure \
		--bindir=$commandBinDir \
		--with-expat=$expatDir
	make $jobArgs
}

INSTALL()
{
	make install

	# Clean up
	rm -f $libDir/libgdal.la

	prepareInstalledDevelLib libgdal
	fixPkgconfig

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