#!/usr/bin/env bash
# Build Path: /app/.heroku/vendor/

OUT_PREFIX=$1

# Use new path, containing autoconf.
export PATH="/app/.heroku/python/bin/:$PATH"
hash -r


echo "Building gdal…"

VERSION="2.2.1"
SOURCE_TARBALL="http://download.osgeo.org/gdal/${VERSION}/gdal-${VERSION}.tar.gz"

curl -L $SOURCE_TARBALL | tar zx

pushd "gdal-${VERSION}"
./configure --prefix=$OUT_PREFIX --enable-static=no  &&
make
make install

# Cleanup
popd
