#!/bin/sh

# Script to patch and configure asymptote from the
# latest git checkout (as of 19-November-2020).
# Checkout: 9606da530260600112145360c3eaadada1ed645f
# from https://github.com/vectorgraphics/asymptote


git reset --hard


# Patch
patch -p0 <  $(port dir asymptote)/files/patch-Makefile.diff

# Post patch
cat Makefile.in | sed "s|@@PYTHON@@|/opt/local/bin/python3.8|g" > tempfile
cp  tempfile Makefile.in

./autogen.sh


./configure --prefix=/opt/local --enable-gc=system --with-latex=/opt/local/share/texmf/tex/latex --with-context=/opt/local/share/texmf/tex/context/third --mandir=/opt/local/share/man --disable-offscreen
