#!/usr/bin/env bash
# Build Path: /app/.heroku/python/
# Build Deps: libraries/autoconf

OUT_PREFIX=$1

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


echo "Building libffi..."

SOURCE_TARBALL='https://github.com/atgreen/libffi/archive/master.tar.gz'

curl -L $SOURCE_TARBALL | tar xz
mv libffi-master libffi

cd libffi
./autogen.sh
./configure --prefix=$OUT_PREFIX --enable-shared
make
make install

# Cleanup
cd ..
